2020-04-21 08:15 AM
Dear all,
I'm trying to debug FreeRTOS over STM32F7/F3/F4 but I don't get it.
With STLINK gdb server debugger, i can debug but only see 1 task in debugger panel.
I tried with openOCD but it not works...
Anyone do it before?
Thanks
Regards
2020-04-21 01:09 PM
You need to add a user defined configuration script:
Here's an example. The key is the last line: "$_TARGETNAME configure -rtos FreeRTOS"
# This is an genericBoard board with a single STM32L476RGTx chip
#
# Generated by STM32CubeIDE
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
source [find interface/stlink.cfg]
set WORKAREASIZE 0x8000
transport select "hla_swd"
set CHIPNAME STM32L476JEYX
# Enable debug when in low power modes
set ENABLE_LOW_POWER 1
# Stop Watchdog counters when halt
set STOP_WATCHDOG 1
# STlink Debug clock frequency
set CLOCK_FREQ 8000
# Reset configuration
# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1
set CORE_RESET 0
# BCTM CPU variables
source [find target/stm32l4x.cfg]
$_TARGETNAME configure -rtos FreeRTOS
2020-04-21 11:06 PM
Hi,
thanks for the feedback.
I tried it before, and it not works...
This is my ouptut with OCD debugger
Open On-Chip Debugger 0.10.0+dev-01193-g5ce997d (2020-02-20-10:54)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 8000 kHz
Info : STLINK V2J36S26 (API v2) VID:PID 0483:374B
Info : using stlink api v2
Info : Target voltage: 3.235194
Info : SRST line asserted
Warn : Silicon bug: single stepping will enter pending exception handler!
Info : STM32F746ZGTx.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for FreeRTOS
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003828 msp: 0x20050000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : device id = 0x10016449
Info : flash size = 1024kbytes
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003828 msp: 0x20050000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : Padding image section 0 at 0x080001c8 with 8 bytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000044 msp: 0x20050000
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003828 msp: 0x20050000
Error: Error: null stack pointer in thread
Error: RTOS: failed to get register list
Error: Error: null stack pointer in thread
Error: RTOS: failed to get register list
Error: Error: null stack pointer in thread
Error: RTOS: failed to get register list
2020-04-24 06:57 PM
Does "ST-LINK GDB server" have an option similar to $_TARGETNAME configure -rtos FreeRTOS ?
Or must use OpenOCD to have RTOS support?
-- pa
2020-04-24 08:40 PM
Not that I'm aware. I think OpenOCD is the only way to get thread aware debugging in STM32 with STLINK anyway.
2020-04-27 01:05 AM
Hi,
correct, only OpenOCD has multitask debug support.
ST-LINK GDB is an option to debug, but you only see 1 task.
@Panometric any idea about OpenOCD not works in my case?
Thanks
Regards
Jordi
2020-05-17 07:57 PM
@JBeca.1 I don't see that error. It suggests your RTOS is not linked in. I did notice this other part that I had applied though.
Put this in a .C file:
#include "FreeRTOS.h"
#ifdef __GNUC__
#define USED __attribute__((used))
#else
#define USED
#endif
const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;
And put this in the linker settings:
-Wl,--undefined=uxTopUsedPriority
And here's the guide I used to figure it out.
https://mcuoneclipse.com/2016/04/09/freertos-thread-debugging-with-eclipse-and-openocd/
2020-05-27 10:46 PM
HI @Panometric ,
thanks for your support. I tried it... but it doesn't work.
I added the code in main.c
And the linker setting I added in build options (see image)
I can "enter in debug mode" but debugger not works. The eclipse show that app is running, but I can't resume, stop, step, ... and board doesn't do a nything
I attach the console output
Thanks for your tiem
Regards
Jordi
Open On-Chip Debugger 0.10.0+dev-01193-g5ce997d (2020-02-20-10:54)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 8000 kHz
Info : STLINK V2J36S26 (API v2) VID:PID 0483:374B
Info : using stlink api v2
Info : Target voltage: 3.244649
Info : SRST line asserted
Info : STM32F334R8Tx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000640 msp: 0x20003000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : device id = 0x10016438
Info : flash size = 64kbytes
Info : Auto-detected RTOS: FreeRTOS
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000640 msp: 0x20003000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : Padding image section 0 at 0x08000188 with 8 bytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20003000
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000640 msp: 0x20003000
Error: Error reading stack frame from thread
Error: RTOS: failed to get register list
Error: Error reading stack frame from thread
Error: RTOS: failed to get register list
2020-06-03 09:02 PM
2020-09-04 04:29 AM
@KOkun.1048
Hi,
sorry for the delay in my answer.
I check your link, but it not works....
I will answer in the other thread.
Thanks
Jordi