element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Safe and Sound
  • Challenges & Projects
  • Design Challenges
  • Safe and Sound
  • More
  • Cancel
Safe and Sound
Blog Safe and Sound Wearables- Hearing Guard System #6: CCS and TI-RTOS with Class
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jomoenginer
  • Date Created: 2 Apr 2017 8:42 AM Date Created
  • Views 823 views
  • Likes 3 likes
  • Comments 4 comments
  • ccs
  • code composer studio
  • safe and sound design challenge
  • c++
  • ti-rtos
Related
Recommended

Safe and Sound Wearables- Hearing Guard System #6: CCS and TI-RTOS with Class

jomoenginer
jomoenginer
2 Apr 2017

CCS and TI-RTOS with Class

 

For my Hearing Guard System Safe & Sound Challenge project it was decided to attempt to implement C++ Object Oriented Programming features which includes the use of Classes over the standard C Structured Programming.  As a baseline, I used the 'bigtime' project which can be found in the MSP432 TI-RTOS package. However, I soon ran into a limitation especially when calling the Graphics files used with the Sharp LCD.  Initially, like with the 'bigtime' project, I tried to use the default TI-Compiler TI v16.12.0.STS.  The issue is that the grlib libraries use defined variables such as 'int8_t' which are typdef'd as '__int8_t' and is defined as follows

  typedef signed char __int8_t ;

 

The problem is that the the TI-Compiler  TI v16.12.0.STS only supports up to C++03, C Compiler defaults at c89, which does not include defined C99 types from C so I kept getting compiler errors.  After some research, and many a late night hacking,  I found the GNU compiler that can be added to CCS via the CCS App Center tool does support up to C++11 and includes support for the C99 style int8_t and other defines. Thus, I added this to CCS, 6.2 in this instance, and then Created another project via 'Project->New CSS Project' and Selecting Compiler Version GNU v4.9.3 (Linaro). Set a Project name and then under 'Project Templates and examples' select:

     TI-RTOS Examples->MSP_EXP432P401R->Driver Examples->GNU Driver Examples->Empty Examples->Empty Project.

 

 

Once the project has been added to the Project Explorer, the first thing to do to make this a C++ project is to replace the existing empty.c file with a .cpp file.  I found it is best just to create a new Source File and use '_Template' 'Default C++ source template' and ensure to name the file with an .cpp extension. Once the file is in place, copy the contents from empty.c to the new .cpp file and then remove the empty.c file.

 

To complete the conversion to a C++11 supported project, a few changes to the Project Properties have to be made.

     1. Right click on the new project and select 'Properties' at the bottom of the pop-up window

          a. Under CSS General, select the RTSC tab

               I. Select Product and Repositories:

                    1. ensure the following are set:

                         i. XDCtools version:

                              a. 3.32.1.22_core

                              NOTE: The is the latest in my config

                    2. TI-RTOS for MSP43x (checked)

                         I. 2.20.0.06 (checked)

                         Note: Your version may differ

                    3. Other Repositories

                         I. '${TARGET_CONTENT_BASE}' (checked)

                    4. All other items not checked at this time

               II. Target:

                    1. gnu.targets.arm.M4F

              III. Platform:

                    1. ti.platforms.msp432:MSP432P401R

 

image

 

 

 

     2. In the Properties window

          a. Select CCS Build

               I. GNU Compiler

                    1. Symbols

                         i. Add the following

                              a. '__cplusplus'

                                   1. Value = 201103L

                              b. __GXX_EXPERIMENTAL_CXXOX__

image

                    2. Miscellaneous

                         i. Other flags:

                              a. Add

                                   1. -std=c++11

image

 

 

                    3. Select Directories

                         i. Under 'Include paths (-l)' add

                              a. Directory path to the grlib/grlib folder in your workspace

                                   1. ex: "${workspace_loc:/${ProjName}/grlib/grlib}"

 

image

 

 

 

     3. Still in the Properties window, in the left window

          a. Select CCS General

               I. GNU linker

                    1. Libraries

                         i. Libraries ('-l, --library)

                              a. Click Add

                                   1. Enter: “stdc++”

                                      NOTE: use quotes around stdc++

image

 

 

     4. In the Properties window

          a. Select C/C++ Build

               I. Settings

                    1. Tool Settings tab

                         i. GNU Compiler

                              a. Symbols

                              NOTE: ensure the following settings performed previously are set

                                   1. __cplusplus

                                        i. Value = 201103L

                                   2. __GXX_EXPERIMENTAL_CXX0X_

 

image

 

                              b. Miscellaneous

                                   1. Ensure Other flags has

                                        i. -stdc=c++11

image

 

 

          b. Select C/C++ General

               I. Paths and Symbols

                  1. Library Path tab

                        i. Ensure the TIRTOS path is set to the appropriate path for the 'gcc' compiler

                            NOTE: TI-RTOS for MSP432 in this instance for the MSP432 Launchpad

                                                ${COM_TI_RTSC_TIRTOSMSP430_INSTALL_DIR}/products/msp432_driverlib_3_21_00_05/driverlib/MSP432P4xx/gcc

 

image

 

               II. Preprocessor Include Paths, Macros etc.

                  1. Providers tab

                         i. Ensure the only 'CDT GCC Built-in Compiler Settings' is selected:

                            NOTE: All other options are not selected.

                         ii. In the Command to get compiler specs, add the following:

                              a.  '-std=c++11'

image

 

This should get the environment set to for c++11 style development in TI-RTOS using Code Composer Studio.

 

Since this is such a long posting, I'll create a follow on post to cover the C++ Class code I have started.

  • Sign in to reply

Top Comments

  • jomoenginer
    jomoenginer over 8 years ago in reply to Jan Cumps +1
    yeah, it was a lot of head banging to finally get to where I could compile the code without errors and implement what I wanted with Classes. As far as the usage of uintx_t type, but I did find a reference…
  • DAB
    DAB over 8 years ago

    Great post.

     

    There is a lot of set up needed to get your code to the right state.

     

    I have found it takes a while to understand all of the little details needed to make coding using these tools efficient.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jomoenginer
    jomoenginer over 8 years ago in reply to Jan Cumps

    yeah, it was a lot of head banging to finally get to where I could compile the code without errors and implement what I wanted with Classes. 

    As far as the usage of uintx_t type, but I did find a reference that stated it was not good practice to use int8_t for strings which the grlib is doing.  Also, I found there was an inconsistency in how things such as int8_t is defined between C++ standards such as c++03 and c++11.  

    I''' see if I can find this reference again. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 8 years ago

    Well done.

     

    Lots of work and lots of searching ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago

    Oww, Lots of work to get to a point that you can start a first compilation. Very interesting I'm going to try this out.

    When it comes to TI-RTOS and C++, you'll most likely also have to deal with name mangling when registering the handler methods in the configuration file.

     

    On another note: I'm always using uintx_t type variables when writing embedded C. Is that a bad practice (asking because I learned somewhere that it's a best practice image ) or does that choice come in to play only when mixing C and C++?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube