I want to build and simulate a C++ project for Cortex-M4, using the g++ arm compiler, in Arm Dev Studio.
Which example would be suitable as a template please?
This one had me scratching my head for a moment...
I found the default build setting is to send printf (stdout) to Event Recorder, which is a Keil MDK feature for instrumentation.
Open the .rteconfig file, and disable this setting in Compiler > I/O, to use the default (semihosting) stdout.
Rebuilt, and I do indeed see the output in the Target Console:
Iris server started listening to port 7100 telnetterminal0: Listening for serial connection on port 5000 telnetterminal1: Listening for serial connection on port 5001 telnetterminal2: Listening for serial connection on port 5002 Iris server is reported on port 7100 LED On: #0 LED On: #1 LED Off: #0 LED On: #2 LED Off: #1 ...
To add a C++ file, this is not straight forward in this case. I don't think there is an option to change a C project to a C/C++ project. If you are just adding a single C++ source file, you can right click on that file, and in Properties > Tool Chain Editor, select the C++ compiler. You then need to go to Settings and enter compatible build options for the C builds. This will only apply to this source file, so isn't very scalable :(
The easiest solution (sorry) is to create a New > Project > C/C++ > C++ Project > CMSIS C/C++ Project, and then copy over the Blinky.c source file. You will need to setup the generated .rteconfig file the same way as it was for the previous project, but that is fairly straight forward from the GUI (and is likely do-once operation).