AnsweredAssumed Answered

LPC546xx boot block structure CRC calculation

Question asked by ben1 on Jul 5, 2018
Latest reply on May 22, 2019 by ben1



I'm currently looking into single enhanced and double enhanced images on an LPC54608.


I've found the location in the vector table for addressing the boot block structure located on line 14 in the code below.

__attribute__ ((used, section(".isr_vector")))
void (* const g_pfnVectors[])(void) = {
    // Core Level - CM4
    &_vStackTop,                       // The initial stack pointer
    ResetISR,                          // The reset handler
    NMI_Handler,                       // The NMI handler
    HardFault_Handler,                 // The hard fault handler
    MemManage_Handler,                 // The MPU fault handler
    BusFault_Handler,                  // The bus fault handler
    UsageFault_Handler,                // The usage fault handler
    __valid_user_code_checksum,        // LPC MCU checksum
    0,                                 // ECRP
    0,                                 // Reserved - Image Type (0x24)
    0,                                 // Reserved - Boot block pointer (0x28)

My question is, how is the CRC for the boot block structure calculated? If the boot block structure is defined within the application code (in non-volatile memory), how do you actually add the image length and then calculate the CRC? The image would first need to be compiled, and then the address of boot block structure->image length be updated within the compiled image. After this, the CRC would need to be calculated (excluding the address of the CRC in the image) and inserted into the address of boot block structure->CRC. Is there any example code for doing this or does anyone know how this can be accomplished as an automated process?