From c652d230321e8f13eabb0cbb22ae78205c771f29 Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 1 Dec 2024 11:54:36 +0100 Subject: [PATCH 1/3] Added startup() as entry point and added warning for thread priorities --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d28f2d1..33243a4 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,9 @@ namespace tasks { } // namespace tasks ``` +> [!WARNING] +> A thread's priority must be strictly lower than the statemachine's priority. Unless manually changed, this is always `osPriorityHigh`. + To start this thread, we first need to fill out the `startup.cpp` file. This file may look like this: ```cpp #include @@ -173,11 +176,11 @@ namespace sta { namespace tacos { - void onStatemachineInit() + void startup() { // ###### Register different threads for different states here. ###### - // Register a "Spam Task" thread for all states except 1 and 2. - sta::tacos::addThread(ALL_STATES - state_set{1,2}); + // Register a "Spam Task" thread for all states except 1 and 2. + sta::tacos::addThread(ALL_STATES - state_set{1,2}); STA_DEBUG_PRINTF("The answer to everything is %d", 42); } @@ -185,6 +188,8 @@ namespace sta } // namespace sta ``` +The function `startup()` is a weakly implemented function that is executed right before TACOS initializes its statemachine task. It serves as an entry point for the user to initialize all busses, threads and rtos2-utils stuff that is needed for the application to fulfill its purpose. + And that's it! Now you have a thread that prints "Hello World" every second. Simply build the project and flash it to your microcontroller and be amazed by the Spam! ### Setting up the CAN Bus From 6087a03c7e577a630813590009ec89d4c0550b26 Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 1 Dec 2024 12:05:59 +0100 Subject: [PATCH 2/3] Added a note for faster include path setting --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33243a4..6195cf9 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,18 @@ git submodule add https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git ``` Make sure that you add the include paths for TACOS, sta-core and rtos2-utils to the project with the following steps: -1. `Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C -> Add...` +1. Right click your project in the `Project Explorer` and select `Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C -> Add...` 2. Select `Add to all languages` and `Is a workspace path` 3. Click on `Workspace` and select a folder from the `YOUR_PROJECT_FOLDER/(Libs|App)` directory - Always select the `include` or `Inc` folder for the include paths - If the path you want to add is not in the list, refresh the project with `F5` in the `Project Explorer` and try again 4. Repeat for TACOS, sta-core, rtos2-utils and the App folder -5. `Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Add Folder...` +5. Right click your project in the `Project Explorer` and select `Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Add Folder...` - Add the `App` and `Libs` folders +> [!NOTE] +> You often want to add more submodules during development. Here, a faster way to add the include path for a library is to right click the library's include folder in the `Project Explorer` and select `Add/remove include path`. + ### Starting TACOS Navigate to the `Core/Src/freertos.c` file and add the following code to the `StartDefaultTask` function: From 0304bb2a4a8e64ade4c7b0f9d9075b182e2351e1 Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 1 Dec 2024 12:16:56 +0000 Subject: [PATCH 3/3] Updated some config.hpp explanation --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6195cf9..9270b23 100644 --- a/README.md +++ b/README.md @@ -93,17 +93,12 @@ In order to use TACOS, you need to provide a configuration file in the path `sta #define STA_PRINTF_USE_STDLIB // Enable debug serial output and assertions. -#define STA_ASSERT_FORCE +#define STA_ASSERT_ENABLED #define STA_DEBUGGING_ENABLED // Enable Features -#define STA_RTOS_SYSTEM_EVENTS_ENABLE -// #define STA_RTOS_SYSTEM_WATCHDOG_ENABLE -// #define STA_RTOS_WATCHDOG_ENABLE -// #define STA_TACOS_WATCHDOG_FREQUENCY 10000 -#define STA_CAN_BUS_ENABLE -// Statemachine settings. +// Statemachine settings. How many states does your statemachine have? #define STA_TACOS_NUM_STATES 3 // Uses the default configuration for TACOS.