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.
Tool/software: Code Composer Studio
I wish to use GCC to compile some code (so that I can integrate some other libraries that have been compiled with the GCC tools down the road). I enabled the 'GCC' option in Halcogen to generate some code, and opened it in CCS. I changed the toolchain in CCS to GCC (GNU v7.2.1 Linaro), and added the following flags to get rid of errors about certain instructions that it said weren't supported,
-mcpu=cortex-r5 -mfloat-abi=hard
so my complete build command is,
-mcpu=cortex-r5 -mfloat-abi=hard -I"C:/Users/Andrew/Code/ti_projects/demo_server" -I"C:/Users/Andrew/Code/ti_projects/demo_server/include" -I"C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall
But I'm now getting several thousand errors, I think some of them look like the comments in the .asm files are being read as instructions?
Here's a snippet of the errors output:
I tried adding the -mccs flag but it was an unrecognized flag to the compiler. Side note: I'm using windows 10
If anyone can help me out it would be so appreciated.
I haven't yet attempt to create a HalCoGen for a TMS570LC4357 with GCC to investigate the cause of the errors from the assembler, but an initial search found How to create a project using GCC on TMS570 which is another issue in that:
Also, which version of HalGoGen are you using?
The HalCoGen code generation creates:Andrew Rooney said:But I'm now getting several thousand errors, I think some of them look like the comments in the .asm files are being read as instructions?
The .asm assembler files generate lots of errors when used with the GCC compiler, due to what are comments attempted to be compiled as assembler statements.
When a new HalCoGen project is created the defaults selection for the Tools option is "Texas Instrument Tools".
To remove the assembler errors in your project try:
When I used CCS 10, HalCoGen 04.06.00 and gcc-arm-none-eabi-7-2017-q4-major-win32 I found those two options were not sufficient to remove the errors about instruction not supported, I also had to add -mfpu=vfpv3-d16Andrew Rooney said:I changed the toolchain in CCS to GCC (GNU v7.2.1 Linaro), and added the following flags to get rid of errors about certain instructions that it said weren't supported,
1-mcpu=cortex-r5 -mfloat-abi=hard
I was able to compile and link a HalCoGen project for a TMS570LC4357 using GNU v7.2.1, but the program doesn't run since the first instruction executed leads to an Undefined Instruction Exception. The generated executable is little-endian, which is the ARM GCC default, but the TMS570LC4357 is big-endian.
Attempting to add the -mbig-endian option to the compiler then results in errors from the linker:
Invoking: GNU Linker "C:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -specs="nosys.specs" -mbig-endian -mfloat-abi=hard -Wl,-Map,"TMS570LC4357_GCC_halcogen.map" -o"TMS570LC4357_GCC_halcogen.out" "./source/HL_adc.o" "./source/HL_can.o" "./source/HL_crc.o" "./source/HL_dcc.o" "./source/HL_ecap.o" "./source/HL_emac.o" "./source/HL_emif.o" "./source/HL_epc.o" "./source/HL_eqep.o" "./source/HL_errata.o" "./source/HL_esm.o" "./source/HL_etpwm.o" "./source/HL_gio.o" "./source/HL_het.o" "./source/HL_i2c.o" "./source/HL_lin.o" "./source/HL_mdio.o" "./source/HL_mibspi.o" "./source/HL_nmpu.o" "./source/HL_notification.o" "./source/HL_phy_dp83640.o" "./source/HL_phy_tlk111.o" "./source/HL_pinmux.o" "./source/HL_pom.o" "./source/HL_rti.o" "./source/HL_sci.o" "./source/HL_sys_core.o" "./source/HL_sys_dma.o" "./source/HL_sys_intvecs.o" "./source/HL_sys_main.o" "./source/HL_sys_mpu.o" "./source/HL_sys_pcr.o" "./source/HL_sys_phantom.o" "./source/HL_sys_pmm.o" "./source/HL_sys_pmu.o" "./source/HL_sys_startup.o" "./source/HL_sys_vim.o" "./source/HL_system.o" -Wl,-T"../source/HL_sys_link.ld" makefile:177: recipe for target 'TMS570LC4357_GCC_halcogen.out' failed c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crti.o: compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crti.o c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtbegin.o: compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtbegin.o c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard/crt0.o: compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard/crt0.o c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-exit.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-exit.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-impure.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-impure.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-init.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-init.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-memcpy-stub.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-memcpy-stub.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-memset.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-memset.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-__call_atexit.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-__call_atexit.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-atexit.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-atexit.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-fini.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-fini.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-lock.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-lock.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-__atexit.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libc.a(lib_a-__atexit.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libm.a(lib_a-s_floor.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libm.a(lib_a-s_floor.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libnosys.a(_exit.o): compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/hard\libnosys.a(_exit.o) c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtend.o: compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtend.o c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtn.o: compiled for a little endian system and target is big endian c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file c:/ti/ccs1000/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard/crtn.o collect2.exe: error: ld returned 1 exit status
I think this is because the run time libraries supplied with gcc-arm-none-eabi-7-2017-q4-major-win32 are only compiled for little-endian by default. And based upon the posts I previously mentioned I think that gcc needs to be re-built to enable big-endian run time libraries.
Thanks everyone.
Thanks Chester, I did manage to get to that state late last night. What I haven't yet manged to do is find any resources that might tell me how to actually get big endian C runtime libraries, so if you stumble upon that, please let me know!
TMS570LS and GCC compiler contains a patch to the ARM GCC 5 2015q4 source to enable big endian runtime libraries.Andrew Rooney said:What I haven't yet manged to do is find any resources that might tell me how to actually get big endian C runtime libraries, so if you stumble upon that, please let me know!
I have downloaded the https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-src.tar.bz2 source, and am in the process of following the instructions in the How-to-build-toolchain.pdf to build GNU v7.2.1 to try creating a suitable patch for that version.
Edit: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads contains the download links for the source for different versions.
The first problem I had was that the install-sources.sh script was failing, without any apparent error.Chester Gillon said:and am in the process of following the instructions in the How-to-build-toolchain.pdf to build GNU v7.2.1 to try creating a suitable patch for that version.
Turns out the website it was trying to download the libelf source from was returning a HTTP 404 (as noted by https://github.com/oracle/crashcart/issues/14)
To allow install-sources.sh to complete, in gcc-arm-none-eabi-7-2017-q4-major/build-common.sh had to change from:
LIBELF_URL=http://www.mr511.de/software/$LIBELF_PACK
To:
LIBELF_URL=https://fossies.org/linux/misc/old/$LIBELF_PACK
I was able to build a modified GNU v7.2.1 (gcc-arm-none-eabi-7-2017-q4-major) in which the src/gcc/gcc/config/arm/t-rmprofile file was modified to add multi-lib support for big-endian for armv7-ar.Chester Gillon said:am in the process of following the instructions in the How-to-build-toolchain.pdf to build GNU v7.2.1 to try creating a suitable patch for that version.
While an example for a TMS570LC4357 was able to be compiled and linked for big-endian, the resulting example program failed to set up the peripherals correctly. On stepping in the debugger found that the generated assembler for the HalGoGen generated getResetSource function was incorrect, leading to _c_int00 failing to detect the reset source and failing to initialise the clocks and release the peripherals from reset.
I went back to the unmodified GNU v7.2.1, and even when compiling for little-endian the generated assembler for the getResetSource function was incorrect in the same way as with my modified GNU v7.2.1 compiler. I.e. appears to be an existing issue with the compiler rather than introduced by my changes (which only targeted the run time library versions built).
Andrew Rooney said:I changed the toolchain in CCS to GCC (GNU v7.2.1 Linaro)
Do you need to use GNU v7.2.1, or can I try the same modification with a later version of the compiler?
My CCS 10 installation has GNU ARM v7.3.1 and v9.2.1 also available.
Thanks again for the help.
We should be fine with whatever version of GNU, 7.2.1 was just the version available by default.
On further investigation the issue wasn't with the compiler, but bug HERCULES_SW-6008 "getResetSource GCC Naked Attribute should be removed" in HalCoGen 04.07.00.While an example for a TMS570LC4357 was able to be compiled and linked for big-endian, the resulting example program failed to set up the peripherals correctly. On stepping in the debugger found that the generated assembler for the HalGoGen generated getResetSource function was incorrect, leading to _c_int00 failing to detect the reset source and failing to initialise the clocks and release the peripherals from reset.
Upgrading to HalCoGen 04.07.01 fixed the issue (as I described in https://e2e.ti.com/support/tools/ccs/f/81/t/909137).
The GCC ARM based upon v7.2.1 I re-built with big-endian run time libraries is available at gcc-arm-none-eabi-7-2020-q2-update. This includes the updated source, along with Windows and Linux executables. That is on my Google drive which I should have set to shared - let me know if it is not accessible.
I changed the version number to 7.2.1p1 to make it clear it is a modified version, rather than the standard version installed by CCS. If you install it in the CCS ccs/tools/compiler directory it should be discovered by CCS and be able to selected in a project as Compiler Version "GNU v7.2.1p1 (Linaro)":
I have attached an example CCS 10 project for a TMS570LC4357 which has been built with the above compiler, using HalCoGen 04.07.01.
In the CCS project properties under CCS Build -> GNU Linker -> Miscellaneous I had to add the following flags to make the linker select the appropriate run time libraries:
-mcpu=cortex-r5 -mfpu=vfpv3-d16 -mbig-endian
And for reference the changes made to the gcc-arm-none-eabi-7-2017-q4-major source were:
1. Change the URL used to download the libelf source to a URL which is active:
$ git diff /mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/build-common.sh build-common.sh diff --git a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/build-common.sh b/build-common.sh index 0cb4808..5383a89 100755 --- a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/build-common.sh +++ b/build-common.sh @@ -300,7 +300,7 @@ MPFR_URL=https://ftp.gnu.org/gnu/mpfr/$MPFR_PACK MPC_URL=ftp://ftp.gnu.org/gnu/mpc/$MPC_PACK ISL_URL=http://isl.gforge.inria.fr/$ISL_PACK EXPAT_URL=https://downloads.sourceforge.net/project/expat/expat/$EXPAT_VER/$EXPAT_PACK -LIBELF_URL=http://www.mr511.de/software/$LIBELF_PACK +LIBELF_URL=https://fossies.org/linux/misc/old/$LIBELF_PACK LIBICONV_URL=https://ftp.gnu.org/pub/gnu/libiconv/$LIBICONV_PACK ZLIB_URL=http://www.zlib.net/fossils/$ZLIB_PACK ENV_VAR_UPDATE_URL=http://nsis.sourceforge.net/mediawiki/images/a/ad/$ENV_VAR_UPDATE_PACK
2. Change the version:
$ git diff /mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/BASE-VER src/gcc/gcc/BASE-VER diff --git a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/BASE-VER b/src/gcc/gcc/BASE-VER old mode 100755 new mode 100644 index b26a34e..1c97a5a --- a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/BASE-VER +++ b/src/gcc/gcc/BASE-VER @@ -1 +1 @@ -7.2.1 +7.2.1p1
3. Modify the t-rmprofile Makefile fragment to add the building big-endian versions of the run-time libraries for Cortex-R:
$ git diff /mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/config/arm/t-rmprofile src/gcc/gcc/config/arm/t-rmprofile | cat diff --git a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/config/arm/t-rmprofile b/src/gcc/gcc/config/arm/t-rmprofile old mode 100755 new mode 100644 index d4bc9fd..276648d --- a/mnt/gcc_arm_toolchain/gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/config/arm/t-rmprofile +++ b/src/gcc/gcc/config/arm/t-rmprofile @@ -37,6 +37,7 @@ MULTILIB_REUSE = # FPU: VFPv3-D16 (fpv3), FPV4-SP-D16 (fpv4-sp), FPV5-SP-D16 (fpv5-sp), # VFPv5-D16 (fpv5), or None (.). # Float-abi: Soft (.), softfp (softfp), or hard (hardfp). +# Endianness: Little (.) or Big (big-endian) # Options to build libraries with @@ -52,6 +53,9 @@ MULTILIB_DIRNAMES += fpv3 fpv4-sp fpv5-sp fpv5 MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard MULTILIB_DIRNAMES += softfp hard +MULTILIB_OPTIONS += mbig-endian +MULTILIB_DIRNAMES += big-endian + # Option combinations to build library with @@ -86,6 +90,9 @@ MULTILIB_REQUIRED += mthumb/march=armv8-m.main/mfpu=fpv5-sp-d16/mfloat-abi= MULTILIB_REQUIRED += mthumb/march=armv7 MULTILIB_REQUIRED += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=softfp MULTILIB_REQUIRED += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_REQUIRED += mthumb/march=armv7/mbig-endian +MULTILIB_REQUIRED += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=softfp/mbig-endian +MULTILIB_REQUIRED += mthumb/march=armv7/mfpu=vfpv3-d16/mfloat-abi=hard/mbig-endian # Matches @@ -171,6 +178,13 @@ MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp=ma MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7/mfpu.fpv5-d16/mfloat-abi.hard MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/march.armv7/mfpu.fpv5-d16/mfloat-abi.softfp MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard=mthumb/march.armv7/mfpu.fpv5-d16/mfloat-abi.hard +MULTILIB_REUSE += mthumb/march.armv7/mbig-endian=march.armv7/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp/mbig-endian=march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian=march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp/mbig-endian=march.armv7/mfpu.fpv5-d16/mfloat-abi.softfp/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian=march.armv7/mfpu.fpv5-d16/mfloat-abi.hard/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.softfp/mbig-endian=mthumb/march.armv7/mfpu.fpv5-d16/mfloat-abi.softfp/mbig-endian +MULTILIB_REUSE += mthumb/march.armv7/mfpu.vfpv3-d16/mfloat-abi.hard/mbig-endian=mthumb/march.armv7/mfpu.fpv5-d16/mfloat-abi.hard/mbig-endian # Map ARMv7E-M FPV5-SP-D16 to FPV4-SP-D16 MULTILIB_REUSE += mthumb/march.armv7e-m/mfpu.fpv4-sp-d16/mfloat-abi.softfp=mthumb/march.armv7e-m/mfpu.fpv5-sp-d16/mfloat-abi.softfp