I am having an issue compiling c++ code onto a stm32f4 micro-chip.
Aim
I am trying to achieve a few things here:
- compile C++ code to the stm32f4-discovery (which has been done successfully on a bare bone program [with the implementation of constructors and other c++ specific features])
- write code using peripherals library supplied by ST (in this case, I am using the USART functionality)
- Compile code with out using a commercial IDE (this is leaning task) by using GNU tools
Issue
I have two projects setup, one is a c project and will compile correctly. I have also flashed the stm32f4 with the output of this project and it has run correctly. The second project uses the same code with minor changes to the make file and file names for the C++ compiler (no difference in code). The C project successfully compiles and the C++ project throws errors.
Both projects and their output on the terminal can be found here: https://dl.dropboxusercontent.com/u/32204435/USART.tar.gz
Setup
I am using Ubuntu 12.04.3 LTS 64bit. I have installed a arm-none-eabi toolchain by the instruction on this website: vedder.se/2012/07/get-started-with-stm32f4-on-ubuntu-linux/
Information & Analysis
From what I can make there is an error with the support of newlib in the arm-none-eabi-g++ compiler. I don't understand why there is an error as there are no code differences between the two projects. Functions from newlib like printf also product similar errors if used. In the USART examples I have limited any possibility of the project using newlib (only exception is for data types). The error does not seem to be caused by newlib but from the hardware header (or known as newlib stubs) which is missing (syscalls.h). I have been unsuccessful in any attempt to apply syscalls.h.
Can anyone help out with building this project with C++ support and maybe even offer a solution to using the code in newlib without error (like printf [or, I know a big ask, cout from iostream])?
I am still learning, I'm 17 and have no teacher (self driven) so may seem to be inexperienced, which I am :) Expect knowledge gaps.
Merry Christmas!