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.

ARM-CGT: TI Clang tiarmhex Utility unable to produce array output

Part Number: ARM-CGT
Other Parts Discussed in Thread: CC1314R10

Tool/software:

We've been using the ARM HEX utility from the TI-ARM-CGT v20.2.7 LTS to produce an array to embed in our main program in order to implement over-the-air updates. This has been working fine.

We're now in the progress if implementing a new project using  simplelink_cc13xx_cc26xx_sdk_7_41_00_17 together with TI Clang v3.2.2.LTS and would like to continue using our existing system for over-the-air updates.

However the ARM HEX utility does never finish the conversion and instead seems to add an endless stream of 0x00 to the array with the output file growing indefinitely.

The issue can be reproduced using the "empty_LP_EM_CC1314R10_tirtos7_ticlang" example from the SDK examples and enabling the ARM HEX utility to produce an array.

Any help would be appreciated.

  • Hi Pascal,

    Instead of using the Arm Hex utility, please add the following Post-build step inside of CCS -> Project Properties -> CCS Build -> Steps:

    ${CG_TOOL_ROOT}/bin/tiarmhex -order MS --memwidth=8 --romwidth=8 --intel -o ${BuildArtifactFileBaseName}.hex ${BuildArtifactFileBaseName} 

    Regards,
    Ryan

  • Hi Ryan,

    Thanks for the quick response. However as I mentioned in my OP we are trying to use the --array output from the Hex tool.

    Adjusting your command to use --array and adding it as a post-build step results in the same issue.

    ${CG_TOOL_ROOT}/bin/tiarmhex -order MS --array -o ${BuildArtifactFileBaseName}.hex ${BuildArtifactFileBaseName}

  • I apologize for missing that part of your OP and thank you for clarifying your intent.  I'm not seeing any "array" option in the tiarmobjcopy.exe help:

    C:\ti\ti_cgt_tiarmclang_2.1.2.LTS\bin>tiarmobjcopy.exe --help
    OVERVIEW: llvm-objcopy tool
    
    USAGE: llvm-objcopy [options] input [output]
    
    OPTIONS:
      --add-gnu-debuglink=debug-file
                              Add a .gnu_debuglink for <debug-file>
      --add-section=section=file
                              Make a section named <section> with the contents of <file>.
      --add-symbol=name=[section:]value[,flags]
                              Add new symbol <name> to .symtab. Accepted flags: global, local, weak, default, hidden, protected, file, section, object, function, indirect-function. Accepted but ignored for compatibility: debug, constructor, warning, indirect, synthetic, unique-object, before.
      --adjust-start <value>  Alias for --change-start
      --allow-broken-links    Allow the tool to remove sections even if it would leave invalid section references. The appropriate sh_link fields will be set to zero.
      --binary-architecture=<value>
                              Ignored for compatibility
      -B <value>              Alias for --binary-architecture
      --change-start=incr     Add <incr> to the start address. Can be specified multiple times, all values will be applied cumulatively.
      --compress-debug-sections=[ zlib | zlib-gnu ]
                              Compress DWARF debug sections using specified style. Supported styles: 'zlib-gnu' and 'zlib'
      --decompress-debug-sections
                              Decompress DWARF debug sections.
      --disable-deterministic-archives
                              Disable deterministic mode when operating on archives (use real values for UIDs, GIDs, and timestamps).
      --discard-all           Remove all local symbols except file and section symbols. Also remove all debug sections
      --discard-locals        Remove compiler-generated local symbols, (e.g. symbols starting with .L)
      --dump-section=section=file
                              Dump contents of section named <section> into file <file>
      -D                      Alias for --enable-deterministic-archives
      --enable-deterministic-archives
                              Enable deterministic mode when operating on archives (use zero for UIDs, GIDs, and timestamps).
      --extract-dwo           Remove all sections that are not DWARF .dwo sections from file
      --extract-main-partition
                              Extract main partition from the input file
      --extract-partition=name
                              Extract named partition from input file
      -F <value>              Alias for --target
      --globalize-symbol=symbol
                              Mark <symbol> as global
      --globalize-symbols=filename
                              Reads a list of symbols from <filename> and marks them global.
      -G <value>              Alias for --keep-global-symbol
      -g                      Alias for --strip-debug
      --input-target=<value>  Format of the input file
      -I <value>              Alias for --input-target
      -j <value>              Alias for --only-section
      --keep-file-symbols     Do not remove file symbols
      --keep-global-symbol=symbol
                              Convert all symbols except <symbol> to local. May be repeated to convert all except a set of symbols to local.
      --keep-global-symbols=filename
                              Reads a list of symbols from <filename> and runs as if --keep-global-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files.
      --keep-section=section  Keep <section>
      --keep-symbol=symbol    Do not remove symbol <symbol>
      --keep-symbols=filename Reads a list of symbols from <filename> and runs as if --keep-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files.
      --keep-undefined        Do not remove undefined symbols
      -K <value>              Alias for --keep-symbol
      --localize-hidden       Mark all symbols that have hidden or internal visibility as local
      --localize-symbol=symbol
                              Mark <symbol> as local
      --localize-symbols=filename
                              Reads a list of symbols from <filename> and marks them local.
      -L <value>              Alias for --localize-symbol
      --new-symbol-visibility=<value>
                              Visibility of symbols generated for binary input or added with --add-symbol unless otherwise specified. The default value is 'default'.
      -N <value>              Alias for --strip-symbol
      --only-keep-debug       Produce a debug file as the output that only preserves contents of sections useful for debugging purposes
      --only-section=section  Remove all but <section>
      --output-target=<value> Format of the output file
      -O <value>              Alias for --output-target
      --prefix-alloc-sections=prefix
                              Add <prefix> to the start of every allocated section name
      --prefix-symbols=prefix Add <prefix> to the start of every symbol name
      --preserve-dates        Preserve access and modification timestamps
      -p                      Alias for --preserve-dates
      --redefine-sym=old=new  Change the name of a symbol old to new
      --redefine-syms=filename
                              Reads a list of symbol pairs from <filename> and runs as if --redefine-sym=<old>=<new> is set for each one. <filename> contains two symbols per line separated with whitespace and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files.
      --regex                 Permit regular expressions in name comparison
      --remove-section=section
                              Remove <section>
      --rename-section=old=new[,flag1,...]
                              Renames a section from old to new, optionally with specified flags. Flags supported for GNU compatibility: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings.
      -R <value>              Alias for --remove-section
      --set-section-alignment=section=align
                              Set alignment for a given section.
      --set-section-flags=section=flag1[,flag2,...]
                              Set section flags for a given section. Flags supported for GNU compatibility: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings.
      --set-start=addr        Set the start address to <addr>. Overrides any previous --change-start or --adjust-start values.
      --split-dwo=dwo-file    Equivalent to extract-dwo on the input file to <dwo-file>, then strip-dwo on the input file
      --strip-all-gnu         Compatible with GNU's --strip-all
      --strip-all             Remove non-allocated sections outside segments. .gnu.warning* and .ARM.attribute sections are not removed
      --strip-debug           Remove all debug sections
      --strip-dwo             Remove all DWARF .dwo sections from file
      --strip-non-alloc       Remove all non-allocated sections outside segments
      --strip-sections        Remove all section headers and all sections not in segments
      --strip-symbol=symbol   Strip <symbol>
      --strip-symbols=filename
                              Reads a list of symbols from <filename> and removes them.
      --strip-unneeded-symbol=symbol
                              Remove symbol <symbol> if it is not needed by relocations
      --strip-unneeded-symbols=filename
                              Reads a list of symbols from <filename> and removes them if they are not needed by relocations
      --strip-unneeded        Remove all symbols not needed by relocations
      --subsystem=name[:version]
                              Set PE subsystem and version
      -S                      Alias for --strip-all
      --target=<value>        Format of the input and output file
      --update-section=name=file
                              Add section <name> with contents from a file <file>.
      -U                      Alias for --disable-deterministic-archives
      --version               Print the version and exit.
      -V                      Alias for --version
      --weaken-symbol=symbol  Mark <symbol> as weak
      --weaken-symbols=filename
                              Reads a list of symbols from <filename> and marks them weak.
      --weaken                Mark all global symbols as weak
      --wildcard              Allow wildcard syntax for symbol-related flags. Incompatible with --regex. Allows using '*' to match any number of characters, '?' to match any single character, '' to escape special characters, and '[]' to define character classes. Wildcards beginning with '!' will prevent a match, for example "-N '*' -N '!x'" will strip all symbols except for "x".
      -W <value>              Alias for --weaken-symbol
      -w                      Alias for --wildcard
      -X                      Alias for --discard-locals
      -x                      Alias for --discard-all
    
    Pass @FILE as argument to read options from FILE.

    I will notify the TI Compiler Team of this thread so that they can offer some advice.  You can also look at the TI ARM Clang Compiler User's Guide to determine if there is any useful information within.

    Regards,
    Ryan

  • The hex utility only processes initialized sections such as .text.  All other sections are ignored.  When converting to --array format, any holes between initialized sections are filled with 0.  This occurs without regard to the size of the hole.  In this case, a very large hole occurs between the end of the .cinit section and the beginning of the .ccfg section.  Filling this large hole with 0 takes so long, you presume tiarmhex is hung and kill it before it completes.  

    The solution is to supply a ROMS directive similar to ...

    /* roms_directive.txt */
    
    ROMS
    {
        name1 : origin = 0x00000000, length = 0x457c
        name2 : origin = 0x50000000, length = 0x7c
    }

    Please see the documentation of the ROMS directive.  I gave each entry a very vague name.  Change those names to something meaningful.

    Here is how to determine the values to use for each entry.  Inspect the linker map file.  Use the part titled SECTION ALLOCATION MAP.  Review each output section.  Ignore sections that are marked UNINITIALIZED or DSECT, or have a length of 0 bytes.  For the remaining sections, combine them into loose groups based on how close they are.  Note the start address and length of each group.  In this particular case, I combined these sections for the first entry.

    • .resetVecs
    • .text
    • .rodata
    • .args
    • .cinit

    The base address is the same as that of .resetVecs.  In this case, that address is 0.  The length is determined by adding up all their sizes.  The second entry only contains one section.

    • .ccfg

    Thus, the base address and length are the same as those of this section.

    Run a command similar to ...

    % tiarmhex --array -o empty_LP_EM_CC1314R10_tirtos7_ticlang_array.c roms_directive.txt empty_LP_EM_CC1314R10_tirtos7_ticlang.out

    Two arrays are created in the file empty_LP_EM_CC1314R10_tirtos7_ticlang_array.c.  The base address of each array is not present in that file.  That detail must be maintained in some other manner.

    Thanks and regards,

    -George

  • Hi George,

    You're absolutely right about the hole between the code and the .ccfg section causing the issue.

    Thank you for your help.