Skip to main content
Sara.T
Associate II
November 11, 2021
Question

I have a single hex file for F & G series microcontroller. What is the best way to detect the MCU and load the appropriate hex file section from the single hex file

  • November 11, 2021
  • 3 replies
  • 1601 views

I will be able to detect if its an F series or G using DEV_ID register

    This topic has been closed for replies.

    3 replies

    TDK
    Super User
    November 11, 2021

    Have two HEX files, read the DEV_ID to determine the chip, and load the correct one based on the result.

    Any loader can load a HEX file, such as STM32CubeProgrammer.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    Sara.T
    Sara.TAuthor
    Associate II
    November 11, 2021

    What are the cons of having a single hex file ?

    TDK
    Super User
    November 11, 2021
    It’s not compatible with the limitations of the format. Different chips require different code.
    "If you feel a post has answered your question, please click ""Accept as Solution""."
    Tesla DeLorean
    Guru
    November 11, 2021

    How exactly are you sending this "singular" .HEX file to the Target(s)?

    Do you own the software delivering the file? ie Host side application

    How is the Target storing/staging this?

    How are you constructing the .HEX file? ie merging two divergent builds?

    Why a .HEX file and not a binary image, or an object containing/identifying the two sections/builds?

    If the Target STM32 has a loader that's injesting the .HEX it could perhaps differentiate based of the faux-address range each lives in, and then write the appropriate one into the application space whilst ignoring data from the other range.

    https://community.st.com/s/question/0D53W00001BvkNnSAJ/i-have-a-single-hex-file-for-stm32f-and-stm32g-series-can-you-suggest-a-way-to-identify-if-the-microcontroller-is-a-f-or-g-series-to-load-the-appropriate-code

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    MM..1
    Chief III
    November 12, 2021

    When Sara ask how to use command line utility to achieve this then run an request parse output and then run next command ,

    but when i rememmber stlink utility can validate ID then simply in one cmd script place flash G after this flash F and check results...