2.3 FIRST STM32 Project - Hello World
As any other programming languages, our first STM32 Project is also "Hello World", without hardware wiring. Using GNU MCU Eclipse to develop STM32 follows the same way to develop any other projects under Eclipse.
2.3.1 Steps to Build Our First Empty Project
A. Create an Empty Project
File->New->C/C++ Project, then click on C++ Managed Build:
Then, click Next.
B. Select STM32F7XX C/C++ Project
In the dialog C++ Project,
under Project type:->Executable, select STM32F7XX C/C++ Project
under Project name:, input Hello World
Then, click Next.
C. Target Processor Settings
In the dialog Target Processor Settings,
under Chip family, select STM32F767xx
under Flash size (kB):, make sure it's 2048
under External clock (Hz):", make sure it's 8000000
under Content:, select Empty (add your own content)
under Use system calls:, select Freestanding (no POSIX system calls)
Then, click Next.
D. Folder settings
Just click Next.
E. Select Configurations
Just click Next.
F. GNU ARM Cross Toolchain
In the dialog GNU ARM Cross Toolchain,
under Toolchain name:, select GNU MCU Eclipse ARM Embedded GCC (arm-none-eabi-gcc)
under Toolchain path:, make sure you put the correct toolchain directory. In our case:
Finally, click Finish.
G. Build the Empty Project
Now, let's have a look at the empty project's code:
Then, we Build Project,
2.3.2 Steps to Build "Hello World"
A. Code Modification
In file main.cpp, add one line printf("Hello World!\n"); under Add your code here. as:
B. Build Project - Failure
Why? In the next step, we are going to solve the problem.
C. --specs=nosys.specs
To build the project successfully, we need to set --specs=nosys.specs. But, how to? HelloWorld->Properties->C/C++ Build->Settings->Tool Settings->GNU ARM Cross C++ Linker->Miscellaneous, and tick Do not use syscalls(-specs=nosys.specs).
Then, we Apply.
D. Devices STM32F767ZI
Then, we move to Devices tab, and we found STM32F767ZI.
Then, we Apply and Close.
E. Build Project Again - Successful
Last updated