 |
| Author |
Message |
|
|
Posted: Feb 25, 2012 - 06:07 PM |
|

Joined: Feb 25, 2012
Posts: 2
|
|
I try to write my own bootloader for ATxmega192A3. I use interrupts in boot section. For this i set IVSEL bit, but my program doesn't work. If i don't set IVSEL bit the program works properly. I use AVR Studio 5. I think i should tell the linker to place the interrupt vector table in the boot section, but i don't know how to do it. Please, tell me what should i do. Thanks..
the bootloader functions i add with the sentence:
#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))
BOOTLOADER_SECTION int main()
{
}
and then add the following in linker options: -Wl,--section-start=.bootloader=0x30000
Maybe i should add something like i've just said in order my interrupts work properly.. |
|
|
| |
|
|
|
|
|
Posted: Feb 25, 2012 - 07:07 PM |
|


Joined: Jan 23, 2004
Posts: 9831
Location: Trondheim, Norway
|
|
If you are writing a bootloader, what you almost ALWAYS want to do is relocate the entire application to the start address of the bootloader section. This allows you to write your application as normal without having to add the BOOTLOADER_SECTION attribute everywhere, and allows the compiler to correctly generate the vector table at the usual location.
You can do this by relocating the .text section rather than .bootloader section in your linker flags.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Feb 26, 2012 - 06:10 AM |
|

Joined: Feb 25, 2012
Posts: 2
|
|
Thank you! |
|
|
| |
|
|
|
|
|
Posted: Feb 26, 2012 - 12:26 PM |
|


Joined: Jul 18, 2005
Posts: 62352
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Code:
-Wl,-Ttext=0xNNNN
and have a read of the Bootloader FAQ in the Tutorial Forum which explains why BOOTLOADER_SECTION is never used when writing a bootloader. (I still think it's very unwisely named though it's true that it does coerce the tagged item to be in the BLS) |
_________________
|
| |
|
|
|
|
|
|
|