Clone NuttX:
$ git clone https://bitbucket.org/nuttx/nuttx
Clone NuttX’s Apps:
$ git clone https://bitbucket.org/nuttx/apps
Clone libc++ for NuttX:
$ git clone https://bitbucket.org/acassis/libcxx
Install the libc++ on NuttX:
cd libcxx $ ./install.sh ../nuttx/ Installing LLVM/libcxx in the NuttX source tree Installation suceeded
Modify the HelloXX example to use sstream:
$ cd .. $ cd apps
Download 0001-Modify-helloxx-to-test-sstream.patch: https://gist.github.com/acassis/504e86d992a2fc459784c6284aa90e53
Apply it:
$ git am 0001-Modify-helloxx-to-test-sstream.patch
Add (l)gamma to NuttX and add helloxx example:
$ cd .. $ cd nuttx
Download 0001-Add-gamma-and-lgamma.patch: https://gist.github.com/acassis/4fc95d3ecba3c4829eac303d5704dc76
Apply it:
$ git am 0001-Add-gamma-and-lgamma.patch
Download 0001-Add-helloxx-C-example-to-STM32F4Discovery.patch: https://gist.github.com/acassis/b17e90835eeffb58a35651a4e0d0503d
Apply it:
$ git am 0001-Add-helloxx-C-example-to-STM32F4Discovery.patch
Configure NuttX to use the helloxx example:
$ cd tools $ ./configure.sh stm32f4discovery/helloxx
Compile it:
$ cd .. $ make
Flash it:
$ sudo openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"
Restart NuttX, you should see:
Hello World! 42 helloxx_main: Saying hello from the dynamically constructed instance CHelloWorld::HelloWorld: Hello, World!! Hello World! 42 helloxx_main: Saying hello from the instance constructed on the stack CHelloWorld::HelloWorld: Hello, World!! helloxx_main: Saying hello from the statically constructed instance CHelloWorld::HelloWorld: Hello, World!!