Debug Temp Break at Main Not appearing

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

pcat
Posts: 5
Joined: Thu May 24, 2018 10:22 am

Debug Temp Break at Main Not appearing

Postby pcat » Mon Aug 06, 2018 2:01 pm

Hi,
I have two Boards an STM32F407 Discovery and my own board with the same device.
If I program either with a simple CubeMx LED Blinking program BOTH boards function the same and I can single step.

When I try to program both boards with a larger program that the LED blinking is derived from, only the Discovery board reaches the Temporary breakpoint Thread#1 at start and then I can single step through the code.

If I program my board the Flash programs successfully but the Temp breakpoint never gets set and no Code appears and the Resume button is Greyed out. But no Error messages.

I'm using a STLINK/V2 for my board.


I have attached two screenshots to show the differences in the debug panel.
Any ideas would be appreciated ?

2018-08-06.png

2018-08-06 (1).png
You do not have the required permissions to view the files attached to this post.

Mattias Norlander
Posts: 198
Joined: Fri Apr 29, 2016 10:01 am

Re: Debug Temp Break at Main Not appearing

Postby Mattias Norlander » Wed Aug 08, 2018 1:33 pm

Are you sure that your custom board is programmed successfully with the larger program?
Can you connect STM32CubeProgrammer and compare the flash content of the binary and the flash memory?

pcat
Posts: 5
Joined: Thu May 24, 2018 10:22 am

Re: Debug Temp Break at Main Not appearing

Postby pcat » Wed Aug 08, 2018 3:05 pm

Hi Mattias,

In Truestudio the Flash for all pages program successfully okay in the Console panel with both boards.
They finish at the same memory location.

I have compared using STLink Utility and just tried STM32CubeProgrammer and both verify the output file against the contents on the chip.

So I programmed both boards (DISCO & Custom) did a Memory Checksum and another file compare and they are both identical.
But the Debugger console never sets the Breakpoint at main and no resume button on the Custom board.

I have made additions to the smaller Blinky program so I have more I/O, SPI, & CAN working so the board appears okay.
But I cannot understand how the same file sets the breakpoint and runs runs in the DISCO board but doesnt get to the start of the Debug in the custom board.
I have also tried running from the the HSI Internal oscilator and the HSE external just in case but no difference.

I have listed the debugger script (default) below in case you were interested.

Thanks for the assistance.

Paul

# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers
# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode
#monitor flash set_parallelism_mode 2

# Set character encoding
set host-charset CP1252
set target-charset CP1252

# Reset to known state
monitor reset

# Load the program executable
load

# Reset the chip to get to a known state. Remove "monitor reset" command
# if the code is not located at default address and does not run by reset.
monitor reset

# Enable Debug connection in low power modes (DBGMCU->CR)
set *0xE0042004 = (*0xE0042004) | 0x7

# Set a breakpoint at main().
tbreak main

# Run to the breakpoint.
continue

Mattias Norlander
Posts: 198
Joined: Fri Apr 29, 2016 10:01 am

Re: Debug Temp Break at Main Not appearing

Postby Mattias Norlander » Thu Aug 09, 2018 6:35 am

If you remove the "continue" command and the "tbreak main", then execution should be suspended on first line in Reset_Handler.
What happens then?

pcat
Posts: 5
Joined: Thu May 24, 2018 10:22 am

Re: Debug Temp Break at Main Not appearing

Postby pcat » Thu Aug 09, 2018 10:21 am

Hi,
on the custom board, with the continue and tbreak removed the debugger loads the Startup assembler file and the Resume button becomes available.
When pressed it appears as though the program is running but it is not running.
So if I halt the debugger I get no source available.

On the Disco board with the continue and tbreak removed, when I press resume the program runs and it I halt it I get the source listing.
I have also updated both ST-Links to same version as a precaution.

I set up for the st_link_gdgserver_log.txt , I notice that it can vary slightly for the same board but there is a difference at the end of the file for custom and disco board.

Perhaps these snippets from near the end of both files may help.

CUSTOM BOARD
[8.820] flash_f2_wait_for_last_operation(): FuncExit
[8.820] lock_flash_f2_prg_and_erase_ctrler(): FuncExit
[8.836] stm32_f2_program_flash_memory_debug_write_byte(): STM32 device: flash programming successful 0x800541c
[8.836] stm32_f2_program_flash_memory_debug_write_byte(): FuncExit
[8.836] handleFlashPacket(): Flash write completed in 0.281000 seconds, 3.614324kB/s
[8.836] STM32_AppReset(): Enter STM32_AppReset() function
[8.945] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[8.945] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[8.945] STM32_AppReset(): XPSR = 0x01000000
[8.945] handlePacket(): Reading 0x2 bytes of memory from addr 0x8003308
[8.945] handlePacket(): Reading 0x4 bytes of memory from addr 0x80045f4
[8.945] STM32_AppReset(): Enter STM32_AppReset() function
[9.078] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[9.080] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[9.081] STM32_AppReset(): XPSR = 0x01000000
[9.082] handlePacket(): Reading 0x4 bytes of memory from addr 0xe0042004
[9.092] handlePacket(): Reading 0x4 bytes of memory from addr 0x1fff3da2
[9.092] handlePacket(): Reading 0x2 bytes of memory from addr 0x1fff3da2
[9.092] handlePacket(): Reading 0x4 bytes of memory from addr 0xffffffff
[9.092] handlePacket(): Reading 0x4 bytes of memory from addr 0xffffffff
[9.092] handlePacket(): Reading 0x2 bytes of memory from addr 0x8003308
[9.092] performContinue(): TraceCaptureStart and SWV event set to APP_TRUE
[9.124] Device_GetStatus(): ST_LINK device status: RUN_MODE

DISCO BOARD
[8.744] flash_f2_wait_for_last_operation(): FuncEntry
[8.744] flash_f2_get_busy_status(): FuncEntry
[8.744] flash_f2_get_busy_status(): FuncExit
[8.744] flash_f2_wait_for_last_operation(): FuncExit
[8.744] lock_flash_f2_prg_and_erase_ctrler(): FuncExit
[8.760] stm32_f2_program_flash_memory_debug_write_byte(): STM32 device: flash programming successful 0x800541c
[8.760] stm32_f2_program_flash_memory_debug_write_byte(): FuncExit
[8.760] handleFlashPacket(): Flash write completed in 0.266000 seconds, 3.818139kB/s
[8.771] STM32_AppReset(): Enter STM32_AppReset() function
[8.881] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[8.881] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[8.881] STM32_AppReset(): XPSR = 0x01000000
[8.881] handlePacket(): Reading 0x2 bytes of memory from addr 0x8003308
[8.881] handlePacket(): Reading 0x4 bytes of memory from addr 0x80045f4
[8.896] STM32_AppReset(): Enter STM32_AppReset() function
[9.006] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[9.006] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[9.006] STM32_AppReset(): XPSR = 0x01000000
[9.006] handlePacket(): Reading 0x4 bytes of memory from addr 0xe0042004
[9.021] handlePacket(): Reading 0x4 bytes of memory from addr 0x80045f8
[9.021] handlePacket(): Reading 0x2 bytes of memory from addr 0x80045f4
[9.021] handlePacket(): Reading 0x2 bytes of memory from addr 0x80045f6
[9.021] handlePacket(): Reading 0x4 bytes of memory from addr 0x800462c
[9.021] handlePacket(): Reading 0x2 bytes of memory from addr 0x8003308
[9.037] performContinue(): TraceCaptureStart and SWV event set to APP_TRUE
[9.068] handleGDBConnection(): TraceCaptureStart and SWV event set to APP_FALSE
[9.076] Device_GetHaltReason(): NVIC_DFSR_REG = 0x00000002
[9.077] handleStopReply(): ST_LINK Halt Reason break point hit

[9.089] handlePacket(): Reading 0x4 bytes of memory from addr 0x8003308
[9.262] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed04
[9.278] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed2c
[9.293] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed28
[9.309] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed38
[9.325] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed34
[25.030] performContinue(): TraceCaptureStart and SWV event set to APP_TRUE
[25.064] Device_GetStatus(): ST_LINK device status: RUN_MODE
[30.387] parseForPacket(): Received Ctrl-C from the client
[30.387] handleGDBConnection(): TraceCaptureStart and SWV event set to APP_FALSE
[30.402] handleSignalPacket(): Device not halted(0), performing Ctrl-C
[30.402] handleSignalPacket(): Device halted
[30.404] handlePacket(): Reading 0x4 bytes of memory from addr 0x8004694
[30.416] Device_GetStatus(): ST_LINK device status: HALT_MODE
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x8003ff2
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ff94
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ff94
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ff94
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x80041d2
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ffa4
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ffa4
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ff94
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x2001ffa4
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0x80036d8
[30.432] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed04
[30.792] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed2c
[30.839] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed28
[30.854] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed38
[30.870] handlePacket(): Reading 0x4 bytes of memory from addr 0xe000ed34


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 1 guest