Initial bare-metal foundation for nRF52840 PTT-FHSS
- Fully open toolchain: arm-none-eabi-gcc inside Podman/Docker container - Platform-agnostic build via justfile (auto-detects podman vs docker) - CMake + Ninja build system with arm-none-eabi toolchain file - nRF52840 linker script and startup with full 64-entry vector table - Register access via typed bitfield unions (include/regs.h) - FHSS channel sequencer: AES-128-ECB PRNG over 40 channels (2402-2480 MHz) - Low-power sleep via SYSTEM_ON WFI + GPIOTE wakeup on button press - Vendor deps as shallow git submodules: nrfx, CMSIS_5, tiny-AES-c
This commit is contained in:
52
justfile
Normal file
52
justfile
Normal file
@@ -0,0 +1,52 @@
|
||||
# ── variables ──────────────────────────────────────────────────────────────
|
||||
|
||||
image := "ptt-builder"
|
||||
build_dir := "build"
|
||||
|
||||
# podman takes priority over docker
|
||||
engine := `command -v podman 2>/dev/null \
|
||||
|| command -v docker 2>/dev/null \
|
||||
|| { echo "error: podman or docker required" >&2; exit 1; }`
|
||||
|
||||
# user-namespace mapping: podman rootless vs docker
|
||||
user_ns := `command -v podman >/dev/null 2>&1 \
|
||||
&& echo "--userns=keep-id" \
|
||||
|| echo "--user $(id -u):$(id -g)"`
|
||||
|
||||
# host CPU arch → container build arg
|
||||
arch := `uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/'`
|
||||
|
||||
# ── recipes ────────────────────────────────────────────────────────────────
|
||||
|
||||
# build container image (only rebuilt when Dockerfile changes)
|
||||
image-build:
|
||||
{{engine}} build \
|
||||
--build-arg TARGETARCH={{arch}} \
|
||||
--build-arg GCC_VERSION=13.2.rel1 \
|
||||
-t {{image}} .
|
||||
|
||||
# compile firmware inside the container
|
||||
build: image-build
|
||||
{{engine}} run --rm \
|
||||
{{user_ns}} \
|
||||
-v "{{justfile_directory()}}:/src:z" \
|
||||
{{image}} \
|
||||
sh -c "cmake -B /src/{{build_dir}} -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel /src \
|
||||
&& ninja -C /src/{{build_dir}}"
|
||||
|
||||
# flash firmware via pyocd on the host (requires USB / DAPLink)
|
||||
flash: build
|
||||
pyocd flash --target nrf52840 {{build_dir}}/firmware.hex
|
||||
|
||||
# start GDB server for debugging
|
||||
gdbserver:
|
||||
pyocd gdbserver --target nrf52840 --port 3333
|
||||
|
||||
# remove build artifacts
|
||||
clean:
|
||||
rm -rf {{build_dir}}
|
||||
|
||||
# remove build artifacts AND the container image
|
||||
clean-all: clean
|
||||
{{engine}} rmi {{image}} 2>/dev/null || true
|
||||
Reference in New Issue
Block a user