diff --git a/Linux/Demo/Linux_g++_binary_semaphore/makefile b/Linux/Demo/Linux_g++_binary_semaphore/makefile index 9962ea4..8ee3408 100644 --- a/Linux/Demo/Linux_g++_binary_semaphore/makefile +++ b/Linux/Demo/Linux_g++_binary_semaphore/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_binary_semaphore_no_except/makefile b/Linux/Demo/Linux_g++_binary_semaphore_no_except/makefile index b797926..852c912 100644 --- a/Linux/Demo/Linux_g++_binary_semaphore_no_except/makefile +++ b/Linux/Demo/Linux_g++_binary_semaphore_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_condition_variables/makefile b/Linux/Demo/Linux_g++_condition_variables/makefile index a57ad1f..f79226e 100644 --- a/Linux/Demo/Linux_g++_condition_variables/makefile +++ b/Linux/Demo/Linux_g++_condition_variables/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_CONDITION_VARIABLES -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_condition_variables2/makefile b/Linux/Demo/Linux_g++_condition_variables2/makefile index a9bf933..9efebe1 100644 --- a/Linux/Demo/Linux_g++_condition_variables2/makefile +++ b/Linux/Demo/Linux_g++_condition_variables2/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_CONDITION_VARIABLES -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers/makefile b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers/makefile index bf8edb9..0833493 100644 --- a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers/makefile +++ b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_CONDITION_VARIABLES -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/main.cpp b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/main.cpp index 1762d8a..cc546a5 100644 --- a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/main.cpp +++ b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/main.cpp @@ -52,6 +52,8 @@ using namespace cpp_freertos; using namespace std; +#define UNUSED(x) (void)(x) + // // Simple implementation of a bounded queue, to demonstrate @@ -175,6 +177,7 @@ class ConsumerThread : public Thread { ConsumerThread(string name, int delay_seed) : Thread(name, 100, 1), DelaySeed(delay_seed), runIterations(0) { + UNUSED(DelaySeed); // // Now that construction is completed, we // can safely start the thread. diff --git a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/makefile b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/makefile index dac5ea0..e08ee86 100644 --- a/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/makefile +++ b/Linux/Demo/Linux_g++_condition_variables_multiple_producers_consumers2/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_CONDITION_VARIABLES -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_counting_semaphore/makefile b/Linux/Demo/Linux_g++_counting_semaphore/makefile index dca8c2c..23e3e9c 100644 --- a/Linux/Demo/Linux_g++_counting_semaphore/makefile +++ b/Linux/Demo/Linux_g++_counting_semaphore/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_counting_semaphore_no_except/makefile b/Linux/Demo/Linux_g++_counting_semaphore_no_except/makefile index f07682d..af52c2f 100644 --- a/Linux/Demo/Linux_g++_counting_semaphore_no_except/makefile +++ b/Linux/Demo/Linux_g++_counting_semaphore_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_critical_section/makefile b/Linux/Demo/Linux_g++_critical_section/makefile index d6a82bd..8dc6e0c 100644 --- a/Linux/Demo/Linux_g++_critical_section/makefile +++ b/Linux/Demo/Linux_g++_critical_section/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_delay_until/makefile b/Linux/Demo/Linux_g++_delay_until/makefile index fddf32e..753487b 100644 --- a/Linux/Demo/Linux_g++_delay_until/makefile +++ b/Linux/Demo/Linux_g++_delay_until/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_dynamic_tasks/makefile b/Linux/Demo/Linux_g++_dynamic_tasks/makefile index ac7b462..9ae6361 100644 --- a/Linux/Demo/Linux_g++_dynamic_tasks/makefile +++ b/Linux/Demo/Linux_g++_dynamic_tasks/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_dynamic_tasks_high_pri/makefile b/Linux/Demo/Linux_g++_dynamic_tasks_high_pri/makefile index ac6c728..077965b 100644 --- a/Linux/Demo/Linux_g++_dynamic_tasks_high_pri/makefile +++ b/Linux/Demo/Linux_g++_dynamic_tasks_high_pri/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_off/makefile b/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_off/makefile index 60fe56b..24580ad 100644 --- a/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_off/makefile +++ b/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_off/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_on/makefile b/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_on/makefile index 35fc796..aaaf93c 100644 --- a/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_on/makefile +++ b/Linux/Demo/Linux_g++_dynamic_tasks_multistart_scheduler_on/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mem_pools/makefile b/Linux/Demo/Linux_g++_mem_pools/makefile index f417b1c..71f5a30 100644 --- a/Linux/Demo/Linux_g++_mem_pools/makefile +++ b/Linux/Demo/Linux_g++_mem_pools/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mem_pools_add/makefile b/Linux/Demo/Linux_g++_mem_pools_add/makefile index d1dac04..5fb0373 100644 --- a/Linux/Demo/Linux_g++_mem_pools_add/makefile +++ b/Linux/Demo/Linux_g++_mem_pools_add/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mem_pools_static/makefile b/Linux/Demo/Linux_g++_mem_pools_static/makefile index 711f602..f87acb5 100644 --- a/Linux/Demo/Linux_g++_mem_pools_static/makefile +++ b/Linux/Demo/Linux_g++_mem_pools_static/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mutex_recursive/makefile b/Linux/Demo/Linux_g++_mutex_recursive/makefile index ee8408e..4e7c72e 100644 --- a/Linux/Demo/Linux_g++_mutex_recursive/makefile +++ b/Linux/Demo/Linux_g++_mutex_recursive/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mutex_recursive_no_except/makefile b/Linux/Demo/Linux_g++_mutex_recursive_no_except/makefile index 0db8737..5c2acb1 100644 --- a/Linux/Demo/Linux_g++_mutex_recursive_no_except/makefile +++ b/Linux/Demo/Linux_g++_mutex_recursive_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mutex_standard/makefile b/Linux/Demo/Linux_g++_mutex_standard/makefile index 0c7c0c5..250f3f9 100644 --- a/Linux/Demo/Linux_g++_mutex_standard/makefile +++ b/Linux/Demo/Linux_g++_mutex_standard/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_mutex_standard_no_except/makefile b/Linux/Demo/Linux_g++_mutex_standard_no_except/makefile index 1e2ab9f..0188564 100644 --- a/Linux/Demo/Linux_g++_mutex_standard_no_except/makefile +++ b/Linux/Demo/Linux_g++_mutex_standard_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_multiple_producers/makefile b/Linux/Demo/Linux_g++_queues_multiple_producers/makefile index cc6f854..d847c52 100644 --- a/Linux/Demo/Linux_g++_queues_multiple_producers/makefile +++ b/Linux/Demo/Linux_g++_queues_multiple_producers/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers/makefile b/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers/makefile index 0f6c942..d4d0b10 100644 --- a/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers/makefile +++ b/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers_no_except/makefile b/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers_no_except/makefile index 2f90aae..840242f 100644 --- a/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers_no_except/makefile +++ b/Linux/Demo/Linux_g++_queues_multiple_producers_multiple_consumers_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_multiple_producers_no_except/makefile b/Linux/Demo/Linux_g++_queues_multiple_producers_no_except/makefile index f2895a1..e75c538 100644 --- a/Linux/Demo/Linux_g++_queues_multiple_producers_no_except/makefile +++ b/Linux/Demo/Linux_g++_queues_multiple_producers_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_simple_producer_consumer/makefile b/Linux/Demo/Linux_g++_queues_simple_producer_consumer/makefile index f34136b..533d1f9 100644 --- a/Linux/Demo/Linux_g++_queues_simple_producer_consumer/makefile +++ b/Linux/Demo/Linux_g++_queues_simple_producer_consumer/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_queues_simple_producer_consumer_no_except/makefile b/Linux/Demo/Linux_g++_queues_simple_producer_consumer_no_except/makefile index ff707dd..c74a7d4 100644 --- a/Linux/Demo/Linux_g++_queues_simple_producer_consumer_no_except/makefile +++ b/Linux/Demo/Linux_g++_queues_simple_producer_consumer_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_read_write_lock_prefer_reader/makefile b/Linux/Demo/Linux_g++_read_write_lock_prefer_reader/makefile index 1f8a14b..0e2d9b6 100644 --- a/Linux/Demo/Linux_g++_read_write_lock_prefer_reader/makefile +++ b/Linux/Demo/Linux_g++_read_write_lock_prefer_reader/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_read_write_lock_prefer_reader_no_except/makefile b/Linux/Demo/Linux_g++_read_write_lock_prefer_reader_no_except/makefile index f6999e2..96744e4 100644 --- a/Linux/Demo/Linux_g++_read_write_lock_prefer_reader_no_except/makefile +++ b/Linux/Demo/Linux_g++_read_write_lock_prefer_reader_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_read_write_lock_prefer_writer/makefile b/Linux/Demo/Linux_g++_read_write_lock_prefer_writer/makefile index 20da2c1..57f3b55 100644 --- a/Linux/Demo/Linux_g++_read_write_lock_prefer_writer/makefile +++ b/Linux/Demo/Linux_g++_read_write_lock_prefer_writer/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_read_write_lock_prefer_writer_no_except/makefile b/Linux/Demo/Linux_g++_read_write_lock_prefer_writer_no_except/makefile index 62a722b..686b796 100644 --- a/Linux/Demo/Linux_g++_read_write_lock_prefer_writer_no_except/makefile +++ b/Linux/Demo/Linux_g++_read_write_lock_prefer_writer_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_simple_tasks/makefile b/Linux/Demo/Linux_g++_simple_tasks/makefile index 4f67501..1e5f11e 100644 --- a/Linux/Demo/Linux_g++_simple_tasks/makefile +++ b/Linux/Demo/Linux_g++_simple_tasks/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_simple_tasks_no_cpp_strings/makefile b/Linux/Demo/Linux_g++_simple_tasks_no_cpp_strings/makefile index c019bcb..a30a65d 100644 --- a/Linux/Demo/Linux_g++_simple_tasks_no_cpp_strings/makefile +++ b/Linux/Demo/Linux_g++_simple_tasks_no_cpp_strings/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_CPP_STRINGS -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile b/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile index 991fa9e..3c2ff50 100644 --- a/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile +++ b/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile.cpp11 b/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile.cpp11 index ff8efc7..bfae160 100644 --- a/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile.cpp11 +++ b/Linux/Demo/Linux_g++_simple_tasks_no_vTaskDelete/makefile.cpp11 @@ -66,6 +66,7 @@ # information accuracy). # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source FREERTOS_INC_DIR=../../../../FreeRTOS/Source/include @@ -80,7 +81,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -std=c++11 -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_task_delete/makefile b/Linux/Demo/Linux_g++_task_delete/makefile index 361e806..46588db 100644 --- a/Linux/Demo/Linux_g++_task_delete/makefile +++ b/Linux/Demo/Linux_g++_task_delete/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tasklet_dtor/main.cpp b/Linux/Demo/Linux_g++_tasklet_dtor/main.cpp index 80e1be8..52562e6 100644 --- a/Linux/Demo/Linux_g++_tasklet_dtor/main.cpp +++ b/Linux/Demo/Linux_g++_tasklet_dtor/main.cpp @@ -49,6 +49,8 @@ using namespace cpp_freertos; using namespace std; +#define UNUSED(x) (void)(x) + class TestTasklet : public Tasklet { @@ -115,6 +117,7 @@ class TestThread : public Thread { TestThread() : Thread("Thread", 100, configMAX_PRIORITIES - 1) { + UNUSED(DelayInSeconds); Start(); }; diff --git a/Linux/Demo/Linux_g++_tasklet_dtor/makefile b/Linux/Demo/Linux_g++_tasklet_dtor/makefile index ebc9a05..45ea801 100644 --- a/Linux/Demo/Linux_g++_tasklet_dtor/makefile +++ b/Linux/Demo/Linux_g++_tasklet_dtor/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tasklet_dtor_no_except/main.cpp b/Linux/Demo/Linux_g++_tasklet_dtor_no_except/main.cpp index 80e1be8..10fd589 100644 --- a/Linux/Demo/Linux_g++_tasklet_dtor_no_except/main.cpp +++ b/Linux/Demo/Linux_g++_tasklet_dtor_no_except/main.cpp @@ -49,7 +49,7 @@ using namespace cpp_freertos; using namespace std; - +#define UNUSED(x) (void)(x) class TestTasklet : public Tasklet { @@ -115,6 +115,7 @@ class TestThread : public Thread { TestThread() : Thread("Thread", 100, configMAX_PRIORITIES - 1) { + UNUSED(DelayInSeconds); Start(); }; diff --git a/Linux/Demo/Linux_g++_tasklet_dtor_no_except/makefile b/Linux/Demo/Linux_g++_tasklet_dtor_no_except/makefile index 30ec99c..efbf211 100644 --- a/Linux/Demo/Linux_g++_tasklet_dtor_no_except/makefile +++ b/Linux/Demo/Linux_g++_tasklet_dtor_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tasklets/makefile b/Linux/Demo/Linux_g++_tasklets/makefile index f1490f2..b1e5482 100644 --- a/Linux/Demo/Linux_g++_tasklets/makefile +++ b/Linux/Demo/Linux_g++_tasklets/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tasklets_no_except/makefile b/Linux/Demo/Linux_g++_tasklets_no_except/makefile index d2f3698..6687c77 100644 --- a/Linux/Demo/Linux_g++_tasklets_no_except/makefile +++ b/Linux/Demo/Linux_g++_tasklets_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tickhook_disable/makefile b/Linux/Demo/Linux_g++_tickhook_disable/makefile index d2348fb..5067ad5 100644 --- a/Linux/Demo/Linux_g++_tickhook_disable/makefile +++ b/Linux/Demo/Linux_g++_tickhook_disable/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_tickhooks/makefile b/Linux/Demo/Linux_g++_tickhooks/makefile index 78cce57..34b3888 100644 --- a/Linux/Demo/Linux_g++_tickhooks/makefile +++ b/Linux/Demo/Linux_g++_tickhooks/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_timers/makefile b/Linux/Demo/Linux_g++_timers/makefile index c37c71a..c75b23a 100644 --- a/Linux/Demo/Linux_g++_timers/makefile +++ b/Linux/Demo/Linux_g++_timers/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_timers_no_except/makefile b/Linux/Demo/Linux_g++_timers_no_except/makefile index e090a89..8245e0f 100644 --- a/Linux/Demo/Linux_g++_timers_no_except/makefile +++ b/Linux/Demo/Linux_g++_timers_no_except/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_unnamed_tasks/makefile b/Linux/Demo/Linux_g++_unnamed_tasks/makefile index 0254bac..84a4214 100644 --- a/Linux/Demo/Linux_g++_unnamed_tasks/makefile +++ b/Linux/Demo/Linux_g++_unnamed_tasks/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_unnamed_tasks_no_cpp_strings/makefile b/Linux/Demo/Linux_g++_unnamed_tasks_no_cpp_strings/makefile index f85457e..772429f 100644 --- a/Linux/Demo/Linux_g++_unnamed_tasks_no_cpp_strings/makefile +++ b/Linux/Demo/Linux_g++_unnamed_tasks_no_cpp_strings/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -DCPP_FREERTOS_NO_CPP_STRINGS -DCPP_FREERTOS_NO_EXCEPTIONS -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_workqueues/makefile b/Linux/Demo/Linux_g++_workqueues/makefile index 87794e6..2424938 100644 --- a/Linux/Demo/Linux_g++_workqueues/makefile +++ b/Linux/Demo/Linux_g++_workqueues/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_g++_workqueues_delete/makefile b/Linux/Demo/Linux_g++_workqueues_delete/makefile index f148767..f850f47 100644 --- a/Linux/Demo/Linux_g++_workqueues_delete/makefile +++ b/Linux/Demo/Linux_g++_workqueues_delete/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -49,7 +50,6 @@ CXX = g++ CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g CXXFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/Linux_gcc_simple_tasks/makefile b/Linux/Demo/Linux_gcc_simple_tasks/makefile index 7264327..7720b4e 100644 --- a/Linux/Demo/Linux_gcc_simple_tasks/makefile +++ b/Linux/Demo/Linux_gcc_simple_tasks/makefile @@ -34,6 +34,7 @@ # DEALINGS IN THE SOFTWARE. # ############################################################################# +include ../os_specific_linker_options.mk FREERTOS_SRC_DIR=../../../../FreeRTOS/Source @@ -45,7 +46,6 @@ PORTABLE_SRC_MEM_MANG_DIR=../../../../FreeRTOS/Source/portable/MemMang CC = gcc CFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g -LDFLAGS += -Wall -Werror -Wextra -Wpedantic -pthread -O0 -g diff --git a/Linux/Demo/os_specific_linker_options.mk b/Linux/Demo/os_specific_linker_options.mk new file mode 100644 index 0000000..399f6fc --- /dev/null +++ b/Linux/Demo/os_specific_linker_options.mk @@ -0,0 +1,9 @@ +# DETECT OS +OS := $(shell uname) + +LDFLAGS += -Wall -Werror -Wextra -Wpedantic -O0 -g + +ifneq ($(OS), Darwin) +# You cannot use the -pthread flag when linking in Darwin +LDFLAGS += -pthread +endif \ No newline at end of file diff --git a/Linux/portable/GCC/Linux/port.c b/Linux/portable/GCC/Linux/port.c index f87fd67..8389aa4 100644 --- a/Linux/portable/GCC/Linux/port.c +++ b/Linux/portable/GCC/Linux/port.c @@ -95,6 +95,86 @@ #include "portmacro.h" +#if defined(__APPLE__) || defined(__MACH__) +# define PREDEF_PLATFORM_OSX +#endif + + +#ifdef PREDEF_PLATFORM_OSX + /* Darwin specific headers */ + #include + #include + #include + +#endif + + +#ifdef PREDEF_PLATFORM_OSX +/* Darwin specific functionality) */ + + #define SYSCTL_CORE_COUNT "machdep.cpu.core_count" + + #define UNUSED(x) (void)(x) + + typedef struct cpu_set { + uint32_t count; + } cpu_set_t; + + static inline void + CPU_ZERO(cpu_set_t *cs) { cs->count = 0; } + + static inline void + CPU_SET(int num, cpu_set_t *cs) { cs->count |= (1 << num); } + + static inline int + CPU_ISSET(int num, cpu_set_t *cs) { return (cs->count & (1 << num)); } + + int sched_getaffinity(pid_t pid, size_t cpu_size, cpu_set_t *cpu_set) + { + UNUSED(pid); + UNUSED(cpu_size); + int32_t core_count = 0; + size_t len = sizeof(core_count); + int ret = sysctlbyname(SYSCTL_CORE_COUNT, &core_count, &len, 0, 0); + if (ret) { + printf("error while get core count %d\n", ret); + return -1; + } + cpu_set->count = 0; + for (int i = 0; i < core_count; i++) { + cpu_set->count |= (1 << i); + } + + return 0; + } + + int pthread_setaffinity_np(pthread_t thread, size_t cpu_size, + cpu_set_t *cpu_set) + { + thread_port_t mach_thread; + #ifdef PREDEF_PLATFORM_OSX + unsigned long core = 0; + #else + int core = 0; + #endif + + for (core = 0; core < 8 * cpu_size; core++) { + if (CPU_ISSET(core, cpu_set)) break; + } + #ifdef PREDEF_PLATFORM_OSX + printf("binding to core %lu\n", core); + #else + printf("binding to core %d\n", core); + #endif + thread_affinity_policy_data_t policy = { core }; + mach_thread = pthread_mach_thread_np(thread); + thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, + (thread_policy_t)&policy, 1); + return 0; + } + +#endif + /* Each task maintains its own interrupt status in the critical nesting variable. */ typedef struct ThreadState_t_ { @@ -519,11 +599,17 @@ static void prvSetupTimerInterrupt( void ) itimer.it_value.tv_usec = MicroSeconds; printf("Timer Setup:\n"); + #ifdef PREDEF_PLATFORM_OSX + printf(" Interval: %ld seconds, %d useconds\n", + itimer.it_interval.tv_sec, itimer.it_interval.tv_usec); + printf(" Current: %ld seconds, %d useconds\n", + itimer.it_value.tv_sec, itimer.it_value.tv_usec); + #else printf(" Interval: %ld seconds, %ld useconds\n", itimer.it_interval.tv_sec, itimer.it_interval.tv_usec); printf(" Current: %ld seconds, %ld useconds\n", itimer.it_value.tv_sec, itimer.it_value.tv_usec); - + #endif /* Set-up the timer interrupt. */ rc = setitimer( TIMER_TYPE, &itimer, &oitimer ); assert(rc == 0);