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.

SK-AM62B-P1: Linker error when compiling IPC example from academy training.

Part Number: SK-AM62B-P1
Other Parts Discussed in Thread: SYSCONFIG

What's up TI!

I'm having some issues compiling the MCU+ SDK hello world example from following the AM62x Academy's training located on this page.

The error I'm seeing is:

Linking: am62x:m4fss0-0:freertos:ti-arm-clang hello_world.release.out ...
"linker.cmd", line 25: error: program will not fit into available memory, or
   the section contains a call site that requires a trampoline that can't be
   generated for this section. run placement with alignment fails for section
   ".bss" size 0x87fa6.  Available memory ranges:
   M4F_DRAM     size: 0x10000      unused: 0xe650       max hole: 0xe650
error: errors encountered during linking; "hello_world.release.out" not built
tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
make: *** [makefile:182: hello_world.release.out] Error 1

The steps I have taken to get to this state are as follows:

  1. Start with fresh clone of MCU+ sdk am62x 9.1.00.39
  2. Navigate to the SDK directory
  3. Apply the AM62x-SDK-9.0-add-Linux-IPC-to-Sysconfig.patch (I cannot utilize sysconfig gui, as I am developing in a devcontainer. So I am relying on patches)
  4. Apply the AM62x-SDK-9.0-add-linker.cmd-file.patch (Note: The actual file downloaded is not the same name as the provided link in the documentation)
  5. Attempt to build the example using make make -s -C examples/hello_world/am62x-sk/m4fss0-0_freertos/ti-arm-clang/ PROFILE=release

Am I missing a step somewhere? I recognize that the linker file is adding a .resource_table section to the DDR_0 chunk of mem, but I don't how the linker file is wrong out of the box? I have to be missing something. If not, is it as simple as increasing the Length of M4F_DRAM? I'm afraid to do that however, as linux might be unhappy with that.

Thank you for any help / information!

  • Hello Jon,

    can I get you to attach the updated linker.cmd file?

    If it is problematic for the download file and the link name to be slightly different, I can change the file names in the next academy release.

    Regards,

    Nick

  • /* make sure below retain is there in your linker command file, it keeps the vector table in the final binary */
    --retain="*(.vectors)"
    /* 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
    
    
    SECTIONS
    {
        /* This has the M4F entry point and vector table, this MUST be at 0x0 */
        .vectors:{} palign(8) > M4F_VECS
        .text:   {} palign(8) > M4F_IRAM     /* This is where code resides */
    
        .bss:    {} palign(8) > M4F_DRAM     /* This is where uninitialized globals go */
        RUN_START(__BSS_START)
        RUN_END(__BSS_END)
    
        .data:   {} palign(8) > M4F_DRAM     /* This is where initialized globals and static go */
        .rodata: {} palign(8) > M4F_DRAM     /* This is where const's go */
        .sysmem: {} palign(8) > M4F_IRAM     /* This is where the malloc heap goes */
        .stack:  {} palign(8) > M4F_IRAM     /* This is where the main() stack goes */
    
        /* add the resource table */
        GROUP {
            /* This is the resource table used by linux to know where the IPC "VRINGs" are located */
            .resource_table: {} palign(4096)
        } > DDR_0
    
        /* Sections needed for C++ projects */
        .ARM.exidx:     {} palign(8) > M4F_IRAM  /* Needed for C++ exception handling */
        .init_array:    {} palign(8) > M4F_IRAM  /* Contains function pointers called before main */
        .fini_array:    {} palign(8) > M4F_IRAM  /* Contains function pointers called after main */
    }
    
    MEMORY
    {
        M4F_VECS : ORIGIN = 0x00000000 , LENGTH = 0x00000200
        M4F_IRAM : ORIGIN = 0x00000200 , LENGTH = 0x0002FE00
        M4F_DRAM : ORIGIN = 0x00030000 , LENGTH = 0x00010000
    
        /* Resource table must be placed at the start of the "external code/data mem"
         * section that Linux allocates for the core.
         * M4F default allocation is at 0x9cc00000
         */
        DDR_0       : ORIGIN = 0x9cc00000 , LENGTH = 0x1000
    }
    

    Hi Nick,

    I had to change the file extension to .txt as TI's website did not like the ".cmd" being attached.

    In regards to the file name, it is not a big deal and I'm not affected by it. It was just a piece of info I wanted to provide in case it helped investigating the issue.

  • Hello Jon,

    Apologies for dropping your thread - I'm trying to catch up now from the past month.

    Are you still running into issues? If so, I would start by just building the unmodified hello_world project first to make sure it builds correctly, and work up from there. Your linker.cmd file looks fine. You could also send me your example.syscfg file to check if desired.

    In general, I would suggest using a setup with MCU+ development where you are able to open the SysConfig GUI if at all possible. I'm more of a Linux focused guy, but it does seem like the SysConfig GUI does a lot of heavy lifting for MCU+ development.

    By the way, the latest version of the Academy was released this week. I totally rewrote and restructured most pages in the multicore academy, as well as writing a bunch of new content. There's also some new work-in-progress pages - feel free to give me any feedback you have, and I can make edits as needed for the next release.

    Regards,

    Nick

  • Hi Nick,

    Appreciate the followup, however, I have since moved on from cross core work. I ended up just utilizing the default example for some custom benchmark data collection, as I never figured out the issue I was having. When I get back into cross core development, I'll give your new academy a read and report back any suggestions.

    The issue was never resolved, however you can close the thread.