File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ You should observe the compilation of sample_threadx.c (which is the demonstrati
3333application) and linking with tx.a. The resulting file DEMO is a binary file
3434that can be executed.
3535
36+ 2.1 Includes
37+
38+ Notice that the demonstration Makefile includes defines for _GNU_SOURCE
39+ and TX_LINUX_MULTI_CORE. These are necessary to enable GNU/Linux-specific
40+ compatibility for ThreadX using the Linux kernel in multi-core devices,
41+ including the option to control processor affinity. See the GNU documentation
42+ on CPU affinity and Feature Test Macros for more information.
43+
44+ TX_LINUX_MULTI_CORE is necessary to enable code that constrains ThreadX to
45+ one core, to prevent unintended behavior when threads execute simultaneously
46+ across multiple cores. The enabled code configures CPU affinity, requiring
47+ the use of macros such as CPU_SET and functions such as sched_setaffinity.
48+ Access to these macros and functions (and the underlying types for the latter)
49+ are enabled via the definition of _GNU_SOURCE.
50+
51+ When building your own application, the _GNU_SOURCE and TX_LINUX_MULTI_CORE
52+ symbols can be defined by being passed to the compiler (e.g. -D_GNU_SOURCE) or
53+ in the optional user-defined ThreadX user define file tx_user.h. In the latter
54+ case, ensure that the symbol TX_INCLUDE_USER_DEFINE_FILE is defined, to instruct
55+ the tx_port.h header to include tx_user.h.
3656
37573. System Initialization
3858
Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ You should observe the compilation of sample_threadx.c (which is the demonstrati
3333application) and linking with tx.a. The resulting file DEMO is a binary file
3434that can be executed.
3535
36+ 2.1 Includes
37+
38+ Notice that the demonstration Makefile includes defines for _GNU_SOURCE
39+ and TX_LINUX_MULTI_CORE. These are necessary to enable GNU/Linux-specific
40+ compatibility for ThreadX using SMP with the Linux kernel in multi-core devices,
41+ including the option to control processor affinity. See the GNU documentation
42+ on CPU affinity and Feature Test Macros for more information.
43+
44+ TX_LINUX_MULTI_CORE is necessary to enable code that constrains ThreadX to
45+ one core, to prevent unintended behavior when threads execute simultaneously
46+ across multiple cores. The enabled code configures CPU affinity, requiring
47+ the use of macros such as CPU_SET and functions such as sched_setaffinity.
48+ Access to these macros and functions (and the underlying types for the latter)
49+ are enabled via the definition of _GNU_SOURCE.
50+
51+ When building your own application, the _GNU_SOURCE and TX_LINUX_MULTI_CORE
52+ symbols can be defined by being passed to the compiler (e.g. -D_GNU_SOURCE) or
53+ in the optional user-defined ThreadX user define file tx_user.h. In the latter
54+ case, ensure that the symbol TX_INCLUDE_USER_DEFINE_FILE is defined, to instruct
55+ the tx_port.h header to include tx_user.h.
3656
37573. System Initialization
3858
You can’t perform that action at this time.
0 commit comments