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:
Eclipse A New Project
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
Eclipse Create A STM32F7XX Project
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)
Eclipse Target Processor Settings
Then, click Next.

D. Folder settings

Eclipse Folders Settings
Just click Next.

E. Select Configurations

Eclipse 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:
    1
    $ ls /opt/GCCToolChains/gnu-mcu-eclipse/arm-none-eabi-gcc/7/bin
    2
    arm-none-eabi-addr2line arm-none-eabi-elfedit arm-none-eabi-gcc-ranlib arm-none-eabi-gprof arm-none-eabi-ranlib
    3
    arm-none-eabi-ar arm-none-eabi-g++ arm-none-eabi-gcov arm-none-eabi-ld arm-none-eabi-readelf
    4
    arm-none-eabi-as arm-none-eabi-gcc arm-none-eabi-gcov-dump arm-none-eabi-ld.bfd arm-none-eabi-size
    5
    arm-none-eabi-c++ arm-none-eabi-gcc-7.2.1 arm-none-eabi-gcov-tool arm-none-eabi-nm arm-none-eabi-strings
    6
    arm-none-eabi-c++filt arm-none-eabi-gcc-ar arm-none-eabi-gdb arm-none-eabi-objcopy arm-none-eabi-strip
    7
    arm-none-eabi-cpp arm-none-eabi-gcc-nm arm-none-eabi-gdb-py arm-none-eabi-objdump
    Copied!
Eclipse GNU ARM Cross Toolchain
Finally, click Finish.

G. Build the Empty Project

Now, let's have a look at the empty project's code:
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include "diag/Trace.h"
4
5
// ----------------------------------------------------------------------------
6
//
7
// Standalone STM32F7 empty sample (trace via DEBUG).
8
//
9
// Trace support is enabled by adding the TRACE macro definition.
10
// By default the trace messages are forwarded to the DEBUG output,
11
// but can be rerouted to any device or completely suppressed, by
12
// changing the definitions required in system/src/diag/trace_impl.c
13
// (currently OS_USE_TRACE_ITM, OS_USE_TRACE_SEMIHOSTING_DEBUG/_STDOUT).
14
//
15
16
// ----- main() ---------------------------------------------------------------
17
18
// Sample pragmas to cope with warnings. Please note the related line at
19
// the end of this function, used to pop the compiler diagnostics status.
20
#pragma GCC diagnostic push
21
#pragma GCC diagnostic ignored "-Wunused-parameter"
22
#pragma GCC diagnostic ignored "-Wmissing-declarations"
23
#pragma GCC diagnostic ignored "-Wreturn-type"
24
25
int
26
main(int argc, char* argv[])
27
{
28
// At this stage the system clock should have already been configured
29
// at high speed.
30
31
// Infinite loop
32
while (1)
33
{
34
// Add your code here.
35
36
}
37
}
38
39
#pragma GCC diagnostic pop
40
41
// ----------------------------------------------------------------------------
Copied!
Then, we Build Project,
Eclipse Built Empty 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:
1
// Add your code here.
2
printf("Hello World!\n");
Copied!

B. Build Project - Failure

Eclipse Built 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).
--specs=nosys.specs
Then, we Apply.

D. Devices STM32F767ZI

Then, we move to Devices tab, and we found STM32F767ZI.
Devices STM32F767ZI
Then, we Apply and Close.

E. Build Project Again - Successful

Eclipse Successfully Built