AM243x MCU+ SDK  09.01.00
Hello World C++ Project

Introduction

This example is compiled with the C++ compiler options. It does driver and board initialization and prints the string, Hello World! on UART console.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
Toolchain ti-arm-clang
Boards am243x-evm, am243x-lp
Example folder examples/hello_world_cpp

Steps to Run the Example

Sample Output

Shown below is a sample output when the application is run,

Hello World!

C++ Build Details

In this example the "hello_world.cpp" and "main.cpp" files are built with the c++ compiler flags. The example will link with the prebuilt mcu sdk libs.

Flags used for C++ build

Below are the flags used for the files to build with c++ flags along with the other flags used for c files.

  • -x c++
  • -Wno-c99-designator
  • -Wno-extern-c-compat
  • -Wno-c++11-narrowing
  • -Wno-reorder-init-list
  • -Wno-deprecated-register
  • -Wno-writable-strings
  • -Wno-enum-compare
  • -Wno-reserved-user-defined-literal
  • -Wno-unused-const-variable

Building the mcu sdk libs with C++ flsgs.

The pre built libs provided in mcu sdk are built with the C flags. However the application can re build the libs using the C++ flags. The application needs to pass the below additional flag for the make commands used for building libs

CPLUSPLUS_BUILD=yes

note: Before re building the libs you need to clean all the pre built libs.

Attention
All the MCU+ SDK libs are written in C. So if they're built with C++ flags, it is possible that a linking error might happen during the application build because of the name mangling done for C++ linkage. In this case, unless there is a requirement, it is recommended to keep the libs built using C flags only to force the C linkage. For C++ linkage of libraries, currently only the basic libs required for this example to build are tested.

Building an application using c++ flags

Hello world cpp example is provided as referance to building application using c++ flags. If you want to build the application using the c++ flags please refer the makefile In the makefile the files with extn .cpp are compiled with the c++ flags and files with .c extn are compiled with c flags.

examples\hello_world_cpp<soc><core>_<os>\ti-arm-clang\makefile