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.

TMS570LS1227: Issues compiling with ti-arm-clang

Part Number: TMS570LS1227

Hello,

Im attempting to use bring up a TMS570 dev-board and I'm having endianess issues with the TI-ARM-CLANG compiler/assembler/linker. I am compiling a simple hello world program on the command line.  I am building using the following options (I've omitted things like paths):

compiler: tiarmclang.exe -c -o startup.o -mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16 -std=c++14 -fno-rtti -fno-exceptions -O0 -Wall -Werror -g startup.cpp

assembler: tiarmclang.exe -c -o entry.o  -mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16 -Xassembler --fatal-warnings entry.s

linker: tiarmclang.exe -v -mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16 -Xlinker --output_file=TEST.TMS570LS1227.TI.out -Xlinker --map_file=TEST.TMS570LS1227.TI.map startup.o entry.o TEST.TMS570LS1227.TI.cmd

hexer: tiarmhex.exe --outfile TEST.TMS570LS1227.TI.hex --intel --romwidth=32 --memwidth=32 TEST.TMS570LS1227.TI.out

When I attempt to flash the dev board through CCS using the .hex file, I am able to load, run, and debug the program (albeit without debug symbols).  When I attempt to flash the dev board through CCS using the .out file, I get an error that says that the endianess of the .out file and the endianness of the target do not match (see below).

When I dump the file header for the .out file, the object dumper reads the .out as a little endian file.

When I attempt to add the -mbig-endian flag to the compiler, assembler, and linker, CCS is able to flash properly but the program instantly crashes.  An inspection of the code in the debugger reveals that the instructions have all been endian swapped.  In the picture below, the instruction at 0x00 should be a branch to entry point instruction, not a piece of data.

At this point, I'm not sure if there is something wrong with my build settings or if the compiler is incorrectly adding the little endian flag to the .out file.