This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Check ECC for flash memory range

Other Parts Discussed in Thread: HALCOGEN

In bootloader I want check application flash ECC state before read & check CRC32. How I can check ECC for memory area?

  • Hi Vladimir,

     I'm not very clear with your question. The ECC is memory mapped so you can read them. The question I have is that before the application image is programmed into the flash by the bootloader the ECC will still show their erased state. The ECC can be automatically programmed along with the program image when you select the Fapi_AutoEccGeneration parameter for the flash program command.

    3.3.1 Fapi_issueProgrammingCommand()

    Sets up data and issues program command to valid Flash memory addresses

    Synopsis

    Fapi_StatusType Fapi_issueProgrammingCommand(

    uint32_t *pu32StartAddress,

    uint8_t *pu8DataBuffer,

    uint8_t u8DataBufferSizeInBytes,

    uint8_t *pu8EccBuffer,

    uint8_t u8EccBufferSizeInBytes,

    Fapi_FlashProgrammingCommandType oMode)

    Parameters

    pu32StartAddress [in] start address in Flash for the data and ECC to be programmed

    pu8DataBuffer [in] pointer to the Data buffer address

    u8DataBufferSizeInBytes [in] number of bytes in the Data buffer

    pu8EccBuffer [in] pointer to the ECC buffer address

    u8EccBufferSizeInBytes [in] number of bytes in the ECC buffer

    oMode [in] Indicates the programming mode to use:

    Fapi_DataOnly Programs only the data buffer

    Fapi_AutoEccGeneration Programs the data buffer and auto generates and programs the ECC.

    Fapi_DataAndEcc Programs both the data and ECC buffers

    Fapi_EccOnly Programs only the ECC buffer

  • I try describe my application layout. Bootloader occupied first 64 k of flash. Starting from 0x10000 usually located application. At 0x10020 located signature, application size, CRC32, name, compilation date, time etc..
    My bootloader on start check signature, CRC32, etc. If application already flashed all ok. If application not flashed & "Flash ECC Enable" checkbox enabled in halcogen, read of signature generate exception because data & ecc memory area filled with FF. I can temporally disable Flash ECC check, read application signature, crc32, size, calculate flash CRC32 compare etc. But before check CRC32 I need check application flash area ECC. Best way to have some function bool checkECC(uint32 addr) which return true if Flash ECC for address addr is valid.
  • HI Vladimir,

    The ECC occupies 1/8 the size of the program image. The ECC space starts at 0xF040_0000. If the first 32 bytes of your application starts at 0x10000 the the corresponding ECC will be memory mapped at 0xF0402000. You can read from the word at 0xF0402000 to see if it is 0xFFFFFFFF. If it is all F's then the corresponding data at 0x10000 is not valid.