summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuan Nguyen <[email protected]>2025-04-14 13:04:15 -0600
committerHuan Nguyen <[email protected]>2025-04-14 13:04:15 -0600
commit20958ddcf94581a7f8d67ba1172832919021b968 (patch)
tree551a6baf9e85001aa2fc9e111ff8a14479624e20
parent7ad78c40e9702917264a9b722890110fdb909ebc (diff)
Document GNU library compile flags for Linux and SMP Linux
-rw-r--r--ports/linux/gnu/readme_threadx.txt20
-rw-r--r--ports_smp/linux/gnu/readme_threadx.txt20
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