diff options
| author | Frédéric Desbiens <[email protected]> | 2025-05-21 09:41:15 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-21 09:41:15 -0400 |
| commit | b2beb1704648e33c1d2d3734ba816001afbe8ce8 (patch) | |
| tree | c2491e65476d31e8f0251e1ce5d81e90e7e11dd0 | |
| parent | 4fdc5dc0aea77e29118ef9873996d7733beb1309 (diff) | |
| parent | 20958ddcf94581a7f8d67ba1172832919021b968 (diff) | |
Merge pull request #449 from hnguyenHWI/master
Document GNU library compile flags for Linux and SMP Linux
| -rw-r--r-- | ports/linux/gnu/readme_threadx.txt | 20 | ||||
| -rw-r--r-- | ports_smp/linux/gnu/readme_threadx.txt | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/ports/linux/gnu/readme_threadx.txt b/ports/linux/gnu/readme_threadx.txt index e3ac5cf6..997607c7 100644 --- a/ports/linux/gnu/readme_threadx.txt +++ b/ports/linux/gnu/readme_threadx.txt @@ -33,6 +33,26 @@ You should observe the compilation of sample_threadx.c (which is the demonstrati application) and linking with tx.a. The resulting file DEMO is a binary file that can be executed. +2.1 Includes + +Notice that the demonstration Makefile includes defines for _GNU_SOURCE +and TX_LINUX_MULTI_CORE. These are necessary to enable GNU/Linux-specific +compatibility for ThreadX using the Linux kernel in multi-core devices, +including the option to control processor affinity. See the GNU documentation +on CPU affinity and Feature Test Macros for more information. + +TX_LINUX_MULTI_CORE is necessary to enable code that constrains ThreadX to +one core, to prevent unintended behavior when threads execute simultaneously +across multiple cores. The enabled code configures CPU affinity, requiring +the use of macros such as CPU_SET and functions such as sched_setaffinity. +Access to these macros and functions (and the underlying types for the latter) +are enabled via the definition of _GNU_SOURCE. + +When building your own application, the _GNU_SOURCE and TX_LINUX_MULTI_CORE +symbols can be defined by being passed to the compiler (e.g. -D_GNU_SOURCE) or +in the optional user-defined ThreadX user define file tx_user.h. In the latter +case, ensure that the symbol TX_INCLUDE_USER_DEFINE_FILE is defined, to instruct +the tx_port.h header to include tx_user.h. 3. System Initialization diff --git a/ports_smp/linux/gnu/readme_threadx.txt b/ports_smp/linux/gnu/readme_threadx.txt index 6f41a356..19d7c5b6 100644 --- a/ports_smp/linux/gnu/readme_threadx.txt +++ b/ports_smp/linux/gnu/readme_threadx.txt @@ -33,6 +33,26 @@ You should observe the compilation of sample_threadx.c (which is the demonstrati application) and linking with tx.a. The resulting file DEMO is a binary file that can be executed. +2.1 Includes + +Notice that the demonstration Makefile includes defines for _GNU_SOURCE +and TX_LINUX_MULTI_CORE. These are necessary to enable GNU/Linux-specific +compatibility for ThreadX using SMP with the Linux kernel in multi-core devices, +including the option to control processor affinity. See the GNU documentation +on CPU affinity and Feature Test Macros for more information. + +TX_LINUX_MULTI_CORE is necessary to enable code that constrains ThreadX to +one core, to prevent unintended behavior when threads execute simultaneously +across multiple cores. The enabled code configures CPU affinity, requiring +the use of macros such as CPU_SET and functions such as sched_setaffinity. +Access to these macros and functions (and the underlying types for the latter) +are enabled via the definition of _GNU_SOURCE. + +When building your own application, the _GNU_SOURCE and TX_LINUX_MULTI_CORE +symbols can be defined by being passed to the compiler (e.g. -D_GNU_SOURCE) or +in the optional user-defined ThreadX user define file tx_user.h. In the latter +case, ensure that the symbol TX_INCLUDE_USER_DEFINE_FILE is defined, to instruct +the tx_port.h header to include tx_user.h. 3. System Initialization |
