Skip to content

Commit 3a76044

Browse files
committed
Set firmware version from git tags
1 parent 702988a commit 3a76044

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Inc/firmware/configuration.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "firmware/hal_compat.hpp"
1111
#include "firmware/motor_controller.hpp"
1212

13-
const char* const FIRMWARE_VERSION = "1.0.2";
14-
1513
// UART used for rosserial communication
1614
static UART_HandleTypeDef& ROSSERIAL_UART = huart1;
1715

firmware_version.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import subprocess
2+
3+
Import("env")
4+
5+
ret = subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE, text=True)
6+
build_version = ret.stdout.strip()
7+
build_flag = "-D FIRMWARE_VERSION=\\\"" + build_version + "\\\""
8+
9+
print ("Firmware Revision: " + build_version)
10+
11+
env.Append(
12+
BUILD_FLAGS=[build_flag]
13+
)

platformio.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ debug_tool = stlink
1717
upload_protocol = stlink
1818
build_flags =
1919
-D ROS_PLATFORM_STM32CUBE
20+
extra_scripts =
21+
pre:firmware_version.py
2022

2123
[platformio]
2224
include_dir = Inc

0 commit comments

Comments
 (0)