Skip to main content
Graduate II
March 8, 2024
Solved

STM32F303VCT - Applicatoin code not running outside of STMCubeIDE.

  • March 8, 2024
  • 4 replies
  • 8549 views

STM32F303 - Application running fine in CubeIDE debugger, custom board. It will not start as standalone, programmed with CubeIDE or CubeProgrammer with .elf or .hex.

I have created an 'attach' run debug configuration, which can successfully display program execution and symbols when connected after CubeIDE starts the application.

I have placed the following code in main() in order to pause execution at the top of main to hopefully attach and step through to identify the fault.

jlag_1-1709927450108.png

However, when I attach after a cold/power reset, this is my trace, as if the system is not making it to main after cold start/no debugger.

jlag_0-1709927405306.png

I see the following data in the flash at location 0x0000 0000 when read with CubeProgrammer:

jlag_2-1709927661693.png

Shouldn't 0x04-0x07 contain the program start address of 0x0800 0000 + vector table size?

Is the flash is read protected and I am looking at invalid data?

 

    This topic has been closed for replies.
    Best answer by AScha.3

    AScha3_0-1709938516276.png

    from F303 rm.

     

    Solder boot0 to gnd.

    Then flash F303 with your program, use cubeProgrammer , and verify the flash start address. (0x08000000 )

     

    4 replies

    Super User
    March 8, 2024

    Hi,

    what is state of boot0 pin , gnd ?

    (0x1ffffxxx looks like jump to system/bootloader...)

    jlagAuthor
    Graduate II
    March 8, 2024

    Yes @AScha.3, it is 0V/Gnd via 10K Ohms.

    Super User
    March 8, 2024

    Examine option bytes which might be hard-wiring it to start into the system bootloader.

    AN2606 will list all possible patterns which can cause it to run the bootloader rather than system flash. Certainly seems like you're in there, so might be worth running through all possible scenarios.

    Debugging circumvents normal startup behavior.

    AScha.3Answer
    Super User
    March 8, 2024

    AScha3_0-1709938516276.png

    from F303 rm.

     

    Solder boot0 to gnd.

    Then flash F303 with your program, use cubeProgrammer , and verify the flash start address. (0x08000000 )

     

    jlagAuthor
    Graduate II
    March 9, 2024

    @AScha.3 - Thanks, I was incorrect RE the BOOT0 resistor:

    jlag_4-1709948558385.png

    I have verified logic low on the Boot0 input. I am not sure soldering to GND will make any difference here.

    jlagAuthor
    Graduate II
    March 9, 2024

    It turned out to be a HW issue that @AScha.3  made me investigate further. The switch on the board for BOOT0 high/low was mounted incorrectly and caused BOOT0 to be logic 1 for this particular board.

    There was no other electrical way to get BOOT0 to logic 0 other than removing the BOOT0 selection switch from the PCB:

    Bye bye switchie:

    jlag_0-1709961460751.png

     

    Removed boot selection switch from the PCB and all is well. I was thinking this was way worse than it was (clock chasing, etc.).

    KUDOS to @TDK for all their help as well. Learned quite a bit about the STM32 ROM booter. I do still feel the documentation and tools regarding boot specifics (option bytes, write only, what is available for particular uPs in the CubeProgrammer) for particular STM32 uPs are a bit obtuse. Kudos to the community, 2 for 2 on helping me in the STM32F303 "bring-up" world.

     

    jlagAuthor
    Graduate II
    March 30, 2024

    Solution was as @AScha.3 and @TDK suggested was BOOT0 being held high due to PCB manufacturing defect on boot switch orientation/placement.

    Cheers to all.