24 lines
701 B
Markdown
24 lines
701 B
Markdown
|
|
# Add `env:mod` with version + git hash
|
||
|
|
|
||
|
|
## Task
|
||
|
|
Add a PlatformIO environment that flashes firmware with a `-mod+<git_hash>` version suffix (e.g. `1.0.0-mod+a3f7c21`).
|
||
|
|
|
||
|
|
## Changes
|
||
|
|
|
||
|
|
### New file: `scripts/inject_mod_version.py`
|
||
|
|
- PlatformIO pre-build script
|
||
|
|
- Reads `version` from the `[crosspoint]` section of `platformio.ini`
|
||
|
|
- Runs `git rev-parse --short HEAD` to get the current commit hash
|
||
|
|
- Injects `-DCROSSPOINT_VERSION="{version}-mod+{hash}"` into build flags
|
||
|
|
|
||
|
|
### Modified: `platformio.ini`
|
||
|
|
- Added `[env:mod]` section (lines 58-64) that extends `base`, includes the new script via `extra_scripts`, and inherits base build flags
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
```
|
||
|
|
pio run -e mod -t upload
|
||
|
|
```
|
||
|
|
|
||
|
|
## Follow-up
|
||
|
|
- None
|