Other Parts Discussed in Thread: UNIFLASH
Hi forum!
We have an executable that is protected by calculating a SHA256. This is done at runtime in the executable, and reported to another device that we are connected to.
Unfortunately, it appears that when I build and download to a target using Code Composer Studio (Version: 10.4.0.00006), the .bin file has a different SHA256 reported than if I download a TI-TXT (.txt) file using the MSP432 bootloader via Ethernet (BOOTP/TFTP). Both executables work, but perhaps there is some fill value or another switch that needs to be turned on in the conversion to TI-TXT?
Here is how the build completes at present:
Building target: "cvrPIM_nortos_ccs.out"
Invoking: Arm Linker
Flags: -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --advice:power=none --define=DeviceFamily_MSP432E4 --define=__MSP432E401Y__ -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --section_sizes=on -z -m"cvrPIM_nortos_ccs.map" --heap_size=65536 --stack_size=32768 -i"C:/Users/swhitney/OneDrive - Full Spectrum Software LLC/CVR/CRV_PIM/cvrPIM_nortos_ccs/lwip/src/include/lwip/priv" -i"C:/ti/simplelink_msp432e4_sdk_4_20_00_12/source" -i"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/lib" --define=DEBUG_WOLFSSL --diag_wrap=off --display_error_number --warn_sections --xml_link_info="cvrPIM_nortos_ccs_linkInfo.xml" --rom_model
"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armcl" -@"ccsLinker.opt" -o "cvrPIM_nortos_ccs.out"
<Linking>
FILE: cvrPIM_nortos_ccs.out
CODE size (bytes): 324642
CONST size (bytes): 22248
DATA size (bytes): 241002
Finished building target: "cvrPIM_nortos_ccs.out"
Building secondary target: "cvrPIM_nortos_ccs.txt"
Invoking: Arm Hex Utility
"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armhex" --diag_wrap=off --ti_txt -o "cvrPIM_nortos_ccs.txt" "cvrPIM_nortos_ccs.out"
Translating to TI-TXT format...
"cvrPIM_nortos_ccs.out" .intvecs ==> .intvecs
"cvrPIM_nortos_ccs.out" .text ==> .text
"cvrPIM_nortos_ccs.out" .const ==> .const
"cvrPIM_nortos_ccs.out" .cinit ==> .cinit
Finished building secondary target: "cvrPIM_nortos_ccs.txt"
"C:/ti/ccs1040/ccs/utils/tiobj2bin/tiobj2bin.bat" "cvrPIM_nortos_ccs.out" "cvrPIM_nortos_ccs.bin" "C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armofd.exe" "C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armhex.exe" "C:/ti/ccs1040/ccs/utils/tiobj2bin/mkhex4bin.exe"
certutil.exe -hashfile "cvrPIM_nortos_ccs.bin" SHA256
SHA256 hash of cvrPIM_nortos_ccs.bin:
a2b517c881b7c5948c9c989960f7917ce1fc35b8762def4da3786d45fe472587
CertUtil: -hashfile command completed successfully.
**** Build Finished ****
After running from Debug in Code Composer Studio, the executable outputs the calculated SHA256:
[INFO] SHA256: a2b517c881b7c5948c9c989960f7917ce1fc35b8762def4da3786d45fe472587
This exactly matches the SHA256 calculated on the .bin file using Windows "certutil" utility.
However, if I download the TI-TXT .txt file generated by the "armhex" utility (e.g. via the MSP432 Bootloader BOOTP/TFTP or the TI UniFlash utility), the following SHA256 is reported:
[INFO] SHA256: 2511116a16e8bbee448a1433bb0060e126ef022f65938d181e188842cdf2a9b1
Has anyone run into this? Is there some additional switch/parameter needed to make sure that the .txt output matches the value from the .bin output?
Your help is sincerely appreciated. Thanks!
--Scott