From: Georg-Johann Lay <a...@gjlay.de>

>With
 > int x __attribute__((section (".bootdata")));
>you can use x in the known way, it's only about locating .bootdata
>to whatever location you deem appropriate.  Read the linker manual.

This appears to be the only best way!!! This means I create a section, say 
.bootdata with some
address in the boot loader. Create exactly the same section with the same 
address in the actual application
section. Since the boot loader starts first, it writes whatever data to be 
passed into this section and
when application gets executed, it reads this section. Am I right?

One point to consider - boot loader is somewhat a permanent fixture in flash, 
whereas application(s)
can keep changing or updated. Should the compiler version be same for both? 
will the ordering of variables change
with versions? If this remains same, then the above approach is best as of now, 
else the same compiler
has to be used for future updates of application.

>> I would actually prefer to call application main with parameters
>> from boot section.

>Calling main from boot does not sound sane.  How do you know the
>address of main?  How do you run startup code to initialize .data
>and .bss, setup SP, call constructors, etc.?  How do you reset the
>hardware like communication I/O?

There are two issues -
1. I/Os can be initialized in the boot section as the boot loader will be 
specific to the target board. 
2. SP setup etc., will have to be done afresh in the application portion. When 
I mentioned calling main, it is
actually calling application startup (00 address). This is not possible any way 
(I guess).

Thank you.

Regards
Nayani
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to