This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem updating flash program memory

I would appreciate any help getting past this problem.

I am attempting to write code that I can use to update the program in flash memory.

I am using the xc16x_iap-flash example and so far have successfully managed to locate the flash programming section to RAM and am able to erase and write to flash memory from it.

The next part has me confused though. When I erase the sector 0xC00000 (beginning of flash memory) the program in RAM stops running. It appears as though constants from my program in RAM are being stored in flash.

I assume that I am missing something in the L166 Locate Options, but after trying many combinations I am quite lost on how to set this up correctly.

Keil xc16x_iap-flash example:
http://www.keil.com/download/docs/xc16x_iap-flash.zip.asp

Parents
  • Thank you for responding.

    Actually, I have changed the original example quite a bit.
    I am not expecting the program to ever return to the Srom section.

    The flash is being erased and re-programmed from a function in the pflash section that calls PFlash_Erase and PFlash_Write. This function stops if I have it erase sector 0xC00000

    The pflash section executable is stored in RAM at 0x420000. How do I tell the linker to store all parts of the pflash code, including constants and variable storage at 0x420000 so it can erase all parts of the flash?

Reply
  • Thank you for responding.

    Actually, I have changed the original example quite a bit.
    I am not expecting the program to ever return to the Srom section.

    The flash is being erased and re-programmed from a function in the pflash section that calls PFlash_Erase and PFlash_Write. This function stops if I have it erase sector 0xC00000

    The pflash section executable is stored in RAM at 0x420000. How do I tell the linker to store all parts of the pflash code, including constants and variable storage at 0x420000 so it can erase all parts of the flash?

Children