Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
KuzIgor
PostPosted: Feb 25, 2012 - 06:07 PM
Newbie


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..
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Feb 25, 2012 - 07:07 PM
Moderator


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 Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
KuzIgor
PostPosted: Feb 26, 2012 - 06:10 AM
Newbie


Joined: Feb 25, 2012
Posts: 2


Thank you!Smile
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Feb 26, 2012 - 12:26 PM
10k+ Postman


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)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits