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.

RTOS/AM5728: Board_init requires UART_config when UART is not needed

Part Number: AM5728
Other Parts Discussed in Thread: AM5729, SYSBIOS,

Tool/software: TI-RTOS

Hi all,

I'm trying to create simple SYS/BIOS project with using of Board_init() function and I found out that it is working under DSP but not under ARM. My code is simple:

    Board_initCfg boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK;
    int res = 0;
    if (BOARD_SOK == (res = Board_init(boardCfg)))
    {
        BIOS_start();    /* does not return */
    }

When I compile the code in DSP project, the compilation is successful.

When I compile the code in ARM-A15 project, the compilation fails and requires a UART_config structure:

'Invoking: GNU Linker'
"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a15 -marm -Dam5728 -Dcore0 -g -gdwarf-3 -gstrict-dwarf -Wall -std=c99 -mfloat-abi=hard -Wl,-Map,"prj3.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,CORE0=1 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"prj3.out" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lgcc -lm -lnosys -lc -lc -Wl,--end-group
makefile:146: recipe for target 'prj3.out' failed
C:\ti\pdk_am57xx_1_0_14\packages\ti\drv\uart\lib\a15\release\ti.drv.uart.aa15fg(UART_drv.oa15fg): In function `UART_init':
/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:112: undefined reference to `UART_config'
/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:112: undefined reference to `UART_config'
C:\ti\pdk_am57xx_1_0_14\packages\ti\drv\uart\lib\a15\release\ti.drv.uart.aa15fg(UART_drv.oa15fg): In function `UART_open':
/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:128: undefined reference to `UART_config'
/oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:128: undefined reference to `UART_config'
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [prj3.out] Error 1
gmake: *** [all] Error 2
makefile:142: recipe for target 'all' failed

If I add a UART_config structure to my ARM project, it is able to compile but doesn't work when I'm debugging the target. The execution of function Board_init() is terminated and ends in _exit() function in file:

C:\ti\bios_6_75_02_00\packages\gnu\targets\arm\rtsv7A\syscalls.c

My platform:

AM5729 on BeagleBorad-X15 (I chose evmAM5728 in software)
pdk_am57xx_1_0_14
processor_sdk_rtos_am57xx_5_03_00_07
bios_6_75_02_00
CCS Version: 7.2.0.00013
Windows 10 Pro

Here are the projects:

prj3 - the ARM project without UART_config structure (unable to compile)

prj4 - the DSP project without UART_config structure (able to compile, able to run)

prj5 - the ARM project with UART_config structure (able to compile, unable to pass through Board_init)

prj.zip

So did I find a bug or what I'm doing wrong? I want to have Board_init() in ARM project and don't understand why it requires UART_config.

  • Hi Pavol,

    Regarding System_printf() function usage on AM572x Cortex-A15 core, you can refer to below user guide:

    Following the steps from the user guide, I am able to create Cortex-A15 SYS/BIOS project that is using System_printf() for printing messages. And I am able to build the project successful.

    Another option for you is to use UART_ptintf() function, which is based on BOARD_INIT_UART_STDIO applied to Board_init(boardCfg). For using this function refer to AM572x Cortex-A15 RTOS template file:

    processor_sdk_rtos_am57xx_5_03_00_07/demos/rtos_template_app/am572x/evmAM572X/A15/template_app/main.c

    Regards,
    Pavel

  • Hi Pavel,

    thank you for the reply.

    My intent, my goal was to have SYS/BIOS project without UART. I don't require UART and want to keep the project as clean as possible. When I generate new SYS/BIOS project, I'm able to compile it and everything works. But when I add the function Board_init() to my project, the situation is different. On DSP core, the project is still compile-able. But on A15 core, the project requires also using of UART. Thus I'm guessing there is a bug in the libraries (maybe wrong #ifdef that causes the need of UART for A15 project). 

    Because of this situation, I cannot keep my project as clean as possible and I must use UART no matter if I want to use UART or want not.

    Meanwhile, I found out why my project "prj5" doesn't work. In the case of using UART the Cache and MMU must be enabled and the cfg file must set these two regions as non-cached:

    Mmu.setSecondLevelDescMeta(0x4844a000, 0x4844a000, attrs);
    Mmu.setSecondLevelDescMeta(0x4ae07d00, 0x4ae07d00, attrs);

  • Pavol,

    Can you try to use linker option to remove unused sections. The board library is a static library which may be including that symbol but in application build, you might be able to eliminate the section using the following settings:

    Build Options: (Compiler)

    -fdata-sections -ffunction-sections

    Linker Options: (Compiler)

    -Wl,--gc-sections

    If this doesn`t work then we will try to reproduce the issue and try to provide you a workaround until we can eliminate the issue completely.

    Regards,
    Rahul
  • Hi Rahul,

    thank you for the reply.

    Unfortunately it didn't resolve the issue. I added the options as follows:

    I opened Project Properties -> CSS Build -> GNU Compiler -> Miscellaneous -> Other flags

    I created there two new flags, the first flag with value -fdata-sections and the second with the value -ffunction-sections

    Then I opened Project Properties -> CSS Build -> GNU Linker -> Miscellaneous -> Other flags

    I created there one new flag with value -Wl,--gc-sections

    The compilation still fails as you can see below:

    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dam5728 -Dcore0 -I"C:/Users/belianci/workspace_v7/prj3" -I"C:/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/include/newlib-nano" -I"C:/ti/bios_6_75_02_00/packages/ti/posix/gcc" -I"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -std=c99 -fdata-sections -ffunction-sections -MMD -MP -MF"main.d" -MT"main.o" -o"main.o" @"configPkg/compiler.opt" "../main.c"
    'Finished building: ../main.c'
    ' '
    making ../src/sysbios/sysbios.aa15fg ...
    gmake[2]: Nothing to be done for 'all'.
    'Building target: prj3.out'
    'Invoking: GNU Linker'
    "C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a15 -marm -Dam5728 -Dcore0 -g -gdwarf-3 -gstrict-dwarf -Wall -std=c99 -fdata-sections -ffunction-sections -mfloat-abi=hard -Wl,-Map,"prj3.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,CORE0=1 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -Wl,--gc-sections -o"prj3.out" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lgcc -lm -lnosys -lc -lc -Wl,--end-group
    makefile:146: recipe for target 'prj3.out' failed
    C:\ti\pdk_am57xx_1_0_14\packages\ti\drv\uart\lib\a15\release\ti.drv.uart.aa15fg(UART_drv.oa15fg): In function `UART_init':
    /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:112: undefined reference to `UART_config'
    /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:112: undefined reference to `UART_config'
    C:\ti\pdk_am57xx_1_0_14\packages\ti\drv\uart\lib\a15\release\ti.drv.uart.aa15fg(UART_drv.oa15fg): In function `UART_open':
    /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:128: undefined reference to `UART_config'
    /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/uart-lld-rtos/01.00.00.14-r0/build/ti/drv/uart/src/UART_drv.c:128: undefined reference to `UART_config'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [prj3.out] Error 1
    gmake: *** [all] Error 2
    makefile:142: recipe for target 'all' failed

     

    Steps to reproduce the issue:

    Create new A15 project: New -> CCS Project

    Choose target AM572x - Cortex A15, AM5728

    Select SYS/BIOS Minimal project

    Add "am572x PDK" to the project

    Select ti.platforms.evmAM572X

    Add these lines to main.c:

    #include <ti/board/board.h>

        Board_initCfg boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK;
        int res = 0;
        if (BOARD_SOK == (res = Board_init(boardCfg)))
        {
            BIOS_start();    /* does not return */
        }

     

    Add these lines to app.cfg:

    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "evmAM572x";

     

    Build the project, you will see the error "undefined reference to `UART_config' " as shown in the log above.

    Comment out the line with Board_init() function so the will look like:

        //if (BOARD_SOK == (res = Board_init(boardCfg)))

    Build the project again and you would see successful compilation. So the issue is related with the using of Board_init() function. When this function is used in the A15 project, it requires using of UART too.

    Repeat these steps for a C66XX DSP project and you will see that the using of Board_init() doesn't require UART like in A15 project.

     

  • Hi Pavol,

    I made some tests on my side and I am able to build the project successful without involving UART. I just add two linker flags in:

    Build Settings -> GNU Linker -> Edit Flags -> Wl,--gc-sections, -Wl,--start-group

    When I build the project I have:

    **** Build of configuration Debug for project hello_IDK_AM572X_CortexA ****

    /home/users/pbotev/ti/ccsv8/utils/bin/gmake -k -j 8 all -O
     
    making ../src/sysbios/sysbios.aa15fg ...
    gmake[1]: Nothing to be done for 'all'.
    Building file: "../hello.c"
    Invoking: GNU Compiler
    "/home/users/pbotev/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dam5728 -Dcore0 -I"/home/users/pbotev/workspace_v8_3/hello_IDK_AM572X_CortexA" -I"/home/users/pbotev/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/include/newlib-nano" -I"/home/users/pbotev/ti/bios_6_75_02_00/packages/ti/posix/gcc" -I"/home/users/pbotev/ti/gcc-arm-none-eabi-7-2018-q2-update/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"hello.d" -MT"hello.o" -std=c99 @"configPkg/compiler.opt" -o"hello.o" "../hello.c"
    Finished building: "../hello.c"
     
    making ../src/sysbios/sysbios.aa15fg ...
    gmake[2]: Nothing to be done for 'all'.
    Building target: "hello_IDK_AM572X_CortexA.out"
    Invoking: GNU Linker
    "/home/users/pbotev/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc" -mtune=cortex-a15 -marm -Dam5728 -Dcore0 -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"hello_IDK_AM572X_CortexA.map" -nostartfiles -static -Wl,--gc-sections -L"/home/users/pbotev/ti/bios_6_75_02_00/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,CORE0=1 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -Wl,--start-group -o"hello_IDK_AM572X_CortexA.out" "./hello.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lrdimon -lgcc -lm -lc -Wl,--end-group
    Finished building target: "hello_IDK_AM572X_CortexA.out"
     

    **** Build Finished ****

    I am attaching also my main file (hello.c) and my CFG file (hello.cfg) for reference. All other files are as default.

    /*
     *  ======== hello.c ========
     *  The hello example serves as a basic sanity check program for SYS/BIOS. It
     *  demonstrates how to print the string "hello world" to stdout. 
     */
    
    #include <xdc/std.h>
    
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    
    #include <ti/board/board.h>
    
    
    
    /*
     *  ======== main ========
     */
    Int main()
    { 
        System_printf("hello world\n");
    
        Board_initCfg boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK;
            int res = 0;
            if (BOARD_SOK == (res = Board_init(boardCfg)))
            {
                BIOS_start();    /* does not return */
            }
            return(0);
    }
    
    

    4578.hello.cfg

    Regards,
    Pavel

  • Hi Pavel,

    thank you for your reply. Your hint resolved my issue! In my project, using of -Wl,--start-group is enough, I needn't use -Wl,--gc-sections flag. So as I understand from the description of --start-group flag, it helps to solve the circular dependencies.

    The project is able to compile without errors or warnings, however the execution of Board_init() fails in _exit() on my target. I assume it is because of missing Cache/MMU settings. When I add these settings to cfg file, the Board_init() is able to execute with success. I used the Cache/MMU settings from template project.

    I consider the issue as resolved, you can lock this thread. Thanks!