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.

Boolean problem on Launchpad F28377S

Other Parts Discussed in Thread: CONTROLSUITE, TMS320F28377S

I've been struggling for the whole day trying to compile a very simple (and empty) program on the Launchpad F28377S.

It fails complaining that the _Bool type is undefined:

"C:/ti/ccsv6/tools/compiler/ti-cgt-c2000_6.4.10/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -O2 --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-c2000_6.4.10/include" --include_path="C:/ti/controlSUITE/device_support/f2837xD/v110/F2837xD_headers/include" --include_path="C:/ti/controlSUITE/device_support/f2837xD/v110/F2837xD_common/include" --advice:performance=all -g --c++03 --cpp_default --define=_INLINE --define=CPU1 --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp"  "../main.cpp"
"C:/ti/controlSUITE/device_support/f2837xD/v110/F2837xD_headers/include/F2837xD_Device.h", line 102: error #20: identifier "_Bool" is undefined
"C:/ti/controlSUITE/device_support/f2837xD/v110/F2837xD_headers/include/F2837xD_Device.h", line 105: error #20: identifier "_Bool" is undefined
"C:\ti\controlSUITE\device_support\f2837xD\v110\F2837xD_common\include\F2837xD_Pbist_defines.h", line 252: error #20: identifier "_Bool" is undefined
"C:\ti\controlSUITE\device_support\f2837xD\v110\F2837xD_common\include\F2837xD_Pbist_defines.h", line 254: error #20: identifier "_Bool" is undefined

If the project is compiled in C instead of C++ (thus the main is included in a main.c file rather than a main.cpp file) the project compiles correctly. Now I do need C++ for development of my project so I would like to hear what could solve this. I tried the workarounds of editing the controlSUITE libraries and declare or typedef _Bool but got nowhere.

Ironically I can compile my project if I link it against other Piccolos' libraries but that's not the point. The point is to use this powerful hardware to its full extent ;)

Anyone got this sorted? 

Thanks

  • Technically, there is no formal solution for this problem. The type _Bool only exists in the standard C language. The C++ language does not provide any type that would guarantee compatibility with _Bool. Now you could try using #include <stdbool.h> and use bool. However this is not guaranteed to be compatible. The best recommendation would be working strictly in C, but I guess I can see the possibility of using C++ in order to take advantage of certain programming capabilities. Try using the workarounds and if not, the best suggestion would be reverting your code to C99.
  • Hi Kyle,

    My main is actually empty ...

    /*
    * main.cpp
    *
    * Created on: 6-mag-2016
    * Author: Stefano
    */

    #include "F28x_Project.h" // Device Headerfile and Examples Include File
    #include <limits.h>
    #include <stdio.h>

    int main()
    {

    return 0;
    }

    It is just the "F28x_Project.h" that seems to mess up the booleans thing ...
  • I'm trying to update TI ControlSUITE to latest version that includes support for F2833xS. I am now using the libs and headers for F2833xD which may explain this problem. I'll keep you updated ;)
  • Please do. Getting any feedback is greatly appreciated and hopefully will be helpful in fixing this problem.
  • OK so this is what I did, following and adapting the guide in e2e.ti.com/.../1541.Lunchpad-basics.pdf

    1) Update ControlSUITE to latest version. In the old version I had installed there was support for F2837xD but not F2837xS. Indeed the F28377S launchpad didn't appear in the device search results

    2) Manually added in F2837xS_device.h (TI: could you please fix this upstream ?)

    #ifdef __cplusplus
    typedef bool _Bool;
    #endif

    Just after the existing #include <stdint.h>

    3) Project properties -> CCS Build -> C2000 Compiler -> Advanced options -> Language options and
    unchecked the "Treat C files as C++ files (--cpp_default, -fg)" option (I think I set this myself though)

    4) Resource -> Linked Resources -> Path Variables
    Click "New" and create a variable "CONTROLSUITE" pointing to "C:\ti\controlSUITE"

    5) Project properties -> CCS Build -> C2000 Compiler -> Include options
    Add "${CONTROLSUITE}/device_support/f2837xS/v191/F2837xS_headers/include"
    Add "${CONTROLSUITE}/device_support/f2837xS/v191/F2837xS_common/include"

    6) Project properties -> CCS Build -> C2000 Linker -> File Search Path
    Add "${CONTROLSUITE}/device_support/f2837xS/v191/F2837xS_common/include"

    7) Go with Windows explorer to C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_common\source and drag and drop the following files to CCS project:
    - F2837xS_CodeStartBranch.asm
    - F2837xS_CpuTimers.c
    - F2837xS_DefaultISR.c
    - F2837xS_Gpio.c
    - F2837xS_PieCtrl.c
    - F2837xS_PieVect.c
    - F2837xS_SysCtrl.c
    - F2837xS_usDelay.asm

    Be sure to select "Link files" and relative to "CONTROLSUITE" in the dropdown menu

    8) Go with Windows explorer to C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_headers\source and drag and drop the following files to CCS project:
    - F2837xS_GlobalVariableDefs.c

    Be sure to select "Link files" and relative to "CONTROLSUITE" in the dropdown menu

    9) Go with Windows explorer to C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_headers\cmd and drag and drop the following files to CCS project:
    - F2837xS_Headers_nonBIOS.cmd

    Be sure to select "Link files" and relative to "CONTROLSUITE" in the dropdown menu

    10) Go with Windows explorer to C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_common\cmd and drag and drop the following files to CCS project:
    - 2837xS_Generic_FLASH_lnk.cmd

    Be sure to select "Link files" and relative to "CONTROLSUITE" in the dropdown menu

    11) Project properties -> CCS General
    Family: C2000
    Variant: TMS320F28377S
    Connection: Texas Instruments XDS100v2 USB Debug Probe

    Compiler version: TI v6.4.10
    Linker command file: F2837xS_Headers_nonBIOS.cmd
    Runtime support library: <automatic>


    ** Be sure to link the "2837xS_Generic_FLASH_lnk.cmd" file (step 10) otherwise you will get many errors for many sections not fitting into memory **


    Like this I am able to compile and upload a basic (and empty) program into the Launchpad.
    I hope this information can be useful to those in a similar situation.

    Just another question: is it possible to avoid erasing the RAM at each time I upload a new program ? I am a bit worried of wearing it out quickly (and it takes quite a few seconds to do it) ? Maybe I should replace the 2837xS_Generic_FLASH_lnk.cmd with the 2837xS_Generic_RAM_lnk.cmd ?