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.

TM4C1231H6PZ: CheckImageCRC32 in bl_crc32.c

Part Number: TM4C1231H6PZ

Hi team,

We are looking to use the TM4C1231H6PZ in our design. We are looking at the boot_usb example and in the bl_crc32.c file at the CheckImageCRC32 function. Based on the definition of CLASS_IS_TM4C129, it appears this will be defined as 0 and we will enter the else part of the if-else statement. As the APP_START_ADDRESS is greater than 0x800, we end up with a negative number. Where does this 0x800 come from? Is there a typo here?

uint32_t
CheckImageCRC32(uint32_t *pui32Image)
{
    uint32_t ui32Loop, ui32FlashSize, ui32CRC;

    //
    // Determine the size of flash (giving an upper bound for the image
    // size).
    //
    if(CLASS_IS_TM4C129)
    {
        //
        // Get the flash size from the FLASH_PP register.
        //
        ui32FlashSize = ((2048 * ((HWREG(FLASH_PP) & FLASH_PP_SIZE_M) + 1)) -
                         APP_START_ADDRESS);
    }
    else
    {
        //
        // Compute the size of the flash.
        //
        ui32FlashSize = (((HWREG(FLASH_FSIZE) & FLASH_FSIZE_SIZE_M) << 11) +
                         0x800 - APP_START_ADDRESS);
    }

//...

}

Regards,

Akash Patel

  • Hi Akash,
    I don't think it is (0x800 - APP_START_ADDRESS) but rather the (((HWREG(FLASH_FSIZE) & FLASH_FSIZE_SIZE_M) << 11) + 0x800 - APP_START_ADDRESS). I think the 0x800 may have come from the fact that the CRC values is stored at the end of the vector table.
  • Akash Patel said:
    Where does this 0x800 come from?

    I think it is because the value of the Flash Size (FSIZE) register is the size of the flash with units of 0x800 bytes, minus one.

    I.e. a FSIZE value of 0x7f indicates the flash size is ((0x7f +1) * 0x800) which is 256 Kbytes.

    The computation of the size of the flash for the TM4C123 could be re-written as the following equivalent expression, in line with the case for a TM4C129:

        else
        {
            //
            // Compute the size of the flash.
            //
            ui32FlashSize = ((2048 * ((HWREG(FLASH_FSIZE) & FLASH_FSIZE_SIZE_M) + 1)) -
                             APP_START_ADDRESS);
        }

  • Hi Chester,
    Thank you for clarifying the doubt!