Visual Studio Code nRF52 (nRF52833, S140) project template for Windows. This template is based on some solutions from the following repository: https://github.com/gera-k/VSC-Nordic-example.
This template uses a modified Makefile
from the nRF SDK and supports following features:
- automated
c_cpp_properties.json
generation for a PROPER InteliSense support (Python), - build (gcc-arm-none-eabi),
- flash (nrfjprog),
- SoftDevices flash (nrfjprog),
- debugging (Cortex Debug),
- nRF SKD Configuration (CMSIS Configuration Wizard),
- SEGGER's Real Time Transfer console.
In order to setup the environment following tools are needed to be installed:
- Visual Studio Code
- C/C++ Extension - InteliSense, and C/C++ support for VSCode,
- Cortex-Debug - ARM Cortex-M GDB Debugger support for VSCode
- GNU Arm Embedded Toolchain - a cross-compiler for ARM
- xPack Windows Build Tools - GNU Build Tools for Windows
- Nordic SDK v17.0.0 or above - software development kit for nRF52 Series SoCs
- nRF Command Line Tools - set of tools for development, programming and debugging of nRF52 SoCs
- SEGGER J-Link Software - set of tool to be used with J-Link probe
- Python 3 - to generate the
c_cpp_properties.json
- Java - to run the CMSIS Configuration Wizard
- Install all the tools, note the paths.
- Clone this repository.
- Adjust
.bat
file to match your setup:- Set
NRF_SD_VER
with a SoftDevices version provided with your nRF SDK (see<Nordic SDK>\components\softdevice\s140\hex
), - Set all tool paths.
- Set
- Set GNU Arm Embedded Toolchain path and its version in
<Nordic SDK>\components\toolchain\gcc\Makefile.windows
file.
Additional step (not mandatory). Setup a convenient keyboard shortcut to run tasks in VSCode:
- Open VSCode, go to: File -> Preferences -> Keyboard Shortcuts
- Search for Tasks: Run Task
- Setup a preferred shortcut, e.g.
Ctrl+B
to match other popular IDEs
- Run the
.bat
file to open the VSCode workspace. - Edit
SRC_FILES
,INC_FOLDERS
,CFLAGS
andASMFLAGS
of theMakefile
to match your requirements (default ones are ok). - Run the c_cpp_properties task to generate a proper InteliSense input each time you edit the
Makefile
. - Run the flash_softdevices task - not flashing the SoftDevices can cause runtime errors.
- Hit
F5
to start a build -> flash -> debug workflow.
Following tasks are configured for this VSCode template:
- build
- clean
- flash - flash the main binary
- flash_softdevice - flash the SoftDevices stack
- erase - erase flash
- sdk_config - run the CMSIS Configuration Wizard
- rtt - run the Real Time Transfer console
- c_cpp_properties - generate a
c_cpp_properties.json
based on theMakefile