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.

assistance flashing binaries created using GreenHills compiler

Other Parts Discussed in Thread: UNIFLASH

Pardon the question from a dumb software guy.

I am attempting to flash a program created in a GHS compiler.

I can successfully flash and run TI example code using UniFlash.

TMC129XNCZAD - Stellaris In-Circuit Debug Interface/CORTEX_M4_0

Not sure which details matter.  I note that the TI code is EABI 5, GHS is EABI 1.

[16:47:40] Operation Launching session returned. 

[16:47:40] Loaded target configuration from: C:\Users\chchr\src\tiva.ccxml
[16:48:42] Start operations on multiple programs on the target core...
[16:48:42] Loading program: C:\Users\chchr\src\haLO\platform\tm4c129x\tikitflash
[16:48:43] ERROR >> CORTEX_M4_0: File Loader: Data verification failed at address 0x00000000 Please verify target memory and memory map.

[16:48:43] ERROR >> CORTEX_M4_0: GEL: File: C:\Users\chchr\src\haLO\platform\tm4c129x\tikitflash: a data verification error occurred, file load failed.

[16:48:43] File: C:\Users\chchr\src\haLO\platform\tm4c129x\tikitflash: a data verification error occurred, file load failed.
[16:48:43] Programs operation finished.

$ arm-stellaris-eabi-objdump.exe -x tikitflash | sed 50q

tikitflash: file format elf32-littlearm
tikitflash
architecture: arm, flags 0x00000012:
EXEC_P, HAS_SYMS
start address 0x00000438

Program Header:
LOAD off 0x00000200 vaddr 0x00000000 paddr 0x00000000 align 2**7
filesz 0x00000400 memsz 0x00000400 flags r-x
LOAD off 0x00000600 vaddr 0x00000400 paddr 0x00000000 align 2**2
filesz 0x00000030 memsz 0x00000030 flags r-x
LOAD off 0x00000630 vaddr 0x00000430 paddr 0x00000000 align 2**2
filesz 0x0001dfe0 memsz 0x0001dfe0 flags r-x
LOAD off 0x0001e610 vaddr 0x0001e410 paddr 0x00000000 align 2**1
filesz 0x00000004 memsz 0x00000004 flags r-x
LOAD off 0x0001e614 vaddr 0x0001e414 paddr 0x00000000 align 2**2
filesz 0x00001c77 memsz 0x00001c77 flags r-x
LOAD off 0x0002028c vaddr 0x0002008c paddr 0x00000000 align 2**2
filesz 0x0000003c memsz 0x0000003c flags r-x
LOAD off 0x000202c8 vaddr 0x000200c8 paddr 0x00000000 align 2**2
filesz 0x000002b4 memsz 0x000002b4 flags r-x
LOAD off 0x00000000 vaddr 0x20008000 paddr 0x00000000 align 2**7
filesz 0x00000000 memsz 0x00000400 flags rwx
LOAD off 0x00000000 vaddr 0x20008400 paddr 0x00000000 align 2**2
filesz 0x00000000 memsz 0x000002b4 flags rwx
LOAD off 0x00000000 vaddr 0x20008800 paddr 0x00000000 align 2**10
filesz 0x00000000 memsz 0x0000cd00 flags rwx
LOAD off 0x00000000 vaddr 0x20015500 paddr 0x00000000 align 2**4
filesz 0x00000000 memsz 0x00000200 flags rwx
LOAD off 0x00000000 vaddr 0x20015700 paddr 0x00000000 align 2**4
filesz 0x00000000 memsz 0x00002000 flags rwx
LOAD off 0x00000000 vaddr 0x20017700 paddr 0x00000000 align 2**4
filesz 0x00000000 memsz 0x00000190 flags rwx
private flags = 1372600: [Version1 EABI] [unsorted symbol table]<Unrecognised flag bits set>

Sections:
Idx Name Size VMA LMA File off Algn
0 .ROM.vector 00000400 00000000 00000000 00000200 2**7
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .reset 00000030 00000400 00000400 00000600 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .text 0001dfe0 00000430 00000430 00000630 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .syscall 00000004 0001e410 0001e410 0001e610 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .rodata 00001c77 0001e414 0001e414 0001e614 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .secinfo 0000003c 0002008c 0002008c 0002028c 2**2

...

Thanks!

  • continuing:

    5 .secinfo 0000003c 0002008c 0002008c 0002028c 2**2
    CONTENTS, ALLOC, LOAD, READONLY, DATA
    6 .ROM.data 000002b4 000200c8 000200c8 000202c8 2**2
    CONTENTS, ALLOC, LOAD, READONLY, DATA
    7 .vector 00000400 20008000 20008000 00000200 2**7
    ALLOC, CODE
    8 .sdata 00000000 20008400 20008400 00000000 2**0
    ALLOC, READONLY
    9 .data 000002b4 20008400 20008400 000202c8 2**2
    ALLOC
    10 .bss 0000cd00 20008800 20008800 00000000 2**10
    ALLOC
    11 .heap 00000200 20015500 20015500 00000000 2**4
    ALLOC
    12 .stack 00002000 20015700 20015700 00000000 2**4
    ALLOC
    13 .istack 00000190 20017700 20017700 00000000 2**4
    ALLOC
    14 /DISCARD/ 00000000 00000000 00000000 00000000 2**0
    CONTENTS, READONLY
    15 .linfix 00000000 00000000 00000000 00000000 2**2
    CONTENTS, READONLY
    16 .gstackfix 00000000 00000000 00000000 00000000 2**2
    CONTENTS, READONLY
    SYMBOL TABLE:
    00000000 l df *ABS* 00000000 crt0.arm
    00000000 l df *ABS* 00000000 ..\..\main\halo.c

  • Chip,

    Do the GH tools come with a utility to convert the executable into a standard format for flash programming.  In the TI tools we have something called the hex conversion utility that can convert the output of the TI compiler into various different formats (ASCII-hex, Intel, Motorola, TI...).  If they have such a utility you may be able to run that and then use Uniflash to program.  It is even possible that our utility might work on the GH output but I have not tried that.

    Regards,

    John

  • I suppose what I'm asking is what "standard format for flash programming" means.  I'll check with GHS.

    I'm hard pressed to find a difference in the file format produced by the 2 compilers aside from the ABI version.

    UniFlash successfully flashes the one from CCS but not the one from GHS.

    This is the GHS-created binary:

    $ file tikitflash
    tikitflash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped

    $ od -c tikitflash | sed 20q
    0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0
    0000020 002 \0 ( \0 001 \0 \0 \0 8 004 \0 \0 4 \0 \0 \0
    0000040 314 \a 004 \0 \0 & 7 001 4 \0 \0 \r \0 ( \0
    0000060 035 \0 034 \0 001 \0 \0 \0 \0 002 \0 \0 \0 \0 \0 \0
    0000100 \0 \0 \0 \0 \0 004 \0 \0 \0 004 \0 \0 005 \0 \0 \0
    0000120 200 \0 \0 \0 001 \0 \0 \0 \0 006 \0 \0 \0 004 \0 \0
    0000140 \0 \0 \0 \0 0 \0 \0 \0 0 \0 \0 \0 005 \0 \0 \0
    0000160 004 \0 \0 \0 001 \0 \0 \0 0 006 \0 \0 0 004 \0 \0
    0000200 \0 \0 \0 \0 340 337 001 \0 340 337 001 \0 005 \0 \0 \0
    0000220 004 \0 \0 \0 001 \0 \0 \0 020 346 001 \0 020 344 001 \0
    0000240 \0 \0 \0 \0 004 \0 \0 \0 004 \0 \0 \0 005 \0 \0 \0
    0000260 002 \0 \0 \0 001 \0 \0 \0 024 346 001 \0 024 344 001 \0
    0000300 \0 \0 \0 \0 w 034 \0 \0 w 034 \0 \0 005 \0 \0 \0
    0000320 004 \0 \0 \0 001 \0 \0 \0 214 002 002 \0 214 \0 002 \0
    0000340 \0 \0 \0 \0 < \0 \0 \0 < \0 \0 \0 005 \0 \0 \0

    This is from CCS:

    $ file boot_demo_emac_flash.out
    boot_demo_emac_flash.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

    $ od -c boot_demo_emac_flash.out | sed 20q
    0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0
    0000020 002 \0 ( \0 001 \0 \0 \0 q 273 \0 \0 304 301 \n \0
    0000040 $ 302 \n \0 \0 \0 \0 005 4 \0 \0 003 \0 ( \0
    0000060 030 \0 027 \0 \0 \0 \0 \0 314 214 \0 - 317 \0 \0
    0000100 323 224 \0 \0 347 _ \0 \0 \v e \0 \0 \v e \0 \0
    0000120 \v e \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
    0000140 \0 \0 \0 \0 \v e \0 \0 \v e \0 \0 \0 \0 \0 \0
    0000160 \v e \0 \0 9 317 \0 \0 \v e \0 \0 \v e \0 \0
    0000200 \v e \0 \0 \v e \0 \0 \v e \0 \0 \v e \0 \0
    *
    0000420 \v e \0 \0 \v e \0 \0 215 266 \0 \0 \v e \0 \0
    0000440 \v e \0 \0 \v e \0 \0 \v e \0 \0 \v e \0 \0
    *
    0000600 \v e \0 \0 \v e \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
    0000620 \v e \0 \0 \v e \0 \0 \v e \0 \0 \v e \0 \0
    0000640 \0 \0 \0 \0 \v e \0 \0 \v e \0 \0 \v e \0 \0
    0000660 \v e \0 \0 \v e \0 \0 \v e \0 \0 \v e \0 \0
    *
    0001060 \v e \0 \0 \v e \0 \0 - 351 370 O 006 F 206 H
    0001100 337 370 020 302 001 h 203 F 177 H \0 x @ \t 300 360

  • The GHS flash programmer supports "ELF, Raw Binary and S-Record".  

    I see I can create/convert to S-Record if that helps.

  • 09:59:48] Start operations on multiple programs on the target core...
    [09:59:48] Loading program: C:\Users\chchr\src\haLO\platform\tm4c129x\foo
    [09:59:49] ERROR >> CORTEX_M4_0: GEL: Erorr on line 4716 : Undefined Record Type

    [09:59:49] Erorr on line 4716 : Undefined Record Type
    [09:59:50] Programs operation finished.

    $ wc -l foo
    4717 foo

    $ tail foo

    S321000202A0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56
    S321000202BCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3A
    S321000202D8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1E
    S321000202F4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02
    S32100020310FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5
    S3210002032CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9
    S32100020348FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAD
    S31D00020364FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFF81
    S5050000126A7E
    S70500000438BE

  • Chip,

    I would give the S-Record file a try.  I bet Uniflash will be able to load that ok.  CCS can't, but Uniflash should work.  If you then want to debug in CCS you could try loading in Uniflash and then load symbols via CCS.

    We don't do any integration testing with the GHS compiler today.  Would you be switching to MULTI later, i.e. just trying to do some benchmarking on the LaunchPad and need a way to load or are you looking to use CCS to debug GHS programs for development?

    Regards,

    John

  • I deleted this unknown record from the S-Record format file and it flashed:

    S5050000126A7E

    I don't know what that means but it's progress of a sort.  Thanks!

    We expect to have the right code to flash from MULTI in about 2 weeks.  I'm trying to get to the point now where I can flash through the bootloader.  

  • The record that GHS creates and TI doesn't recognize:

    S5 Count 16-bit
    Count
    No This optional record contains a 16-bit count of S1 / S2 / S3 records.[1] This record is used if the record count is less than or equal to 65,535 (0xFFFF), otherwise S6record would be used.
  • If the GHS compiler or tools support, please convert your binary to a .bin file.

    Basically a pure binary file representing the byte stream of the binary as it appears in the target memory, with no metadata what so ever.

    When you load it in UniFlash, select Load Binary Program from the menu, and give it a start address, usually "0x0" as that's where the stellaris flash starts at.

    This .bin format of pure byte array is definitely an "universal" format because of its simplicity.

    Victor

  • Thanks!  The .mem generated by GHS MULTI also successfully flashes.  Now the real fun starts.