-
1Install toolchain for nRF82540 development environment
Install Toolchain on debian testing(currently bulleseye)
$ apt install libnewlib-dev libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi
Verify the version of installed gcc
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:7-2018-q2-6+b1) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Download, and install the nRF5 SDK
Go to https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK/, and
download the latest verion of SDK at https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/nRF5SDK153059ac345.zip
Unzip nRF5SDK153059ac345.zip like as:
nRF5_SDK_15.3.0_59ac345
+- components
+- config
+- documentation
+- examples
+- external
+- external_tools
+- intergation
+- modules
+- license.txt
+- nRF5x_MDK_8_24_1_IAR_NordicLicense.msi
+- nRF5x_MDK_8_24_1_Keil4_NordicLicense.msiAt "$(SDK_ROOT)/components/toolchain/gcc" under SDK, there are several kinds of Makefile for Windows/Linux/MacOs.
Now, we should edit "Makefile.posix" in the case of Linux or MacOs like the below.GNU_INSTALL_ROOT ?= /usr/local/gcc-arm-none-eabi-7-2018-q2-update/bin/
GNU_VERSION ?= 7.3.1
GNU_PREFIX ?= arm-none-eabiinto
GNU_INSTALL_ROOT ?= /usr/bin/
GNU_VERSION ?= 7.3.1
GNU_PREFIX ?= arm-none-eabiTry to compile the example.
Under "$(SDK_ROOT)/examples/peripheral/blinkyPCA10056/blank/armgcc", $ make
mkdir _build
cd _build && mkdir nrf52840_xxaa
Assembling file: gcc_startup_nrf52840.S
Compiling file: nrf_log_frontend.c
Compiling file: nrf_log_str_formatter.c
Compiling file: boards.c
Compiling file: app_error.c
Compiling file: app_error_handler_gcc.c
Compiling file: app_error_weak.c
Compiling file: app_util_platform.c
Compiling file: nrf_assert.c
Compiling file: nrf_atomic.c
Compiling file: nrf_balloc.c
Compiling file: nrf_fprintf.c
Compiling file: nrf_fprintf_format.c
Compiling file: nrf_memobj.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_strerror.c
Compiling file: nrfx_atomic.c
Compiling file: main.c
Compiling file: system_nrf52840.c
Linking target: _build/nrf52840_xxaa.out
text data bss dec hex filename
2168 112 172 2452 994 _build/nrf52840_xxaa.out
Preparing: _build/nrf52840_xxaa.hex
Preparing: _build/nrf52840_xxaa.bin
DONE nrf52840_xxaaInstall programmer for nRF52, and setup correspondances
-
2Make a template for new project
Make the new directory named as "projects" under the root of SDK.
$ mkdir projects
$ cd projects
$ mkdir template$ cd ../
Copy files from main.c at examples/peripheral/bliky/, blinky_gcc_nrf52.ld, and Makefile at examples/peripheral/blinky/pca10056/blank/armgcc, and config/sdk_config.h at examples/peripheral/blinky/pca10056/blank into newly created project of projects/blinky.
$ cp -r ./examples/peripheral/blinky/main.c ./examples/peripheral/blinky/pca10056/blank/armgcc/blinky_gcc_nrf52.ld ./examples/peripheral/blinky/pca10056/blank/armgcc/Makefile ./examples/peripheral/blinky/pca10056/blank/config ./projects/template
Change some definitions in Makefile like;
SDK_ROOT := ../../../../../..
PROJ_DIR := ../../..
...
INC_FOLDERS += \ $(SDK_ROOT)/components \ $(SDK_ROOT)/modules/nrfx/mdk \ $(PROJ_DIR) \ $(SDK_ROOT)/components/libraries/strerror \ $(SDK_ROOT)/components/toolchain/cmsis/include \ $(SDK_ROOT)/components/libraries/util \ ../config \
...
CFLAGS += -Wall -Werror
asSDK_ROOT := ../..
PROJ_DIR := .
...
INC_FOLDERS += \ $(SDK_ROOT)/components \ $(SDK_ROOT)/modules/nrfx/mdk \ $(PROJ_DIR) \ $(SDK_ROOT)/components/libraries/strerror \ $(SDK_ROOT)/components/toolchain/cmsis/include \ $(SDK_ROOT)/components/libraries/util \ ./config \
...
CFLAGS += -Wall #-WerrorFinally, make sure the compilation done.
daysleep@t480s-debian ~/W/p/f/p/template> make
mkdir _build
cd _build && mkdir nrf52840_xxaa
Assembling file: gcc_startup_nrf52840.S
Compiling file: nrf_log_frontend.c
Compiling file: nrf_log_str_formatter.c
Compiling file: boards.c
Compiling file: app_error.c
Compiling file: app_error_handler_gcc.c
Compiling file: app_error_weak.c
Compiling file: app_util_platform.c
Compiling file: nrf_assert.c
Compiling file: nrf_atomic.c
Compiling file: nrf_balloc.c
Compiling file: nrf_fprintf.c
Compiling file: nrf_fprintf_format.c
Compiling file: nrf_memobj.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_strerror.c
Compiling file: nrfx_atomic.c
Compiling file: main.c
Compiling file: system_nrf52840.c
Linking target: _build/nrf52840_xxaa.out text data bss dec hex filename 2168 112 172 2452 994 _build/nrf52840_xxaa.out
Preparing: _build/nrf52840_xxaa.hex
Preparing: _build/nrf52840_xxaa.bin
DONE nrf52840_xxaa
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.