Boot memory and flash pointers

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

Hello,

I need to locate a 'C' routine in the boot section and to declare a parameter to be a pointer to FLASH memory. Doing this with the IAR compiler I understand, but the documentation on GNU C is not too clear on how to do this.

Target is an ATMega32, using Studio 4, WinAVR.

"It's easier to ask forgiveness than it is to get permission" - Admiral "Amazing" Grace Hopper.

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

See BOOTLOADER_SECTION within the manual:

http://www.nongnu.org/avr-libc/u...

Having defined functions to be in ".bootloader" you'll then need to add a --section-start=.bootloader=NNNN to LDFLAGS to locate that text section at the Booloader Section address NNNN (bytes, not words).

As for flash pointers, you need to read the manual section about pgmspace.h:

http://www.nongnu.org/avr-libc/u...

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

Ah. Thank you. I had hoped someone could point me to the right document and section, though it suprises me that boot segment location coding would be defined in the library documentation instead of the compiler.

"It's easier to ask forgiveness than it is to get permission" - Admiral "Amazing" Grace Hopper.

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

Remember that GCC is a generic compiler that is targetted to about 50 odd processors so anything "CPU specific" tends to be handled in the library rather than being part of the core compiler (unless it's a facility that would be useful to a number of targets). Part of the reason IAR costs you $3000 per copy is that they do the work to make each port very target specific.