Skip to content

Commit 9a87d7b

Browse files
bulislawc1728p9
authored andcommitted
CMSIS/RTX: Patch RTX4 to preserve osThreadDef compatibility
mbed OS used older RTX4 version and with osThreadDef accepting only 3 parameters, to preserve compatibility we hardcode the 'instances' parameter to 1. (cherry picked from commit 428acae) (cherry picked from commit 4360b7b)
1 parent 342841a commit 9a87d7b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

rtos/TARGET_CORTEX/rtx4/cmsis_os.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -438,26 +438,25 @@ uint32_t osKernelSysTick (void);
438438
/// Create a Thread Definition with function, priority, and stack requirements.
439439
/// \param name name of the thread function.
440440
/// \param priority initial priority of the thread function.
441-
/// \param instances number of possible thread instances.
442441
/// \param stacksz stack size (in bytes) requirements for the thread function.
443442
#if defined (osObjectsExternal) // object is external
444-
#define osThreadDef(name, priority, instances, stacksz) \
443+
#define osThreadDef(name, priority, stacksz) \
445444
extern const osThreadDef_t os_thread_def_##name
446445
#else // define the object
447446
#if (osCMSIS < 0x20000U)
448-
#define osThreadDef(name, priority, instances, stacksz) \
447+
#define osThreadDef(name, priority, stacksz) \
449448
const osThreadDef_t os_thread_def_##name = \
450-
{ (name), (priority), (instances), (stacksz) }
449+
{ (name), (priority), 1, (stacksz) }
451450
#else
452-
#define osThreadDef(name, priority, instances, stacksz) \
453-
static uint64_t os_thread_stack##name[(stacksz)?(((stacksz+7)/8)):1] __attribute__((section(".bss.os.thread.stack"))); \
451+
#define osThreadDef(name, priority, stacksz) \
452+
uint64_t os_thread_stack##name[(stacksz)?(((stacksz+7)/8)):1] __attribute__((section(".bss.os.thread.stack"))); \
454453
static osRtxThread_t os_thread_cb_##name __attribute__((section(".bss.os.thread.cb"))); \
455454
const osThreadDef_t os_thread_def_##name = \
456455
{ (name), \
457456
{ NULL, osThreadDetached, \
458-
(instances == 1) ? (&os_thread_cb_##name) : NULL,\
459-
(instances == 1) ? osRtxThreadCbSize : 0U, \
460-
((stacksz) && (instances == 1)) ? (&os_thread_stack##name) : NULL, \
457+
&os_thread_cb_##name,\
458+
osRtxThreadCbSize, \
459+
(stacksz) ? (&os_thread_stack##name) : NULL, \
461460
8*((stacksz+7)/8), \
462461
(priority), 0U, 0U } }
463462
#endif

0 commit comments

Comments
 (0)