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.

CCS v6 hex utility

I am trying to use CCS v6 built-in hex utility to generate hex output file. Looks like the output hex file contains half of the text section (If I dump the hex file it shows text section from 20007C to 207BD8.). Why the hex file does not show text section from 21xxxx ? I am using F28M35HC1 which has 512K flash. Using C2prog (via UART0) I can program the flash, but after reset, system does not start. I suspect only half of flash is programmed.

I used hex2000 and RTOS-Oct27.out to generate hex output file. This also looks exactly same.

Any idea what is wrong ? 

Here are relevant sections of linker, map and hex files.

                 TI ARM Linker PC v5.1.7                      
******************************************************************************
>> Linked Mon Nov 03 16:05:08 2014
OUTPUT FILE NAME:   <RTOS-Oct27.out>
ENTRY POINT SYMBOL: "_c_int00"  address: 00212c01
MEMORY CONFIGURATION
         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  BOOTROM                  00000000   00010000  00000000  00010000  R  X
  FLASH_BOOT            00200030   00000004  00000004  00000000  RW X
  FLASH                         00200034   0001ffcc  00017bda  000083f2  RW X
<Linking>
'Finished building target: RTOS-Oct27.out'
' '
'Invoking: ARM Hex Utility'
"c:/ti/ccsv6/tools/compiler/arm_5.1.7/bin/armhex" --map="rt.map" --memwidth=16 --romwidth=16 --intel -o "RTOS-Oct27.hex"  "RTOS-Oct27.out" 
Translating to Intel format...
   "RTOS-Oct27.out"   ==> .ti_catalog_arm_cortexm3_concertoInit_begin
   "RTOS-Oct27.out"   ==> .resetVecs
   "RTOS-Oct27.out"   ==> .text
   "RTOS-Oct27.out"   ==> .const
   "RTOS-Oct27.out"   ==> .flashfuncs
   "RTOS-Oct27.out"   ==> .cinit
   "RTOS-Oct27.out"   ==> .binit
'Finished building: RTOS-Oct27.hex'
' '
**** Build Finished ****
=========================================
output hex file start
===========================================

020000040020DA
:04003000F012BDE627
:20004000E00020002C010021406500214065002140650021406500214065002140650021AE
:1C006000406500214065002140650021406500214065002140650021432F00214D
:20007C00F1AD0D0890009800F00000FF900198012805D90120FF9001F89D0004B0024770B7
:20009C00F1AD0D08900020009001E0229801F04000019001E02C9801F04000029001E02784
:2000BC009801F04000089001E0229801F04000049001E01D9801F04000109001E01898016A
:2000DC00F04000209001E0139801F04000409001E00E98002800D0DE1E40D0E1380AD0E930

...

...

:207B9800000000001F800000000000000DBF0000000000002400000000000000021000002C
:207BB8000000000001B000000000000020000000000000002000000076B80021F00020005D
:207BD8007B980021608020007BA00021C28020007BA80021F78020007BB00021C0002000B4
:187BF8007BB80021000020007BC00021800020007BC80021A0002000E1
:107C1000000C00017674002160002000004000008C
:00000001FF

----------------------------------------------

Map file contents:

=========================

run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00200030 00200030 00000004 00000004 r-x
00200030 00200030 00000004 00000004 r-x .ti_catalog_arm_cortexm3_concertoInit_begin
00200040 00200040 00017634 00017634 r-x
00200040 00200040 0000003c 0000003c r-- .resetVecs
0020007c 0020007c 000149e2 000149e2 r-x .text
00214a60 00214a60 00002c14 00002c14 r-- .const
002176b8 002176b8 00000568 00000568 r--
002176b8 002176b8 00000558 00000558 r-- .cinit
00217c10 00217c10 00000010 00000010 r-- .binit
20000000 20000000 000001b0 00000000 rw-
20000000 20000000 000001b0 00000000 rw- .vecs
20006000 00217674 00000040 00000040 r-x
20006000 00217674 00000040 00000040 r-x .flashfuncs
20006080 20006080 00005f80 00000000 rw-
20006080 20006080 00001f80 00000000 rw- .bss.1

  • The hex converter is clearly trying to initialize addresses 0x217c10, etc.   The second-to-last line of the hex output you posted shows a write of 10 bytes to address ??7C10.

    len addr tp ck bytes                          ck
    :10 7C10 00 00 0C0001767400216000200000400000 8C

    Remember that the Intel format can only hold 16 bits worth of the address.  The upper 16 bits of the address are specified in an extended address record, of type "04".  Are you absolutely sure there isn't a preceding "04" record for 0021?  It would look like this:

    len addr tp ck
    :00 0021 04 FF
  • You mention hex2000 and C2prog, however the executable seems to be for the ARM processor as ARM hex utlity armhex is being run on it. If this is indeed an ARM executable, could you try setting the romwidth and memwidth to 32 and see if that helps?

  • Thanks. 0x217c10 is there in the hex output file. It was in the middle part of the file (see the contents at the end of this message). So it looks like the content of the file is right - but something else is not right.

    I use CCS jtag to program flash first and make sure it works and then use c2prog (uart0 interface) to overwite the content of the flash just to test.  C2prog erases JKLMN (Smart sector selection) and programs without any problem. But after I change SW1 to boot from flash, it does not run. I tried both  (romwidth=16 and memwidth=16) and (romwidth=32 and memwidth=32) on M3 (F28M35xx) - no success.  

    I tried to program only JKLM sectors by removing the contents of N from hex file and manually erasing JKLM sectors. But c2prog ends up with write error on sector J (write wrror 509 : address 0x21xxxx) though it erases that sector.

    ............................................................................................................................................................................................

    :20FFBC00EA1C0F00D105481668008800EA1C0F00D00E48166AA1680091004B139501491149
    :20FFDC006AAA468692026808881A4661462347F02020F3808811F1050110F1040010F004EC
    :04FFFC00FBA989389C
    :020000040021D9
    :200000002800D1B2BDFE46C0F4A820007540002176560021754C002175480021755000214F
    :20002000755C00217654002175580021E92D4FF82020F38088114C2C4A283C24681569A17B

    ...

    :187BF8007BB80021000020007BC00021800020007BC80021A0002000E1
    :107C1000000C00017674002160002000004000008C
    :00000001FF

  • You should consider using a hex command file if you want to pick and choose sections to program.  If you cut up the hex file by hand, you risk inadvertently cutting out an "04" record or similar.

    I'm sorry, I'm not at all familiar with c2prog, so I can't help you with that specifically.