[En-Nut-Discussion] xnutboot entry point

Przemyslaw Rudy prudy at audiotech.pl
Sun Aug 27 16:28:24 CEST 2006


Hi Henrik
I found the problem but I have no any robust solution for it.
It is probably only by accident that your xnutEboot boots or you have
created the eboot.c and linking order explicitly in such way.

Basically:
1. any optimisation –O influences the functions order in the .o file
created (or it might influence but does not have to).
The serial bootloader (xnutboot) consists of one .c file only. Compiled
with old avr-gcc and –Os it worked but it does not work with the latest
avr-gcc:
- previously generated .o file consisted of:
----------------
main
other_functions
----------------
- with the latest avr-gcc this is true only for –O0 and –O1, for –Os and
–O2 it generates:
----------------
other_functions
main
----------------

Your xnutEboot consists of a few files, where the eboot.c file has only
one single function ‘main’. Compiling this file produces .o with the
‘main’ function only, so it is always in the right order.

2. files are linked in the order as they are in the linker command line
– it think the build process cannot depend on it.
Currently in xnutEboot the eboot.c is the first on the list, what makes
the ‘main’ function is the first one linked. But what if some day ‘main’
goes at the end?

If ‘–nostartfiles’ parameter is not used for the linker, the ‘main’ can
go in any place, as the start code added finally jumps to it. But
‘-nostartfiles’ is used in our case.

Do you have any idea ho to ensure that the final .hex will start with
‘main’ (or any other name as ‘main’ presence is not required here). For
now it requires:
1. The entry point function (e.g. ‘main’) must be the only one single
function in a separate .c file.
2. This file must be the first one linked.

Thanks
Przemek



Przemyslaw Rudy wrote:
> Hi Henrik
> 
> I will check your code today. The loader I use is
> http://www.ethernut.de/arc/xnutboot-20030826.zip.
> 
> I am almost 100% sure I compiled it long time ago ‘as it is’ (-Os)
> without any problems, so the only difference was in gcc.
> With the latest gcc sbi/cbi/inb/outb must be defined to compile it.
> 
> Thanks
> Przemek
> 
> 
> Henrik Maier wrote:
> 
> 
>>Hello Przemek,
>>
>>Have a look at the files I sent, it is supposed to work out of the box
>>for the XNUT-105 and I am supporting it.
>>
>>You also can send me your bootloader with makefile. I might be able to
>>assist.
>>
>>
>>Best Regards
>>
>>Henrik Maier
>>
>>
>>proconX - Protocol Converter, Device Server and Industrial Gateways
>>http://www.proconx.com  Tel: +61-7-3376 3911   Fax: +61-7-3102 9206
>>
>>
>>
>>Przemyslaw Rudy wrote:
>>
>>
>>>Hi
>>>
>>>I focus on the old serial bootloader, but I presume ethernet one might
>>>have the same problem.
>>>
>>>Thanks
>>>Przemek
>>>
>>>
>>>Henrik Maier wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>Which bootloader are you using for the XNUT-105?
>>>>
>>>>For the XNUT-100/105 you can use attached Ethernet TFTP bootloader.
>>>>
>>>>
>>>>Best Regards
>>>>
>>>>Henrik Maier
>>>>
>>>>
>>>>proconX - Protocol Converter, Device Server and Industrial Gateways
>>>>http://www.proconx.com  Tel: +61-7-3376 3911   Fax: +61-7-3102 9206
>>>>
>>>>
>>>>Przemyslaw Rudy wrote:
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>I am trying to compile the xnutboot serial bootloader.
>>>>>It looks like with the original build options and the latest avr-gcc
>>>>>the
>>>>>‘main’ function is not the entry point anymore.
>>>>>The .map file shows:
>>>>>------------
>>>>>.text          0x0001fc00      0x260 xnutboot.o
>>>>>                0x0001fd94                main
>>>>>------------
>>>>>whilst in the reference .map file:
>>>>>------------
>>>>>.text          0x0001fc00      0x2a8 xnutboot.o
>>>>>                0x0001fc00                main
>>>>>------------
>>>>>
>>>>>The .lst file shows ‘main’ at offset 0x194 indeed:
>>>>>------------
>>>>>.text:00000000 SendOctet
>>>>>.text:00000008 FlashPage
>>>>>.text:000000cc RecvOctet
>>>>>.text:00000104 RecvPacket
>>>>>.text:00000194 main
>>>>>------------
>>>>>whilst in the reference .lst file:
>>>>>------------
>>>>>.text:00000000 main
>>>>>.text:00000218 RecvPacket
>>>>>.text:000001d8 SendOctet
>>>>>.text:000000cc FlashPage
>>>>>.text:000001e0 RecvOctet
>>>>>------------
>>>>>
>>>>>Do you have any quick solution for that?
>>>>>
>>>>>Best Regards
>>>>>Przemek
>>>>>_______________________________________________
>>>>>En-Nut-Discussion mailing list
>>>>>En-Nut-Discussion at egnite.de
>>>>>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> 



More information about the En-Nut-Discussion mailing list