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/AM3358: undefined reference to `NIMUDeviceTable' - Beaglebone Black NDK

Part Number: AM3358

Tool/software: TI-RTOS

Hi,

I want to start working with NDK and created a SYS/BIOS project with minimal and selected NDK libraries for the project. The Project builded successfully. However, when I added a Global element to NDK Core Stack and recompiled my  project, I get the error undefined reference to `NIMUDeviceTable'. I see that the nimu.c file is empty. Can someone help me with this error? 

Also, are there any example projects for Beaglebone Black with NDK ?

Thanks

Vishal

  • Hi,

    Yes, there are existing BBB NIMU/NDK examples in Processor SDK RTOS, e.g. NIMU_BasicExample_bbbAM335x_armExampleproject. Check the user guide: software-dl.ti.com/.../index_Foundational_Components.html

    The NIMUDeviceTable should be provided from application.

    Regards, Eric
  • Hi,

    Thanks for the reply. I was able to find the NIMU basic example and able to build and run it as well. But what if I want to create my own network application from scratch? I get this build error undefined reference to 'NIMUDeviceTable'

    Regards

    Vishav

  • Hi,

    Good to know that you can run the NIMU basic example!

    As you can see that NIMUDeviceTable is supplied from user application. So if you want to create your own network application, you need to provide such table, and point the init function to your CPSW initialization routine. Like the NIMU test code:

    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[MAX_TABLE_ENTRIES];

    NIMUDeviceTable[nimu_device_index++].init = &CpswEmacInit ;
    NIMUDeviceTable[nimu_device_index].init = NULL ;

    Regards, Eric
  • Hi Eric,

    Thanks for the reply. As you said, I created a NIMU_DEVICE_TABLE and included all the header files specified in the NIMU Basic example. However, while building my project, I get an error 'undefined reference to CpswEmacInit'. Here is my source code. Any help will be appreciated in understanding this error.

    /*
     *  ======== main.c ========
     */
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/family/arm/a8/Mmu.h>
    
    #include <ti/ndk/inc/stkmain.h>
    
    #include <ti/drv/emac/emac_drv.h>
    #include <ti/drv/emac/src/v4/emac_drv_v4.h>
    
    #include <ti/starterware/include/types.h>
    #include <ti/starterware/include/hw/hw_types.h>
    #include <ti/starterware/include/hw/hw_control_am335x.h>
    #include <ti/starterware/include/hw/soc_am335x.h>
    #include <ti/starterware/include/ethernet.h>
    #include <ti/starterware/include/soc_control.h>
    
    #include <ti/board/board.h>
    
    /* UART Header files */
    #include <ti/drv/uart/UART.h>
    #include <ti/drv/uart/UART_stdio.h>
    
    #define MAX_TABLE_ENTRIES   3
    
    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[MAX_TABLE_ENTRIES];
    static int nimu_device_index = 0U;
    extern int CpswEmacInit (STKEVENT_Handle hEvent);
    /*
     *  ======== taskFxn ========
     */
    Void taskFxn(UArg a0, UArg a1)
    {
        System_printf("enter taskFxn()\n");
    	
        Task_sleep(10);
    	
        System_printf("exit taskFxn()\n");
    }
    
    /*
     *  ======== main ========
     */
    Int main()
    { 
    
        /*
         * use ROV->SysMin to view the characters in the circular buffer
         */
    
    
        System_printf("enter main()\n");
        NIMUDeviceTable[nimu_device_index++].init = &CpswEmacInit ;
        NIMUDeviceTable[nimu_device_index].init = NULL ;
        BIOS_start();    /* does not return */
        return(0);
    }
    

     

  • Hi,

    Then, you need to look at in the working case, where the CpswEmacInit came from?

    It is declared as extern in your application:
    extern int CpswEmacInit (STKEVENT_Handle hEvent);

    This function is implemented by NIMU driver: pdk_am335x_1_0_13\packages\ti\transport\ndk\nimu\src\v4\cpsw_nimu_eth.c

    Regards, Eric
  • Hi,

    It was also declared as extern in NIMU_Basic application. So I added it like so. Also, I tried to add 'pdk_am335x_1_0_13\packages\ti\transport\ndk\nimu\src\v4\cpsw_nimu_eth.h' but the compiler does not find the files although they are there. Please excuse me if the questions are bit wayward as I am pretty new to this.

    Thanks
    Vishav
  • Please show me your build log.

    Regards, Eric
  • Hi,

    I added the following header to my code:

    #include <ti/transport/ndk/nimu/src/v4/cpsw_nimu_eth.h>

    The function is implemented in ti/transport/ndk/nimu/src/v4/cpsw_nimu_eth.c But I get the compilation error that undefined reference to CpswEmacInit. Here is my code and build log

    /*
     *  ======== main.c ========
     */
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/family/arm/a8/Mmu.h>
    
    #include <ti/ndk/inc/stkmain.h>
    
    #include <ti/drv/emac/emac_drv.h>
    #include <ti/drv/emac/src/v4/emac_drv_v4.h>
    
    #include <ti/starterware/include/types.h>
    #include <ti/starterware/include/hw/hw_types.h>
    #include <ti/starterware/include/hw/hw_control_am335x.h>
    #include <ti/starterware/include/hw/soc_am335x.h>
    #include <ti/starterware/include/ethernet.h>
    #include <ti/starterware/include/soc_control.h>
    #include <ti/transport/ndk/nimu/src/v4/cpsw_nimu_eth.h>
    #include <ti/board/board.h>
    
    /* UART Header files */
    #include <ti/drv/uart/UART.h>
    #include <ti/drv/uart/UART_stdio.h>
    
    #define MAX_TABLE_ENTRIES   3
    
    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[MAX_TABLE_ENTRIES];
    static int nimu_device_index = 0U;
    extern int32_t CpswEmacInit (STKEVENT_Handle hEvent);
    /*
     *  ======== taskFxn ========
     */
    Void taskFxn(UArg a0, UArg a1)
    {
        SOCKET s;
        s = NDK_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        System_printf("enter taskFxn()\n");
    	
        Task_sleep(10);
    	
        System_printf("exit taskFxn()\n");
    }
    
    /*
     *  ======== main ========
     */
    Int main()
    { 
    
        /*
         * use ROV->SysMin to view the characters in the circular buffer
         */
    
    
        System_printf("enter main()\n");
        NIMUDeviceTable[nimu_device_index++].init = NULL ;
        NIMUDeviceTable[nimu_device_index].init = &CpswEmacInit ;
        BIOS_start();    /* does not return */
        return(0);
    }
    

    Build log:

    **** Build of configuration Debug for project First_EThernet ****
    
    /home/vishav/ti/ccsv8/utils/bin/gmake -k -j 8 all -O 
     
    making ../src/sysbios/sysbios.aa8fg ...
    gmake[1]: Nothing to be done for 'all'.
    making ../src/sysbios/sysbios.aa8fg ...
    gmake[2]: Nothing to be done for 'all'.
    Building target: "First_EThernet.out"
    Invoking: GNU Linker
    "/home/vishav/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc" -mtune=cortex-a8 -marm -Dam3359 -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"First_EThernet.map" -nostartfiles -static -Wl,--gc-sections -L"/home/vishav/ti/bios_6_73_01_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"First_EThernet.out" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lgcc -lm -lnosys -lc -Wl,--end-group 
    makefile:143: recipe for target 'First_EThernet.out' failed
    ./main.o: In function `main':
    /home/vishav/workspace_new/First_EThernet/Debug/../main.c:64: undefined reference to `CpswEmacInit'
    /home/vishav/workspace_new/First_EThernet/Debug/../main.c:64: undefined reference to `CpswEmacInit'
    collect2: error: ld returned 1 exit status
    gmake[1]: *** [First_EThernet.out] Error 1
    gmake: *** [all] Error 2
    makefile:139: recipe for target 'all' failed
    
    **** Build Finished ****
    

  • Hi,

    This is linking stage error, not the compiling stage. It looks that you didn't include the NIMU library to your application. Looking at the working case TI NIMU example, there is a .cfg file in the CCS project, e.g: PDK_INSTALL_PATH/ti/transport/ndk/nimu/example/am335x/armv7/bios/nimu_bbbam335x.cfg.

    Inside this .cfg file,
    /* Load the NIMU package */
    var Nimu = xdc.loadPackage('ti.transport.ndk.nimu');
    Nimu.Settings.socType = socType;

    This is how the NIMU library is added to the CCS project.

    Regards, Eric
  • Hi,

    Thanks for the information. I added the NIMU Library to my project. However, I still get build errors. It would really help to have your feedback.The .cfg file looks like this:



    var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Error = xdc.useModule('xdc.runtime.Error'); var Log = xdc.useModule('xdc.runtime.Log'); var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var Main = xdc.useModule('xdc.runtime.Main'); var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Text = xdc.useModule('xdc.runtime.Text'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var Task = xdc.useModule('ti.sysbios.knl.Task'); var Global = xdc.useModule('ti.ndk.config.Global'); /* * Uncomment this line to globally disable Asserts. * All modules inherit the default from the 'Defaults' module. You * can override these defaults on a per-module basis using Module.common$. * Disabling Asserts will save code space and improve runtime performance. Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; */ /* * Uncomment this line to keep module names from being loaded on the target. * The module name strings are placed in the .const section. Setting this * parameter to false will save space in the .const section. Error and * Assert messages will contain an "unknown module" prefix instead * of the actual module name. */ Defaults.common$.namedModule = false; /* * Minimize exit handler array in System. The System module includes * an array of functions that are registered with System_atexit() to be * called by System_exit(). */ System.maxAtexitHandlers = 4; /* * Uncomment this line to disable the Error print function. * We lose error information when this is disabled since the errors are * not printed. Disabling the raiseHook will save some code space if * your app is not using System_printf() since the Error_print() function * calls System_printf(). Error.raiseHook = null; */ /* * Uncomment this line to keep Error, Assert, and Log strings from being * loaded on the target. These strings are placed in the .const section. * Setting this parameter to false will save space in the .const section. * Error, Assert and Log message will print raw ids and args instead of * a formatted message. */ Text.isLoaded = false; /* * Uncomment this line to disable the output of characters by SysMin * when the program exits. SysMin writes characters to a circular buffer. * This buffer can be viewed using the SysMin Output view in ROV. */ SysMin.flushAtExit = false; /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ BIOS.heapSize = 0x0; /* System stack size (used by ISRs and Swis) */ Program.stack = 0x400; /* Circular buffer size for System_printf() */ SysMin.bufSize = 128; /* * Create and install logger for the whole system */ var loggerBufParams = new LoggerBuf.Params(); loggerBufParams.numEntries = 4; var logger0 = LoggerBuf.create(loggerBufParams); Defaults.common$.logger = logger0; Main.common$.diags_INFO = Diags.ALWAYS_ON; System.SupportProxy = SysMin; /* * Build a custom BIOS library. The custom library will be smaller than the * pre-built "instrumented" (default) and "non-instrumented" libraries. * * The BIOS.logsEnabled parameter specifies whether the Logging is enabled * within BIOS for this custom build. These logs are used by the RTA and * UIA analysis tools. * * The BIOS.assertsEnabled parameter specifies whether BIOS code will * include Assert() checks. Setting this parameter to 'false' will generate * smaller and faster code, but having asserts enabled is recommended for * early development as the Assert() checks will catch lots of programming * errors (invalid parameters, etc.) */ BIOS.libType = BIOS.LibType_Custom; BIOS.logsEnabled = false; BIOS.assertsEnabled = true; /* * Create a task. The 'taskFxn' function can be found in main.c. */ var task0Params = new Task.Params(); task0Params.priority = 9; var task0 = Task.create("&taskFxn", task0Params); var task1Params = new Task.Params(); task1Params.instance.name = "task1"; task1Params.priority = 7; Program.global.task1 = Task.create("&hello", task1Params); /* ================ Driver configuration ================ */ var socType = "am335x"; /*use CSL package*/ var Csl = xdc.loadPackage('ti.csl'); Csl.Settings.deviceType = socType; /* Load the OSAL package */ var osType = "tirtos" var Osal = xdc.useModule('ti.osal.Settings'); Osal.osType = osType; /* Load the board package */ var Board = xdc.loadPackage('ti.board'); Board.Settings.boardName = "bbbAM335x"; /* Load the uart package */ var UartPackage = xdc.loadPackage('ti.drv.uart'); /* Load the uart package */ var I2cPackage = xdc.loadPackage('ti.drv.i2c'); /* Load the uart package */ var GpioPackage = xdc.loadPackage('ti.drv.gpio'); /* Load the EMAC packages */ var Emac = xdc.loadPackage('ti.drv.emac'); Emac.Settings.socType = socType; /* Load the NIMU package */ var Nimu = xdc.loadPackage('ti.transport.ndk.nimu'); Nimu.Settings.socType = socType;

    However, I still get build errors. The build log is as follows:

    **** Build of configuration Debug for project First_EThernet ****
    
    /home/vishav/ti/ccsv8/utils/bin/gmake -k -j 8 all -O 
     
    making ../src/sysbios/sysbios.aa8fg ...
    Building file: "../app.cfg"
    Invoking: XDCtools
    "/home/vishav/ti/xdctools_3_50_08_24_core/xs" --xdcpath="/home/vishav/ti/bios_6_73_01_01/packages;/home/vishav/ti/edma3_lld_2_12_05_30C/packages;/home/vishav/ti/ndk_3_40_01_01/packages;/home/vishav/ti/uia_2_30_01_02/packages;/home/vishav/ti/pdk_am335x_1_0_13/packages;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A8F -p ti.platforms.evmAM3359 -r release -c "/home/vishav/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major" "../app.cfg"
    gmake[1]: Nothing to be done for 'all'.
    configuring app.xa8fg from package/cfg/app_pa8fg.cfg ...
    generating custom ti.sysbios library makefile ... 
    	Linking with library ti.transport.ndk.nimu:./lib/am335x/a8/release/ti.transport.ndk.nimu.aa8fg
    	Linking with library ti.drv.emac:./lib/am335x/a8/release/ti.drv.emac.aa8fg
    	Linking with library ti.drv.gpio:./lib/a8/release/ti.drv.gpio.aa8fg
    	Linking with library ti.drv.i2c:./lib/a8/release/ti.drv.i2c.aa8fg
    	Linking with library ti.drv.uart:./lib/a8/release/ti.drv.uart.aa8fg
    	Linking with library ti.board:./lib/bbbAM335x/a8/release/ti.board.aa8fg
    	Linking with library ti.osal:./lib/tirtos/a8/release/ti.osal.aa8fg
    	Linking with library ti.csl:./lib/am335x/a8/release/ti.csl.aa8fg
    Starting build of library sources ...
    making /home/vishav/workspace_new/First_EThernet/src/sysbios/sysbios.aa8fg ...
    gmake[1]: Entering directory `/home/vishav/workspace_new/First_EThernet/src/sysbios'
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/IntrinsicsSupport_asm_gnu.asm ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/TaskSupport_asm_gnu.asm ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/intcps/Hwi_asm_gnu.sv7A ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/exc/Exception_asm_gnu.asm ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/Cache_asm_gnu.sv7A ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/Mmu_asm_gnu.sv7A ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/TimestampProvider_asm_gnu.sv7A ...
    asma8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/timers/dmtimer/Timer_asm_gnu.sv7A ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/BIOS.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/IntrinsicsSupport.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/TaskSupport.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Clock.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Idle.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Intrinsics.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Event.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Mailbox.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Queue.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Semaphore.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Swi.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/knl/Task.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Cache.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Core.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/CoreNull.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Hwi.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Hwi_stack.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Hwi_startup.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/Seconds.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/hal/SecondsClock.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/gates/GateHwi.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/gates/GateMutex.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/intcps/Hwi.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/exc/Exception.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/Cache.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/Mmu.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/TimestampProvider.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/timers/dmtimer/Timer.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a8/ti81xx/TimerSupport.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/clock.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/mqueue.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_barrier.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_cond.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_key.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_mutex.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_rwlock.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/pthread_util.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/sched.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/semaphore.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/sleep.c ...
    cla8fg /home/vishav/ti/bios_6_73_01_01/packages/ti/posix/tirtos/timer.c ...
    ara8fg arm_IntrinsicsSupport_asm_gnu.o arm_TaskSupport_asm_gnu.o intcps_Hwi_asm_gnu.o exc_Exception_asm_gnu.o a8_Cache_asm_gnu.o a8_Mmu_asm_gnu.o a8_TimestampProvider_asm_gnu.o dmtimer_Timer_asm_gnu.o _BIOS.o arm_IntrinsicsSupport.o arm_TaskSupport.o knl_Clock.o knl_Idle.o knl_Intrinsics.o knl_Event.o knl_Mailbox.o knl_Queue.o knl_Semaphore.o knl_Swi.o knl_Task.o hal_Cache.o hal_Core.o hal_CoreNull.o hal_Hwi.o hal_Hwi_stack.o hal_Hwi_startup.o hal_Seconds.o hal_SecondsClock.o gates_GateHwi.o gates_GateMutex.o intcps_Hwi.o exc_Exception.o a8_Cache.o a8_Mmu.o a8_TimestampProvider.o dmtimer_Timer.o ti81xx_TimerSupport.o tirtos_clock.o tirtos_mqueue.o tirtos_pthread.o tirtos_pthread_barrier.o tirtos_pthread_cond.o tirtos_pthread_key.o tirtos_pthread_mutex.o tirtos_pthread_rwlock.o tirtos_pthread_util.o tirtos_sched.o tirtos_semaphore.o tirtos_sleep.o tirtos_timer.o ...
    gmake[1]: Leaving directory `/home/vishav/workspace_new/First_EThernet/src/sysbios'
    Build of libraries done.
    cla8fg package/cfg/app_pa8fg.c ...
    In file included from /home/vishav/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43:0,
                     from /home/vishav/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
                     from /home/vishav/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
                     from package/cfg/app_pa8fg.c:2710:
    /home/vishav/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
     #define _SYS_SELECT_H   1 // TODO: still needed for struct timeval conflict
     
    In file included from /home/vishav/ti/bios_6_73_01_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include/sys/types.h:68:0,
                     from /home/vishav/ti/bios_6_73_01_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include/time.h:28,
                     from package/cfg/app_pa8fg.c:2670:
    /home/vishav/ti/bios_6_73_01_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include/sys/select.h:13:0: note: this is the location of the previous definition
     #define _SYS_SELECT_H
     
    Finished building: "../app.cfg"
     
    making ../src/sysbios/sysbios.aa8fg ...
    gmake[2]: Nothing to be done for 'all'.
    Building target: "First_EThernet.out"
    Invoking: GNU Linker
    "/home/vishav/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc" -mtune=cortex-a8 -marm -Dam3359 -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"First_EThernet.map" -nostartfiles -static -Wl,--gc-sections -L"/home/vishav/ti/bios_6_73_01_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"First_EThernet.out" "./UART_soc.o" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lgcc -lm -lnosys -lc -Wl,--end-group 
    makefile:144: recipe for target 'First_EThernet.out' failed
    /home/vishav/ti/pdk_am335x_1_0_13/packages/ti/transport/ndk/nimu/lib/am335x/a8/release/ti.transport.ndk.nimu.aa8fg(cpsw_nimu_eth.oa8fg): In function `NIMU_start':
    cpsw_nimu_eth.c:(.text.NIMU_start+0xf8): undefined reference to `Osal_TaskCreate'
    /home/vishav/ti/pdk_am335x_1_0_13/packages/ti/board/lib/bbbAM335x/a8/release/ti.board.aa8fg(enet_phy.oa8fg): In function `ENETPHY_SetPhyMode':
    enet_phy.c:(.text.ENETPHY_SetPhyMode+0x98): undefined reference to `UART_printf'
    /home/vishav/ti/pdk_am335x_1_0_13/packages/ti/board/lib/bbbAM335x/a8/release/ti.board.aa8fg(enet_phy.oa8fg): In function `ENETPHY_Tic':
    enet_phy.c:(.text.ENETPHY_Tic+0x1c4): undefined reference to `UART_printf'
    enet_phy.c:(.text.ENETPHY_Tic+0x2d0): undefined reference to `UART_printf'
    enet_phy.c:(.text.ENETPHY_Tic+0x548): undefined reference to `UART_printf'
    enet_phy.c:(.text.ENETPHY_Tic+0x5ac): undefined reference to `UART_printf'
    /home/vishav/ti/pdk_am335x_1_0_13/packages/ti/board/lib/bbbAM335x/a8/release/ti.board.aa8fg(enet_phy.oa8fg):enet_phy.c:(.text.ENETPHY_Tic+0x5c4): more undefined references to `UART_printf' follow
    collect2: error: ld returned 1 exit status
    gmake[1]: *** [First_EThernet.out] Error 1
    gmake: *** [all] Error 2
    makefile:140: recipe for target 'all' failed
    
    **** Build Finished ****
    

  • Hi,

    A simple way is for you to look at the existing NIMU_BasicExample_bbbAM335x_armExampleproject, why you can build it without error? Look at the build log to understand what libraries are included, look at the map file where Osal_TaskCreate and UART_printf came from.

    .text.UART_printf
    0x800299c4 0x2c0 C:\ti\pdk_am335x_1_0_13\packages\ti\drv\uart\lib\a8\release\ti.drv.uart.aa8fg(UART_stdio.oa8fg)
    0x800299c4 UART_printf

    .text 0x80008360 0x100 ./nimu_osal.o
    0x80008360 Osal_TaskSleep
    0x8000836c Osal_TaskCreate
    0x800083c4 Osal_TaskCreate_v2
    0x80008424 Osal_malloc
    0x80008448 Osal_free


    Osal_TaskCreate came from your application file nimu_osal.c I am not sure why UART_printf() has issue. You may see if it will be resolved after you fix the OSAL error.

    Regards, Eric
  • Hi,

    Thanks for the support. I added the file nimu_osal.c to my project and it compiles successfully. Going further in my application, I am facing following problems:

    1. I created a socket. However, I get an error. I use fderror() to see the error and I get the response as ffffffff. I don't understand this error. Is it because that there is no session to create a socket? As per the NDK API documentation, fdOpenSession() is automatically called when a task is created.

    2. I am able to create a task through XGCONF tool. But if use the function task_create in my app to create a task, the program exits even before starting the BIOS. Am I missing something? for the current source code, I have commented out the task_create function and instead using XGCONF to create tasks.

    Please find attached my source code:

    /*
     *  ======== main.c ========
     */
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/family/arm/a8/Mmu.h>
    
    #include <ti/ndk/inc/stkmain.h>
    
    #include <ti/drv/emac/emac_drv.h>
    #include <ti/drv/emac/src/v4/emac_drv_v4.h>
    
    #include <ti/starterware/include/types.h>
    #include <ti/starterware/include/hw/hw_types.h>
    #include <ti/starterware/include/hw/hw_control_am335x.h>
    #include <ti/starterware/include/hw/soc_am335x.h>
    #include <ti/starterware/include/ethernet.h>
    #include <ti/starterware/include/soc_control.h>
    #include <ti/transport/ndk/nimu/src/v4/cpsw_nimu_eth.h>
    #include <ti/board/board.h>
    
    /* UART Header files */
    
    #include <ti/drv/uart/UART.h>
    #include <ti/drv/uart/UART_stdio.h>
    
    #define MAX_TABLE_ENTRIES   3
    
    /**Phy address of the CPSW port 1*/
    #define EMAC_CPSW_PORT0_PHY_ADDR_EVM    0
    /**Phy address of the CPSW port 1*/
    #define EMAC_CPSW_PORT1_PHY_ADDR_EVM    1
    
    
    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[MAX_TABLE_ENTRIES];
    static int nimu_device_index = 0U;
    extern int CpswEmacInit (STKEVENT_Handle hEvent);
    /*
     *  ======== taskFxn ========
     */
    void Board_initUART(void)
    {
        Board_initCfg boardCfg;
    
    #if defined(evmK2E) || defined(evmC6678)
        boardCfg = BOARD_INIT_MODULE_CLOCK |
                   BOARD_INIT_UART_STDIO;
    #else
        boardCfg = BOARD_INIT_PINMUX_CONFIG |
                   BOARD_INIT_MODULE_CLOCK  |
                   BOARD_INIT_UART_STDIO;
    #endif
    
    #if defined (evmK2H) || defined (evmK2K) || defined (evmK2E) || defined (evmK2L) || defined(evmK2G) || defined(evmC6678) || defined(evmC6657)
    #ifdef _TMS320C6X
        /* boardCfg |= BOARD_INIT_PLL | BOARD_INIT_DDR; */
    #endif
    #endif
        Board_init(boardCfg);
    }
    
    Void taskFxn(UArg a0, UArg a1)
    {
        SOCKET s;
        s = NDK_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (s == INVALID_SOCKET)
        {
            UART_printf("%x\n", fdError());
        }
        System_printf("enter taskFxn()\n");
    	
        Task_sleep(10);
    	
        System_printf("exit taskFxn()\n");
    }
    
    void hello()
    {
        }
    /*
     *  ======== main ========
     */
    Int main()
    { 
    
        /*
         * use ROV->SysMin to view the characters in the circular buffer
         */
        EMAC_HwAttrs_V4 cfg;
        Task_Params taskParams;
    
    
        SOCCtrlCpswPortMacModeSelect(1, ETHERNET_MAC_TYPE_MII);
        SOCCtrlCpswPortMacModeSelect(2, ETHERNET_MAC_TYPE_MII);
    
        EMAC_socGetInitCfg(0, &cfg);
        cfg.port[0].phy_addr = EMAC_CPSW_PORT0_PHY_ADDR_EVM;
        cfg.port[1].phy_addr = EMAC_CPSW_PORT0_PHY_ADDR_EVM;
        cfg.macModeFlags = EMAC_CPSW_CONFIG_MODEFLG_FULLDUPLEX;
        EMAC_socSetInitCfg(0, &cfg);
    
    
        System_printf("enter main()\n");
        Board_initUART();
        Task_Params_init(&taskParams);
        taskParams.priority = 5;
        taskParams.instance->name = "Ethernet";
       // Task_create(taskFxn, &taskParams, NULL);
        NIMUDeviceTable[nimu_device_index++].init = &CpswEmacInit ;
        NIMUDeviceTable[nimu_device_index].init = NULL ;
    
    
    
        BIOS_start();    /* does not return */
        return(0);
    }