STM32 hex file, determine if it needs a custom bootloader

it is possible to determine somehow if a hex file (that I know is compiled/intended to work on a STM32F405) can be flashed to a blank STM32F405 chip, or if this hex is just a "firmware update" that needs a custom bootloader to run on, hence can only be flashed on a chip that already has that particular bootloader in it?

I could just try to flash it on a blank chip, but at the moment I don't have a STM32F405 prototype board so if possible I'd like to understand that before building a PCB for this task.

this is the start of the hex file (posted as suggested in the comment below)



  • The Intel HEX format is explained in depth for example on this Wikipedia page.

    Let's start the analysis with the first record.

    :020000040800F2: The record type is '04', designating an extended linear address. The data field contains the upper 16 bits of the 32 bit address, '0800'. Citing the Wikipedia page:

    The absolute address for a type 00 record is formed by combining the upper 16 address bits of the most recent 04 record with the low 16 address bits of the 00 record.

    Therefore, the following code bytes are located at 0x0800xxxx, xxxx being the addresses of the data records. According to the data sheet, this is the first 64 KiB page of the flash. The first following data record has the address 0x0000, resulting in the absolute address 0x08000000.

    The regular pattern of the following bytes looks like a vector table.

    Side note: Please be aware that the records in a Intel HEX file don't need to be in order.

    If your hex file is larger than about 130 KiB (two times 64 KiB because of two hex characters per byte), we can expect another extended linear address record with '0801', and so on.

    Depending on your boot configuration, we can assume that this code needs no specific bootloader to run.