[En-Nut-Discussion] eboot - bootloader under 4k
Bernard Fouché
bernard.fouche at kuantic.com
Fri May 4 09:27:03 CEST 2007
Since sending a message with a .tgz file attached failed, I stored the
.tgz file on this URL: http://www.kuantic.com/misc/bl.tgz . Those
interested may get it, I'll keep that link operationnal for a few days.
For the C files: you can generally get a better optimization if you
manage to have all the C files grouped in a single file that is compiled
all at once. If you manage to correctly declare functions as "static"
and as "inline" if they are called only once, the compiler then know
that it can optimize at the maximum: there is no need to preserve C
calling conventions in many cases (registers push/pops, stack
management, etc). So there is a small shell script that use 'cat' and a
very little bit of 'sed' to do that job.
Bernard
Thiago A. Corrêa wrote:
> Hi Bernard,
>
> It appears that the message finally got thru, but without the attachments :(
>
> Anyway, what is this fiddling that you do to the C files? What is it
> that reduces the compiled size?
>
> Regards,
> Thiago A. Correa
>
> On 5/3/07, Bernard Fouché <bernard.fouche at kuantic.com> wrote:
>
>> So here it comes (well, if email attachments are allowed!) . You'll get
>> 2 directories:
>>
>> - addcrc : the program that adds a header to an application to download.
>> This header will have the CRC's.
>> - bootloader: the reworked 'appload' bootloader.
>>
>> I wrote a README file and put it in 'bootloader'. As one may see, I work
>> under Linux. It means:
>>
>> - that I use a shell script (bootloader/mkbl) to fiddle the C files
>> before compilation. This is how I got a lot of spare room to add
>> features. This mechanism (or one tailored to other particular needs) can
>> be used in other projects for different targets. For Windows users, I
>> guess that some script in any language or a small C program doing the
>> same job would be easy to write.
>>
>> - 'addcrc' uses getopt with the long_options.
>>
>> Feedback and improvements welcome.
>>
>> Bernard
>>
>> Don Ingram wrote:
>>
>>> Bernard Fouché wrote:
>>>
>>>
>>>> FYI a while back I did change appload. Now I have a version that:
>>>>
>>>> - fits under 4k (4068 bytes with gcc 3.4.5 and avr-libc 1.4.5)
>>>> - has a .bss segment and a .data segment as usual apps (however .data is
>>>> unused at the moment)
>>>> - flash only modified pages from a boot to another, sparing flash write
>>>> cycles when rebooting often. If you reboot and get the same file, no
>>>> flashing is done.
>>>> - read jumpers on port F to select if network info from EEPROM is to be
>>>> read before booting and to select if network bootloading is to be done.
>>>> That allows you to bootload once and then keep your current application
>>>> if it has to be used in a place you can't bootload.
>>>> - be able to read and flash a usual binary file or use files that have
>>>> CRC's prefixed at the beginning of the file thanks to an external C
>>>> tool. ('addcrc'). This is to be sure that you flash a correct file (not
>>>> relying on UDP checksums)
>>>>
>>>>
>>>
>>>
>>>> - be aware of gateway issues (you can TFTP from a remote site if your
>>>> firewall correctly manages TFTP)
>>>>
>>>>
>>> This I would love to see. I hacked appload to save some space to allow for
>>> variants to be specified via EEPROM but the code still requires a local TFTP
>>> server which is a bit of an inconvenient issue in my current application.
>>>
>>> Similarly dealing with CRC'd files would be great.
>>>
>>>
>>>
>>>
>>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
>>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
More information about the En-Nut-Discussion
mailing list