2019-10-23 02:48 AM
In STM32CubeIDE 1.0.2, after I added '-c "$_TARGETNAME configure -rtos FreeRTOS"' to 'OpenOCD Options', I could debug FreeRTOS's target with threading mode.
But, in STM32CubeIDE 1.1.0, even if I set same settings to 'OpenOCD Options', I could not debug with threading mode. In this version, openocd outputs 'Error: No symbols for FreeRTOS'.
Could you please check about this?
2020-05-02 11:36 AM
I'm using CubeIDE 1.3.1
My project is an STM32L496VG based FreeRTOS & TouchGFX project with mixed C and C++
I successfully build run and debug the project with ST-Link (OpenOCD)
I follow the list of actions above and did all of them but I can't get the Thread awareness to work.
#include "FreeRTOS.h"
#ifdef __GNUC__
#define USED __attribute__((used))
#else
#define USED
#endif
const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;
I get this terminal output:
Open On-Chip Debugger 0.10.0+dev-01193-g5ce997d (2020-02-20-10:57)
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.264694
Info : SRST line asserted
Info : STM32L496VGYxP.cpu: hardware has 6 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: 0x08000590 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 idcode = 0x20006461 (STM32L49/L4Axx - Rev: B)
Info : flash size = 1024kbytes
Info : flash mode : dual-bank
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000590 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 0x080001ac with 4 bytes
Warn : Padding 4 bytes to keep 8-byte write size
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000050 msp: 0x20050000
Info : block write succeeded
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (5141). Workaround: increase "set remotetimeout" in GDB
Info : SRST line asserted
Info : SRST line released
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000590 msp: 0x20050000
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
I can see here two issues:
.rodata.uxTopUsedPriority
0x0000000000000000 0x4 Application/User/openOCD_ThreadAware.o
What I'm doing wrong?
2020-05-03 12:04 AM
@DB.7abatunde , @egoltzman
Please add the following option to linker options.
-Wl,-undefined=uxTopUsedPriority
And, please confirm your uxTopUsedPriority symbol, again.
In my map file,
.rodata.uxTopUsedPriority
0x000000000803eff8 uxTopUsedPriority
Maybe, in your binary, uxTopUsedPriority was eliminated, since the symbol is not reffered.
2020-05-03 01:17 AM
Thank you KOkun!
The linker option did the job
2020-05-03 02:55 AM
Update procedure.
#include "FreeRTOS.h"
#ifdef __GNUC__
#define USED __attribute__((used))
#else
#define USED
#endif
const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;
(*)YOUR_TARGET.elf means the elf binary with debug symbols.
(*)BUILD_DIR is the directory includes YOUR_TARGET.elf. and separator is "/" even if windows platform.
In STM32CubeIDE 1.0.2, "6." procedure is not needed. But, after STM32CubeIDE 1.1.0, "6." is needed for thread awareness debug.
ST members, could you confirm this?
2020-05-03 03:11 AM
I checked this on CubeIDE 1.3.1 and it is working
2020-05-08 12:44 AM
I checked this on CubeIDE 1.3.1 and it's working too.
2020-05-12 03:34 AM
That fixed it. Cheers!
2020-06-12 06:45 AM
Many thanks for sharing your solution!
However I am struggling with linker part - 2.
In my CUBE v1.3.1 the linker options appears to be read only. That is at: Properties=>C/C++ Build=>ToolSettings=>MCU GCC Linker=>All options
Sorted my issue above: just add the linker fix to the Command box:
Properties=>C/C++ Build=>ToolSettings=>MCU GCC Linker=>Command:
and change "gcc" to "gcc -Wl,-undefined=uxTopUsedPriority"
2020-06-24 02:50 AM
Please add "-Wl,-undefined=uxTopUsedPriority" to your linker options.
2020-09-04 04:35 AM
Hi,
I'm using STm32F446RE and I don't reach a valid configuration to debug with multi thread support. I'm using st cube ide 1.2.0
I followed the 6 steps defined by @KOkun.1048 and I get error allocating threads. This is the error message:
Open On-Chip Debugger 0.10.0+dev-00022-g02bea1f (2020-01-08-09:31)
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 v2.1 JTAG v35 API v2 M26 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.248915
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : STM32F446RETx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800099c msp: 0x20020000
configuring PLL
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
Info : device id = 0x10006421
Info : flash size = 512kbytes
Info : Padding image section 0 with 12 bytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000046 msp: 0x20020000
Error: Error allocating memory for -184299509 threads
Error: Error allocating memory for -184299509 threads
Any idea?
Thanks for you support
Jordi