Skip to content

Commit e3a67ba

Browse files
committed
compatible layer
1 parent 5a819be commit e3a67ba

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Kconfig

+8
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,14 @@ config RT_USING_SCHED_THREAD_CTX
443443
mandatory option in the future.
444444
default y if RT_USING_SMP
445445

446+
config RT_USING_ABSTRACT_THREAD_SELF
447+
bool "Using the abstract version of thread self"
448+
depends on !RT_USING_SMP
449+
help
450+
Using the rt_thread_self() to get TCB instead of fetching from
451+
global object rt_current_thread to achieve better maintainability
452+
default n
453+
446454
config RT_USING_CONSOLE
447455
bool "Using console for rt_kprintf"
448456
default y

src/cpu_up.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
#include <rthw.h>
1313
#include <rtthread.h>
1414

15-
static struct rt_cpu _cpu;
15+
#ifndef RT_USING_ABSTRACT_THREAD_SELF
16+
#undef rt_current_thread
17+
#define _cpu rt_current_thread
18+
/* regarding to the legacy codes */
19+
#endif /* RT_USING_ABSTRACT_THREAD_SELF */
20+
21+
struct rt_cpu _cpu;
1622

1723
/**
1824
* @brief Initialize a static spinlock object.

0 commit comments

Comments
 (0)