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.

CCS/PROCESSOR-SDK-AM335X: How to Build NDK 3_61

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Code Composer Studio

Hello,

We have a massive project that uses the NDK source directly imported into the project.  (Please don't lecture about how that is not necessary, we had to enhance it to meet some requirements).

This WAS version 2_25.

I am trying to upgrade to 3_61.  But it is generating hundreds of errors.

In addition to apparently being tightly coupled to other packages (CSL, OSAL, PDK, SDK,... etc...), I can't even get it to find a SUSBIOS call.

Specifically the original file:

\ndk_2_25_01_11\packages\ti\ndk\hal\timer_bios\lltimer.c has the function

void llTimerTick()
{
#ifdef USER_LED1
    LED_TOGGLE( USER_LED1 );
#endif

    if( TimerOpen )
    {
#if DSPBIOS_ENHANCED
        LastCLKTime  = Clock_getTicks();
        LastCLKValid = 1;
#endif
        TimeMS += 100;
        if( TimeMS >= 1000 )
        {
            TimeS++;
            TimeMS -= 1000;
        }
        STKEVENT_signal( hEvent, STKEVENT_TIMER, 1 );
    }
}

The new function in  C:\ti\ndk_3_61_01_01\packages\ti\ndk\hal\timer_bios\lltimer.c contains the function

void llTimerTick()
{

    if( TimerOpen )
    {
        struct timespec timestamp;

        clock_gettime(CLOCK_MONOTONIC, &timestamp);

        /* save timestamp in nanoseconds */
        LastCLKTime = ((unsigned long long)timestamp.tv_sec) * 1000000000
                + timestamp.tv_nsec;
        LastCLKValid = 1;

        TimeMS += 100;
        if( TimeMS >= 1000 )
        {
            TimeS++;
            TimeMS -= 1000;
        }
        STKEVENT_signal( hEvent, STKEVENT_TIMER, 1 );
    }
}

Where both clock_gettime  and CLOCK_MONOTONIC cannot be resolved.

The file #includes <time.h> however that is being dragged in from the GCC compiler includes folder.  Not the correct one.

The clock_gettime is defined in multiple places, two candidates are 

  • bios_6_76_03_01\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\time.h
  • bios_6_76_03_01\packages\ti\posix\gcc\time.h

 There are no less that 60 no-source code files that are counter intuitive and so far I have been unable to find anything comprehendible in something other than "TI-Internal-Speak".   i.e. "build.cfg" should be the place to start... but contains only this:

if (pkg.$vers.length >= 3) {
pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..'));
}

pkg.build.libraries = [
];

pkg.build.libDesc = [
];

Which pretty much tells me nothing.  And the Welcome.html is of little value either.

Can anyone clue me in as to how to structure the search paths and #defines in order to get this to build in a CCS 10 project?   

  • How about a simpler question:   Where are the -I include paths defined?

    That would at least get me started.

    There are hundreds of *.mak, *.bld, *.xml files plus java all over the place.

    The opening command that starts the entire process appears to be:

    XDC = $(XDC_INSTALL_DIR)/xdc -j $(j) XDCARGS="$(XDCARGS)" XDCBUILDCFG=./ndk.bld

    Where 'j' is defined as 8 a few lines before.

    Trying to find some information on the "xdc" command, apparently the 'j' option isn't documented in the only command line reference that comes up on a search:

    software-dl.ti.com/.../Command_-_xdc.html

    A TI search yielded this, and although top of the list, is even older

    www.ti.com/.../spruex4.pdf

    So, as I traverse hundreds of files through a maze that is not documented, is there any documentation overview that shows how this hybrid, customized, proprietary build system works?

    Or can someone just tell me where the -I includes are defined in this maze of files?

  • Hi Chris,

    I see NDK build instructions here: ndk_3_61_01_01/docs/ndk/NDK_Users_Guide.html, 1.2 Rebuilding NDK Libraries. This takes you to this FAQ: https://e2e.ti.com/support/processors/f/791/t/947275, which finally takes you to "Rebuilding The NDK Core Using Gmake - Texas Instruments Wiki.pdf" for NDK 3.61.

    I tried building the NDK on a Windows 10 host using the instructions in "Rebuilding The NDK Core Using Gmake - Texas Instruments Wiki.pdf". I was able to build some of the archives, but the build wasn't completely successful.

    My purpose in going through this exercise was to see if I could observe the options supplied to the compiler and archiver. If these options can be obtained, then they can be ported into a CCS-based build.

    Unfortunately the command-line build output is very quiet, and doesn't show the options provided the compiler. For example:

    Example CL compiler output:

    cla8fg slnetifndk.c ...

    Example CL archiver output:

    archiving package/lib/lib/servers/package/package_ti.ndk.tools.servers.oa8fg package/lib/lib/servers/autoconn.oa8fg package/lib/lib/servers/datasrv.oa8fg package/lib/lib/servers/echosrv.oa8fg package/lib/lib/servers/newservers.oa8fg package/lib/lib/servers/nullsrv.oa8fg package/lib/lib/servers/oobsrv.oa8fg into lib/servers.aa8fg ...

    I'm not an expert in the NDK build system as you can probably surmise. I'll see if I can find an expert internally. In the meantime my suggestion would be to see if you can determine which files in the build system display the command-line output, and then see if you can modify these files to produce verbose output.

    Regards,
    Frank

  • Chris,

    I see this in ndk.mak:

    #
    # Set XDCOPTIONS.  Use -v for a verbose build.
    #
    #XDCOPTIONS=v
    

    I'll see if this provides more verbose output.

    Regards,
    Frank

  • Chris,

    Using this option in ndk.mak produces verbose command-line output (please see below). This output should allow you to determine the compiler / archiver options to use in a CCS-based build.

    # cla8fg package/package_ti.ndk.slnetif.c ...                                                                                                                                                                    
    R:/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -c -MD -MF package/lib/lib/slnetifndk/package/package_ti.ndk.slnetif.oa8fg.dep -x c  -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections  
    -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard -mabi=aapcs -g -Dfar= -D__DYNAMIC_REENT__  -std=c99  -Dxdc_target_name__=A8F -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_
    0_7_3_1  -O2    -I../../../ti/ndk/inc -I../../../ti/ndk/inc/tools -IR:/ndk_3_61_01_01/source -IR:/bios_6_76_03_01/packages/ti/posix/gcc -I. -IR:/bios_6_76_03_01/packages -IR:/xdctools_3_55_02_22_core/packages 
    -I../../.. -IR:/bios_6_76_03_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include/newlib-nano -IR:/bios_6_76_03_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include -o packa
    ge/lib/lib/slnetifndk/package/package_ti.ndk.slnetif.oa8fg package/package_ti.ndk.slnetif.c                                                                                                                      
    R:/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -c -MD -MF package/lib/lib/nettool/dhcp/dhcpbild.oa8fg.dep -x c  -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections  -mcpu=cortex-a8 -mfp
    u=neon -mfloat-abi=hard -mabi=aapcs -g -Dfar= -D__DYNAMIC_REENT__  -std=c99  -Dxdc_target_name__=A8F -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_7_3_1  -O2  -D_NDK
    _EXTERN_CONFIG -D_INCLUDE_NAT_CODE -D_INCLUDE_PPP_CODE -D_INCLUDE_PPPOE_CODE -D_INCLUDE_NIMU_C# cla8fg mem.c ...ODE -D_INCLUDE_IPv6_CODE  -I../../../ti/ndk/inc -I../../../ti/ndk/inc/tools  -IR:/bios_6_76_03_01
    # cla8fg mem_data.c ...-I. -IR:/bios_6_76_03_01/packages -IR:/xdctools_3_55_02_22_core/packages -I../../.. -IR:/bios_6_76_03_01/packages/gnu/targets/arm//libs/install-native/arm-none-eabi/include/newlib-nano -
    R:/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -c -MD -MF package/lib/lib/os/mem.oa8fg.dep -x c  -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections  -mcpu=cortex-a8 -mfpu=neon -mfloat-
    abi=hard -mabi=aapcs -g -Dfar= -D__DYNAMIC_REENT__  -std=c99  -Dxdc_target_name__=A8F -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_7_3_1  -O2  -DUSE_LL_SEMAPHORE=0 
    -D_NDK_EXTERN_CONFIG   -I../../../ti/ndk/inc -I../../../ti/ndk/inc/tools -IR:/bios_6_76_03_01/packages/ti/posix/gcc -I. -IR:/bios_6_76_03_01/packages -IR:/xdctools_3_55_02_22_core/packages -I../../.. -IR:/bios

    Regards,
    Frank

  • Frank,

    Frank Livingston said:
    1
    2
    3
    4
    #
    # Set XDCOPTIONS.  Use -v for a verbose build.
    #
    #XDCOPTIONS=v

    I think it will, but much of it will scroll off the window.  It'll have to be captured to a file.

    A few years ago I was able to drag the entire NDK 2_25_01_11 into our project (600+ files, 100's of thousands of lines) and adjust the includes and defines. Then we could modify a few small things as needed, and also integrate some of our custom drivers through the NIMU.

    Now, trying to do that again, there are conflicts with the GNU compiler, conflicts with the older baremetal starterware, complete changes to the CPSW files... 

    And there is never any documentation about how the internals of any of these are structured.  Figuring out the NDK NIMU and stack was a tedious, hand debugged job.

    I guess I also have to do that for the PDK and whatever other functions/files the updated NDK is dependent on.  Because I can't find any doc on how it works (I don't want or need doc on how to use it).

    You'll be happy to know I'm systematically going through SPRUEX3...   Educational, but finding a few errors, and inadequate explained material.

    ( Someday, I'll be posting a question as to why I have one ccxml file that does EXACTLY what I want, but I can't replicate it...  every other target config I try to create, there are no settings to get it to do what I need.  )

  • Hi Chris,

    Christopher Weber said:
    I think it will, but much of it will scroll off the window.  It'll have to be captured to a file.

    Agreed, I just did this as follows:

    gmake -f ndk.mak > build_log.txt 2>&1

    Regards,
    Frank