Skip to main content
Visitor II
June 4, 2023
Question

Place const at specific flash location

  • June 4, 2023
  • 3 replies
  • 2019 views

Hi everyone,

I am developing a custom bootloader and before flash the new application image, the bootloader must ensure that the image corresponds to the board, so I think a simple way to do it is to store a specific value (constant uint32_t) into a specific flash memory location, so the bootloader can dig into the .Hex file and find it. How can I store a constant in, lets say 0x8030000 flash address?

thanks in advance.

    This topic has been closed for replies.

    3 replies

    Graduate II
    June 4, 2023
    Graduate II
    June 4, 2023

    Cast a pointer to read

    Have a code / version / sequence# in the empty positions in the Vector Table, via startup.s

    If staging an image, perhaps package it with a a wrapper / integrity check

    Having stuff floating around at specific addresses via Linker AT directives, or similar, tends to be highly non-portable and future limiting

    manuisletAuthor
    Visitor II
    June 5, 2023

    Thanks to all for your replies,

    @Community member​ what do you think is the best option to verify/check that the firmware the end user is trying to flash was writen by my using only the .hex file?

    Graduate II
    June 5, 2023

    Not sure I understand the question.

    You could perhaps sign the .HEX file with additional records, say adding a SECP192R1 type signature, or CRC32 or SHA256, you could perhaps salt them so harder to recognized/duplicate.

    Each STM32 has a 96-bit Unique ID you could use that to salt the signing, or generate a key