Author Topic: LPC1768 Modify/Overwrite Flash  (Read 5242 times)

zappzapp

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
    • Email
LPC1768 Modify/Overwrite Flash
« on: January 25, 2013, 04:00:09 am »
I am trying to patch new information into the flash of an already programmed device using FlashMagic.

Steps I have done so far:
- original program has a variable located far away from the other code in it's own flash-block (let's say size of 1 byte at 0x50000)
- this original program is flashed into the device and is working
- create a hex file that contains a new value (0xAB) for the formerly mentioned variable
Code: [Select]
:020000040005F5
:01000000AB54
:00000001FF
- now flash this hex file into the device, erasing only block 0x050000 - 0x057FFF (there is no program code within this block other than the variable)

After flashing, the memory looks like expected. 0xAB is shown at the correct position. The rest of the block has been reset to 0xFF.

However, the device does not execute any code whatsoever after a reset.

What am I missing here?
Does FlashMagic alter something else within the the controller?
Or does it have anything to do with that NXP valid code checksum thing?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Modify/Overwrite Flash
« Reply #1 on: January 26, 2013, 07:49:42 pm »
What happens if you reproduce the interrupt vectors in your patch file?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

zappzapp

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
    • Email
Re: LPC1768 Modify/Overwrite Flash
« Reply #2 on: February 08, 2013, 12:47:45 am »
It turns out, that the problem does not occur if I use FlashMagic to write into a flash region, which is not part of a code section.
So I guess it was indeed the valid code checksum halting the program.

Instead of trying to overwrite a variable located in flash (with the compiler cmd __attribute__(at) ) like I did before, I will have to place my information somewhere in unused space and copy it from there during runtime. Then make sure this flash region stays unused in the future with the CODE compiler cmd.
However not related to FlashMagic anymore.
Thanks

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 Modify/Overwrite Flash
« Reply #3 on: February 09, 2013, 09:22:04 am »
Thanks for posting the solution!

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com