Description
When debugging, it can be very useful to know exactly what code is running on an ECU. We can indicate this by encoding the Git commit hash into the firmware and transmitting it.
#486 added some template messages for this, but they are currently unused.
BO_ 400 FcGitHash: 5 FC
SG_ Commit : 0|28@1+ (1,0) [0|0] "" RPI
SG_ Dirty : 32|1@1+ (1,0) [0|0] "" RPI
BO_ 410 LvGitHash: 5 LVC
SG_ Commit : 0|28@1+ (1,0) [0|0] "" RPI
SG_ Dirty : 32|1@1+ (1,0) [0|0] "" RPI
BO_ 420 TmsGitHash: 5 LVC
SG_ Commit : 0|28@1+ (1,0) [0|0] "" RPI
SG_ Dirty : 32|1@1+ (1,0) [0|0] "" RPI
BO_ 430 DashGitHash: 5 DASH
SG_ Commit : 0|28@1+ (1,0) [0|0] "" RPI
SG_ Dirty : 32|1@1+ (1,0) [0|0] "" RPI
Commit refers to the git commit hash. This is 40 hexadecimal characters which uniquely represent a specific commit. For example, at time of writing, main
is at commit f05a8fd2b9f769ab9d19da817b42a93e50a8dc5e
40 hex characters is 160 bits which is far too long to send in a single CAN frame, but Git commonly uses just the first 7 characters f05a8fd
as shorthand. This will fit in a message.
A "dirty" repository is when there are unstaged changes. It is important to include a Dirty flag in the message so that we know whether the code was modified without making a commit.
Task
- Modify cangen to include the current Git Hash and dirty flag in the generated
_messages
file.Consider looking at how we currently do the DbcHash
- Add code to each ECU to send the git hash message once per second.