From 90843468a82967dbd708589c4517716c9354f5b3 Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 31 Dec 2023 08:10:02 +0100 Subject: [PATCH 1/7] Added default config --- include/sta/tacos/configs/default.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 include/sta/tacos/configs/default.hpp diff --git a/include/sta/tacos/configs/default.hpp b/include/sta/tacos/configs/default.hpp new file mode 100644 index 0000000..b68739b --- /dev/null +++ b/include/sta/tacos/configs/default.hpp @@ -0,0 +1,12 @@ +#ifndef STA_TACOS_CONFIGS_DEFAULT_HPP +#define STA_TACOS_CONFIGS_DEFAULT_HPP + +// Generally, we assume the TACOS threads to have the highest priorties. +#define STA_TACOS_MANAGER_PRIORITY osPriorityHigh +#define STA_TACOS_STATEMACHINE_PRIORITY osPriorityHigh +#define STA_TACOS_WATCHDOG_PRIORITY osPriorityHigh + +// Per default, we assume state 0 to be the initial state. +#define STA_TACOS_INITIAL_STATE 0 + +#endif // STA_TACOS_CONFIGS_DEFAULT_HPP \ No newline at end of file From 550ec320766ab1adc63131c9c2e33501fa6dfdbd Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 31 Dec 2023 08:21:25 +0100 Subject: [PATCH 2/7] Disabled printable initialization if debugging is not enabled --- src/startup.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/startup.cpp b/src/startup.cpp index 1a9e4fb..8ceebf7 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -5,6 +5,7 @@ * Author: Dario */ +#include #include #include @@ -28,11 +29,11 @@ extern osMutexId_t uartMutexHandle; namespace sta { +#ifdef STA_DEBUGGING_ENABLED // Here the printable used for debugging is defined. Printable * Debug; - namespace tacos - { + namespace tacos { void initPrintable() { // Initialize the mutex for UART communication. @@ -45,8 +46,11 @@ namespace sta STA_DEBUG_PRINTLN("UART SUCCESSFULLY INITIALIZED"); } + } +#endif // STA_DEBUGGING_ENABLED - + namespace tacos + { STA_WEAK void onStatemachineInit() {} @@ -79,7 +83,9 @@ namespace sta // Override the weak implementation of startupExtras provided in rtos2-utils. void startupExtras(void * argument) { +#ifdef STA_DEBUGGING_ENABLED tacos::initPrintable(); +#endif // STA_DEBUGGING_ENABLED tacos::initStatemachine(); From 08ed271f13591e24e9c785da8e8226ebe7f8f1b5 Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 2 Jan 2024 01:00:43 +0100 Subject: [PATCH 3/7] Disabled printable initialization if debugging is disabled --- include/sta/tacos/startup.hpp | 36 ----------------------------------- src/startup.cpp | 3 +-- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 include/sta/tacos/startup.hpp diff --git a/include/sta/tacos/startup.hpp b/include/sta/tacos/startup.hpp deleted file mode 100644 index c0edd90..0000000 --- a/include/sta/tacos/startup.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * startup.hpp - * - * Created on: 22 Sep 2023 - * Author: Dario - */ - -#ifndef INCLUDE_STA_TACOS_STARTUP_HPP_ -#define INCLUDE_STA_TACOS_STARTUP_HPP_ - -/** - * @defgroup tacos TACOS - * @brief TACOS library. - */ - -namespace sta -{ - namespace tacos - { - /** - * @brief Function that is called before the statemachine task is started. - * Override it to adjust the statemachine to your specifications. - */ - void onStatemachineInit(); - - /** - * @brief Function that is called before the manager task is started. - * Override it to adjust the manager to your specifications. - */ - void onManagerInit(); - } // namespace tacos -} // namespace sta - - - -#endif /* INCLUDE_STA_TACOS_STARTUP_HPP_ */ diff --git a/src/startup.cpp b/src/startup.cpp index 8ceebf7..a71ab35 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -20,7 +20,6 @@ // Tacos-specific includes. #include #include -#include // The UART mutex defined in freertos.c @@ -37,7 +36,7 @@ namespace sta void initPrintable() { // Initialize the mutex for UART communication. - RtosMutex * mutex = new RtosMutex(&uartMutexHandle); + RtosMutex * mutex = new RtosMutex("uart"); // Initialize the UART interface and printable object. UARTSettings settings = { .mode = UARTMode::RX_TX }; From a8a77388592e8988aeaa1766c6985d8c05f33068 Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 2 Jan 2024 11:34:49 +0000 Subject: [PATCH 4/7] README.md aktualisiert --- README.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7611825..1dc2092 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ void MX_FREERTOS_Init(void) { ``` ## Configuring TACOS -Be sure to add a "config.hpp" to the App/Inc/sta directory. This file could look like this: +In order to use TACOS, you need to provide a configuration file in the path `sta/config.hpp`. The following code is an example for a TACOS-project using default configuration: ``` #ifndef INC_STA_CONFIG_HPP_ #define INC_STA_CONFIG_HPP_ @@ -62,23 +62,13 @@ Be sure to add a "config.hpp" to the App/Inc/sta directory. This file could look #define STA_ASSERT_FORCE #define STA_DEBUGGING_ENABLED -// Activate the timer for microsecond delays. -// #define STA_STM32_DELAY_ENABLE -// #define STA_STM32_DELAY_US_TIM htim1 - // Settings for the rtos-utils #define STA_RTOS_SYSTEM_EVENTS_ENABLE // #define STA_RTOS_SYSTEM_WATCHDOG_ENABLE // #define STA_RTOS_WATCHDOG_ENABLE - -// Settings for TACOS -#define STA_TACOS_MANAGER_PRIORITY osPriorityNormal -#define STA_TACOS_STATEMACHINE_PRIORITY osPriorityNormal - -// Statemachine settings. Here, we only have a single state which is also the initial state. -#define STA_TACOS_NUM_STATES 3 -#define STA_TACOS_INITIAL_STATE 0 +// Uses the default configuration for TACOS. +\include #endif /* INC_STA_CONFIG_HPP_ */ ``` From ae588bc91ff8becb5933c524ad4051a8db88eb9e Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 2 Jan 2024 11:35:08 +0000 Subject: [PATCH 5/7] README.md aktualisiert --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1dc2092..405f658 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ In order to use TACOS, you need to provide a configuration file in the path `sta // #define STA_RTOS_WATCHDOG_ENABLE // Uses the default configuration for TACOS. -\include +#include #endif /* INC_STA_CONFIG_HPP_ */ ``` From ada57bc36e361e324498612184700c832901a3f8 Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 2 Jan 2024 12:51:22 +0100 Subject: [PATCH 6/7] Moved doxygen to weak implementation and added tacos defgroup --- src/startup.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/startup.cpp b/src/startup.cpp index a71ab35..6550cc1 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -5,6 +5,12 @@ * Author: Dario */ +/** + * @defgroup tacos + * @brief TACOS library. + */ + + #include #include @@ -32,7 +38,8 @@ namespace sta // Here the printable used for debugging is defined. Printable * Debug; - namespace tacos { + namespace tacos + { void initPrintable() { // Initialize the mutex for UART communication. @@ -50,11 +57,14 @@ namespace sta namespace tacos { + /** + * @brief Function that is called before the statemachine task is started. Override it to + * adjust the statemachine to your specifications. + */ STA_WEAK void onStatemachineInit() {} - void initStatemachine() { onStatemachineInit(); @@ -62,12 +72,14 @@ namespace sta Statemachine::instance()->start(); } - + /** + * @brief Function that is called before the manager task is started. Override it to adjust + * the manager to your specifications. + */ STA_WEAK void onManagerInit() {} - void initManager() { onManagerInit(); From 0fca639a2f640a3d80a05e3a0ddfc9c1b8cd5b97 Mon Sep 17 00:00:00 2001 From: dario Date: Tue, 2 Jan 2024 12:42:20 +0000 Subject: [PATCH 7/7] README.md aktualisiert --- README.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/README.md b/README.md index 405f658..51cdb5b 100644 --- a/README.md +++ b/README.md @@ -28,24 +28,6 @@ void StartDefaultTask(void *argument) } ``` -Ebenfalls müssen noch diese Ergänzungen in `Core/Src/freertos.c` vorgenommen werden: -``` -/* Definitions for uartMutex */ -osMutexId_t uartMutexHandle; -osStaticMutexDef_t uartMutex_cb; -const osMutexAttr_t uartMutex_attributes = { - .name = "uartMutex", - .cb_mem = &uartMutex_cb, - .cb_size = sizeof(uartMutex_cb), -}; - - -void MX_FREERTOS_Init(void) { - uartMutexHandle = osMutexNew(&uartMutex_attributes); - //... -} -``` - ## Configuring TACOS In order to use TACOS, you need to provide a configuration file in the path `sta/config.hpp`. The following code is an example for a TACOS-project using default configuration: ```