Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Commit

Permalink
solve adafruit#133 program via jlink
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jan 10, 2019
1 parent 6383861 commit 3463e38
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -149,7 +149,7 @@ which in turn is based on the [Arduino SAMD Core](https://github.com/arduino/Ard
The following libraries are used:

- adafruit-nrfutil is based on Nordic Semiconductor ASA's [pc-nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil)
- freeRTOS as operating system
- [freeRTOS](https://www.freertos.org/) as operating system
- [tinyusb](https://github.com/hathach/tinyusb) as usb stack
- [nrfx](https://github.com/NordicSemiconductor/nrfx) for peripherals driver
- [littlefs](https://github.com/ARMmbed/littlefs) for internal file system
Expand Down
11 changes: 1 addition & 10 deletions platform.txt
Expand Up @@ -124,7 +124,6 @@ recipe.output.save_file={build.project_name}.{build.variant}.hex
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
# pre-built binaries are provided for macos and windows
#***************************************************

tools.nrfutil.cmd=adafruit-nrfutil
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
Expand All @@ -133,20 +132,12 @@ tools.nrfutil.upload.params.verbose=--verbose
tools.nrfutil.upload.params.quiet=
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank

#***************************************************
# Jlink for programming
#***************************************************

#tools.nrfutil.upload.pattern=nrfjprog --reset --program "{build.path}/{build.project_name}.hex" --sectorerase -f nrf52
# && nrfjprog --erasepage {upload.BOOT_SETTING_ADDR} -f nrf52 && nrfjprog --memwr {upload.BOOT_SETTING_ADDR} --val 0x00000001 -f nrf52 && nrfjprog --reset -f nrf52
# tools.nrfutil.upload.BOOT_SETTING_ADDR=0xFF000

#***************************************************
# Burning bootloader with either jlink or nrfutil
#***************************************************
tools.bootburn.bootloader.params.verbose=
tools.bootburn.bootloader.params.quiet=
tools.bootburn.bootloader.pattern={program.pattern}
tools.bootburn.bootloader.pattern={program.burn_pattern}

# erase flash page while programming
tools.bootburn.erase.params.verbose=
Expand Down
27 changes: 21 additions & 6 deletions programmers.txt
@@ -1,22 +1,37 @@
#**********************************************
# Jlink with nrfjprog to burn bootloader
# Jlink with nrfjprog
#**********************************************
nrfjprog.name=J-Link for Bluefruit nRF52
nrfjprog.program.tool=bootburn
#nrfjprog.program.path={runtime.tools.nrfjprog.path}/
nrfjprog.program.path=
nrfjprog.program.cmd=nrfjprog
nrfjprog.program.cmd.windows=nrfjprog.exe

nrfjprog.program.pattern="{program.path}{program.cmd}" --program "{runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.hex" -f nrf52 --chiperase --reset
# Burn bootloader pattern
nrfjprog.program.bootfile={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.hex
nrfjprog.program.burn_pattern="{program.cmd}" --program "{program.bootfile}" -f nrf52 --chiperase --reset

# Jlink to upload sketch
nrfjprog.program.params.quiet=
nrfjprog.program.params.verbose=
nrfjprog.program.pattern="{program.cmd}" --reset --program "{build.path}/{build.project_name}.hex" --sectorerase -f nrf52

# && nrfjprog --erasepage {upload.BOOT_SETTING_ADDR} -f nrf52 && nrfjprog --memwr {upload.BOOT_SETTING_ADDR} --val 0x00000001 -f nrf52 && nrfjprog --reset -f nrf52
# tools.nrfutil.upload.BOOT_SETTING_ADDR=0xFF000

#**********************************************
# adafruit-nrfutil to upgrade bootloader
# adafruit-nrfutil
#**********************************************
nrfutil_boot.name=Bootloader DFU for Bluefruit nRF52
nrfutil_boot.program.tool=bootburn
nrfutil_boot.program.cmd=adafruit-nrfutil
nrfutil_boot.program.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
nrfutil_boot.program.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil

nrfutil_boot.program.pattern={program.cmd} --verbose dfu serial -pkg "{runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.zip" -p {serial.port} -b 115200 --touch 1200
# Burn bootloader pattern
nrfutil_boot.program.bootfile={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.zip
nrfutil_boot.program.burn_pattern={program.cmd} --verbose dfu serial -pkg "{program.bootfile}" -p {serial.port} -b 115200 --touch 1200

# Remind user to select Jlink when used to upload sketch
nrfutil_boot.program.params.quiet=
nrfutil_boot.program.params.verbose=
nrfutil_boot.program.pattern=echo Please select <J-Link for Bluefruit nRF52> as programmer

0 comments on commit 3463e38

Please sign in to comment.