[ABANDONED] Ozone can't set SP and PC at start for STM32F205

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

  • [ABANDONED] Ozone can't set SP and PC at start for STM32F205

    I'm evaluating Ozone 3.20e with an STM32F205ZG chip and a v9.1 J-Link. I flashed the device earlier using JFlash, and am trying to start the debugger using the "Attach & Halt" command. I get the following error dialog:

    ===================
    The target stopped in HardFault exception state.

    Reason: A fault with configurable priority has been escalated to a HardFault exception at 0x00000000.

    For more information about analyzing faults on Cortex-M, refer to:
    wiki.segger.com/Cortex-M_Fault.
    ===================

    I expect an error of that sort because the device doesn't have a bootloader flashed (the image is firmware that expects to be launched by a bootloader).

    But when I issue a "Reset & Halt" command, I expect that the SP and PC registers will be set up from the firmware file's ELF symbol information. It looks like the debugger attempts to set those registers properly using the Target.SetReg() function but those calls return an "Invalid parameter" error:

    Source Code

    1. Debug.SetResetMode (RM_RESET_HALT);
    2. Debug.Reset();
    3. Reset: Halt core after reset via DEMCR.VC_CORERESET.
    4. Reset: Reset device via AIRCR.SYSRESETREQ.
    5. Elf.GetBaseAddr(); // returns 0x8041800
    6. Target.ReadU32 (0x08041800); // returns 0x20003400
    7. Target.SetReg ("SP", 0x20003400);
    8. Target.SetReg ("SP", 0x20003400): Invalid parameter: SP
    9. Elf.GetEntryPointPC(); // returns 0x807CE38
    10. Target.SetReg ("PC", 0x807CE38);
    11. Target.SetReg ("PC", 0x807CE38): Invalid parameter: PC
    Display All

    The addresses look correct, and the disassembly at address 0x807ce38 is correct. So I assume the invalid parameters are the register names "SP" and "PC". I didn't write any Ozone script for this project - it must be a script that came with Ozone. Should those register names (which look normal tome) be something else?

    Any idea what is going wrong?
  • Hello,

    Thank you for your inquiry.
    Such an issue is not known to us.
    It should be working without the invalid parameter error.
    Here is an example console log from one of my test projects where SP and PC are set without any issues:

    Source Code

    1. Connected to target device.
    2. Reset: Halt core after reset via DEMCR.VC_CORERESET.
    3. Reset: Reset device via AIRCR.SYSRESETREQ.
    4. Elf.GetBaseAddr(); // returns 0x8000000
    5. Target.ReadU32 (0x08000000); // returns 0x20020000
    6. Target.SetReg ("SP", 0x20020000);
    7. Elf.GetEntryPointPC(); // returns 0x8000A64
    8. Target.SetReg ("PC", 0x8000A64);
    9. J-Link: Flash download: Bank 0 @ 0x08000000: Skipped. Contents already match
    10. Elf.GetBaseAddr(); // returns 0x8000000
    11. Debug.ReadIntoInstCache (0x08000000, 0x8000);
    12. Target.ReadU32 (0x08000000); // returns 0x20020000
    13. Target.SetReg ("SP", 0x20020000);
    14. Elf.GetEntryPointPC(); // returns 0x8000A64
    15. Target.SetReg ("PC", 0x8000A64);
    16. Executed J-Link command "SelectTraceSource=1"
    17. Startup complete (PC=0x08000834)
    18. Executed J-Link command "SetRTTAddr 0x20000404"
    Display All
    What host OS are you using?
    Do you see the same behaviour on an eval board?
    If yes, could you provide an example project for reproduction for the eval board?

    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.
  • Nino:

    The board I am working on is our own board where a STM32F103 chip was removed and a STM32F205 soldered in place. I am working on getting an STM3220G-EVAL board which uses the similar STM32F207 chip.

    Until then, the IAR EWARM v5.20 debugger does work with J-Link JTAG on the modified board I have. If there is some log from that or other diagnostic that might give you information, please let me know.

    Thanks,

    --
    Michael Burr
  • Hello Michael,

    Could you attach the Ozone project file .jdebug for reference?

    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.