cancel
Showing results for 
Search instead for 
Did you mean: 

I Have a source code written with C++ Math Calculation(.cpp + .h files). I can run it on desktop by compilling .dll/ .exe or .OS. Is there any chance to compile or run this code on STM32F4 Discovery Board. What should ı have to do?

MetuPhysics
Associate II
 
9 REPLIES 9
MM..1
Chief II

Create in CubeIDE C++ project ...

sory but ı hav basic level on this stm32. can u explain the critical steps. for example, should ı write my code as copy and paste or should ı add some lib headers or etc.

Thanks for your response

Install STMCubeIDE , run it create new project , choice your discovery board and C++.

...

selected c/c++ project, selected c++ Manage Build, and under the executable file selected STM32F4xx C/C++ Project with Cross ARM Choice, and

Toolchain name: GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc)

Toolchain path: ARM Embedded GCC ... and ı pressed finish.

now it bring an folders which includes GNU folders...

after that ı write simple code for demo:

#include <stdio.h>

int main() {

    printf("Hello World\n");

    return 0;

}

But it gives error..

AScha.3
Chief III
  1. select...ST32 project -> select your board (F4disco) ...generate...put in code and -> debug
  2.  printf( ... prints to what ? - and - : "helloWorld" here is more switch an LED on and off :)
If you feel a post has answered your question, please click "Accept as Solution".

>>But it gives error..

Error says what?

The main() has nowhere to return too, and the printf() expects you to provide some plumbing that indicates where and how the data goes somewhere.

You are responsible from bringing up clock, pins, peripherals.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Here you can find helping hands for your project.

Actually ı looking for pritng C++ stringCode the hello World output in a serial monitor by using COM connection. Is that Possible?

Probaly, If ı can figure out this way maybe ı can run my C++ Math Code in STM32...

AScha.3
Chief III

on F4disco board should be STLink V2.1 ; this makes multi-USB device, for debug and a vcp (com port).

look for example in STM files, and disco manual, which USART is connected to stlink/serial .

If you feel a post has answered your question, please click "Accept as Solution".