diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9e07877 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - uses: actions/cache@v4 + with: + path: ~/.platformio + key: pio-${{ hashFiles('platformio.ini') }} + - run: pip install platformio + - run: pio run + - uses: actions/upload-artifact@v4 + with: + name: firmware-esp32dev + path: | + .pio/build/esp32dev/firmware.bin + .pio/build/esp32dev/bootloader.bin + .pio/build/esp32dev/partitions.bin diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..546f16d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +# Pushing a tag like v0.1.0 builds the firmware and publishes a GitHub +# Release with a single merged image that can be flashed at offset 0x0: +# esptool.py --chip esp32 write_flash 0x0 msns-firmware-esp32dev-v0.1.0.bin + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + env: + BOARD: esp32dev + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install platformio "esptool<5" + - run: pio run -e "$BOARD" + - name: Merge into one flashable image + run: | + out="msns-firmware-${BOARD}-${GITHUB_REF_NAME}.bin" + build=".pio/build/${BOARD}" + boot_app0="$HOME/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin" + esptool.py --chip esp32 merge_bin -o "$out" \ + --flash_mode dio --flash_freq 40m --flash_size 4MB \ + 0x1000 "$build/bootloader.bin" \ + 0x8000 "$build/partitions.bin" \ + 0xe000 "$boot_app0" \ + 0x10000 "$build/firmware.bin" + sha256sum "$out" > "$out.sha256" + echo "IMAGE=$out" >> "$GITHUB_ENV" + - name: Publish release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$GITHUB_REF_NAME" "$IMAGE" "$IMAGE.sha256" \ + --title "$GITHUB_REF_NAME" --generate-notes diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b5851be --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this repository are recorded here. +The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). + +## [Unreleased] + +### Added +- MIT `LICENSE` file (the README badge already pointed at one). +- CI build of the `esp32dev` environment on every push and pull request. +- Release workflow: pushing a `v*` tag publishes a merged, single-file + firmware image and its SHA-256. + +### Fixed +- Comment on the GPS globals said they were written by `task_sensors`; + they are written by `task_serial` and read by `task_sensors`. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..caecd10 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Shivtej Gaikwad and the Multi-Sensor Navigation System contributors + +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. diff --git a/src/main.cpp b/src/main.cpp index 6bc8599..3df84cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,10 +24,10 @@ bool has_mpu = false; bool has_qmc = false; bool has_bmp = false; -// Last known good GPS state — written and read exclusively by task_sensors -// (Core 1). task_serial (Core 0) never touches these globals directly; -// it only reads rows already in the ring buffer. -// Cross-core access exists but is benign for logging (no RMW, snapshot semantics). +// Last known good GPS state — written by task_serial (Core 0), which drains +// the GPS UART, and snapshotted into each row by task_sensors (Core 1). +// Single writer, single reader, no read-modify-write. The 64-bit doubles can +// tear across cores; that is accepted for logging (see README). volatile double gps_lat = 0.0; volatile double gps_lon = 0.0; volatile float gps_alt = 0.0f;