[SOLVED] Abort flash download for wrong mcu type

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Abort flash download for wrong mcu type

    Dear SEGGER-Team,

    is there a way to abort flash download when the wrong mcu is connected to the J-Link?


    In our scenario we have two boards which are based on STM32 MCUs from the same family "STM32F765".
    However on the first board is the STM32F765_NI and on the second is the STM32F765_IG.
    We have a firmware project in SES with a build configuration for each board.

    Lets say a "NI" board is connected to our J-Link.
    Then we try to debug the "IG" build configuration.

    Result: The "IG" firmware is downloaded onto the "NI" board ROM.
    Our desired result would be, that the flash download is aborted because the wrong mcu variant is connected.


    Best regards,
    inv_sma
  • Hello,

    Thank you for your inquiry.
    It is unfortunately not easily possible for the J-Link to detect what device is connected currently so the J-Link software assumes that the device name that is passed at the beginning of the debug session is correct.
    We had a autodetection in the early days of J-Link, but due to many silicon vendors not following the Arm specification the autodetection either did not work for many devices or in some hard cases even lead to bricked target devices. This is why we currently have no more autodetection for target devices and rely on the user input.

    But if you know how to differentiate your specific pair of target devices by e.g. reading out some registers you could expand the target script (usually called <targetname>_Target.js) that can be found in the Script File folder of your project.

    This is a simple javascript file where you can implement different actions that interact with the target device:
    studio.segger.com/arm_es_target_script_TargetInterface.htm

    Once you finished your "detection" callback you can set it in project options e.g. at Debug->Target Script->Debug Begin Script or Load Begin Script.

    That way this callback will always be executed at the beginning of a debug session. If the check fails no download should be issued.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.