Flash ECC Error when using NowFlash


We are using NowFlash to programe both the program and ECC regions, and we are currently getting an ESM error after flashing is complete. If we use Lauterbach Trace32 to flash both regions we don't get the ESM error.

I assume this Error is generated by Enabling FlashECC error checking.

Any idea on what needs to be done or if there is any special flags I need to use when Flashing using NowFlash?


8 Replies

  • Is the contents successfully programmed into flash? After programming the device using nowflash, power reset the device, Is your code running as expected?

    If you get an ESM error after power reset the device, could you please check the ESM registers (offset 0xFFFFF500) to find out the error source?

    Could you please post a screen shot of the NowFlash configuration



  • In reply to Haixiao Weng:


    I assume my content is successfuly programmed into flas as I enable Flash ECC Check in my code. When I disable the Flash ECC check, i don't get the ESM error... So Flashing the code is done successfuly.

    I use command Line to download the program, please see below

    The first Line programs the code and the second line programs the ECC value.

    nowFlash.exe -bl -er -pr -ve %ROOTDIR%\Code_Device\TGDevice\10_Software\31_Build\Label\TGP.elf -w 1 -pllcfg 0xFFFFFF70 0X20033800 -emu TIXDS100V2 -p 000 -cpu CORTEX_RXX -targets 1
    nowFlash.exe -pr -ve %ROOTDIR%\Code_Device\TGDevice\10_Software\31_Build\Label\TGP_ECC.elf -w 1 -pllcfg 0xFFFFFF70 0X20033800 -emu TIXDS100V2 -p 000 -cpu CORTEX_RXX -targets 1


  • In reply to Tareq Alqaisi:

    Please see if my understanding is correct:

    Your question is: why I get a flash ECC error after the ECC contents were programmed into device?

    One possibility is: R4 prefetch to some location without ECC. If you programmed all the 2Mbyte flash/ECC, this should be an issue.

    If possible, can you show us your hardware and upload the software to see if we can reproduce it on our side.



  • In reply to Haixiao Weng:

    Hi, let us know if you were able to get away with this ESM error issue.

    If you are able to connect through CCS , you may send the ESM register log to analyse it further.


  • In reply to Haixiao Weng:

    Hi, let us know if you were able to get away with this issue.

    If you are able to connect through the CCS , you may send us the ESM register values to analyse it further.


  • In reply to Pratip Kumar:

    I am also enabling the Falsh ECC and i dont see any problem as of now. Looks working fine.

    Is it required to fill the entire Flash with the known values and program ECC correspondingly ?

    My application size is 1MB maximum. Do i need to program the remaining flash also to known value to avoid the ESM error ?

  • In reply to Bindu Tanguturi:

    99% chance,  you will not see any problem without filling all flash area (if ECC is enabled/notified).

    However, it is possible that you get a flash ECC due to prefetch. 

    Usually, this problem occurs just after the interrupt service routine. At the end of the interrupt service routine, the compiler put an instruction mov PC, LR there. The R4 CPU does not know it is the end of an function and the R4 CPU still does the prefetch. 

    Workaround No.1:

    Add a empty function after the ISR. e.g. void GIO_dummy(){}; The dummy function will translate to BX LR. Now, R4 CPU see this BX function and stop prefetch.

    However, this dummy might get deleted if optimization is enabled.

    Workaround No.2:

    Fill the flash will known values. Now, where ever the CPU goes, no ECC error will be generated. If the RAM ECC is enabled (notified), you also need to init all SRAM.

    Back to your question, in the code developing stage, filling all the flash area is timing consuming. You can use wrokaround no.1 to avoid this problem. In the production stage, you can delete the dummy function and fill all your flash area.



  • Hello,

    I have a similar problem, just from the other side: I cannot make Trace32 flash the ECC data in the proper place.

    What I have is an out-file with the ECC appended by nowECC but when used with my Trace32-script all I can see in the ECC flash area (0xF0400000 onwards) is a field of '1's (0xF as long as the eye reaches).

    Creating a Flash area from 0xF0400000 onwards also did not do anything to help.

    Do you have any tips?