How to reserve part of FLASH? (Linker issue)

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

Hi all,

I'm trying to take part of the FLASH for my own use. Google found this page
http://www.ultimaserial.com/avr_lwip_tips7.html. That example shows how to create a section in FLASH and even place a function there. That kind of works, and I have even run a function in the reserved FLASH section on a test program. However, when I try to use the technique in a real application, I get a Bus Error Data Fetch error, caused by the INTC_init_interrupts() function.

In other words: I try to take the top 10K of memory with following additions to the standard linker script:

MEMORY
{
  MY_FLASH (rxai!w) : ORIGIN = 0x80000000+256K-10K, LENGTH = 10K
  FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 256K-10K
... 
and:

  .mysection: { *(.mysection) } >MY_FLASH AT>MY_FLASH

This causes the program to crash in the interrupt initialization routine, even when there is no reference to .mysection in the program.

Why? Or the real question: How can I reserve part of FLASH for myself?

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

See in linker file:

PROVIDE (__executable_start = 0x80000000); . = x80000000;

Adapt it to your new memory start, and get rid of Trampoline files, if they are in your project.

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

PeteAVR, Thank you for the suggestion. However, that wasn't the solution.

My goal was to have a bootloader and the main program in the same project, linking the bootloader to a known location of the memory (so it knows not to overwrite itself). I hoped to gain simplicity in the project management (only one project to manage), simplicity in manufacturing (only one file to program) and some program memory (no need to have initialization code twice is FLASH). Ok, the FLASH saving may not be that important; although we are close to needing a bigger part, it might be a good idea to use one anyway. The whole point of making the product field-upgradeable is to be prepared for future needs, and if there is no room in FLASH for those, then why bother in the first place?

Anyway, the current conclusion is that maybe it cannot be done at all. At least, there is no documentation of how to do this, and the few ways we have tried, don't work.

We throw in the towel; if any of you actually knows how to do that, it would be very kind of you to share. Please?

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

If your bootloader and the main program are in the same file, doesnt that make the bootloader obsolete? since its just one program?
What is your problem with 2 different projects?
you could just use scripts to program both applications at once.

If your only goal is to minimize the "empty space" between bootloader and firmware, just take a firmware start address that is as close as possible to the bootloader (no wasted flash)
and u dont have to initialize the hardware twice anyway. everything that is initialzied by the bootloader doesnt need to be initializen by the firmware.

but maybe i just dont understand your problem