Skip to content

Commit 87a0c11

Browse files
CopilotMikefly123
andcommitted
Add configurable spacecraft ID for CI builds
- Convert ComCfg.fpp to template (ComCfg.fpp.in) - Add CMake option FPRIME_SPACECRAFT_ID (default 0x0044) - Configure ComCfg.fpp generation from template - Update CI to use spacecraft ID 0x00C1 - Add documentation for spacecraft ID configuration Co-authored-by: Mikefly123 <[email protected]>
1 parent c2c1dd6 commit 87a0c11

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ jobs:
5555
5656
- name: Generate
5757
run: |
58-
make generate
58+
make generate FPRIME_CMAKE_OPTIONS="-DFPRIME_SPACECRAFT_ID=0x00C1"
5959
6060
- name: Build
6161
run: |
62-
make build
62+
make build FPRIME_CMAKE_OPTIONS="-DFPRIME_SPACECRAFT_ID=0x00C1"
6363
6464
- name: Upload build artifacts
6565
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ build-fprime-*
77
*.template.cpp
88
*.template.hpp
99

10+
# Generated FPP configuration files
11+
FprimeZephyrReference/project/config/ComCfg.fpp
12+
1013
# Zephyr workspace
1114
lib/zephyr-workspace/*
1215

FprimeZephyrReference/project/config/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
#
44
# Sets a list of source files for cmake to process as part of autocoding.
55
####
6+
7+
# Configure spacecraft ID (can be overridden via CMake option)
8+
set(FPRIME_SPACECRAFT_ID "0x0044" CACHE STRING "Spacecraft ID (10 bits) - default 0x0044 for development, use 0x00C1 for CI")
9+
10+
# Generate ComCfg.fpp from template with configured spacecraft ID
11+
configure_file(
12+
"${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp.in"
13+
"${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp"
14+
@ONLY
15+
)
16+
617
register_fprime_config(
718
CONFIGURATION_OVERRIDES
819
"${CMAKE_CURRENT_LIST_DIR}/CdhCoreConfig.fpp"

FprimeZephyrReference/project/config/ComCfg.fpp renamed to FprimeZephyrReference/project/config/ComCfg.fpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module ComCfg {
1515
# - spacecraftId
1616
# - TmFrameFixedSize
1717
# - potentially APID enum ?
18-
constant SpacecraftId = 0x0044 # Spacecraft ID (10 bits)
18+
constant SpacecraftId = @FPRIME_SPACECRAFT_ID@ # Spacecraft ID (10 bits)
1919
constant TmFrameFixedSize = 248 # Needs to be at least COM_BUFFER_MAX_SIZE + (2 * SpacePacketHeaderSize) + 1
2020
constant AggregationSize = TmFrameFixedSize - 6 - 6 - 1 - 2 # 2 header (6) + 1 idle byte + 2 trailer bytes
2121

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fmt: pre-commit-install ## Lint and format files
4141

4242
.PHONY: generate
4343
generate: submodules fprime-venv zephyr ## Generate FPrime-Zephyr Proves Core Reference
44-
@$(UV_RUN) fprime-util generate --force
44+
@$(UV_RUN) fprime-util generate --force $(FPRIME_CMAKE_OPTIONS)
4545

4646
.PHONY: generate-if-needed
4747
BUILD_DIR ?= $(shell pwd)/build-fprime-automatic-zephyr
@@ -50,7 +50,7 @@ generate-if-needed:
5050

5151
.PHONY: build
5252
build: submodules zephyr fprime-venv generate-if-needed ## Build FPrime-Zephyr Proves Core Reference
53-
@$(UV_RUN) fprime-util build
53+
@$(UV_RUN) fprime-util build $(FPRIME_CMAKE_OPTIONS)
5454

5555
.PHONY: test-integration
5656
test-integration: uv

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ cd proves-core-reference
2121
make
2222
```
2323

24+
## Configuration
25+
26+
### Spacecraft ID
27+
28+
The spacecraft ID is used to identify different spacecraft/devices in the communication protocol. By default, the project uses spacecraft ID `0x0044` (68 in decimal) for development builds.
29+
30+
To build with a different spacecraft ID, use the `FPRIME_CMAKE_OPTIONS` variable:
31+
32+
```shell
33+
make generate FPRIME_CMAKE_OPTIONS="-DFPRIME_SPACECRAFT_ID=0x00C1"
34+
make build FPRIME_CMAKE_OPTIONS="-DFPRIME_SPACECRAFT_ID=0x00C1"
35+
```
36+
37+
**Note:** CI builds automatically use spacecraft ID `0x00C1` (193 in decimal) to prevent conflicts with development devices.
38+
2439
## Running the code
2540

2641
Run generate from the `proves-core-reference` directory. This generates the build cache for FPrime. You only need to do generate if something in the core FPrime package has changed

0 commit comments

Comments
 (0)