mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-12 09:36:00 +00:00
82 lines
2.9 KiB
Markdown
82 lines
2.9 KiB
Markdown
# TACOS
|
|
|
|
This is the Trajectory Analysis Control OS (TACOS) that serves as a starting point for developing TACOS-based projects, by implementing threads in the App directory. TACOS is a subset of the features provided by ALPAKA. In particular, TACOS consists of the STM32-specific components of sta-core, rtos-2 and rtos2-utils.
|
|
|
|
## Setting Up TACOS
|
|
|
|
Add this as a library an existing CubeIDE project using FreeRTOS. Generally, we advise you to add it as a submodule. Make sure that you add the include paths for Tacos, i.e. sta-core and rtos2-utils, to the project with the following steps:
|
|
```
|
|
Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C -> Add...
|
|
Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++ -> Add...
|
|
Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Add Folder...
|
|
```
|
|
|
|
Create a new thread via the project's IOC and call `startALPAKA()` from this thread. If your thread is called `defaultTask`, the corresponding function `StartDefaultTask` generated in `Core/Src/freertos.c` should look like this:
|
|
```
|
|
void StartDefaultTask(void *argument)
|
|
{
|
|
/* USER CODE BEGIN StartDefaultTask */
|
|
extern void startALPAKA(void *);
|
|
startALPAKA(argument);
|
|
|
|
/* Infinite loop */
|
|
for(;;)
|
|
{
|
|
osDelay(1);
|
|
}
|
|
/* USER CODE END StartDefaultTask */
|
|
}
|
|
```
|
|
|
|
## 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:
|
|
```
|
|
#ifndef INC_STA_CONFIG_HPP_
|
|
#define INC_STA_CONFIG_HPP_
|
|
|
|
// Using a board with an ASEAG module present.
|
|
#define STA_STM32_ASEAG
|
|
// Use the STM32F407 microprocessor.
|
|
#include <sta/devices/stm32/mcu/STM32F407xx.hpp>
|
|
|
|
// Doesn't really do too much right now. Has to be added for successful compilation.
|
|
#define STA_PRINTF_USE_STDLIB
|
|
|
|
// Enable debug serial output and assertions.
|
|
#define STA_ASSERT_FORCE
|
|
#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_CAN_BUS_ENABLE
|
|
|
|
// Statemachine settings.
|
|
#define STA_TACOS_NUM_STATES 3
|
|
|
|
// Uses the default configuration for TACOS.
|
|
#include<sta/tacos/configs/default.hpp>
|
|
|
|
#endif /* INC_STA_CONFIG_HPP_ */
|
|
```
|
|
PS: For not officially supported chips use this as the include:
|
|
```
|
|
#include <sta/devices/stm32/mcu/common.hpp>
|
|
#define STA_MCU_LITTLE_ENDIAN
|
|
#define STA_PLATFORM_STM32
|
|
```
|
|
## Setting up the CAN Bus
|
|
|
|
To enable the CAN Bus two things need to be done:
|
|
1. Enable CAN in the IOC with the RX0 and RX1 Interrupts enabled.
|
|
2. Add the following code to the `sta/config.hpp` file:
|
|
```
|
|
#define STA_CAN_BUS_ENABLE
|
|
```
|
|
PS: For not officially supported chips add this:
|
|
```
|
|
#define STA_STM32_CAN_HANDLE {YOUR_HCAN_HANDLE}
|
|
```
|
|
|
|
After this messages will automatically be forwarded to the task with it's ID. To send messages use the interface defined in `tacos.hpp`. |