apollo-lhc / cm_mcu

Microcontroller source code for the APOLLO blade for the CMS tracker HL-LHC upgrade.
MIT License
2 stars 2 forks source link

version string is wrong on tagged version #194

Closed pwittich closed 7 months ago

pwittich commented 10 months ago

The code below is used to parse the actual version number out of the version string. The version string currently something like this for a tagged version

commit date 2023-06-28 11:09:36 -0500   (grafted, HEAD, tag: v0.99.4) v0.99.4

and this for an untagged version

commit date 2023-08-18 10:39:17 -0400   (HEAD, origin/dev_zynqmon_path, dev_zynqmon_path) v0.99.4-40-g5f95c6a-dirty 

The following code is used to pull out the semver version (i.e., the part that is vXX.YY.ZZ-*-dirty) https://github.com/apollo-lhc/cm_mcu/blob/bc04d3fa801c489bd475a1c3c9e535fbcbeed760/projects/cm_mcu/ZynqMonTask.c#L229-L233

This works for untagged versions but it doesn't work for tagged versions because the version string is repeated 2x. The string is generated by the makefile in projects/cm_mcu with a command like this:

GIT_VERSION="$(shell git --no-pager  show -s --format="commit date %ci  %d"  ; git describe  --dirty --always --tags )"

so for the version that gets sent to the zynq the code above gets the wrong answer, as evidenced by this BUTool command:

>readstring PL_MEM_CM.MCU_FW_VER 
PL_MEM_CM.MCU_FW_VER: v0.99.4) v0.99.4

The correct outcome would be to just report v0.99.4, not 2x with the extra bonus parenthesis. The possible ways to do this might be either to