diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e7e9e8..8531bc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,3 +71,25 @@ jobs: with: verbose: true recurse_submodules: true + + build-cli: + runs-on: ubuntu-latest + container: + image: tryspaceorg/tryspace-lab:0.0.1 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 1 + - name: Build CLI + run: | + cd cfg + python3 tryspace-orchestrator.py + cd .. + for dir in $(pwd)/comp/*/cli ; do + if [ -f "$dir/Makefile" ]; then + echo "Building CLI component in $dir" + make -C "$dir" build-cli || { echo "Failed building $dir"; exit 1; } + fi + done diff --git a/Makefile b/Makefile index c93363a..4dbd933 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Makefile for TrySpace Lab development -.PHONY: build clean clean-cache clean-cli clean-fsw clean-gsw clean-sim cfg cli container debug fsw gsw help mold sim start stop uninstall +.PHONY: build clean clean-cache clean-cli clean-fsw clean-gsw clean-sim cfg cli cli-start container debug fsw gsw help mold sim start stop uninstall # Build image name export BUILD_IMAGE ?= tryspaceorg/tryspace-lab:0.0.1 @@ -56,12 +56,13 @@ clean-sim: cli: cfg $(MAKE) container - $(MAKE) sim @for dir in $(CURDIR)/comp/*/cli ; do \ if [ -f "$$dir/Makefile" ]; then \ $(MAKE) -C "$$dir" runtime; \ fi; \ done + +cli-start: cfg docker compose -f ./cfg/cli-compose.yaml up container: cfg/Dockerfile.base @@ -92,8 +93,9 @@ help: @echo "Targets:" @echo " build - Build the full runtime environment" @echo " cfg - Run orchestrator to configure environment" - @echo " cli - Build CLI and start CLI services" - @echo " clean - Remove build artifacts and stop services" + @echo " cli - Build CLI components" + @echo " cli-start - Start CLI compose" + @echo " clean - Remove build artifacts and stop compose" @echo " clean-cache - Clean Docker build cache (frees significant disk space)" @echo " clean-cli - Clean CLI components" @echo " clean-fsw - Clean FSW components" @@ -105,8 +107,8 @@ help: @echo " gsw - Build GSW" @echo " mold - Create new component from demo template (Usage: make mold COMP=)" @echo " sim - Build Simulith and component simulators" - @echo " start - Start lab services" - @echo " stop - Stop lab and CLI services, clean up Docker images" + @echo " start - Start lab compose" + @echo " stop - Stop lab and CLI compose, clean up Docker images" @echo " uninstall - Remove containers, images, volumes, and networks" sim: cfg diff --git a/comp/CompFlags.cmake b/comp/CompFlags.cmake index 3a6455f..dec82ad 100644 --- a/comp/CompFlags.cmake +++ b/comp/CompFlags.cmake @@ -1,31 +1,61 @@ # TrySpace-Lab Component Settings include(CheckCCompilerFlag) -set(TRYSPACE_C_FLAGS - "-Wall" - "-Wextra" - "-Wpedantic" - "-Wformat=2" - "-Wno-discarded-qualifiers" - "-Winline" - "-Wpointer-arith" - "-Wredundant-decls" - "-Wwrite-strings" - "-Wuninitialized" - "-Winit-self" - "-Wswitch-default" - "-Wfloat-equal" - "-Wno-packed" - "-Wno-unused-parameter" - "-Wvariadic-macros" - "-Wvla" - "-Wstrict-overflow" - "-Wstrict-overflow=5" - "-fdiagnostics-show-option" - "-pedantic-errors" - "-fprofile-arcs" - "-ftest-coverage" -) +# Allow callers to skip applying these component flags by setting +# the CMake variable TRYSPACE_SKIP_COMP_FLAGS to TRUE. +if(ENABLE_UNIT_TESTS) + set(TRYSPACE_C_FLAGS + # --- Diagnostics and coverage --- + "-fdiagnostics-show-option" # Show warning/diagnostic option in output + "-fprofile-arcs" # Code coverage (gcov) + "-ftest-coverage" # Code coverage (gcov) + ) +else() + set(TRYSPACE_C_FLAGS + # --- Core warnings and strictness --- + "-Wall" # Enable all common warnings + "-Werror" # Treat warnings as errors + "-Wextra" # Enable extra warnings + "-Wpedantic" # Enforce standard compliance + "-Wformat=2" # Strict format string checking + "-Wconversion" # Warn on implicit type conversions + "-Wsign-conversion" # Warn on sign conversions + "-Wshadow" # Warn about variable shadowing + "-Wpointer-arith" # Warn about pointer arithmetic on void* and function pointers + "-Wcast-align" # Warn about cast alignment issues + "-Wstrict-prototypes" # Warn about missing function prototypes + "-Wmissing-prototypes" # Warn about missing prototypes in files + "-Wmissing-declarations" # Warn about missing declarations + "-Wredundant-decls" # Warn about redundant declarations + "-Wwrite-strings" # Make string literals const char* + "-Wuninitialized" # Warn about uninitialized variables + "-Winit-self" # Warn about variables initialized with themselves + "-Wswitch-default" # Warn if switch statement does not have a default case + "-Wswitch-enum" # Warn if switch on enum does not handle all values + "-Wfloat-equal" # Warn about comparing floating point values for equality + "-Wbad-function-cast" # Warn about bad function casts + + # --- Suppressions and compatibility --- + "-Wno-discarded-qualifiers" # Suppress warnings about discarded qualifiers + "-Wno-packed" # Suppress warnings about packed attribute + "-Wno-unused-parameter" # Suppress warnings about unused parameters + + # --- Overflow and macros --- + "-Wstrict-overflow" # Warn about code that may have strict overflow issues + "-Wstrict-overflow=5" # Maximum strict overflow warnings + "-Wvariadic-macros" # Warn about variadic macros + "-Wvla" # Warn about use of variable length arrays + + # --- Standard enforcement --- + "-pedantic-errors" # Make all pedantic warnings into errors + + # --- Optimization and safety --- + "-O2" # Optimize for speed (use -O3 for max, -Og for debug) + "-std=c99" # Enforce C99 standard (or use -std=c11) + "-D_FORTIFY_SOURCE=2" # Enable buffer overflow protection (if supported) + "-fstack-protector-strong" # Enable stack protection + ) +endif() # Example: Add target-specific flags # if(${TGTNAME} STREQUAL cpu1) diff --git a/comp/adcs b/comp/adcs index a470444..0ac5fa4 160000 --- a/comp/adcs +++ b/comp/adcs @@ -1 +1 @@ -Subproject commit a470444657998ca8c09e48d7211c59f148ebfb97 +Subproject commit 0ac5fa4267aa0ca548dbdf714c165ee6374dc998 diff --git a/comp/demo b/comp/demo index 10f7385..cbd8ac0 160000 --- a/comp/demo +++ b/comp/demo @@ -1 +1 @@ -Subproject commit 10f7385dd472d0cf8df3eb7b118c60ef78f6d5f0 +Subproject commit cbd8ac09d266d6862c14fae2a5516ded496fd4b5 diff --git a/comp/eps b/comp/eps index cb0f001..809b1ba 160000 --- a/comp/eps +++ b/comp/eps @@ -1 +1 @@ -Subproject commit cb0f001eb3a3c113f8e7ada7cd48bc53f2390fea +Subproject commit 809b1ba9cae506dcd36eba7bad1ddface65beb64 diff --git a/comp/radio b/comp/radio index 3337195..444d44b 160000 --- a/comp/radio +++ b/comp/radio @@ -1 +1 @@ -Subproject commit 3337195177756fe99e80eb10a481479dfe7a186d +Subproject commit 444d44bd71a0c41d21473baeb31f683fa1685672 diff --git a/fsw b/fsw index 3524d39..0c2aeca 160000 --- a/fsw +++ b/fsw @@ -1 +1 @@ -Subproject commit 3524d3912c5abc9131684adf51a2a2b595246a8d +Subproject commit 0c2aecae6b50ea65a7c94f594f607e62108ae0a9 diff --git a/simulith b/simulith index 339cd2c..0d0115f 160000 --- a/simulith +++ b/simulith @@ -1 +1 @@ -Subproject commit 339cd2c6f23697a9ca710232f4fdd34f30eda410 +Subproject commit 0d0115f17e2a35ea33c03ca70c3ff15cc6f3140a