imgtool custom TLV disregards endian and always uses big endian
This was originally (a long time ago) reported to the wrong repository: https://github.com/apache/mynewt-mcumgr/issues/152
The issue with imgtool is that the value of --custom-tlv is always encoded in big-endian format, one might assume that selecting the endian of the output would determine this but it does not, and according to https://github.com/mcu-tools/mcuboot/blob/main/boot/bootutil/include/bootutil/boot_status.h#L156 actually should not because all fields must be in little endian, therefore imgtool has a bug in this functionality.
Example:
imgtool sign -k /tmp/aa/bootloader/mcuboot/root-rsa-2048.pem --align 4 --version 1.2.3 -H 0x200 -S 0x78000 --custom-tlv 0xaa 0x22550011 hello_world/zephyr/zephyr.hex test.hex
The following is the raw bytes from the hex file (taken from JFlash): 00 AA 00 04 00 22 55 00 11, as can be seen 0x22550011 is wrongly added in big endian format.
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.