This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280039: C2000 Hex Utility: Binary File Output with --cmac secure boot

Part Number: TMS320F280039

Hi,

I am trying to enable the --cmac secure boot feature on the TMS320F280039.  I am using cgt 22.6.1LTS.

We have used the Hex Utility for a long time to convert the .out files into .bin files that can be used for OTA updates.

I am getting the following issue when I try to enable the --cmac options on the binary options.

error: CMAC tag, cmac_sb_1, region from start 0x80000 to end 0x82000 is not within allocated region from 0x100000 to 0x10c000

Here is the hex cmd file.

/* .stack was throwing an warning because it had a fill on it so exclude it here */
--exclude=.stack
--memwidth=16
--romwidth=16
--image
--binary
--cmac=/Users/colinparker/sandbox/tahoe-bootloader/project/platforms/f28003x/cmac_key.txt

ROMS
{
	/*origin and length values are 8 bit.  Divide by 2 to match values in linker */
	FLASH: origin = 0x100000, length = 0xC000, romwidth = 8, fill = 0xFFFF
}

It appears that the --cmac option isn't able to handle the ROMS directive for binary outputs.  If I remove the --binary and update the ROMS section to use 16 bit instead of 8 bit, everything work A-OK.

Can you help me with a workaround so that I can use the --binary option?

Thanks,

-Colin

  • Hello Colin,

    It appears that the --cmac option isn't able to handle the ROMS directive for binary outputs.  If I remove the --binary and update the ROMS section to use 16 bit instead of 8 bit, everything work A-OK.

    Can you help me with a workaround so that I can use the --binary option?

    One solution might be to add another section in the ROMS directive where the CMAC resides, rather than have the entire memory section treated the same. I'm not familiar with the --binary option or the hex utility, but if it's just an output format option and you're only looking to see the CMAC key it would be better to limit your output to just that memory range.

  • Thanks ,

    Unfortunately your suggestion doesn't quite do what i'm aiming to achieve.  I need to get the entire image into binary format.

    I've seen you answer questions in this part of the tool set.  Is there a way to convert intel hex output from the hex2000 tool into the equivalent form as if we used the `--binary` option?  I appears that we cannot generate a --binary output if we want to use the tool to --cmac a c2000 image.

    If I try to put the hex2000 output into tools such as `hex2bin.py` it complains that the file is malformed.  (16 bit addresses )

    `ERROR: bad HEX file: Hex file has data overlap at address 0x80010 on line 3`

    Any suggestions?  I need a binary file as that is the format that our OTA infrastructure expects.

    -Colin

  • Hello Colin,

    I will let George respond if he gets the chance, I will also ask around the team to see if anyone is more familiar with the hex utility tool to support this.

  • I am not familiar with hex2bin.py.  But I have a suggestion which may help.  When using hex2000 to create the Intel hex file, use the option --byte.  For details, search for it in the C28x assembly tools manual.

    Thanks and regards,

    -George

  • Thanks George, My issue is that I don't think we can use the --byte option with the --cmac option from the c2000hex utility.  Or is that not the case.

  • Hi Colin,

    Had you already tried to use the --byte option before? From your initial post my understanding was that you couldn't use the --binary option with the CMAC.

  • Ah, thank you for pointing that out!  I had misread the response!

    The `-byte` option updates the hex output so that I can then use another tool to convert it to a binary output!

    So for those following along later:

    1. Build traditional `.out` file
    2. Use hex2000 to sign the image and embed the hash with `--cmac`
    3. Use hex2000 to create a intel hex output file with `--image`, `--byte`, `--memwidth=16`, `--romwidth=16`
    4. Use other tools like `hex2bin` to convert the resultant intel hex output to a binary
  • Use hex2000 to sign the image and embed the hash with `--cmac`

    Sorry, just to clarify are you running the hex2000 for both step 2 and 3? Or are you doing them separate and somehow combining them in some way? I'm not very familiar with the hex utility tool, so I'm interested in understanding this.

  • Steps 2 and 3 are implemented as one single call to hex2000.  I broke them out because step two chronologically occurs before step 3.  I.e. you have to put the hash into the image before you convert it into the final output file.

  • Okay, that makes sense. Thank you for clarifying!