trezor-firmware
trezor-firmware copied to clipboard
improve flexibility of combine script
Also, combine_fw makefile target is added.
closes #3123
[no changelog]
It's flexible alright but doesn't work for my usecase anymore, namely, pick arbitrary build artifacts from arbitrary historic versions and/or Notion archives and combine them for the factory blob -- at least not without memorizing some ugly constants.
could we do something like, put the memory layouts into separate files and make the call look like combine.py --layout u5.layout boardloader.bin bootloader.bin [firmware.bin [firmware.p2.bin ...]]
?
Actually, that specific usecase was broken already - for MCUs different than STM32F4.
So here is more complex proposal: https://github.com/trezor/trezor-firmware/commit/e22248f725968131bc4d34762c2b11dd172c1dd0
Using core/embed/models/model_XXXX.h
as a source of truth, makefile
and combine script are using it via new layout_parser
script. The parser script is quite naive so it prevents using preprocessor features, but upside is that we duplicate these constants one less time (some of them are still duplicated in linker scripts)
the usage requires for every passed binary to specify the name of the binary, so that the layout parser knows what to look for, e.g.
-b BOOTLOADER ./build/bootloader/bootloader.bin
the PR is now broken, it seems to include all of U5 changes
rebased.