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.

SYSCONFIG: v1.18.0, delivered with MCU+ SDK for AM64x v09.01.00.41 is unusable with GCC

Part Number: SYSCONFIG
Other Parts Discussed in Thread: AM6442

Hello,

At first place, the key products and versions:

  • OS: Windows 10
  • CCS IDE 12.5.0.00007
  • MCU+ SDK for AM64x v09.01.00.41
  • SYSCONFIG v1.18.0

After upgrading to MCU+ SDK for AM64x v09.01.00.41, I was trying to import an example project, in this case hello_world_am64x-evm_r5fss0-0_freertos_gcc-armv7. I have separately installed a recent GCC version (arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi) and try to build the project. The result is a failed build with the following linker error:

makefile:156: recipe for target 'hello_world_am64x-evm_r5fss0-0_freertos_gcc-armv7-09.01.out' failed
C:/ti/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:syscfg/linker.cmd:12: syntax error

make was executing the following link command:

Building target: "hello_world_am64x-evm_r5fss0-0_freertos_gcc-armv7-09.01.out"
Invoking: GNU Linker
"C:/ti/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc-13.2.1.exe" -mfpu=vfpv3-d16 -DSOC_AM64X -D_DEBUG_=1 -Og -ffunction-sections -fdata-sections -g -gdwarf-3 -gstrict-dwarf -Wall -Werror -Wno-unused-function -Wno-enum-compare -Wno-uninitialized -Wno-int-to-pointer-cast -fgnu89-inline -Wno-pointer-to-int-cast -Wno-unused-variable -Wno-unused-but-set-variable -mcpu=cortex-r5 -Wl,-Map,"hello_world.Debug.map" -static -Wl,--gc-sections -L"C:/ti/mcu_plus_sdk_am64x_09_01_00_41/source/kernel/freertos/lib" -L"C:/ti/mcu_plus_sdk_am64x_09_01_00_41/source/drivers/lib" -L"C:/ti/mcu_plus_sdk_am64x_09_01_00_41/source/board/lib" -L"/lib" -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -Wl,--build-id=none -o"hello_world_am64x-evm_r5fss0-0_freertos_gcc-armv7-09.01.out" "./syscfg/ti_dpl_config.o" "./syscfg/ti_drivers_config.o" "./syscfg/ti_drivers_open_close.o" "./syscfg/ti_pinmux_config.o" "./syscfg/ti_power_clock_config.o" "./syscfg/ti_board_config.o" "./syscfg/ti_board_open_close.o" "./syscfg/ti_enet_config.o" "./syscfg/ti_enet_open_close.o" "./syscfg/ti_enet_soc.o" "./syscfg/ti_enet_lwipif.o" "./hello_world.o" "./main.o" -Wl,-T"../linker.cmd" -Wl,-T"syscfg/linker.cmd"  -Wl,--start-group -lstdc++ -lgcc -lm -lnosys -l:freertos.am64x.r5f.gcc-armv7.debug.lib -l:drivers.am64x.r5f.gcc-armv7.debug.lib -l:board.am64x.r5f.gcc-armv7.debug.lib -lc -Wl,--end-group 
makefile:156: recipe for target 'hello_world_am64x-evm_r5fss0-0_freertos_gcc-armv7-09.01.out' failed
C:/ti/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe:syscfg/linker.cmd:12: syntax error

As you may notice above, the linker is invoked with a linker script -T"../linker.cmd", which translates to syscfg/linker.cmd:

Unfortunately, the content of this file is not for GNU, but for TICLANG:


 /* This is the stack that is used by code running within main()
  * In case of NORTOS,
  * - This means all the code outside of ISR uses this stack
  * In case of FreeRTOS
  * - This means all the code until vTaskStartScheduler() is called in main()
  *   uses this stack.
  * - After vTaskStartScheduler() each task created in FreeRTOS has its own stack
  */

 --stack_size=16384
/* This is the heap size for malloc() API in NORTOS and FreeRTOS
* This is also the heap used by pvPortMalloc in FreeRTOS
*/
 --heap_size=32768
-e_vectors  /* This is the entry of the application, _vector MUST be placed starting address 0x0 */

/* This is the size of stack when R5 is in IRQ mode
 * In NORTOS,
 * - Here interrupt nesting is enabled
 * - This is the stack used by ISRs registered as type IRQ
 * In FreeRTOS,
 * - Here interrupt nesting is enabled
 * - This is stack that is used initally when a IRQ is received
 * - But then the mode is switched to SVC mode and SVC stack is used for all user ISR callbacks
 * - Hence in FreeRTOS, IRQ stack size is less and SVC stack size is more
 */
__IRQ_STACK_SIZE = 256;
/* This is the size of stack when R5 is in IRQ mode
 * - In both NORTOS and FreeRTOS nesting is disabled for FIQ
 */
__FIQ_STACK_SIZE = 256;
__SVC_STACK_SIZE = 4096; /* This is the size of stack when R5 is in SVC mode */
__ABORT_STACK_SIZE = 256;  /* This is the size of stack when R5 is in ABORT mode */
__UNDEFINED_STACK_SIZE = 256;  /* This is the size of stack when R5 is in UNDEF mode */



SECTIONS
{
    .vectors  : {
    } > R5F_VECS   , palign(8) 


    GROUP  :   {
    .text.hwi : {
    } palign(8)
    .text.cache : {
    } palign(8)
    .text.mpu : {
    } palign(8)
    .text.boot : {
    } palign(8)
    .text:abort : {
    } palign(8)
    } > MSRAM  


    GROUP  :   {
    .text : {
    } palign(8)
    .rodata : {
    } palign(8)
    } > MSRAM  


    GROUP  :   {
    .data : {
    } palign(8)
    } > MSRAM  


    GROUP  :   {
    .bss : {
    } palign(8)
    RUN_START(__BSS_START)
    RUN_END(__BSS_END)
    .sysmem : {
    } palign(8)
    .stack : {
    } palign(8)
    } > MSRAM  


    GROUP  :   {
    .irqstack : {
        . = . + __IRQ_STACK_SIZE;
    } align(8)
    RUN_START(__IRQ_STACK_START)
    RUN_END(__IRQ_STACK_END)
    .fiqstack : {
        . = . + __FIQ_STACK_SIZE;
    } align(8)
    RUN_START(__FIQ_STACK_START)
    RUN_END(__FIQ_STACK_END)
    .svcstack : {
        . = . + __SVC_STACK_SIZE;
    } align(8)
    RUN_START(__SVC_STACK_START)
    RUN_END(__SVC_STACK_END)
    .abortstack : {
        . = . + __ABORT_STACK_SIZE;
    } align(8)
    RUN_START(__ABORT_STACK_START)
    RUN_END(__ABORT_STACK_END)
    .undefinedstack : {
        . = . + __UNDEFINED_STACK_SIZE;
    } align(8)
    RUN_START(__UNDEFINED_STACK_START)
    RUN_END(__UNDEFINED_STACK_END)
    } > MSRAM  


    GROUP  :   {
    .ARM.exidx : {
    } palign(8)
    .init_array : {
    } palign(8)
    .fini_array : {
    } palign(8)
    } > MSRAM  

    .bss.user_shared_mem (NOLOAD) : {
    } > USER_SHM_MEM    

    .bss.log_shared_mem (NOLOAD) : {
    } > LOG_SHM_MEM    

    .bss.ipc_vring_mem (NOLOAD) : {
    } > RTOS_NORTOS_IPC_SHM_MEM    

    .bss.nocache (NOLOAD) : {
    } > NON_CACHE_MEM    


}


MEMORY
{
    R5F_VECS   : ORIGIN = 0x0 , LENGTH = 0x40 
    R5F_TCMA   : ORIGIN = 0x40 , LENGTH = 0x7FC0 
    R5F_TCMB0   : ORIGIN = 0x41010000 , LENGTH = 0x8000 
    NON_CACHE_MEM   : ORIGIN = 0x70060000 , LENGTH = 0x8000 
    MSRAM   : ORIGIN = 0x70080000 , LENGTH = 0x40000 
    USER_SHM_MEM   : ORIGIN = 0x701D0000 , LENGTH = 0x80 
    LOG_SHM_MEM   : ORIGIN = 0x701D0080 , LENGTH = 0x3F80 
    RTOS_NORTOS_IPC_SHM_MEM   : ORIGIN = 0x701D4000 , LENGTH = 0xC000 
    FLASH   : ORIGIN = 0x60100000 , LENGTH = 0x80000 

    /* For memory Regions not defined in this core but shared by other cores with the current core */


}

At first I thought, that sysconfig file is per default configured for clang, which is wrong, but it was the case:

Unfortunately, even after changing it to GCC, the problem remains.

Several remarks at the end:

  • This behavior is not seen with MCU+ SDK for AM64x v09.00.00.30
  • The reason why we want to use GCC is the support of C++ 20/23 in the recent versions
  • The above described behavior is also seen under Linux (actually first seen there)

Any advice will be welcome!

Regards,

Angel Gavrailov

  • Hello Angel,

    Thank you for reaching out to Texas Instruments E2E support forum.

    I have taken your inputs and working on it. Please allow some time to revert back.

    Regards,

    Tushar

  • Hello Angel,

    Thanks for your patience.

    To remove the above error, please follow the below steps:

    • Open the example.syscfg file.
    • Remove all the sections related to Memory Configurator. Please refer below screenshot.

    • Build the GCC libraries.

    To build the libraries, please run the below commands from root of ${MCU+SDK path}.

    cd ${MCU+SDK install path}
    gmake -f makefile.am64x libs_gcc PROFILE=debug
    gmake -f makefile.am64x libs_gcc PROFILE=release

    Rebuild the example with above settings. The example will now build without any errors.

    The problem here is because of the linker.cmd file generated by Sysconfig Memory Configurator tool. The linker configuration if made from sysconfig, ccs will try to pick that up. The memory configurator tool doesn't support gcc linkers and there's no plan to do so yet.

    To By-pass sysconfig generated linker configuration, please refer MEMORY_CONFIGURATOR.

    Please let me know if the above solution works.

    Regards,

    Tushar

  • Hi Tushar,

    Thank you for your answer. I have disabled the Memory Configurator sections and I was able to build. However, no GCC libraries were available for linking, so I had to make the second step from your reply, namely building the libs. 

    Unfortunately, when building, I am getting the following errors (actually warnings, but with -Werror flag, those are handled as errors):

    dpl/r5/HwiP_armv7r_handlers_nortos.c:40:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       40 | void __attribute__((interrupt("SWI"), section(".text.hwi"))) HwiP_svc_handler(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_nortos.c:41:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       41 | void __attribute__((interrupt("ABORT"), section(".text.hwi"),weak)) HwiP_data_abort_handler_c(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_nortos.c:125:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      125 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_nortos.c:185:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      185 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_nortos.c:194:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      194 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_nortos.c:203:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      203 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_nortos.c:213:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      213 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_nortos.c:222:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      222 | {
          | ^
    

    dpl/r5/HwiP_armv7r_handlers_freertos.c:62:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       62 | void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_reserved_handler(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_freertos.c:63:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       63 | void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_undefined_handler(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_freertos.c:64:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       64 | void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_prefetch_abort_handler(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_freertos.c:68:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
       68 | void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_data_abort_handler(void);
          | ^~~~
    dpl/r5/HwiP_armv7r_handlers_freertos.c:183:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      183 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_freertos.c:241:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      241 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_freertos.c:248:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      248 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_freertos.c:255:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      255 | {
          | ^
    dpl/r5/HwiP_armv7r_handlers_freertos.c:261:1: warning: FP registers might be clobbered despite 'interrupt' attribute: compile with '-mgeneral-regs-only' [-Wattributes]
      261 | {
          | ^
    

    After removing the "-Werror" flag for those two specific directories, the compilation still was producing the warnings, but then passed successfully. May be this is getting out of scope for the original question, but I hope you can forward it to your colleagues if so. Or, you can open another related ticket with the solution of those 2 warnings above and the make process for gcc as a whole.

    Thank you!

  • Hello Angel,

    Thank you for your response.

    I have tried to build the libraries using the same command given above and didn't see the above warnings.

    Can you please confirm, Are you using the recommended version of gcc arm compiler for compilation?

    To know the recommended toolchain version, please refer SDK_SETUP.

    Please check you have the recommended GCC AARCH64 compiler 9.2-2019.12 version installed with you.

    Regards,

    Tushar 

  • Hi Tushar,

    Thanks for the prompt reply and for the effort to build the libs. 

    As I mentioned in the beginning, I am trying to use arm-gnu-toolchain-13.2, because of the support of C++ 23 features. GCC 9.2 supports only C++21 (2a) and this as experimental. I understand, that TI cannot guarantee the libs to be working with each and any compiler version and I am pleased to see, that there are almost no issues also with the newest compiler version. 

    I looked at the code, which is causing problems, that are the exception handlers for freertos/nortos in particular:

    void __attribute__((section(".text.hwi"))) HwiP_irq_handler_c(void);
    void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_reserved_handler(void);
    void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_undefined_handler(void);
    void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_prefetch_abort_handler(void);

    The warning says, that the user is responsible for the save/restore of the FPU registers in interrupt handlers, which in this case is irrelevant, so it is a harmless one, at least so the theory. I am going to build the libs without the -Werror flags for this particular dpl dirs and go with that. 

    In the meantime, I found a very similar question about AM6442 and clang this time:

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1019277/am6442-clang-warning-call-to-function-without-interrupt-attribute-could-clobber-interruptee-s-vfp-registers

    I am happy to hear you comments. Thank you in advance!

    Regards,

    Angel 

  • Hello Angel,

    Thanks for your response.

    I am happy to hear you comments. Thank you in advance!

    I cannot comment on what could be the implication of suppressing this warnings. As of now TI does not support arm-gnu-toolchain-13.2.

    The warning says, that the user is responsible for the save/restore of the FPU registers in interrupt handlers, which in this case is irrelevant, so it is a harmless one, at least so the theory. I am going to build the libs without the -Werror flags for this particular dpl dirs and go with that. 

    If building the libraries by suppressing warnings is working fine for you and as mentioned in the above reply that it is irrelevant for your usecase. I don't see any problem in using the libraries build by suppressing warnings.

    Best Regards, 

    Tushar