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

Altered .HEX file when flashing to MCU

Dear friends,

I have developed a C# program that accepts .hex file, extracts raw data from it, UUencodes this data and uses it to flash LPC1768 MCU.

When I use my own application the exact raw data of .hex file is transferred to the flash memory of MCU, but the application is not running. When I use flash magic or keil to program the device, they change 4 bytes of the hex file in address 0x10. Here is what I mean:

The third line of .hex file (address 0x10):

:100010007501000077010000790100000000000078
extracted raw data: 75010000770100007901000000000000 (my C# program sends this)
altered raw data: 750100007701000079010000E6F4FFEF (flash magic or keil send this)

as you can see the last characters at this line (third line in .hex file) are changed by flash magic. The other parts of the hex file remain unchanged. I was wondering what is the reason for that.

With warm regards

Parents
  • Hello Reza Ghochkhani,

    look at chapter 32.3.1.1 of the User manual:

    32.3.1.1 Criterion for Valid User Code
    The reserved Cortex-M3 exception vector location 7 (offset 0x 001C in the vector table)
    should contain the 2’s complement of the check-sum of table entries 0 through 6. This
    causes the checksum of the first 8 table entries to be 0. The boot loader code checksums
    the first 8 locations in sector 0 of the flash. If the result is 0, then execution control is
    transferred to the user code.

    Therefore you have to do the same and modify this program location before you flash the code.

    Regards, Gunnar

Reply
  • Hello Reza Ghochkhani,

    look at chapter 32.3.1.1 of the User manual:

    32.3.1.1 Criterion for Valid User Code
    The reserved Cortex-M3 exception vector location 7 (offset 0x 001C in the vector table)
    should contain the 2’s complement of the check-sum of table entries 0 through 6. This
    causes the checksum of the first 8 table entries to be 0. The boot loader code checksums
    the first 8 locations in sector 0 of the flash. If the result is 0, then execution control is
    transferred to the user code.

    Therefore you have to do the same and modify this program location before you flash the code.

    Regards, Gunnar

Children