Environment
- Host PC: Ubuntu 16.04
- Device: NUCLEO F446RE
- IDE: Eclipse IDE for C/C++ Developers Version: Photon Release (4.8.0)
I’ve already made eclipse environment before to develop LPC1768. You can see detail of it at below.
Setup Eclipse Environment for Mbed NXP LPC1768 | shiroku.Net
Create New Makefile for F446RE
Copy from default gcc4mbed.
$ cd ~/gcc4mbed/build/
$ cp gcc4mbed.mk gcc4mbed_NUCLEO_F446RE.mk
Modify two lines as below.
$ vi gcc4mbed_NUCLEO_F446RE.mk
# DEVICES ?= LPC1768
DEVICES ?= NUCLEO_F446RE
# deploy: LPC1768-deploy
deploy: NUCLEO_F446RE-deploy
Create New Work Space
$ mkdir ~/gcc4med/NUCLEO_F446RE
Open Eclipse, and switch workspace.
File > Switch Workspace > Other
Create New Project
File -> New -> Makefile Project from Existing Code
Right click project, and click “Clean Project”
Makefile
Edit Makefile.
PROJECT := HelloWorld
DEVICES := NUCLEO_F446RE
GCC4MBED_DIR := ../..
NO_FLOAT_SCANF := 1
NO_FLOAT_PRINTF := 0
MBED_OS_ENABLE := 0
include $(GCC4MBED_DIR)/build/gcc4mbed_NUCLEO_F446RE.mk
Setup Property of Project
Select “HelloWorld” and right click and select “Properties”.
C/C++ Build -> Manage Configurations… -> New…
Create “Debug”.
Delete “Default” and set like this.
Build (Incremental build): all deploy GCC4MBED_TARGET=Debug
C/C++Build -> Environment
Name: GCC4MBED_DEPLOY
Value: cp PROJECT.bin /media/$(USER)/NODE_F446RE; sync
C/C++ General -> Paths and Symbols
/home/reyes/gcc4mbed/external/mbed-os
/home/reyes/gcc4mbed/external/mbed-os/platform
/home/reyes/gcc4mbed/external/mbed-os/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F446xE/TARGET_NUCLEO_F446RE
Right click the tab on the right side window, and click new.
Target name: build all & deploy
Build target: -j4 all deploy GCC4MBED_TARGET=Debug
Connect Nucleo to Host PC, then click “build all & deploy” which was made one step before.
Now we can see the result in the console window like this.
15:57:48 **** Build of configuration Debug for project HelloWorld ****
make all deploy GCC4MBED_TARGET=Debug
Preprocessing ../../external/mbed-os/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F446xE/device/TOOLCHAIN_GCC_ARM/STM32F446XE.ld
Compiling main.cpp
Compiling ../../src/gcc4mbed.c
Linking NUCLEO_F446RE/HelloWorld.elf
Extracting NUCLEO_F446RE/HelloWorld.bin
Extracting NUCLEO_F446RE/HelloWorld.hex
Extracting disassembly to NUCLEO_F446RE/HelloWorld.disasm
text data bss dec hex filename
21340 496 1188 23024 59f0 NUCLEO_F446RE/HelloWorld.elf
Deploying to target.
15:57:51 Build Finished. 0 errors, 0 warnings. (took 3s.588ms)
Code
shirokunet/NUCLEO_F446RE_HelloWorld