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
Select Git revision

Target

Select target project
  • avn/swd/skyward-boardcore
  • emilio.corigliano/skyward-boardcore
  • ettore.pane/skyward-boardcore
  • giulia.facchi/skyward-boardcore
  • valerio.flamminii/skyward-boardcore
  • nicolo.caruso/skyward-boardcore
6 results
Select Git revision
Show changes
Commits on Source (1558)
Showing with 2385 additions and 251 deletions
{
BasedOnStyle: Google,
AccessModifierOffset: -4,
AlignConsecutiveAssignments: true,
AllowShortIfStatementsOnASingleLine: false,
AllowShortLoopsOnASingleLine: false,
BreakBeforeBraces: Allman,
ColumnLimit: 80,
ConstructorInitializerAllOnOneLineOrOnePerLine: false,
IndentCaseLabels: true,
IndentWidth: 4,
KeepEmptyLinesAtTheStartOfBlocks: true,
}
BasedOnStyle: Google
ColumnLimit: 80
IndentWidth: 4
AccessModifierOffset: -4
BreakBeforeBraces: Allman
# Allow braceless single line if/else/for/while statements
RemoveBracesLLVM: true
AlignConsecutiveAssignments: Consecutive
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
PackConstructorInitializers: BinPack
IndentCaseLabels: true
# Empty lines behavior
InsertNewlineAtEOF: true
KeepEmptyLinesAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
# Align pointers/references to the type, not the variable
DerivePointerAlignment: false
PointerAlignment: Left
......@@ -14,16 +14,24 @@ bin/*
.project
.cproject
.settings
compile_flags.txt
STM32F429zi_Discovery.xml
._*
.DS_Store
build
build-host
cmake-build-*
*.sublime-workspace
*.sublime-project
.vscode/*
store.json
*/generated/
core
**/generated/
__pycache__
/scripts/generators/generated
/scripts/generators/scxmls
scripts/logdecoder/logdecoder
doc/output
\ No newline at end of file
# This file is a template, and might need editing before it works on your project.
# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
# you can delete this line if you're not using Docker
#image: busybox:latest
# 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
# 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.
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- echo "Before script section"
- echo "For example you might run an update here or install a build dependency"
- echo "Or perhaps you might print out some debugging details"
default:
image: registry.skywarder.eu/avn/swd/docker/miosix:v2
stages:
- lint
- build
- test
- documentation
# Stage lint
cppcheck:
stage: lint
script:
- cppcheck --version
- ./scripts/linter.py --cppcheck src
format:
stage: lint
script:
- clang-tidy --version
- clang-format --version
- ./scripts/linter.py --format src
copyright:
stage: lint
script:
- /usr/bin/python3 --version
- ./scripts/linter.py --copyright src
find:
stage: lint
script:
- /usr/bin/python3 --version
- ./scripts/linter.py --find src
after_script:
- echo "After script section"
- echo "For example you might do some cleanup here"
# Stage build
build1:
build-debug:
stage: build
only:
- master
- testing
script:
- echo "Do your build here"
- python3 sbs
- cmake --version
- ccache --version
- ninja --version
- ./sbs build --debug
test1:
stage: test
build-release:
stage: build
script:
- cmake --version
- ccache --version
- ninja --version
- ./sbs build
logdecoder:
stage: build
script:
- echo "Do a test here"
- echo "For example run a test suite"
- g++ --version
- cd scripts/logdecoder
- make
# Stage test
test2:
test:
stage: test
script:
- echo "Do another parallel test here"
- echo "For example run a lint test"
- ./scripts/linter.sh
- ./sbs test
deploy1:
stage: deploy
# Stage documentation
pages:
stage: documentation
only:
- main
script:
- echo "Do your deploy here"
- doxygen --version
- doxygen doc/Doxyfile
- mv doc/output/html public
artifacts:
paths:
- public
[submodule "libs/miosix-kernel"]
[submodule "Catch2"]
path = libs/Catch2
url = https://git.skywarder.eu/avn/swd/third-party/Catch2.git
[submodule "Eigen"]
path = libs/eigen
url = https://git.skywarder.eu/avn/swd/third-party/eigen.git
[submodule "Modern formatting library"]
path = libs/fmt
url = https://git.skywarder.eu/avn/swd/third-party/fmt.git
[submodule "MAVLink Skyward library"]
path = libs/mavlink-skyward-lib
url = https://git.skywarder.eu/avn/swd/mavlink/mavlink-skyward-lib
[submodule "Miosix Host"]
path = libs/miosix-host
url = https://git.skywarder.eu/avn/swd/miosix-host.git
[submodule "Miosix Kernel"]
path = libs/miosix-kernel
url = ../../elc/miosix-kernel.git
branch = master
[submodule "libs/tscpp"]
url = https://git.skywarder.eu/avn/swd/miosix-kernel.git
[submodule "Miosix GUI library"]
path = libs/mxgui
url = https://git.skywarder.eu/avn/swd/third-party/mxgui.git
[submodule "Trivial serialization for C++"]
path = libs/tscpp
url = https://github.com/fedetft/tscpp.git
[submodule "libs/mavlink_skyward_lib"]
path = libs/mavlink_skyward_lib
url = ../mavlink_skyward_lib.git
[submodule "libs/simple-template-matrix"]
path = libs/simple-template-matrix
url = https://github.com/fedetft/simple-template-matrix.git
url = https://git.skywarder.eu/avn/swd/third-party/tscpp.git
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://gitlab.com/daverona/pre-commit/cpp
rev: 0.8.0
hooks:
- id: cppcheck
args: [
--quiet,
--language=c++,
--enable=all,
--inline-suppr,
--suppress=unmatchedSuppression,
--suppress=unusedFunction,
--suppress=missingInclude
]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.0
hooks:
- id: clang-format
args: [
-style=file,
--dry-run,
--Werror
]
- repo: local
hooks:
- id: copyright
name: Copyright
entry: scripts/linter.py
args: [
--copyright,
src
]
pass_filenames: false
language: python
- repo: local
hooks:
- id: find
name: Find
entry: scripts/linter.py
args: [
--find,
src
]
pass_filenames: false
language: python
This diff is collapsed.
[
{
"name": "Miosix",
"toolchainFile": "libs/miosix-kernel/miosix/_tools/toolchain.cmake"
}
]
......@@ -3,25 +3,43 @@
"configurations": [
{
"cwd": "${workspaceRoot}",
"executable": "${workspaceFolder}/bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.elf",
"executable": "${workspaceFolder}/build/${fileBasenameNoExtension}",
"name": "ST-LINK V2 (current entrypoint)",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"device": "STM32F429ZI",
"svdFile": "/home/luca/drive/Skyward/STM32F429.svd",
"armToolchainPath": "/opt/arm-miosix-eabi/bin",
"toolchainPrefix": "arm-miosix-eabi",
"configFiles": [
"/home/luca/test.cfg"
"${workspaceFolder}/data/gdb/stm32f4-stlinv2.cfg"
]
},
{
"cwd": "${workspaceRoot}",
"executable": "${workspaceFolder}/bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.elf",
"executable": "${workspaceFolder}/build/${fileBasenameNoExtension}",
"name": "F756",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"device": "STM32F756ZG",
"svdFile": "${workspaceFolder}/data/gdb/stm32f750.svd",
"armToolchainPath": "/opt/arm-miosix-eabi/bin",
"toolchainPrefix": "arm-miosix-eabi",
"configFiles": [
"${workspaceFolder}/data/gdb/stm32f7-stlinv2.cfg"
]
},
{
"cwd": "${workspaceRoot}",
"executable": "${workspaceFolder}/build/${fileBasenameNoExtension}",
"name": "ST-LINK V1 (current entrypoint)",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"device": "STM32F429ZI",
"armToolchainPath": "/opt/arm-miosix-eabi/bin",
"toolchainPrefix": "arm-miosix-eabi",
"configFiles": [
"${workspaceFolder}/libs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_death_stack/death_stack.cfg"
]
......
{
"cmake.configureSettings": {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
},
"cmake.parallelJobs": 1,
"files.associations": {
"sstream": "cpp",
"format": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"shared_mutex": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp",
"__config": "cpp",
"__threading_support": "cpp",
"__mutex_base": "cpp",
"__tree": "cpp",
"locale": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__tuple": "cpp",
"ios": "cpp",
"queue": "cpp",
"stack": "cpp",
"__functional_03": "cpp",
"filesystem": "cpp",
"unordered_set": "cpp",
"hash_map": "cpp",
"valarray": "cpp",
"ranges": "cpp",
"compare": "cpp",
"concepts": "cpp",
"core": "cpp",
"iterativelinearsolvers": "cpp",
"pastixsupport": "cpp",
"superlusupport": "cpp",
"adolcforward": "cpp",
"alignedvector3": "cpp",
"bvh": "cpp",
"fft": "cpp",
"iterativesolvers": "cpp",
"mprealsupport": "cpp",
"matrixfunctions": "cpp",
"nonlinearoptimization": "cpp",
"openglsupport": "cpp",
"polynomials": "cpp",
"autodiff": "cpp",
"sparseextra": "cpp",
"specialfunctions": "cpp"
},
"cSpell.words": [
"abom",
"ADCPRE",
"addfilter",
"ADON",
"aelf",
"airbrakes",
"Airbrakes",
"Alain",
"Alessandro",
"ALST",
"AMSL",
"apbclk",
"atthr",
"AVDD",
"awum",
"Baro",
"bittiming",
"boardcore",
"Boardcorev",
"boudrate",
"Canbus",
"canprotocol",
"Carlucci",
"CCMDATAR",
"CCMDATARAMEN",
"compid",
"Corigliano",
"CORTEXM",
"CPHA",
"cpitch",
"cppcheck",
"croll",
"cwise",
"cyaw",
"DATABUS",
"datasheet",
"Davide",
"deleteme",
"DMEIE",
"Doxyfile",
"doxygen",
"DRDY",
"Duca",
"Ecompass",
"Eigen",
"elfs",
"Erbetta",
"Fatt",
"Fatttr",
"fedetft's",
"fiprintf",
"FMCEN",
"FMPIE",
"FOVR",
"FRLVL",
"FRXTH",
"Gatttr",
"getdetahstate",
"Ghirardini",
"Giulia",
"GNSS",
"Gpio",
"GPIOA",
"GPIOB",
"GPIOC",
"GPIOD",
"GPIOE",
"GPIOF",
"GPIOG",
"GPIOH",
"GPIOI",
"GPIOJ",
"GPIOK",
"GPIOS",
"gpstr",
"Hatt",
"HCLK",
"HIFCR",
"HISR",
"hppw",
"HSCMAND",
"HSCMRNN",
"HWMAPPING",
"IDLEIE",
"Impli",
"Implii",
"INAK",
"INRQ",
"irqn",
"irqv",
"JEOC",
"JOFR",
"JSQR",
"JSWSTART",
"Kalman",
"Katt",
"kbps",
"LBKM",
"ldrex",
"leds",
"LIFCR",
"LISR",
"logdecoder",
"LSBFIRST",
"Luca",
"Mandelli",
"Matteo",
"Mavlink",
"mavlinkdriver",
"MEKF",
"microcontrollers",
"Microstep",
"Microsteps",
"MINC",
"miosix",
"mkdir",
"MODER",
"mosfet",
"mosi",
"MPXHZ",
"Musso",
"nart",
"NATT",
"NBAR",
"NDTR",
"NGPS",
"Nidasio",
"NJRST",
"NMAG",
"NMEA",
"NMEKF",
"nord",
"NVIC",
"OUTX",
"OUTY",
"OUTZ",
"peripehral",
"Piazzolla",
"PINC",
"Pitot",
"Plin",
"prescaler",
"PUPDR",
"Qgbw",
"Qget",
"Qhandle",
"Qput",
"Qwait",
"Qwakeup",
"RDHR",
"RDLR",
"RDTR",
"rflm",
"RFOM",
"Riccardo",
"RQCP",
"RXCRCR",
"Rssi",
"RXIRQ",
"RXNE",
"RXNEIE",
"sats",
"Satt",
"SDCLK",
"SDCR",
"sdio",
"SDRAM",
"smpr",
"SMPR",
"spitch",
"sqdip",
"sqtrp",
"sroll",
"SSCDANN",
"SSCDRRN",
"stof",
"SWSTART",
"syaw",
"taskscheduler",
"TCIE",
"TCIF",
"TDHR",
"TDLR",
"TDTR",
"TEIE",
"Terraneo",
"testsuite",
"THID",
"TMEIE",
"tparam",
"TSCPP",
"TSVREFE",
"Tweakable",
"TXCRCR",
"txfp",
"TXIRQ",
"TXOK",
"TXRQ",
"Ublox",
"UBXACK",
"UBXGPS",
"UBXNAV",
"Unsync",
"upcounter",
"USART",
"vbat",
"VBATE",
"velnord",
"vout",
"vsense",
"WSPI",
"Xbee",
"xnord",
"yned",
"Zyxda"
],
"cSpell.language": "en",
"cSpell.enabled": true
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
"label": "CLEAN",
"type": "shell",
"windows": {
"command": "python sbs -c"
"command": "./sbs -c"
},
"linux": {
"command": "./sbs -c"
......@@ -24,7 +24,7 @@
"label": "BUILD all",
"type": "shell",
"windows": {
"command": "python sbs"
"command": "sh sbs"
},
"linux": {
"command": "./sbs"
......@@ -32,13 +32,24 @@
"problemMatcher": "$gcc"
},
{
"label": "BUILD current-entrypoint",
"label": "BUILD current-entrypoint DEBUG",
"type": "shell",
"windows": {
"command": "python sbs -v -n -b ${fileBasenameNoExtension}"
"command": "./sbs -d -b ${fileBasenameNoExtension}"
},
"linux": {
"command": "./sbs -v -b ${fileBasenameNoExtension}"
"command": "./sbs -d -b ${fileBasenameNoExtension}"
},
"problemMatcher": "$gcc"
},
{
"label": "BUILD current-entrypoint NO DEBUG",
"type": "shell",
"windows": {
"command": "./sbs -b ${fileBasenameNoExtension}"
},
"linux": {
"command": "./sbs -b ${fileBasenameNoExtension}"
},
"problemMatcher": "$gcc"
},
......@@ -46,7 +57,7 @@
"label": "RUN current-entrypoint",
"type": "shell",
"windows": {
"command": "ST-LINK_CLI.exe -P bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst"
"command": "ST-LINK_CLI.exe -P build/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst"
},
"linux": {
"command": "st-flash write bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000"
......@@ -54,18 +65,30 @@
"problemMatcher": []
},
{
"label": "BUILD+RUN current-entrypoint",
"label": "BUILD+RUN current-entrypoint DEBUG",
"type": "shell",
"windows": {
"command": "ST-LINK_CLI.exe -P bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000 -V -Rst"
"command": "./sbs -d -f ${fileBasenameNoExtension}"
},
"linux": {
"command": "sleep 1;st-flash write bin/${fileBasenameNoExtension}/${fileBasenameNoExtension}.bin 0x8000000"
"command": "./sbs -d -f ${fileBasenameNoExtension}"
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "BUILD+RUN current-entrypoint NO DEBUG",
"type": "shell",
"windows": {
"command": "./sbs -f ${fileBasenameNoExtension}"
},
"linux": {
"command": "./sbs -f ${fileBasenameNoExtension}"
},
"problemMatcher": [],
"dependsOn": [
"BUILD current-entrypoint"
],
"group": {
"kind": "build",
"isDefault": true
......@@ -75,7 +98,7 @@
"label": "BUILD tests-catch",
"type": "shell",
"windows": {
"command": "python sbs -v -n -b tests-catch"
"command": "sh sbs -v -n -b tests-catch"
},
"linux": {
"command": "./sbs -v -b tests-catch"
......@@ -106,6 +129,17 @@
"options": {
"cwd": "/opt/arm-miosix-eabi/bin"
}
},
{
"label": "Open PuTTY 'skyward' session",
"type": "shell",
"windows": {
"command": "putty.exe -load skyward &"
},
"linux": {
"command": "putty.exe -load skyward &"
},
"problemMatcher": []
}
]
}
......@@ -55,6 +55,7 @@ flags = [
'-Ilibs/miosix-kernel/miosix/arch/common',
'-Ilibs/miosix-kernel/miosix/arch/cortexM4_stm32f4/common',
'-Ilibs/miosix-kernel/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery',
'-Ilibs/eigen',
'-Imiosix',
'-Imiosix-kernel',
'-Isrc/shared',
......@@ -160,4 +161,3 @@ def FlagsForFile( filename, **kwargs ):
'flags': final_flags,
'do_cache': True
}
This diff is collapsed.
all:
@echo "MAKEFILE WRAPPER. PLEASE USE ./sbs FOR A BETTER EXPERIENCE :)"
@python3 sbs -v
.PHONY: clean
clean:
@echo "MAKEFILE WRAPPER. PLEASE USE ./sbs FOR A BETTER EXPERIENCE :)"
@python3 sbs -c
\ No newline at end of file
SBS_BASE = {SBS_BASE_PATH}
##
## Makefile for Miosix embedded OS
##
MAKEFILE_VERSION := 1.07S
## Path to kernel directory (edited by init_project_out_of_git_repo.pl)
KPATH := $(SBS_BASE)/libs/miosix-kernel/miosix
## Path to config directory (edited by init_project_out_of_git_repo.pl)
CONFPATH := $(SBS_BASE)/libs/miosix-kernel/miosix
{SBS_BOARD_DEFINE}
{SBS_MAP_FILE}
include $(CONFPATH)/config/Makefile.inc
##
## List here subdirectories which contains makefiles
##
SUBDIRS := $(KPATH) {SBS_PROJECT_SUBDIRS}
##
## List here your source files (both .s, .c and .cpp)
##
SRC := {SBS_SOURCE_FILES}
##
## List here additional static libraries with relative path
##
LIBS := {SBS_PROJECT_LIBS}
##
## List here additional include directories (in the form -Iinclude_dir)
##
INCLUDE_DIRS := -I$(SBS_BASE)/libs -I$(SBS_BASE)/libs/miosix-kernel/miosix \
{SBS_PROJECT_INCLUDES}
##############################################################################
## You should not need to modify anything below ##
##############################################################################
ifeq ("$(VERBOSE)","1")
Q :=
ECHO := @true
else
Q := @
ECHO := @echo
endif
BINDIR := bin/$(BOARD_UUID)
OBJDIR := obj/$(BOARD_UUID)
## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
OBJ := $(addprefix $(OBJDIR)/, $(addsuffix .o, $(basename $(SRC))))
## Includes the miosix base directory for C/C++
## Always include CONFPATH first, as it overrides the config file location
CXXFLAGS := $(CXXFLAGS_BASE) -I$(CONFPATH) -I$(CONFPATH)/config/$(BOARD_INC) \
-I. -I$(KPATH) -I$(KPATH)/arch/common -I$(KPATH)/$(ARCH_INC) \
-I$(KPATH)/$(BOARD_INC) $(INCLUDE_DIRS) -Wall -Wextra -pedantic
CFLAGS := $(CFLAGS_BASE) -I$(CONFPATH) -I$(CONFPATH)/config/$(BOARD_INC) \
-I. -I$(KPATH) -I$(KPATH)/arch/common -I$(KPATH)/$(ARCH_INC) \
-I$(KPATH)/$(BOARD_INC) $(INCLUDE_DIRS) -Wall -Wextra -pedantic
AFLAGS := $(AFLAGS_BASE)
LFLAGS := $(LFLAGS_BASE) -Wl,--gc-sections,-Map,$(BINDIR)/${SBS_BIN_NAME}.map
DFLAGS := -MMD -MP
LINK_LIBS := $(LIBS) -L$(KPATH)/bin/$(OPT_BOARD) -Wl,--start-group \
-lmiosix -lstdc++ -lc -lm -lgcc -Wl,--end-group
all: folders all-recursive $(BINDIR)/{SBS_BIN_NAME}.bin
clean: clean-recursive clean-topdir
program:
$(PROGRAM_CMDLINE)
all-recursive:
$(foreach i,$(SUBDIRS),$(MAKE) -C $(i) \
KPATH=$(shell perl $(KPATH)/_tools/relpath.pl $(i) $(KPATH)) \
CONFPATH=$(shell perl $(KPATH)/_tools/relpath.pl $(i) $(CONFPATH)) \
|| exit 1;)
clean-recursive:
$(foreach i,$(SUBDIRS),$(MAKE) -C $(i) \
KPATH=$(shell perl $(KPATH)/_tools/relpath.pl $(i) $(KPATH)) \
CONFPATH=$(shell perl $(KPATH)/_tools/relpath.pl $(i) $(CONFPATH)) \
clean || exit 1;)
clean-topdir:
$(ECHO) "[RM] Cleaning files"
$(Q)rm -f $(OBJ) \
$(BINDIR)/{SBS_BIN_NAME}.elf $(BINDIR)/{SBS_BIN_NAME}.hex \
$(BINDIR)/{SBS_BIN_NAME}.bin $(BINDIR)/{SBS_BIN_NAME}.map \
$(OBJ:.o=.d)
$(Q)rm -rf $(BINDIR) $(OBJDIR)
$(BINDIR)/{SBS_BIN_NAME}.bin: folders $(BINDIR)/{SBS_BIN_NAME}.elf
$(ECHO) "[CP] Linking binary"
$(Q)$(CP) -O ihex $(BINDIR)/{SBS_BIN_NAME}.elf $(BINDIR)/{SBS_BIN_NAME}.hex
$(Q)$(CP) -O binary $(BINDIR)/{SBS_BIN_NAME}.elf $(BINDIR)/{SBS_BIN_NAME}.bin
$(Q)$(SZ) $(BINDIR)/{SBS_BIN_NAME}.elf
$(BINDIR)/{SBS_BIN_NAME}.elf: folders $(OBJ) all-recursive
$(ECHO) "[LD] Linking binary"
$(Q) $(CXX) $(LFLAGS) -o $@ $(OBJ) \
$(KPATH)/$(BOOT_FILE) $(LINK_LIBS)
$(OBJDIR)/%.o: %.s
$(ECHO) "[AS] " $<
$(Q) $(AS) $(AFLAGS) $< -o $@
$(OBJDIR)/%.o : %.c
$(ECHO) "[CC] " $<
$(Q) $(CC) $(DFLAGS) $(CFLAGS) {SBS_CUSTOM_DEFINES} $< -o $@
$(OBJDIR)/%.o : %.cpp
$(ECHO) "[CXX] " $<
$(Q) $(CXX) $(DFLAGS) $(CXXFLAGS) {SBS_CUSTOM_DEFINES} $< -o $@
folders:
$(Q) mkdir -pv $(dir $(OBJ)) $(BINDIR)
#pull in dependecy info for existing .o files
-include $(OBJ:.o=.d)
.PHONY: clean folders program clean-topdir clean-recursive
.NOTPARALLEL: clean-topdir clean-recursive folders clean program
![alt text](https://avatars2.githubusercontent.com/u/8077370?s=200&v=4)
<div align="center">
<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>
Skyward Boardcore
[![pipeline status](https://git.skywarder.eu/scs/skyward-boardcore/badges/master/pipeline.svg)](https://git.skywarder.eu/scs/skyward-boardcore/commits/master)
-------------
Boardcore is a C++14 rocket software framework targeting custom embedded boards designed by Skyward Experimental Rocketry.
Boardcore is a framework for developing and building missile software for custom boards with Miosix .
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.
[Miosix](https://miosix.org/) is a lightweigth 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/elc/miosix-kernel)
We maintain a fork of the Miosix OS to fit our needs: [skyward/miosix-kernel](https://git.skywarder.eu/avn/swd/miosix-kernel)
Building is made with [SBS](https://git.skywarder.eu/scs/skyward-boardcore/wikis/Skyward-Build-Systems-(SBS)), which was created to easily compile and reuse code for different boards.
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
## Content
| **src/** | sources! |
| ------------ | ------------------------------------------------------- |
| shared/ | objects, drivers and other stuff written by us |
| entrypoints/ | each file here is a 'main' |
| tests/ | contains the 'main' of every test |
| **bin/** | compiled binaries that can be flashed on a target board |
| **build/** | sbs stuff, not interesting |
| **data/** | configuration (barely used now) |
| **libs/** | external libs (Miosix kernel as a git submodule) |
| **obj/** | build folder, not interesting |
| **scripts/** | some tools (e.g. script for flashing on the boards) |
| Path | Description |
| ---------------- | ----------------------------------------------------------- |
| 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) |
In the main folder you will find **sbs.conf** which is used to configure the build system.
## Getting Started
### Getting Started
### Dependencies
#### Dependencies
The following are required to build the project:
* `CMake` 3.25
* `Git`
* `Miosix` Toolchain
* Python3
* Git
* Miosix toolchain
You will also need the following tools for linting and formatting:
* `Python3`
* `Cppcheck 2.7`
* `ClangFormat 18`
Also, openocd, cppcheck and clang-format are recommended for a better experience.
We also recommend to install `Ccache`, `Ninja`, `OpenOCD`, and `pre-commit` for a smoother development experience.
#### Cloning the repo
### Cloning the repo
Clone the repository with the `--recursive` option:
```sh
git clone --recursive https://git.skywarder.eu/avn/swd/skyward-boardcore.git
cd skyward-boardcore
```
## Building
Clone this repo with the `--recursive` option and build everything.
Using the SBS script is the recommended way to build the project. When called with no arguments, it will build all targets:
```sh
./sbs
```
git clone --recursive https://git.skywarder.eu/scs/skyward-boardcore.git
cd skyward-boardcore
python3 sbs -v
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.
Alternatively, you can build with CMake commands:
```sh
mkdir build
cd build
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_TOOLCHAIN_FILE=../libs/miosix-kernel/miosix/_tools/toolchain.cmake -GNinja ..
cmake --build .
```
SBS will start building all the entrypoints. Depending on how many entrypoints there are, this operation can take several minutes.
## Documentation
The code is documented with Doxygen, check it out [here](http://avn.pages.skywarder.eu/swd/skyward-boardcore).
## Contributing
Once SBS finished, check the resulting message: if every build displays an *OK* message, pat yourself on the back - you've got things *working*!
You can install a pre-commit hook to ensure changes to the code will pass CI:
```sh
pre-commit install
```
### What's next?
## What's next?
In the [Wiki](https://git.skywarder.eu/scs/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/scs/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/scs/skyward-boardcore/wikis/Boardcore-Quick-Start).
\ No newline at end of file
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).
# Copyright (c) 2021 Skyward Experimental Rocketry
# Authors: Damiano Amatruda
#
# 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.
# 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
${SBS_BASE}/src/shared/diagnostic/PrintLogger.cpp
# Actuators
${SBS_BASE}/src/shared/actuators/Servo/Servo.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
# Radio
${SBS_BASE}/src/shared/radio/Xbee/APIFrameParser.cpp
# Scheduler
${SBS_BASE}/src/shared/scheduler/TaskScheduler.cpp
# Sensors
${SBS_BASE}/src/shared/sensors/SensorManager.cpp
${SBS_BASE}/src/shared/sensors/SensorSampler.cpp
# Utils
${SBS_BASE}/src/shared/utils/AeroUtils/AeroUtils.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
${SBS_BASE}/src/shared/utils/Registry/RegistryFrontend.cpp
${SBS_BASE}/src/shared/utils/Registry/RegistrySerializer.cpp
${SBS_BASE}/src/shared/utils/DependencyManager/DependencyManager.cpp
)
# 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
Eigen3::Eigen
fmt::fmt-header-only
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
# Copyright (c) 2021 Skyward Experimental Rocketry
# Authors: Damiano Amatruda
#
# 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.
# Load in BOARDCORE_PATH the project path if not already defined
if (NOT DEFINED BOARDCORE_PATH)
cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH BOARDCORE_PATH)
endif()
# 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/dma/DMA.cpp
${BOARDCORE_PATH}/src/shared/drivers/dma/DMADefs.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
${BOARDCORE_PATH}/src/shared/sensors/ND015X/ND015D.cpp
${BOARDCORE_PATH}/src/shared/sensors/ND015X/ND015A.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
Catch2::Catch2
Mavlink::Mavlink
)
# 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_conrig_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
${BOARDCORE_PATH}/src/bsps/stm32f429zi_lyra_cubesat/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_orion_biscotto/config/board_options.cmake
${BOARDCORE_PATH}/src/bsps/stm32f767zi_orion_engine/config/board_options.cmake
)
# Copyright (c) 2021 Skyward Experimental Rocketry
# Author: Damiano Amatruda
#
# 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.
# 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)
# 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)
# Copyright (c) 2021 Skyward Experimental Rocketry
# Author: Damiano Amatruda
#
# 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.
enable_language(C CXX ASM)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Load in SBS_BASE the project path
cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SBS_BASE)
# Load in BOARDCORE_PATH the boardcore path
cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH BOARDCORE_PATH)
# Add the version information header to the global include path, so that all
# targets defined after this point will have access to it (Boardcore, Kernel)
include_directories(${BOARDCORE_PATH}/version)
# Include the Boardcore libraries
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(boardcore)
# 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()
target_include_directories(${TARGET} PRIVATE src/shared)
# Define the version information generation command
add_custom_target(${TARGET}-version-info
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/generated/${TARGET}/version.cpp
COMMAND "${CMAKE_COMMAND}"
"-D" "TARGET_NAME=${TARGET}"
"-D" "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-D" "BOARDCORE_PATH=${BOARDCORE_PATH}"
"-D" "OUT_DIR=${CMAKE_CURRENT_BINARY_DIR}/generated/${TARGET}"
"-P" "${BOARDCORE_PATH}/cmake/version.cmake"
COMMENT "Generating version information file for ${TARGET}"
VERBATIM
)
# Build the generated version information file as part of the target
target_sources(${TARGET} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/generated/${TARGET}/version.cpp
)
if(CMAKE_CROSSCOMPILING)
# Link the embedded Boardcore library
target_link_libraries(${TARGET} PRIVATE Skyward::Boardcore::${OPT_BOARD})
# Linker script and linking options are inherited 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
COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET} ${TARGET}.bin
BYPRODUCTS ${TARGET}.hex ${TARGET}.bin
VERBATIM
)
else()
target_link_libraries(${TARGET} PRIVATE Skyward::Boardcore::host)
endif()
endfunction()
function(sbs_catch_test TARGET)
if(NOT CMAKE_CROSSCOMPILING)
catch_discover_tests(${TARGET})
endif()
endfunction()