Skip to content

Commit

Permalink
Add Config files for Visual Studio Code
Browse files Browse the repository at this point in the history
  • Loading branch information
gera-k committed Jul 30, 2018
1 parent db503c7 commit 0588fac
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
_build
49 changes: 49 additions & 0 deletions ble_app_blinky/.vscode/c_cpp_properties.json
@@ -0,0 +1,49 @@
{
"configurations": [
{
"name": "pca10040/s132",
"includePath": [
"${workspaceFolder}/pca10040/s132/config",
"${env:NRF_SDK}/**"
],
"defines": [
"BOARD_PCA10040",
"CONFIG_GPIO_AS_PINRESET",
"FLOAT_ABI_HARD",
"NRF52",
"NRF52832_XXAA",
"NRF52_PAN_74",
"NRF_SD_BLE_API_VERSION=6",
"S132",
"SOFTDEVICE_PRESENT",
"SWI_DISABLE0"
],
"compilerPath": "${env:GNU_GCC}/arm-none-eabi-gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
},
{
"name": "pca10056/s140",
"includePath": [
"${workspaceFolder}/pca10056/s140/config",
"${env:NRF_SDK}/**"
],
"defines": [
"BOARD_PCA10056",
"CONFIG_GPIO_AS_PINRESET",
"FLOAT_ABI_HARD",
"NRF52840_XXAA",
"NRF_SD_BLE_API_VERSION=6",
"S140",
"SOFTDEVICE_PRESENT",
"SWI_DISABLE0"
],
"compilerPath": "${env:GNU_GCC}/arm-none-eabi-gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
16 changes: 16 additions & 0 deletions ble_app_blinky/ble_app_blinky.code-workspace
@@ -0,0 +1,16 @@
{
"folders": [
{
"name": "BLE Example Blinky",
"path": "."
},
{
"name": "PCA10056/s140",
"path": "pca10056/s140/armgcc"
},
{
"name": "PCA10040/s132",
"path": "pca10040/s132/armgcc"
}
]
}
39 changes: 39 additions & 0 deletions ble_app_blinky/pca10040/s132/armgcc/.vscode/launch.json
@@ -0,0 +1,39 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "_build/nrf52832_xxaa.out",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerPath": "${env:GNU_GCC}/arm-none-eabi-gdb.exe",
"targetArchitecture": "arm",
"customLaunchSetupCommands": [
{ "text": "-environment-cd ${workspaceFolder}", "description": "set cwd", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols _build/nrf52832_xxaa.out", "description": "set executable", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"set pagination off\"", "description": "set pagination off", "ignoreFailures": false },
{ "text": "-target-select remote localhost:2331", "description": "connect target", "ignoreFailures": false },
{ "text": "-break-insert main", "description": "break on main", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "description": "reset target", "ignoreFailures": false },
],
"stopAtEntry": true,
"miDebuggerServerAddress": "localhost:2331",
"debugServerPath": "${env:SEGGER_TOOLS}/JLinkGDBServerCL.exe",
"debugServerArgs": "-select USB=${env:PCA10040_SN} -device nRF52840_xxAA -if SWD -speed 1000 -noir",
"serverStarted": "Connected to target",
// "logging": {
// "engineLogging": true,
// "exceptions": true,
// "moduleLoad": true,
// "programOutput": true,
// "trace": true,
// "traceResponse": true
// }
}
]
}
47 changes: 47 additions & 0 deletions ble_app_blinky/pca10040/s132/armgcc/.vscode/tasks.json
@@ -0,0 +1,47 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${env:GNU_TOOLS}/make",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "clean",
"type": "shell",
"command": "${env:GNU_TOOLS}/make clean",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "flash",
"type": "shell",
"command": "${env:GNU_TOOLS}/make flash",
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "flash_softdevice",
"type": "shell",
"command": "${env:GNU_TOOLS}/make flash_softdevice",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
28 changes: 20 additions & 8 deletions ble_app_blinky/pca10040/s132/armgcc/Makefile
Expand Up @@ -2,9 +2,11 @@ PROJECT_NAME := ble_app_blinky_pca10040_s132
TARGETS := nrf52832_xxaa
OUTPUT_DIRECTORY := _build

SDK_ROOT := ../../../../../..
SDK_ROOT := $(NRF_SDK)
PROJ_DIR := ../../..

NRFJPROG=$(NRF_TOOLS)/nrfjprog -s $(PCA10040_SN)

$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \
LINKER_SCRIPT := ble_app_blinky_gcc_nrf52.ld

Expand Down Expand Up @@ -197,10 +199,12 @@ INC_FOLDERS += \
LIB_FILES += \

# Optimization flags
OPT = -O3 -g3
#OPT = -O3 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto

OPT = -O0 -g

# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10040
Expand Down Expand Up @@ -263,7 +267,9 @@ LIB_FILES += -lc -lnosys -lm
.PHONY: default help

# Default target - first one defined
default: nrf52832_xxaa
default: echo_build nrf52832_xxaa

clean: echo_clean

# Print all targets that can be built
help:
Expand All @@ -282,20 +288,26 @@ $(foreach target, $(TARGETS), $(call define_target, $(target)))

.PHONY: flash flash_softdevice erase

echo_build:
@echo Building: $(TARGETS)

echo_clean:
@echo Cleaning: $(TARGETS)

# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
@echo Flashing: $<
nrfjprog -f nrf52 --program $< --sectorerase
nrfjprog -f nrf52 --reset
$(NRFJPROG) -f nrf52 --program $< --sectorerase
$(NRFJPROG) -f nrf52 --reset

# Flash softdevice
flash_softdevice:
@echo Flashing: s132_nrf52_6.0.0_softdevice.hex
nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.0.0_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
$(NRFJPROG) -f nrf52 --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.0.0_softdevice.hex --sectorerase
$(NRFJPROG) -f nrf52 --reset

erase:
nrfjprog -f nrf52 --eraseall
$(NRFJPROG) -f nrf52 --eraseall

SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
Expand Down
39 changes: 39 additions & 0 deletions ble_app_blinky/pca10056/s140/armgcc/.vscode/launch.json
@@ -0,0 +1,39 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "_build/nrf52840_xxaa.out",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerPath": "${env:GNU_GCC}/arm-none-eabi-gdb.exe",
"targetArchitecture": "arm",
"customLaunchSetupCommands": [
{ "text": "-environment-cd ${workspaceFolder}", "description": "set cwd", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols _build/nrf52840_xxaa.out", "description": "set executable", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"set pagination off\"", "description": "set pagination off", "ignoreFailures": false },
{ "text": "-target-select remote localhost:2331", "description": "connect target", "ignoreFailures": false },
{ "text": "-break-insert main", "description": "break on main", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "description": "reset target", "ignoreFailures": false },
],
"stopAtEntry": true,
"miDebuggerServerAddress": "localhost:2331",
"debugServerPath": "${env:SEGGER_TOOLS}/JLinkGDBServerCL.exe",
"debugServerArgs": "-select USB=${env:PCA10056_SN} -device nRF52840_xxAA -if SWD -speed 1000 -noir",
"serverStarted": "Connected to target",
// "logging": {
// "engineLogging": true,
// "exceptions": true,
// "moduleLoad": true,
// "programOutput": true,
// "trace": true,
// "traceResponse": true
// }
}
]
}
47 changes: 47 additions & 0 deletions ble_app_blinky/pca10056/s140/armgcc/.vscode/tasks.json
@@ -0,0 +1,47 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${env:GNU_TOOLS}/make",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "clean",
"type": "shell",
"command": "${env:GNU_TOOLS}/make clean",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "flash",
"type": "shell",
"command": "${env:GNU_TOOLS}/make flash",
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "flash_softdevice",
"type": "shell",
"command": "${env:GNU_TOOLS}/make flash_softdevice",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
25 changes: 18 additions & 7 deletions ble_app_blinky/pca10056/s140/armgcc/Makefile
Expand Up @@ -2,9 +2,11 @@ PROJECT_NAME := ble_app_blinky_pca10056_s140
TARGETS := nrf52840_xxaa
OUTPUT_DIRECTORY := _build

SDK_ROOT := ../../../../../..
SDK_ROOT := $(NRF_SDK)
PROJ_DIR := ../../..

NRFJPROG=$(NRF_TOOLS)/nrfjprog -s $(PCA10056_SN)

$(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
LINKER_SCRIPT := ble_app_blinky_gcc_nrf52.ld

Expand Down Expand Up @@ -261,7 +263,10 @@ LIB_FILES += -lc -lnosys -lm
.PHONY: default help

# Default target - first one defined
default: nrf52840_xxaa
default: echo_build nrf52840_xxaa

clean: echo_clean


# Print all targets that can be built
help:
Expand All @@ -280,20 +285,26 @@ $(foreach target, $(TARGETS), $(call define_target, $(target)))

.PHONY: flash flash_softdevice erase

echo_build:
@echo Building: $(TARGETS)

echo_clean:
@echo Cleaning: $(TARGETS)

# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
@echo Flashing: $<
nrfjprog -f nrf52 --program $< --sectorerase
nrfjprog -f nrf52 --reset
$(NRFJPROG) -f nrf52 --program $< --sectorerase
$(NRFJPROG) -f nrf52 --reset

# Flash softdevice
flash_softdevice:
@echo Flashing: s140_nrf52_6.0.0_softdevice.hex
nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.0.0_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
$(NRFJPROG) -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.0.0_softdevice.hex --sectorerase
$(NRFJPROG) -f nrf52 --reset

erase:
nrfjprog -f nrf52 --eraseall
$(NRFJPROG) -f nrf52 --eraseall

SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
Expand Down
20 changes: 20 additions & 0 deletions ble_app_blinky/vscode.bat
@@ -0,0 +1,20 @@
rem Location of Nordic SDK
set NRF_SDK=V:/Nordic/nRF5_SDK_15.0.0_a53641a

rem Location of Nordic Command Line tools (nrfjprog)
set NRF_TOOLS=C:/Program Files (x86)/Nordic Semiconductor/nrf5x/bin

rem location of GCC Cross-compiler https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
set GNU_GCC=V:/Nordic/gcc-arm-none-eabi-7-2018-q2-update-win32/bin

rem Location of Gnu Tools (make) https://github.com/gnu-mcu-eclipse/windows-build-tools/releases
set GNU_TOOLS=V:/Nordic/GNU/Tools/2.11-20180428-1604/bin

rem Location of SEGGER JLink tools
set SEGGER_TOOLS=C:/Program Files (x86)/SEGGER/JLink_V620i

rem Serial numbers of nRF development boards
set PCA10056_SN=683798348
set PCA10040_SN=682645815

"C:/Program Files/Microsoft VS Code/Code.exe" ble_app_blinky.code-workspace

0 comments on commit 0588fac

Please sign in to comment.