Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • avn/swd/skyward-boardcore
  • emilio.corigliano/skyward-boardcore
  • nicolo.caruso/skyward-boardcore
  • ettore.pane/skyward-boardcore
  • giulia.facchi/skyward-boardcore
  • valerio.flamminii/skyward-boardcore
6 results
Show changes
Commits on Source (192)
Showing
with 1179 additions and 415 deletions
......@@ -27,7 +27,6 @@ cmake-build-*
store.json
**/generated/
core
__pycache__
/scripts/generators/generated
......
# Copyright (c) 2021 Skyward Experimental Rocketry
# Authors: Luca Erbetta, Luca Conterio, Alberto Nidasio, Damiano Amatruda
# Copyright (c) 2024 Skyward Experimental Rocketry
# Authors: Luca Erbetta, Luca Conterio, Alberto Nidasio, Damiano Amatruda, Giacomo Caironi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
......@@ -22,75 +22,74 @@
variables:
GIT_SUBMODULE_STRATEGY: recursive
default:
image: registry.skywarder.eu/avn/swd/docker/miosix:latest
stages:
- lint
- build
- test
- lint
- documentation
# Stage build
release:
stage: build
tags:
- miosix
script:
- ./sbs
debug:
stage: build
tags:
- miosix
script:
- ./sbs --debug
logdecoder:
stage: build
tags:
- miosix
script:
- cd scripts/logdecoder
- make
# Stage test
test:
stage: test
tags:
- miosix
script:
- ./sbs --test catch-tests-boardcore
# Stage lint
cppcheck:
stage: lint
tags:
- miosix
script:
- cppcheck --version
- ./scripts/linter.py --cppcheck src
format:
stage: lint
tags:
- miosix
script:
- clang-tidy --version
- clang-format --version
- ./scripts/linter.py --format src
copyright:
stage: lint
tags:
- miosix
script:
- /usr/bin/python3 --version
- ./scripts/linter.py --copyright src
find:
stage: lint
tags:
- miosix
script:
- /usr/bin/python3 --version
- ./scripts/linter.py --find src
# Stage build
build-debug:
stage: build
script:
- cmake --version
- ccache --version
- ninja --version
- ./sbs --debug
build-release:
stage: build
script:
- cmake --version
- ccache --version
- ninja --version
- ./sbs
logdecoder:
stage: build
script:
- g++ --version
- cd scripts/logdecoder
- make
# Stage test
test:
stage: test
script:
- ./sbs --test catch-tests-boardcore
# Stage documentation
pages:
......@@ -98,6 +97,7 @@ pages:
only:
- main
script:
- doxygen --version
- doxygen doc/Doxyfile
- mv doc/output/html public
artifacts:
......
This diff is collapsed.
......@@ -154,6 +154,7 @@
"cyaw",
"DATABUS",
"datasheet",
"Davide",
"deleteme",
"DMEIE",
"Doxyfile",
......@@ -274,6 +275,7 @@
"Riccardo",
"RQCP",
"RXCRCR",
"Rssi",
"RXIRQ",
"RXNE",
"RXNEIE",
......
This diff is collapsed.
<div align="center">
<img src="https://avatars2.githubusercontent.com/u/8077370?s=200&v=4" alt="Skyward" width="200"></a>
<h2>Skyward Boardcore</h2>
<img src="https://avatars2.githubusercontent.com/u/8077370?s=200&v=4" alt="Skyward Experimental Rocketry" width="200"></a>
<h1>Skyward Boardcore</h1>
<a href="https://git.skywarder.eu/avn/swd/skyward-boardcore/-/pipelines"><img src="https://git.skywarder.eu/avn/swd/skyward-boardcore/badges/main/pipeline.svg"></a>
</div>
Boardcore is a framework for developing and building rockets software for custom boards with Miosix.
Boardcore is a C++14 rocket software framework targeting custom embedded boards designed by Skyward Experimental Rocketry.
[Miosix](https://miosix.org/) is a lightweight OS for embedded developing which provides support for basic things such as Threads, GPIO, Time and many other. You can find our fork of the kernel here: [skyward/miosix-kernel](https://git.skywarder.eu/avn/swd/miosix-kernel)
Boardcore runs on top of [Miosix](https://miosix.org/), a lightweight operating system for microcontrollers. It implements a POSIX-like API, the C standard library and the C++ standard library. It also provides a pre-emptive scheduler (among others) and a custom concurrency API with support for Threads and synchronization primitives.
A FAT32 filesystem, a serial port driver, platform timers and General Purpose I/O functionalities (GPIO) are also exposed through a custom API.
Building is made with [SBS](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Skyward-Build-System-(SBS)), which was created to easily compile and reuse code for different boards.
We maintain a fork of the Miosix OS to fit our needs: [skyward/miosix-kernel](https://git.skywarder.eu/avn/swd/miosix-kernel)
The project is built with the CMake build system. We also have our own script that is built on top of CMake, to automate compilation and deployment to different hardware targets, [SBS](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Skyward-Build-System-(SBS)).
## Content
| Path | Description |
| ---------------- | ----------------------------------------------------------- |
| src/shared/ | Objects, drivers and other stuff written by us |
| src/entrypoints/ | Each file here is a 'main' |
| src/tests/ | Contains the 'main' of every test |
| build/ | Compiled binaries that can be flashed on a target board |
| libs/ | External libs (Miosix kernel and others as a git submodule) |
| scripts/ | Some tools (e.g. script for flashing on the boards) |
In the main folder you will find **CMakeLists.txt** which is used to configure the build system.
| src/bsps/ | Board Support Packages (BSP) |
| src/shared/ | Device drivers and general-purpose classes/utilities |
| src/entrypoints/ | Entry points for general tasks (e.g. calibration) |
| src/tests/ | Entry points for on-device unit testing |
| build/ | Build output directory |
| libs/ | External libraries (git submodules) |
| scripts/ | Various tools and utilities (e.g. linting, log decoder) |
## Getting Started
### Dependencies
* CMake
* Git
* Miosix Toolchain
* `CMake` 3.25
* `Git`
* `Miosix` Toolchain
Also, Ccache, Ninja, OpenOCD, Cppcheck, clang-format and pre-commit are recommended for a better experience.
We also recommend to install `Ccache`, `Ninja`, `OpenOCD`, `Cppcheck`,`ClangFormat` and `pre-commit` for a smoother development experience.
### Cloning the repo
Clone this repo with the `--recursive` option.
Clone the repository with the `--recursive` option:
```sh
git clone --recursive https://git.skywarder.eu/avn/swd/skyward-boardcore.git
cd skyward-boardcore
......@@ -43,14 +45,14 @@ cd skyward-boardcore
## Building
You can build everything using the SBS script:
Using the SBS script is the recommended way to build the project. When called with no arguments, it will build all targets:
```sh
./sbs
```
The build system will start building all the targets (entrypoints and tests). Depending on how many targets there are, this operation may take several minutes. If you installed ccache, subsequent runs will be much faster.
This may take a while depending on how many targets there are. If `ccache` is installed, it will be used to cache intermediate compilation artifacts to speed-up incremental builds.
Or you can use directly CMake:
Alternatively, you can build with CMake commands:
```sh
mkdir build
cd build
......@@ -60,7 +62,7 @@ cmake --build .
## Documentation
The code is documented with Doxygen, check it [here](http://avn.pages.skywarder.eu/swd/skyward-boardcore).
The code is documented with Doxygen, check it out [here](http://avn.pages.skywarder.eu/swd/skyward-boardcore).
## Contributing
......@@ -72,8 +74,8 @@ pre-commit install
## What's next?
In the [Wiki](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/home) you will find some first-steps **guides** (configuring the IDE, building a firmware, etc.) as well as the **coding guidelines** and some **best practices** we adopt.
You can find first-step **guides** in the [Wiki](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/home) (configuring the IDE, building examples, etc.) as well our **code guidelines** and **best practices** that we follow.
If you want to contribute to this repository, please read [Git Workflow](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Git-Workflow).
If you want to contribute to this repository, please read our [Git Workflow](https://git.skywarder.eu/avn/swd/skyward-boardcore/wikis/Git-Workflow).
If you just want to start messing around, try [this](https://git.skywarder.eu/avn/swd/skyward-boardcore/-/wikis/LED-Blink).
If you want to start messing around with the code, check out the [LED blink guide](https://git.skywarder.eu/avn/swd/skyward-boardcore/-/wikis/LED-Blink).
......@@ -19,7 +19,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
add_library(boardcore-host STATIC EXCLUDE_FROM_ALL
# Boardcore source files used when compiling for host
set(BOARDCORE_HOST_SRC
# Debug
${SBS_BASE}/src/shared/utils/Debug.cpp
${SBS_BASE}/src/shared/diagnostic/CpuMeter/CpuMeter.cpp
......@@ -28,12 +29,15 @@ add_library(boardcore-host STATIC EXCLUDE_FROM_ALL
# Actuators
${SBS_BASE}/src/shared/actuators/Servo/Servo.cpp
# Drivers
${SBS_BASE}/src/shared/drivers/timer/TimestampTimer.cpp
# Events
${SBS_BASE}/src/shared/events/EventBroker.cpp
# Algorithms
${SBS_BASE}/src/shared/algorithms/MEA/MEA.cpp
${SBS_BASE}/src/shared/algorithms/AirBrakes/AirBrakesPI.cpp
${SBS_BASE}/src/shared/algorithms/AirBrakes/AirBrakesInterp.cpp
${SBS_BASE}/src/shared/algorithms/Propagator/Propagator.cpp
# Logger
${SBS_BASE}/src/shared/logger/Logger.cpp
......@@ -52,9 +56,18 @@ add_library(boardcore-host STATIC EXCLUDE_FROM_ALL
${SBS_BASE}/src/shared/utils/SkyQuaternion/SkyQuaternion.cpp
${SBS_BASE}/src/shared/utils/Stats/Stats.cpp
${SBS_BASE}/src/shared/utils/TestUtils/TestHelper.cpp
${SBS_BASE}/src/shared/utils/Registry/RegistryFrontend.cpp
${SBS_BASE}/src/shared/utils/Registry/RegistrySerializer.cpp
${SBS_BASE}/src/shared/utils/DependencyManager/DependencyManager.cpp
)
add_library(SkywardBoardcore::Boardcore::host ALIAS boardcore-host)
target_include_directories(boardcore-host PUBLIC ${SBS_BASE}/src/shared)
# Create a library specific for host builds
add_library(boardcore-host STATIC EXCLUDE_FROM_ALL ${BOARDCORE_HOST_SRC})
# Only one include directory for Boardcore!
target_include_directories(boardcore-host PUBLIC ${BOARDCORE_PATH}/src/shared)
# Link libraries
target_link_libraries(boardcore-host PUBLIC
Miosix::Miosix::host
TSCPP::TSCPP
......@@ -63,3 +76,6 @@ target_link_libraries(boardcore-host PUBLIC
Catch2::Catch2
Mavlink::Mavlink
)
# Create a nice alias for the library
add_library(Skyward::Boardcore::host ALIAS boardcore-host)
\ No newline at end of file
......@@ -19,118 +19,152 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
include(dependencies)
include(boardcore-host)
foreach(OPT_BOARD ${BOARDS})
set(BOARDCORE_LIBRARY boardcore-${OPT_BOARD})
add_library(${BOARDCORE_LIBRARY} STATIC EXCLUDE_FROM_ALL
# Actuators
${SBS_BASE}/src/shared/actuators/HBridge/HBridge.cpp
${SBS_BASE}/src/shared/actuators/Servo/Servo.cpp
${SBS_BASE}/src/shared/actuators/Stepper.cpp
${SBS_BASE}/src/shared/actuators/StepperPWM.cpp
# Algorithms
${SBS_BASE}/src/shared/algorithms/ADA/ADA.cpp
${SBS_BASE}/src/shared/algorithms/AirBrakes/AirBrakes.cpp
${SBS_BASE}/src/shared/algorithms/AirBrakes/AirBrakesPI.cpp
${SBS_BASE}/src/shared/algorithms/AirBrakes/AirBrakesInterp.cpp
${SBS_BASE}/src/shared/algorithms/NAS/NAS.cpp
${SBS_BASE}/src/shared/algorithms/NAS/StateInitializer.cpp
# Debug
${SBS_BASE}/src/shared/utils/Debug.cpp
${SBS_BASE}/src/shared/diagnostic/CpuMeter/CpuMeter.cpp
${SBS_BASE}/src/shared/diagnostic/PrintLogger.cpp
# Drivers
${SBS_BASE}/src/shared/drivers/AD5204/AD5204.cpp
${SBS_BASE}/src/shared/drivers/adc/InternalADC.cpp
${SBS_BASE}/src/shared/drivers/canbus/CanDriver/CanDriver.cpp
${SBS_BASE}/src/shared/drivers/canbus/CanDriver/CanInterrupt.cpp
${SBS_BASE}/src/shared/drivers/canbus/CanProtocol/CanProtocol.cpp
${SBS_BASE}/src/shared/drivers/interrupt/external_interrupts.cpp
${SBS_BASE}/src/shared/drivers/timer/PWM.cpp
${SBS_BASE}/src/shared/drivers/timer/CountedPWM.cpp
${SBS_BASE}/src/shared/drivers/timer/TimestampTimer.cpp
${SBS_BASE}/src/shared/drivers/runcam/Runcam.cpp
${SBS_BASE}/src/shared/drivers/spi/SPITransaction.cpp
${SBS_BASE}/src/shared/drivers/usart/USART.cpp
${SBS_BASE}/src/shared/drivers/i2c/I2CDriver-f4.cpp
${SBS_BASE}/src/shared/drivers/i2c/I2CDriver-f7.cpp
${SBS_BASE}/src/shared/drivers/i2c/I2C.cpp
# Events
${SBS_BASE}/src/shared/events/EventBroker.cpp
# Logger
${SBS_BASE}/src/shared/logger/Logger.cpp
# Radio
${SBS_BASE}/src/shared/radio/gamma868/Gamma868.cpp
${SBS_BASE}/src/shared/radio/Xbee/APIFrameParser.cpp
${SBS_BASE}/src/shared/radio/Xbee/Xbee.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Fsk.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Lora.cpp
${SBS_BASE}/src/shared/radio/SX1278/SX1278Common.cpp
${SBS_BASE}/src/shared/radio/SX1278/Ebyte.cpp
# Scheduler
${SBS_BASE}/src/shared/scheduler/TaskScheduler.cpp
# Sensors
${SBS_BASE}/src/shared/sensors/ADS1118/ADS1118.cpp
${SBS_BASE}/src/shared/sensors/ADS131M04/ADS131M04.cpp
${SBS_BASE}/src/shared/sensors/BME280/BME280.cpp
${SBS_BASE}/src/shared/sensors/BME280/BME280I2C.cpp
${SBS_BASE}/src/shared/sensors/BMP280/BMP280.cpp
${SBS_BASE}/src/shared/sensors/BMP280/BMP280I2C.cpp
${SBS_BASE}/src/shared/sensors/BMX160/BMX160.cpp
${SBS_BASE}/src/shared/sensors/BMX160/BMX160WithCorrection.cpp
${SBS_BASE}/src/shared/sensors/H3LIS331DL/H3LIS331DL.cpp
${SBS_BASE}/src/shared/sensors/HX711/HX711.cpp
${SBS_BASE}/src/shared/sensors/LIS3MDL/LIS3MDL.cpp
${SBS_BASE}/src/shared/sensors/LIS331HH/LIS331HH.cpp
${SBS_BASE}/src/shared/sensors/LPS331AP/LPS331AP.cpp
${SBS_BASE}/src/shared/sensors/MAX6675/MAX6675.cpp
${SBS_BASE}/src/shared/sensors/MAX31855/MAX31855.cpp
${SBS_BASE}/src/shared/sensors/MAX31856/MAX31856.cpp
${SBS_BASE}/src/shared/sensors/MBLoadCell/MBLoadCell.cpp
${SBS_BASE}/src/shared/sensors/MPU9250/MPU9250.cpp
${SBS_BASE}/src/shared/sensors/MS5803/MS5803.cpp
${SBS_BASE}/src/shared/sensors/MS5803/MS5803I2C.cpp
${SBS_BASE}/src/shared/sensors/SensorManager.cpp
${SBS_BASE}/src/shared/sensors/SensorSampler.cpp
${SBS_BASE}/src/shared/sensors/UBXGPS/UBXGPSSerial.cpp
${SBS_BASE}/src/shared/sensors/UBXGPS/UBXGPSSpi.cpp
${SBS_BASE}/src/shared/sensors/VN100/VN100.cpp
${SBS_BASE}/src/shared/sensors/LIS2MDL/LIS2MDL.cpp
# Calibration
${SBS_BASE}/src/shared/sensors/calibration/BiasCalibration/BiasCalibration.cpp
${SBS_BASE}/src/shared/sensors/calibration/SensorDataExtra/SensorDataExtra.cpp
${SBS_BASE}/src/shared/sensors/calibration/SixParameterCalibration/SixParameterCalibration.cpp
${SBS_BASE}/src/shared/sensors/calibration/SoftAndHardIronCalibration/SoftAndHardIronCalibration.cpp
# Correction
${SBS_BASE}/src/shared/sensors/correction/BiasCorrector/BiasCorrector.cpp
${SBS_BASE}/src/shared/sensors/correction/SixParametersCorrector/SixParametersCorrector.cpp
# Utils
${SBS_BASE}/src/shared/utils/AeroUtils/AeroUtils.cpp
${SBS_BASE}/src/shared/utils/ButtonHandler/ButtonHandler.cpp
${SBS_BASE}/src/shared/utils/PinObserver/PinObserver.cpp
${SBS_BASE}/src/shared/utils/SkyQuaternion/SkyQuaternion.cpp
${SBS_BASE}/src/shared/utils/Stats/Stats.cpp
${SBS_BASE}/src/shared/utils/TestUtils/TestHelper.cpp
)
add_library(SkywardBoardcore::Boardcore::${OPT_BOARD} ALIAS ${BOARDCORE_LIBRARY})
target_include_directories(${BOARDCORE_LIBRARY} PUBLIC ${SBS_BASE}/src/shared)
target_link_libraries(${BOARDCORE_LIBRARY} PUBLIC
Miosix::Miosix::${OPT_BOARD}
# Load in BOARDCORE_PATH the project path
cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH BOARDCORE_PATH)
# Include dependencies and board list
include(${BOARDCORE_PATH}/cmake/dependencies.cmake)
include(${BOARDCORE_PATH}/cmake/boardcore-host.cmake)
include(${BOARDCORE_PATH}/cmake/boards.cmake)
# Boardcore source files
set(BOARDCORE_SRC
# Actuators
${BOARDCORE_PATH}/src/shared/actuators/HBridge/HBridge.cpp
${BOARDCORE_PATH}/src/shared/actuators/Servo/Servo.cpp
${BOARDCORE_PATH}/src/shared/actuators/stepper/Stepper.cpp
${BOARDCORE_PATH}/src/shared/actuators/stepper/StepperPWM.cpp
# Algorithms
${BOARDCORE_PATH}/src/shared/algorithms/ADA/ADA.cpp
${BOARDCORE_PATH}/src/shared/algorithms/MEA/MEA.cpp
${BOARDCORE_PATH}/src/shared/algorithms/AirBrakes/AirBrakesPI.cpp
${BOARDCORE_PATH}/src/shared/algorithms/AirBrakes/AirBrakesInterp.cpp
${BOARDCORE_PATH}/src/shared/algorithms/NAS/NAS.cpp
${BOARDCORE_PATH}/src/shared/algorithms/NAS/StateInitializer.cpp
${SBS_BASE}/src/shared/algorithms/Propagator/Propagator.cpp
${SBS_BASE}/src/shared/algorithms/Follower/Follower.cpp
# Debug
${BOARDCORE_PATH}/src/shared/utils/Debug.cpp
${BOARDCORE_PATH}/src/shared/diagnostic/CpuMeter/CpuMeter.cpp
${BOARDCORE_PATH}/src/shared/diagnostic/PrintLogger.cpp
# Drivers
${BOARDCORE_PATH}/src/shared/drivers/AD5204/AD5204.cpp
${BOARDCORE_PATH}/src/shared/drivers/adc/InternalADC.cpp
${BOARDCORE_PATH}/src/shared/drivers/canbus/CanDriver/CanDriver.cpp
${BOARDCORE_PATH}/src/shared/drivers/canbus/CanDriver/CanInterrupt.cpp
${BOARDCORE_PATH}/src/shared/drivers/canbus/CanProtocol/CanProtocol.cpp
${BOARDCORE_PATH}/src/shared/drivers/interrupt/external_interrupts.cpp
${BOARDCORE_PATH}/src/shared/drivers/timer/PWM.cpp
${BOARDCORE_PATH}/src/shared/drivers/timer/CountedPWM.cpp
${BOARDCORE_PATH}/src/shared/drivers/runcam/Runcam.cpp
${BOARDCORE_PATH}/src/shared/drivers/spi/SPITransaction.cpp
${BOARDCORE_PATH}/src/shared/drivers/usart/USART.cpp
${BOARDCORE_PATH}/src/shared/drivers/i2c/I2CDriver-f4.cpp
${BOARDCORE_PATH}/src/shared/drivers/i2c/I2CDriver-f7.cpp
${BOARDCORE_PATH}/src/shared/drivers/i2c/I2C.cpp
${BOARDCORE_PATH}/src/shared/drivers/WIZ5500/WIZ5500.cpp
${BOARDCORE_PATH}/src/shared/drivers/DipSwitch/DipSwitch.cpp
# Events
${BOARDCORE_PATH}/src/shared/events/EventBroker.cpp
# Logger
${BOARDCORE_PATH}/src/shared/logger/Logger.cpp
# Radio
${BOARDCORE_PATH}/src/shared/radio/gamma868/Gamma868.cpp
${BOARDCORE_PATH}/src/shared/radio/Xbee/APIFrameParser.cpp
${BOARDCORE_PATH}/src/shared/radio/Xbee/Xbee.cpp
${BOARDCORE_PATH}/src/shared/radio/SX1278/SX1278Fsk.cpp
${BOARDCORE_PATH}/src/shared/radio/SX1278/SX1278Lora.cpp
${BOARDCORE_PATH}/src/shared/radio/SX1278/SX1278Common.cpp
# Scheduler
${BOARDCORE_PATH}/src/shared/scheduler/TaskScheduler.cpp
# Sensors
${BOARDCORE_PATH}/src/shared/sensors/ADS1118/ADS1118.cpp
${BOARDCORE_PATH}/src/shared/sensors/ADS131M04/ADS131M04.cpp
${BOARDCORE_PATH}/src/shared/sensors/ADS131M08/ADS131M08.cpp
${BOARDCORE_PATH}/src/shared/sensors/BME280/BME280.cpp
${BOARDCORE_PATH}/src/shared/sensors/BME280/BME280I2C.cpp
${BOARDCORE_PATH}/src/shared/sensors/BMP280/BMP280.cpp
${BOARDCORE_PATH}/src/shared/sensors/BMP280/BMP280I2C.cpp
${BOARDCORE_PATH}/src/shared/sensors/BMX160/BMX160.cpp
${BOARDCORE_PATH}/src/shared/sensors/BMX160/BMX160WithCorrection.cpp
${BOARDCORE_PATH}/src/shared/sensors/H3LIS331DL/H3LIS331DL.cpp
${BOARDCORE_PATH}/src/shared/sensors/HX711/HX711.cpp
${BOARDCORE_PATH}/src/shared/sensors/LIS3MDL/LIS3MDL.cpp
${BOARDCORE_PATH}/src/shared/sensors/LIS331HH/LIS331HH.cpp
${BOARDCORE_PATH}/src/shared/sensors/LPS331AP/LPS331AP.cpp
${BOARDCORE_PATH}/src/shared/sensors/MAX6675/MAX6675.cpp
${BOARDCORE_PATH}/src/shared/sensors/MAX31855/MAX31855.cpp
${BOARDCORE_PATH}/src/shared/sensors/MAX31856/MAX31856.cpp
${BOARDCORE_PATH}/src/shared/sensors/MBLoadCell/MBLoadCell.cpp
${BOARDCORE_PATH}/src/shared/sensors/MPU9250/MPU9250.cpp
${BOARDCORE_PATH}/src/shared/sensors/MS5803/MS5803.cpp
${BOARDCORE_PATH}/src/shared/sensors/MS5803/MS5803I2C.cpp
${BOARDCORE_PATH}/src/shared/sensors/RotatedIMU/RotatedIMU.cpp
${BOARDCORE_PATH}/src/shared/sensors/SensorManager.cpp
${BOARDCORE_PATH}/src/shared/sensors/SensorSampler.cpp
${BOARDCORE_PATH}/src/shared/sensors/UBXGPS/UBXGPSSerial.cpp
${BOARDCORE_PATH}/src/shared/sensors/UBXGPS/UBXGPSSpi.cpp
${BOARDCORE_PATH}/src/shared/sensors/Vectornav/VNCommonSerial.cpp
${BOARDCORE_PATH}/src/shared/sensors/Vectornav/VN100/VN100Serial.cpp
${BOARDCORE_PATH}/src/shared/sensors/Vectornav/VN100/VN100Spi.cpp
${BOARDCORE_PATH}/src/shared/sensors/Vectornav/VN300/VN300.cpp
${BOARDCORE_PATH}/src/shared/sensors/LIS2MDL/LIS2MDL.cpp
${BOARDCORE_PATH}/src/shared/sensors/LPS28DFW/LPS28DFW.cpp
${BOARDCORE_PATH}/src/shared/sensors/LPS22DF/LPS22DF.cpp
${BOARDCORE_PATH}/src/shared/sensors/LSM6DSRX/LSM6DSRX.cpp
# Calibration
${BOARDCORE_PATH}/src/shared/sensors/calibration/BiasCalibration/BiasCalibration.cpp
${BOARDCORE_PATH}/src/shared/sensors/calibration/SensorDataExtra/SensorDataExtra.cpp
${BOARDCORE_PATH}/src/shared/sensors/calibration/SixParameterCalibration/SixParameterCalibration.cpp
${BOARDCORE_PATH}/src/shared/sensors/calibration/SoftAndHardIronCalibration/SoftAndHardIronCalibration.cpp
# Correction
${BOARDCORE_PATH}/src/shared/sensors/correction/BiasCorrector/BiasCorrector.cpp
${BOARDCORE_PATH}/src/shared/sensors/correction/SixParametersCorrector/SixParametersCorrector.cpp
# Utils
${BOARDCORE_PATH}/src/shared/utils/AeroUtils/AeroUtils.cpp
${BOARDCORE_PATH}/src/shared/utils/ButtonHandler/ButtonHandler.cpp
${BOARDCORE_PATH}/src/shared/utils/PinObserver/PinObserver.cpp
${BOARDCORE_PATH}/src/shared/utils/SkyQuaternion/SkyQuaternion.cpp
${BOARDCORE_PATH}/src/shared/utils/Stats/Stats.cpp
${BOARDCORE_PATH}/src/shared/utils/TestUtils/TestHelper.cpp
${BOARDCORE_PATH}/src/shared/utils/Registry/RegistryFrontend.cpp
${BOARDCORE_PATH}/src/shared/utils/Registry/RegistrySerializer.cpp
${BOARDCORE_PATH}/src/shared/utils/Registry/Backend/FileBackend.cpp
${BOARDCORE_PATH}/src/shared/utils/DependencyManager/DependencyManager.cpp
)
# Creates the Skyward::Boardcore::${BOARD_NAME} library
function(add_boardcore_library BOARD_OPTIONS_FILE)
# Get board options
include(${BOARD_OPTIONS_FILE})
# Create a library for the board
set(BOARDCORE_LIB boardcore-${BOARD_NAME})
add_library(${BOARDCORE_LIB} STATIC EXCLUDE_FROM_ALL ${BOARDCORE_SRC})
# Only one include directory for Boardcore!
target_include_directories(${BOARDCORE_LIB} PUBLIC ${BOARDCORE_PATH}/src/shared)
# Define DEBUG when in Debug mode
target_compile_definitions(${BOARDCORE_LIB} PUBLIC $<$<CONFIG:Debug>:DEBUG>)
# Define NDEBUG when not in Debug mode
target_compile_definitions(${BOARDCORE_LIB} PUBLIC $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
# Link libraries
target_link_libraries(${BOARDCORE_LIB} PUBLIC
$<TARGET_OBJECTS:Miosix::Boot::${BOARD_NAME}>
$<LINK_GROUP:RESCAN,Miosix::Kernel::${BOARD_NAME},stdc++,c,m,gcc,atomic>
TSCPP::TSCPP
Eigen3::Eigen
fmt::fmt-header-only
......@@ -138,8 +172,23 @@ foreach(OPT_BOARD ${BOARDS})
Mavlink::Mavlink
)
# Link MxGui only if supported by the target
if(${OPT_BOARD} IN_LIST MXGUI_BOARDS)
target_link_libraries(${BOARDCORE_LIBRARY} PUBLIC Mxgui::Mxgui::${OPT_BOARD})
# Link MxGui if supported by the target
if(DEFINED MXGUI_BASE_BOARD_NAME)
target_link_libraries(${BOARDCORE_LIB} PUBLIC MxGui::${MXGUI_BASE_BOARD_NAME})
elseif(TARGET MxGui::${BOARD_NAME})
target_link_libraries(${BOARDCORE_LIB} PUBLIC MxGui::${BOARD_NAME})
endif()
# Create a nice alias for the library
add_library(Skyward::Boardcore::${BOARD_NAME} ALIAS ${BOARDCORE_LIB})
endfunction()
# Create the Miosix libraries for Boardcore custom boards
foreach(BOARD_OPTIONS_FILE ${BOARDCORE_BOARDS_OPTIONS_FILES})
add_miosix_libraries(${BOARD_OPTIONS_FILE})
endforeach()
# Create Boardcore library for each board
foreach(BOARD_OPTIONS_FILE ${MIOSIX_BOARDS_OPTIONS_FILES} ${BOARDCORE_BOARDS_OPTIONS_FILES})
add_boardcore_library(${BOARD_OPTIONS_FILE})
endforeach()
# Copyright (c) 2023 Skyward Experimental Rocketry
# Authors: Alberto Nidasio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
set(BOARDCORE_BOARDS_OPTIONS_FILES
${BOARDCORE_PATH}/src/bsps/stm32f205rc_ciuti/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_nokia/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_parafoil/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_death_stack_v1/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_death_stack_v2/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_death_stack_v3/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_pyxis_auxiliary/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_rig/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f429zi_con_rig/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f756zg_nucleo/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_automated_antennas/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_compute_unit/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_compute_unit_v2/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_compute_unit_v2/config/board_options_no_xram.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_gemini_gs/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_gemini_motor/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_death_stack_v4/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_rig_v2/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_lyra_biscotto/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_lyra_motor/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_lyra_gs/config/board_options.cmake
)
......@@ -19,33 +19,34 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
file(GLOB KPATH ${SBS_BASE}/libs/miosix-kernel/miosix)
if(NOT KPATH)
message(FATAL_ERROR "Kernel directory not found")
endif()
add_subdirectory(${KPATH} EXCLUDE_FROM_ALL)
include(${KPATH}/config/boards.cmake)
# Miosix Kernel
include(${SBS_BASE}/libs/miosix-kernel/miosix/cmake/miosix.cmake EXCLUDE_FROM_ALL)
# Miosix Host
add_subdirectory(${SBS_BASE}/libs/miosix-host EXCLUDE_FROM_ALL)
set(KPATH ${KPATH} CACHE PATH "Path to kernel directory")
add_subdirectory(${SBS_BASE}/libs/mxgui EXCLUDE_FROM_ALL)
include(${SBS_BASE}/libs/mxgui/cmake/boards.cmake)
# MxGui graphical library
include(${SBS_BASE}/libs/mxgui/cmake/mxgui.cmake)
# Serialization library
add_subdirectory(${SBS_BASE}/libs/tscpp EXCLUDE_FROM_ALL)
# Eigen library
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(EIGEN_TEST_NOQT ON CACHE BOOL "Disable Qt support in unit tests")
set(CMAKE_Fortran_COMPILER NOTFOUND)
add_subdirectory(${SBS_BASE}/libs/eigen EXCLUDE_FROM_ALL)
target_compile_definitions(eigen INTERFACE EIGEN_MAX_ALIGN_BYTES=0)
# Format library
add_subdirectory(${SBS_BASE}/libs/fmt EXCLUDE_FROM_ALL)
target_compile_definitions(fmt-header-only INTERFACE _GLIBCXX_USE_WCHAR_T FMT_UNICODE=0 FMT_STATIC_THOUSANDS_SEPARATOR=0)
target_compile_options(fmt-header-only INTERFACE -fno-math-errno)
# Catch2 library
add_subdirectory(${SBS_BASE}/libs/Catch2 EXCLUDE_FROM_ALL)
list(APPEND CMAKE_MODULE_PATH ${SBS_BASE}/libs/Catch2/contrib)
include(Catch)
# MavLink library
add_subdirectory(${SBS_BASE}/libs/mavlink-skyward-lib EXCLUDE_FROM_ALL)
......@@ -21,19 +21,15 @@
enable_language(C CXX ASM)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(SBS_BASE ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL SBS_BASE)
add_subdirectory(${SBS_BASE} EXCLUDE_FROM_ALL)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(${CMAKE_SOURCE_DIR}/cmake/dependencies.cmake OPTIONAL)
return()
endif()
# Load in SBS_BASE the project path
cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SBS_BASE)
# Include the Boardcore libraries
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(boardcore)
string(REPLACE ";" "\\n" BOARDS_STR "${BOARDS}")
# Command to print all the available boards used by the sbs script
string(REPLACE ";" "\\n" BOARDS_STR "${MIOSIX_BOARDS};${BOARDCORE_BOARDS}")
add_custom_target(
help-boards
COMMAND printf ${BOARDS_STR}
......@@ -41,13 +37,22 @@ add_custom_target(
VERBATIM
)
# Function to link the Boardcore library to the target
function(sbs_target TARGET OPT_BOARD)
if(NOT OPT_BOARD)
message(FATAL_ERROR "No board selected")
endif()
# The only include directory of Boardcore is shared!
target_include_directories(${TARGET} PRIVATE src/shared)
if(CMAKE_CROSSCOMPILING)
target_link_libraries(${TARGET} PRIVATE SkywardBoardcore::Boardcore::${OPT_BOARD})
# Link the embedded Boardcore library
target_link_libraries(${TARGET} PRIVATE Skyward::Boardcore::${OPT_BOARD})
# Linker script and linking options are eredited from the kernel library
# Add a post build command to create the hex file to flash on the board
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O ihex ${TARGET} ${TARGET}.hex
......@@ -56,7 +61,7 @@ function(sbs_target TARGET OPT_BOARD)
VERBATIM
)
else()
target_link_libraries(${TARGET} PRIVATE SkywardBoardcore::Boardcore::host)
target_link_libraries(${TARGET} PRIVATE Skyward::Boardcore::host)
endif()
endfunction()
......
Subproject commit c1bbe12c16099acb682dbf75136627ad309a0d35
Subproject commit 7abedf9773b3ebce9d14687d13544f40fad5577f
Subproject commit ed8a4d8c24e59ce7513b1cebc9b6427fde55c7ce
Subproject commit 011ff9ede6fab86ccba5de8eb08f4bd02d7d7522
Subproject commit 8dbca5ad04aa3c52603ef98a516e1049171a8405
Subproject commit a52d94acbfd617ae567a5efc1626e9b88703a0dd
Subproject commit 85c4cfb0cddab47ceb14ed158559ffd4fa7af288
Subproject commit e300a6c2587d29f4795b67ee0eaebf18aeebb5cb
......@@ -47,7 +47,7 @@ init_dirs() {
source_dir="$PWD"
build_default_dir="$source_dir/$BUILD_DEFAULT_DIRNAME"
build_host_dir="$source_dir/$BUILD_HOST_DIRNAME"
toolchain_file="$sbs_base/libs/miosix-kernel/miosix/_tools/toolchain.cmake"
toolchain_file="$sbs_base/libs/miosix-kernel/miosix/cmake/toolchain.cmake"
}
find_deps() {
......
......@@ -83,13 +83,13 @@ def config_cmd_parser():
def print_banner():
# Font: Ivrit
print('+------------------------------+')
print('| _ _ _ |')
print('| | | (_)_ __ | |_ ___ _ __ |')
print('| | | | | \'_ \| __/ _ \ \'__| |')
print('| | |___| | | | | || __/ | |')
print('| |_____|_|_| |_|\__\___|_| |')
print('+------------------------------+')
print(r"+------------------------------+")
print(r"| _ _ _ |")
print(r"| | | (_)_ __ | |_ ___ _ __ |")
print(r"| | | | | '_ \| __/ _ \ '__| |")
print(r"| | |___| | | | | || __/ | |")
print(r"| |_____|_|_| |_|\__\___|_| |")
print(r"+------------------------------+")
class Colors():
......
# Copyright (C) 2023 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
set(BOARD_NAME stm32f205rc_ciuti)
set(ARCH_NAME cortexM3_stm32f2)
# Base directories with header files for this board
set(ARCH_PATH ${KPATH}/arch/${ARCH_NAME}/common)
set(BOARD_PATH ${BOARDCORE_PATH}/src/bsps/${BOARD_NAME})
set(BOARD_CONFIG_PATH ${BOARDCORE_PATH}/src/bsps/${BOARD_NAME}/config)
# Specify where to find the board specific config/miosix_settings.h
set(BOARD_MIOSIX_SETTINGS_PATH ${BOARD_PATH})
# Specify where to find the board specific config/mxgui_settings.h
set(BOARD_MXGUI_SETTINGS_PATH ${BOARD_PATH})
# Optimization flags:
# -O0 do no optimization, the default if no optimization level is specified
# -O or -O1 optimize minimally
# -O2 optimize more
# -O3 optimize even more
# -Ofast optimize very aggressively to the point of breaking the standard
# -Og Optimize debugging experience, enables optimizations that do not
# interfere with debugging
# -Os Optimize for size with -O2 optimizations that do not increase code size
set(OPT_OPTIMIZATION
$<$<CONFIG:Debug>:-O2>
$<$<CONFIG:Release>:-O2>
)
# Boot file and linker script
set(BOOT_FILE ${BOARD_PATH}/core/stage_1_boot.cpp)
set(LINKER_SCRIPT ${BOARD_PATH}/stm32_512k+128k_rom.ld)
# Clock frequency
set(CLOCK_FREQ -DHSE_VALUE=25000000 -DSYSCLK_FREQ_120MHz=120000000)
# C++ Exception/rtti support disable flags.
# To save code size if not using C++ exceptions (nor some STL code which
# implicitly uses it) uncomment this option.
# -D__NO_EXCEPTIONS is used by Miosix to know if exceptions are used.
# set(OPT_EXCEPT -fno-exceptions -fno-rtti -D__NO_EXCEPTIONS)
# Specify a custom flash command
# This is the program that is invoked when the flash flag (-f or --flash) is
# used with the Miosix Build System. Use $binary or $hex as placeolders, they
# will be replaced by the build systems with the binary or hex file repectively.
# If a command is not specified, the build system will use st-flash if found
# set(PROGRAM_CMDLINE "here your custom flash command")
# Basic flags
set(FLAGS_BASE -mcpu=cortex-m3 -mthumb)
# Flags for ASM and linker
set(AFLAGS_BASE ${FLAGS_BASE})
set(LFLAGS_BASE ${FLAGS_BASE} -Wl,--gc-sections,-Map,main.map -Wl,-T${LINKER_SCRIPT} ${OPT_EXCEPT} ${OPT_OPTIMIZATION} -nostdlib)
# Flags for C/C++
string(TOUPPER ${BOARD_NAME} BOARD_UPPER)
set(CFLAGS_BASE
-D_BOARD_${BOARD_UPPER} "-D_MIOSIX_BOARDNAME=\"${BOARD_NAME}\""
-D_DEFAULT_SOURCE=1 -ffunction-sections -Wall -Werror=return-type -g
-D_ARCH_CORTEXM3_STM32F2
${CLOCK_FREQ} ${XRAM} ${FLAGS_BASE} ${OPT_OPTIMIZATION} -c
)
set(CXXFLAGS_BASE ${CFLAGS_BASE} ${OPT_EXCEPT})
# Select architecture specific files
set(ARCH_SRC
${ARCH_PATH}/interfaces-impl/gpio_impl.cpp
${ARCH_PATH}/interfaces-impl/portability.cpp
${BOARD_PATH}/interfaces-impl/bsp.cpp
${BOARD_PATH}/interfaces-impl/delays.cpp
${KPATH}/arch/common/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c
${KPATH}/arch/common/core/interrupts_cortexMx.cpp
${KPATH}/arch/common/core/mpu_cortexMx.cpp
${KPATH}/arch/common/core/stm32f2_f4_l4_f7_h7_os_timer.cpp
${KPATH}/arch/common/drivers/serial_stm32.cpp
${KPATH}/arch/common/drivers/sd_stm32f2_f4_f7.cpp
)
/* Copyright (c) 2021 Skyward Experimental Rocketry
* Author: Davide Mor
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef BOARD_SETTINGS_H
#define BOARD_SETTINGS_H
#include "util/version.h"
/**
* \internal
* Versioning for board_settings.h for out of git tree projects
*/
#define BOARD_SETTINGS_VERSION 300
namespace miosix
{
/**
* \addtogroup Settings
* \{
*/
/// Size of stack for main().
/// The C standard library is stack-heavy (iprintf requires 1.5KB) and the
/// STM32F205RC has 128KB of RAM so there is room for a big 4K stack.
const unsigned int MAIN_STACK_SIZE = 4 * 1024;
/// Serial port
const unsigned int defaultSerial = 1;
const unsigned int defaultSerialSpeed = 115200;
const bool defaultSerialFlowctrl = false;
#define SERIAL_1_DMA
// #define SERIAL_2_DMA //Serial 2 is used by the pogo pins
// #define SERIAL_3_DMA //Serial 3 is used by the pogo pins
// SD card driver
static const unsigned char sdVoltage = 33; // Board powered @ 3.3V
// #define SD_ONE_BIT_DATABUS // This board supports 4 bit data bus to SD card
/// Analog supply voltage for ADC, DAC, Reset blocks, RCs and PLL
#define V_DDA_VOLTAGE 3.3f
/**
* \}
*/
} // namespace miosix
#endif /* BOARD_SETTINGS_H */
/* Copyright (c) 2021 Skyward Experimental Rocketry
* Author: Davide Mor
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
// Before you can compile the kernel you have to configure it by editing this
// file. After that, comment out this line to disable the reminder error.
// The PARSING_FROM_IDE is because Netbeans gets confused by this, it is never
// defined when compiling the code.
#ifndef PARSING_FROM_IDE
//#error This error is a reminder that you have not edited miosix_settings.h
// yet.
#endif // PARSING_FROM_IDE
/**
* \file miosix_settings.h
* NOTE: this file contains ONLY configuration options that are not dependent
* on architecture specific details. The other options are in the following
* files which are included here:
* miosix/arch/architecture name/common/arch_settings.h
* miosix/config/arch/architecture name/board name/board_settings.h
*/
#include "arch_settings.h"
#include "board_settings.h"
#include "util/version.h"
/**
* \internal
* Versioning for miosix_settings.h for out of git tree projects
*/
#define MIOSIX_SETTINGS_VERSION 300
namespace miosix
{
/**
* \addtogroup Settings
* \{
*/
//
// Scheduler options
//
/// \def SCHED_TYPE_PRIORITY
/// If uncommented selects the priority scheduler
/// \def SCHED_TYPE_CONTROL_BASED
/// If uncommented selects the control based scheduler
/// \def SCHED_TYPE_EDF
/// If uncommented selects the EDF scheduler
// Uncomment only *one* of those
#define SCHED_TYPE_PRIORITY
// #define SCHED_TYPE_CONTROL_BASED
// #define SCHED_TYPE_EDF
/// \def WITH_CPU_TIME_COUNTER
/// Allows to enable/disable CPUTimeCounter to save code size and remove its
/// overhead from the scheduling process. By default it is not defined
/// (CPUTimeCounter is disabled).
// #define WITH_CPU_TIME_COUNTER
//
// Filesystem options
//
/// \def WITH_FILESYSTEM
/// Allows to enable/disable filesystem support to save code size
/// By default it is defined (filesystem support is enabled)
#define WITH_FILESYSTEM
/// \def WITH_DEVFS
/// Allows to enable/disable DevFs support to save code size
/// By default it is defined (DevFs is enabled)
#define WITH_DEVFS
/// \def SYNC_AFTER_WRITE
/// Increases filesystem write robustness. After each write operation the
/// filesystem is synced so that a power failure happens data is not lost
/// (unless power failure happens exactly between the write and the sync)
/// Unfortunately write latency and throughput becomes twice as worse
/// By default it is defined (slow but safe)
#define SYNC_AFTER_WRITE
/// Maximum number of open files. Trying to open more will fail.
/// Cannot be lower than 3, as the first three are stdin, stdout, stderr
const unsigned char MAX_OPEN_FILES = 8;
/// \def WITH_PROCESSES
/// If uncommented enables support for processes as well as threads.
/// This enables the dynamic loader to load elf programs, the extended system
/// call service and, if the hardware supports it, the MPU to provide memory
/// isolation of processes
// #define WITH_PROCESSES
#if defined(WITH_PROCESSES) && defined(__NO_EXCEPTIONS)
#error Processes require C++ exception support
#endif // defined(WITH_PROCESSES) && defined(__NO_EXCEPTIONS)
#if defined(WITH_PROCESSES) && !defined(WITH_FILESYSTEM)
#error Processes require filesystem support
#endif // defined(WITH_PROCESSES) && !defined(WITH_FILESYSTEM)
#if defined(WITH_PROCESSES) && !defined(WITH_DEVFS)
#error Processes require devfs support
#endif // defined(WITH_PROCESSES) && !defined(WITH_DEVFS)
//
// C/C++ standard library I/O (stdin, stdout and stderr related)
//
/// \def WITH_BOOTLOG
/// Uncomment to print bootlogs on stdout.
/// By default it is defined (bootlogs are printed)
#define WITH_BOOTLOG
/// \def WITH_ERRLOG
/// Uncomment for debug information on stdout.
/// By default it is defined (error information is printed)
#define WITH_ERRLOG
//
// Kernel related options (stack sizes, priorities)
//
/// \def WITH_DEEP_SLEEP
/// Adds interfaces and required variables to support deep sleep state switch
/// automatically when peripherals are not required
// #define WITH_DEEP_SLEEP
/**
* \def JTAG_DISABLE_SLEEP
* JTAG debuggers lose communication with the device if it enters sleep
* mode, so to use debugging it is necessary to disable sleep in the idle
* thread. By default it is not defined (idle thread calls sleep).
*/
// #define JTAG_DISABLE_SLEEP
#if defined(WITH_DEEP_SLEEP) && defined(JTAG_DISABLE_SLEEP)
#error Deep sleep cannot work together with jtag
#endif // defined(WITH_PROCESSES) && !defined(WITH_DEVFS)
/// Minimum stack size (MUST be divisible by 4)
const unsigned int STACK_MIN = 256;
/// \internal Size of idle thread stack.
/// Should be >=STACK_MIN (MUST be divisible by 4)
const unsigned int STACK_IDLE = 256;
/// Default stack size for pthread_create.
/// The chosen value is enough to call C standard library functions
/// such as printf/fopen which are stack-heavy
const unsigned int STACK_DEFAULT_FOR_PTHREAD = 2048;
/// Maximum size of the RAM image of a process. If a program requires more
/// the kernel will not run it (MUST be divisible by 4)
const unsigned int MAX_PROCESS_IMAGE_SIZE = 64 * 1024;
/// Minimum size of the stack for a process. If a program specifies a lower
/// size the kernel will not run it (MUST be divisible by 4)
const unsigned int MIN_PROCESS_STACK_SIZE = STACK_MIN;
/// Every userspace thread has two stacks, one for when it is running in
/// userspace and one for when it is running in kernelspace (that is, while it
/// is executing system calls). This is the size of the stack for when the
/// thread is running in kernelspace (MUST be divisible by 4)
const unsigned int SYSTEM_MODE_PROCESS_STACK_SIZE = 2 * 1024;
/// Number of priorities (MUST be >1)
/// PRIORITY_MAX-1 is the highest priority, 0 is the lowest. -1 is reserved as
/// the priority of the idle thread.
/// The meaning of a thread's priority depends on the chosen scheduler.
#ifdef SCHED_TYPE_PRIORITY
// Can be modified, but a high value makes context switches more expensive
const short int PRIORITY_MAX = 4;
#elif defined(SCHED_TYPE_CONTROL_BASED)
// Don't touch, the limit is due to the fixed point implementation
// It's not needed for if floating point is selected, but kept for consistency
const short int PRIORITY_MAX = 64;
#else // SCHED_TYPE_EDF
// Doesn't exist for this kind of scheduler
#endif
/// Priority of main()
/// The meaning of a thread's priority depends on the chosen scheduler.
const unsigned char MAIN_PRIORITY = 1;
#ifdef SCHED_TYPE_PRIORITY
/// Maximum thread time slice in nanoseconds, after which preemption occurs
const unsigned int MAX_TIME_SLICE = 1000000;
#endif // SCHED_TYPE_PRIORITY
//
// Other low level kernel options. There is usually no need to modify these.
//
/// \internal Length of wartermark (in bytes) to check stack overflow.
/// MUST be divisible by 4 and can also be zero.
/// A high value increases context switch time.
const unsigned int WATERMARK_LEN = 16;
/// \internal Used to fill watermark
const unsigned int WATERMARK_FILL = 0xaaaaaaaa;
/// \internal Used to fill stack (for checking stack usage)
const unsigned int STACK_FILL = 0xbbbbbbbb;
// Compiler version checks
#if !defined(_MIOSIX_GCC_PATCH_MAJOR) || _MIOSIX_GCC_PATCH_MAJOR < 3
#error \
"You are using a too old or unsupported compiler. Get the latest one from https://miosix.org/wiki/index.php?title=Miosix_Toolchain"
#endif
#if _MIOSIX_GCC_PATCH_MAJOR > 3
#warning "You are using a too new compiler, which may not be supported"
#endif
/**
* \}
*/
} // namespace miosix