Skip to content

Commit

Permalink
Add support to OpenOCD FreeRTOS debug
Browse files Browse the repository at this point in the history
  • Loading branch information
augustofg committed Feb 26, 2021
1 parent 951ef6f commit e1ce538
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions FreeRTOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ set(LIBFREERTOS_SRCS ${LIBFREERTOS_SRCS}
timers.c
tasks.c
event_groups.c
openocd.c
)

include_directories(${UCONTROLLER_HDRS})
Expand Down
20 changes: 20 additions & 0 deletions FreeRTOS/openocd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer
* present in the kernel, so it has to be supplied by other means for
* OpenOCD's threads awareness.
*
* Add this file to your project, and, if you're using --gc-sections,
* ``--undefined=uxTopUsedPriority'' (or
* ``-Wl,--undefined=uxTopUsedPriority'' when using gcc for final
* linking) to your LDFLAGS; same with all the other symbols you need.
*/

#include "FreeRTOS.h"

#ifdef __GNUC__
#define USED __attribute__((used))
#else
#define USED
#endif

volatile const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;
2 changes: 1 addition & 1 deletion toolchain/toolchain-arm-none-eabi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ set( CMAKE_OBJDUMP ${TC_PATH}${CROSS_COMPILE}objdump
set(COMMON_FLAGS "-fno-common -fno-builtin -ffunction-sections -fdata-sections -fno-strict-aliasing -fmessage-length=0")
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=gnu++0x")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections --specs=nosys.specs -nostdlib -static -nostartfiles")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections,--undefined=uxTopUsedPriority --specs=nosys.specs -nostdlib -static -nostartfiles")

0 comments on commit e1ce538

Please sign in to comment.