Bootloader questions

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there a way to add single commands to the AVR studio Project Options to make it compile and link code to end up in the upper memory bootloader area.
( Without using external makefiles )

( The -W1 option seems to be used a lot to move things, but I've had no success !)

If so - a clear and complete guide would be very much appreciated. -

( Yes - I've looked at many 'examples' but none seem to use or clearly show how to use the Studio Project option dialogues )

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Project-Config options-memory section

Add .text there and set the base address to 0xNNNN where NNNN is the WORD address of the BLS.

I just did this in a project setting it to be 0x1C00 and the resulting linker command was:

avr-gcc -mmcu=atmega16 -Wl,-Map=test.map -Wl,-section-start=.text=0x3800 test.o     -o test.elf

As you say, what this has done is add a -Wl to the link command. In this case to set the -section-start of .text to the desired value. Notice also that what appears here is 0x3800 not 0x1C00. This is because Studio works in terms of WORD addresses while everything in GCC is done in terms of byte addresses.

Cliff

PS When you move .text EVERYTHING moves - that includes the reset vector and the interrupt vectors which are now based at 3800 - so the AVR needs BOOTRST to be set in order to enter this code. (just as with any bootloader)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying it now, looking good!

Thanks Cliff!