Option byte launch

Sysprogs forums Forums VisualGDB Option byte launch

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28937
    mattia
    Participant

    Hello,

    I’m using an STM32G0 microcontroller. I need to launch the Option byte before entering in the debug mode, therefore the easiest way I found is to write 1 in the OBL_LAUNCH. Is there a way to modify the register FLASH->CR->OBL_LAUNCH before entering in the debug mode?

    Thank you,

    Mattia Berton

    #28944
    mattia
    Participant

    Let me explain a little better my problem: I use the STM32G030C8. With CubeIDE no problem, the program executes in normal way using my J-link and loading the CubeMX program. However using VisualGDB it seems as if the option bytes are not correctly handled: at address 0x0000000 there is the System memory, and not the Main memory as it should be. During the startup routine the Stack pointer is loaded wrong, while the Program counter is ok. However, if I press the reset button, the program counter goes to the System memory (and of course it is not correct).

    The only way I found to solve this problem is to load runtime the Option Byte and then perform a reset. In this way, at address 0x0 there is the Main memory as it should be.

    This problems arises only during debug, probably because the Boot0 pin is shared with SWCLK. However, I can’t explain why the CubeIDE works without doing anything.

    Can you help me?

    Thank you,

    Mattia Berton

    #28946
    support
    Keymaster

    Hi,

    Most likely, the STM32CubeIDE is running some additional commands during the gdb startup, while VisualGDB doesn’t.

    The easiest way to find it out would be to enable gdb tracing in Eclipse and turn on diagnostic GDB logs in VisualGDB. Then, simply locate the startup commands issued by the CubeIDE that could be related to updating these registers, and add them to VisualGDB Project Properties -> Additional Startup Commands.

    #28957
    mattia
    Participant

    Hello,

    I can’t find the gdb trace in STM32CubeIDE. I attached the file called “immagine” to see what I found on STM32CubeIDE. I alsso attached the log I found on VisualGDB.

    How can I write some register before entering in the debug mode? Can you make an example?

    Thank you,

    Mattia

     

    Attachments:
    You must be logged in to view attached files.
    #28963
    support
    Keymaster

    Generally, as it is a very rare scenario, VisualGDB will not have a direct support for it unless the problem starts affecting multiple users, sorry.

    Since STM32CubeIDE also uses OpenOCD and GDB, you should be able to replicate the results you get there with VisualGDB, but that would require non-trivial research of the STM32CubeIDE internals. You would need to find the exact OpenOCD and GDB command lines, as well as the gdb startup commands. Unfortunately, we won’t be able to provide any STM32CubeIDE-specific instructions to obtain them, however if you do manage to obtain them, and get debugging to work by running gdb and OpenOCD manually, we can help you configure VisualGDB to replicate the same setup.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.