diff --git a/core/sched.c b/core/sched.c index f1414b369..bc85bdc6b 100644 --- a/core/sched.c +++ b/core/sched.c @@ -58,13 +58,19 @@ clist_node_t sched_runqueues[SCHED_PRIO_LEVELS]; static uint32_t runqueue_bitcache = 0; /* Needed by OpenOCD to read sched_threads */ -__attribute__((used)) __attribute__((section (".openocd"))) +#if defined(__APPLE__) && defined(__MACH__) + #define FORCE_USED_SECTION __attribute__((used)) __attribute__((section ("__OPENOCD,__openocd"))) +#else + #define FORCE_USED_SECTION __attribute__((used)) __attribute__((section (".openocd"))) +#endif + +FORCE_USED_SECTION uint8_t max_threads = sizeof(sched_threads) / sizeof(thread_t*); #ifdef DEVELHELP /* OpenOCD can't determine struct offsets and additionally this member is only * available if compiled with DEVELHELP */ -__attribute__((used)) __attribute__((section (".openocd"))) +FORCE_USED_SECTION uint8_t _tcb_name_offset = offsetof(thread_t, name); #endif