Skip to content

Commit

Permalink
core: add comments to symbols used by OpenOCD
Browse files Browse the repository at this point in the history
OpenOCD makes assumptions about those symbol names / enum entries,
so add a note about it as a comment.
  • Loading branch information
benpicco committed Jul 27, 2020
1 parent 42eb044 commit 4d34cee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions core/include/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ typedef struct _thread thread_t;

/**
* @name Thread states supported by RIOT
*
* Keep in sync with OpenOCD src/rtos/riot.c
* @{
*/
typedef enum {
Expand Down
27 changes: 15 additions & 12 deletions core/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@
#include <inttypes.h>
#endif

volatile int sched_num_threads = 0;

volatile unsigned int sched_context_switch_request;

volatile thread_t *sched_threads[KERNEL_PID_LAST + 1];
volatile thread_t *sched_active_thread;

volatile kernel_pid_t sched_active_pid = KERNEL_PID_UNDEF;

clist_node_t sched_runqueues[SCHED_PRIO_LEVELS];
static uint32_t runqueue_bitcache = 0;

/* Needed by OpenOCD to read sched_threads */
#if defined(__APPLE__) && defined(__MACH__)
#define FORCE_USED_SECTION __attribute__((used)) __attribute__((section( \
Expand All @@ -61,6 +49,14 @@ static uint32_t runqueue_bitcache = 0;
".openocd")))
#endif

/**
* @brief Symbols also used by OpenOCD, keep in sync with src/rtos/riot.c
* @{
*/
volatile kernel_pid_t sched_active_pid = KERNEL_PID_UNDEF;
volatile thread_t *sched_threads[KERNEL_PID_LAST + 1];
volatile int sched_num_threads = 0;

FORCE_USED_SECTION
const uint8_t max_threads = ARRAY_SIZE(sched_threads);

Expand All @@ -70,6 +66,13 @@ const uint8_t max_threads = ARRAY_SIZE(sched_threads);
FORCE_USED_SECTION
const uint8_t _tcb_name_offset = offsetof(thread_t, name);
#endif
/** @} */

volatile thread_t *sched_active_thread;
volatile unsigned int sched_context_switch_request;

clist_node_t sched_runqueues[SCHED_PRIO_LEVELS];
static uint32_t runqueue_bitcache = 0;

#ifdef MODULE_SCHED_CB
static void (*sched_cb) (kernel_pid_t active_thread,
Expand Down

0 comments on commit 4d34cee

Please sign in to comment.