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: Mixing C and C++ "undefined reference to `operator new(unsigned int)'"

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hello,

See the subject line.

I started with an example project (NIMU Basic Example) to build on.  The whole project is in pure C.   Now I am adding a couple C++ classes, which are really just encapsulated wrappers for C code.

Everything is compiling fine, as I have correctly compensated for the name mangling with occurs between C and C++.  Here is a small sample of the code which is executed on an incoming TCP/IP connection:

        newskt = accept(skt,(struct sockaddr*)&client, &size);
        System_printf("\nConnection arrived: SD: %x\n", newskt);
        System_flush();

        ipaddr =  client.sin_addr.s_addr;
        m_connection = new CCxn();

        m_connection->Initialize(newskt,ipaddr);

The above code is in a CPP file, not a C file, so the compiler knows what "new" is.

Specifically, the failure is on the m_connection = new CCxn();  (line 58)

'Invoking: GNU Linker'
"C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a8  .....    "
C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `operator new(unsigned int)'
C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `operator delete(void*)'
C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `__cxa_end_cleanup'

The problem is that the linker (not the compiler) says it can't find "new", "delete", or "__cxa_end_cleanup".

I am using GNU v 4.9.3 compiler.  When I tried to change it to the GNU 6.3.1 compiler, I got a boatload of redefinition errors for "struct timeval" so I abandoned that strategy because I didn't want to spend the next few days figuring out why there are header conflicts.

What is the process to link a C++ project, and resolve these basci C++ operators?

Thanks.

-CSW

  • More information, but it STILL does not compile.    I changed the linker from "libc.a" to "libstdc++.a"

    Now I get:

    C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu\libg.a(lib_a-signalr.o): In function `_kill_r':
    /home/xlibrary/trees/gnu/gnu-c04/src/linaro/gcc-arm-none-eabi-4_7-2012q4-20121208/src/newlib/newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
    collect2.exe: error: ld returned 1 exit status

    Who/What is supposed to provide this function?

    Please do not suggest I update to the newer compiler. When I use the new compiler, I can't even get to the link stage because there are header conflicts for things like "struct timeval" which are defined in different header files with conflicting types.

    C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd/socketndk.h:306:8: error: redefinition of 'struct timeval'
    c:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-6-2017-q1-update\arm-none-eabi\include\sys\_timeval.h:52:8: error: previous definition of 'struct timeval'

    being pulled in from completely different sources!  One from "stdio.h"  the other from "socket.h"

    Did no one actually examine these header files before releasing this?

    Here is the diagnostic.  ( And there is also a conflict with "select()"  )

    In file included from C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd/sys/socket.h:45:0,
                     from ../HTTP/Server.cpp:27:
    C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd/socketndk.h:306:8: error: redefinition of 'struct timeval'
     struct timeval {
            ^~~~~~~
    In file included from c:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-6-2017-q1-update\arm-none-eabi\include\sys\select.h:26:0,
                     from c:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-6-2017-q1-update\arm-none-eabi\include\sys\types.h:68,
                     from c:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-6-2017-q1-update\arm-none-eabi\include\stdio.h:61,
                     from ../HTTP/Server.cpp:8:
    c:\ti\ccsv7\tools\compiler\gcc-arm-none-eabi-6-2017-q1-update\arm-none-eabi\include\sys\_timeval.h:52:8: error: previous definition of 'struct timeval'
     struct timeval {
            ^~~~~~~

    In either case, it is impossible to even build the app.

    -CSW

  • Try changing the CCS variable CG_TOOL_GCC to use g++ instead of gcc.  Right click the name of the project and choose Properties.  Then use the attached screen shot as a guide.

    Thanks and regards,

    -George

  • George,

    Thanks... I got closer.  It makes sense, I just wasn't sure where in the CCS world eco-system it was set.

    Now, as I have posted on another thread (which you may not be able to see, since suddenly it needs to be approved by the moderator) , I am getting:

    makefile:159: recipe for target 'NIMU_BasicExample_bbbAM335x_armExampleproject.out' failed
    C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu\libc.a(lib_a-signalr.o): In function `_kill_r':

    On the previous GCC compiler, I tried changing to the G++ std lib, got that missing function (see my screen image below).  

    Now that I changed to the g++ compiler, I am getting it with the Libc and the libstdc++  library.

    Do I need to provide this function?  If so, what is the function signature?  Where is the any reference to it?  

    (Also, I did a search, and all I found was someone else who was told to link to the C++ libs to resolve it.  In my case it had the opposite effect... It caused the missing "_kill". )

    (In my Linux world I would assume it's a hook into the signal vector, but there is no real 'signal' in the RTOS, is there?)

    -CSW

  • Christopher Weber said:
    makefile:159: recipe for target 'NIMU_BasicExample_bbbAM335x_armExampleproject.out' failed
    C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu\libc.a(lib_a-signalr.o): In function `_kill_r':

    There's more to this message, and what's missing probably describes the problem.  Could you post your entire build log when you get this error?

  • Archaeologist,

    Here is the back story:

    I took the BBB_NIMU basic project, and am building on it.  I added a CPP files, and it complained that there was no "new" or "delete".  I altered the build to use the g++ compiler instead of the gcc compiler.  I also changed between the "libc.a" and "libstdc++.a".  In doing do, it now tells me there is a missing "kill" function.  I also renamed all the *.C files to *.CPP to see if that would expose any issues between the C++ compiler and the C compiler.  There were a few issues, but not related to this missing function.

    Every source code modules builds cleanly. The link stage is missing that function.  There are no other messages indicating any other errors or warnings.  If there is an additional library or archive module needed, nothing is documented.

    And here is the ENTIRE build log:


    **** Build of configuration Debug for project NIMU_BasicExample_bbbAM335x_armExampleproject ****

    "C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 4 all -O
    gmake[1]: Entering directory 'C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject/Debug'
    'Building file: ../nimu_bbbam335x.cfg'
    'Invoking: XDCtools'
    "C:/ti/xdctools_3_32_01_22_core/xs" --xdcpath="C:/ti/bios_6_46_05_55/packages;C:/ti/pdk_am335x_1_0_7/packages;C:/ti/edma3_lld_2_12_04_28/packages;C:/ti/ndk_2_25_01_11/packages;C:/ti/ccsv7/ccs_base;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A8F -p ti.platforms.beaglebone -r debug -c "C:/ti/gcc-arm-none-eabi-4_9-2015q3" "../nimu_bbbam335x.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring nimu_bbbam335x.xa8fg from package/cfg/nimu_bbbam335x_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 C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject/src/sysbios/sysbios.aa8fg ...
    gmake[1]: Entering directory `C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject/src/sysbios'
    gmake[1]: Nothing to be done for `all'.
    gmake[1]: Leaving directory `C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject/src/sysbios'
    Build of libraries done.
    cla8fg package/cfg/nimu_bbbam335x_pa8fg.c ...
    'Finished building: ../nimu_bbbam335x.cfg'
    ' '
    gmake[1]: Leaving directory 'C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject/Debug'
    'Building file: ../GPIO_soc.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"GPIO_soc.d" -MT"GPIO_soc.o" -o"GPIO_soc.o" @"configPkg/compiler.opt" "../GPIO_soc.cpp"
    'Finished building: ../GPIO_soc.cpp'
    ' '
    'Building file: ../UART_soc.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"UART_soc.d" -MT"UART_soc.o" -o"UART_soc.o" @"configPkg/compiler.opt" "../UART_soc.cpp"
    'Finished building: ../UART_soc.cpp'
    ' '
    'Building file: ../main_bbbAM335x.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"main_bbbAM335x.d" -MT"main_bbbAM335x.o" -o"main_bbbAM335x.o" @"configPkg/compiler.opt" "../main_bbbAM335x.cpp"
    'Finished building: ../main_bbbAM335x.cpp'
    ' '
    'Building file: ../nimu_osal.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"nimu_osal.d" -MT"nimu_osal.o" -o"nimu_osal.o" @"configPkg/compiler.opt" "../nimu_osal.cpp"
    'Finished building: ../nimu_osal.cpp'
    ' '
    'Building file: ../HTTP/Headers.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"HTTP/Headers.d" -MT"HTTP/Headers.o" -o"HTTP/Headers.o" @"configPkg/compiler.opt" "../HTTP/Headers.cpp"
    ../nimu_osal.cpp: In function 'void Osal_TaskCreate(void*)':
    ../nimu_osal.cpp:102:31: warning: deprecated conversion from string constant to 'xdc_String {aka char*}' [-Wwrite-strings]
    taskParams.instance->name = "EmacPollPkt";
    ^
    'Finished building: ../HTTP/Headers.cpp'
    ' '
    'Building file: ../HTTP/RespHeaders.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"HTTP/RespHeaders.d" -MT"HTTP/RespHeaders.o" -o"HTTP/RespHeaders.o" @"configPkg/compiler.opt" "../HTTP/RespHeaders.cpp"
    'Finished building: ../HTTP/RespHeaders.cpp'
    ' '
    'Building file: ../HTTP/WebServer.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"HTTP/WebServer.d" -MT"HTTP/WebServer.o" -o"HTTP/WebServer.o" @"configPkg/compiler.opt" "../HTTP/WebServer.cpp"
    'Finished building: ../HTTP/WebServer.cpp'
    ' '
    'Building file: ../HTTP/HttpCxn.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"HTTP/HttpCxn.d" -MT"HTTP/HttpCxn.o" -o"HTTP/HttpCxn.o" @"configPkg/compiler.opt" "../HTTP/HttpCxn.cpp"
    'Finished building: ../HTTP/HttpCxn.cpp'
    ' '
    'Building file: ../common/SocketTools.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"common/SocketTools.d" -MT"common/SocketTools.o" -o"common/SocketTools.o" @"configPkg/compiler.opt" "../common/SocketTools.cpp"
    'Finished building: ../common/SocketTools.cpp'
    ' '
    'Building file: ../common/tools.cpp'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3359 -DSOC_AM335x -DBBB_AM335X -I"C:/Users/scott/workspace_v7/NIMU_BasicExample_bbbAM335x_armExampleproject" -I"C:/ti/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include" -I"C:/ti/ndk_2_25_01_11/packages/ti/ndk/inc/bsd" -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"common/tools.d" -MT"common/tools.o" -o"common/tools.o" @"configPkg/compiler.opt" "../common/tools.cpp"
    'Finished building: ../common/tools.cpp'
    ' '
    'Building target: NIMU_BasicExample_bbbAM335x_armExampleproject.out'
    'Invoking: GNU Linker'
    "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-g++.exe" -mtune=cortex-a8 -marm -Dam3359 -DSOC_AM335x -DBBB_AM335X -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -mfloat-abi=hard -Wl,-Map,"NIMU_BasicExample_bbbAM335x_armExampleproject.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu" -L"C:/ti/ndk_2_25_01_11/packages/ti/ndk/os/lib" -L"C:/ti/pdk_am335x_1_0_7/packages/ti/starterware/binary/soc/lib/am335x-evm/a8/release/gcc" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 -o"NIMU_BasicExample_bbbAM335x_armExampleproject.out" "./GPIO_soc.o" "./UART_soc.o" "./main_bbbAM335x.o" "./nimu_osal.o" "./HTTP/Headers.o" "./HTTP/HttpCxn.o" "./HTTP/RespHeaders.o" "./HTTP/WebServer.o" "./common/SocketTools.o" "./common/tools.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lrdimon -lgcc -lm -lnosys -l:os.aa8fg -lsoc -lc -Wl,--end-group
    makefile:161: recipe for target 'NIMU_BasicExample_bbbAM335x_armExampleproject.out' failed
    C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu\libc.a(lib_a-signalr.o): In function `_kill_r':
    /home/xlibrary/trees/gnu/gnu-c04/src/linaro/gcc-arm-none-eabi-4_7-2012q4-20121208/src/newlib/newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [NIMU_BasicExample_bbbAM335x_armExampleproject.out] Error 1
    gmake: *** [all] Error 2
    makefile:157: recipe for target 'all' failed

    **** Build Finished ****

  • Christopher Weber said:
    undefined reference to `_kill'

    Okay, here's your actual problem.  kill is a system call; I don't know in which library G++ chooses to provide it, or if it does at all.

  • Archaeologist said:
    Christopher Weber
    undefined reference to `_kill'

    Yea...  And this is RTOS.  Should the RTOS provide this call?  Even if it's just a "bus fault" vector?

    Archaeologist said:

    I don't know in which library G++ chooses to provide it, or if it does at all.

    So, I can't build a C++ project?

    If can't, okay I'll find another way to do this.  But it would be nice to know there is a limitation.

    -CSW

  • You can build a C++ project, but I don't know if you can build one with a call to "kill" in it. This is beyond my expertise; we need to find someone who knows.
  • No, I can't build a C++ project. Because the linker is looking for a system call that doesn't exist.
    And I am not making any call to "kill" in my project, some other library wants that call.

    Yes, please find someone who knows.

    This is not looking like it's ready for real world use.
  • Hi Christopher,

    There are 2 RTS libraries shipped with GCC - librdimon and libnosys, that contain an implementation of _kill. It looks like you have both these libraries specified on your link line "-rdimon -nosys". Maybe that is part of the problem. Can you remove one of the two and report if you see any change ? If your app is not using semihosting for CIO, then you can keep "-nosys". Otherwise, keep "-rdimon".

    Best,
    Ashish
  • Ashish,

    I did not specify my linker. This was the linker settings that came with the example project.

    I removed "rdimon".

    Then tried to rebuild several times, as CCS 7.2 CONSTANTLY locks up on me (did no one QA this release?  Tells me it can't fine 'gmake'... until I press build again a few more times, then it magically finds it)

    In addition to missing"kill" it is now also missing kill_r, getpid_r, close_r, lseek_r, rear_r, ftsat_r, isatty_r...

    I added rdimon back in, and removed nosys.  Now it's back to just "kill" again.   Specifically, it says this:

    makefile:160: recipe for target 'NIMU_BasicExample_bbbAM335x_armExampleproject.out' failed
    C:/ti/bios_6_46_05_55/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu\libc.a(lib_a-signalr.o):
    In function `_kill_r':  
    /home/xlibrary/trees/gnu/gnu-c04/src/linaro/gcc-arm-none-eabi-4_7-2012q4-20121208/src/newlib/newlib/libc/reent/signalr.c:61
    :
    undefined reference to `_kill'
    collect2.exe: error: ld returned 1 exit status

    And yet you say that the function is inside one (or both) of those libraries... (Which screams to me that the function signature is not correctly declared to link as C to a C++  project- just like the bunch of other TI supplied headers I had to fix because they were broken, and could not even compile in C++ ).

    Also, can you please specifically define "semihosting" ...?  In the gigs of documentation I have had to dig through, I've never seen it defined.  I can't tell you if I'm doing it, if nothing defines what it is.

    -CSW

  • Hi Christopher,

    Sorry to hear you are running into so many issues trying to compile an example project (which should work out of the box). Can you try removing both "-rdimon" and "-nosys" from the link line and adding "--specs=rdimon.specs" ?

    Here's a link that defines semihosting:
    infocenter.arm.com/.../index.jsp

    If you dont see a "xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport')" in your application's cfg file then semihosting has not been enabled and you should use libnosys (--specs=nosys.specs).

    Best,
    Ashish
  • Ashish,

    It does work out of the box, when CCS is behaving properly.  But when I tried to simply change it to C++, everything broke.  
    (You know there is a header file with ifdef cplusplus, extern "C" {   ... but no associated closing brace, right?)

    I removed both rdimon and nosys, and added --specs=rdimon.specs in the "other flags" setting.   Now everything linked.

    The config file does contain "var SemihostSupport = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');"  so I didn't need to add that part.

    Case closed (at least this one). Thanks.

    -CSW

  • Hi Christopher,

    Can you please share which header file is broken for C++ ? I will file a bug to fix that header file and review other header files in the same package to check if similar issues exist.

    Thanks,

    Ashish

  • Ashish,

    First of all, the file
    C:\ti\pdk_am335x_1_0_7\packages\ti\board\board.h 
    doesn't have *any* extern "C" wrappers protecting the function declarations.  I have to put this in my code:

    #ifdef __cplusplus
    extern "C" {
    #endif
    #include <ti/board/board.h>
    #ifdef __cplusplus
    }
    #endif

    In the file C:\ti\pdk_am335x_1_0_7\packages\ti\drv\emac\src\v4\emac_drv_v4.h there is an opening

    #ifdef __cplusplus
    extern "C" {
    #endif

    but no closing control.  

    I did a quick (NOT EXHAUSTIVE) search of header files, looking for the keyword "__cplusplus", and found a few more which have openings, but no closings:

     C:\ti\pdk_am335x_1_0_7\packages\ti\board\src\idkAM437x\device\qspi_flash.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\board\src\idkAM571x\device\qspi_flash.h 
     C:\ti\pdk_am335x_1_0_7\packages\ti\board\src\idkAM572x\device\qspi_flash.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\csl\csl_tsipAux.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\csl\src\ip\bwmgmt\V0\csl_bwmngmtAux.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\drv\spi\test\mcspi_serial_flash\src\W25Q.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\drv\spi\test\qspi_flash\src\Flash_S25FL\S25FL.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\drv\usb\src\include\debug.h

    And there are some that ONLY HAVE CLOSING statements:
     C:\ti\pdk_am335x_1_0_7\packages\ti\starterware\library\nandlib\include\nand_lib.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\starterware\utils\display_utils_dss.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\starterware\utils\display_utils_ip.h
     C:\ti\pdk_am335x_1_0_7\packages\ti\starterware\utils\display_utils_lcdc.h 

    There some files , such as   C:\ti\pdk_am335x_1_0_7\packages\ti\drv\gpio\Settings.h which creatively redefined "extern" to handle it

    #ifdef __cplusplus
    #define __extern extern "C"
    #else
    #define __extern extern
    #endif

    So those only contain one "ifdef __cplusplus"

    -CSW 

  • Thanks Christopher. I have opened a bug against Processor SDK and described the problem. The bug id is PRSDK-2819. We don't have a way to make the bug database available externally, but, you will probably see this JIRA id in a future processor SDK release note indicating it has been resolved.

    Best,
    Ashish