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 |
mcu-r5fss0-0 nortos |
CPU + OS |
mcu-r5fss0-0 freertos |
Toolchain |
ti-arm-clang |
Toolchain |
arm.gnu.aarch64-none |
Board |
am62px-sk |
Example folder |
examples/hello_world_cpp |
Steps to Run the Example
When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
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.
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