summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-05-24 17:47:07 +0200
committerJF <jf@codingfield.com>2020-05-24 17:47:07 +0200
commit00451ef05b7b793c7cd098cc3834c6874c51e56e (patch)
tree6e40121de12dafc5143d5228f771423b10323ddd
parent4154dae01acfd4f377101858c1b9b9faf0d1fdcd (diff)
Add example scripts to generate mcuboot image, dfu file and program them with openocd.
-rw-r--r--bootloader/booloader_app_jlink.ocd34
-rwxr-xr-xbootloader/create_dfu.sh3
-rwxr-xr-xbootloader/create_image.sh3
-rwxr-xr-xbootloader/flash_bootloader_app.sh3
4 files changed, 43 insertions, 0 deletions
diff --git a/bootloader/booloader_app_jlink.ocd b/bootloader/booloader_app_jlink.ocd
new file mode 100644
index 00000000..66243831
--- /dev/null
+++ b/bootloader/booloader_app_jlink.ocd
@@ -0,0 +1,34 @@
+# This script programs the bootloader and the firmware application using J-Link debugger.
+
+gdb_flash_program enable
+gdb_breakpoint_override hard
+
+$_TARGETNAME configure -event reset-init {
+ # Arm Semihosting is used to show debug console output and may only be enabled after init event. We wait for the event and enable Arm Semihosting.
+ echo "Enabled ARM Semihosting to show debug output"
+ arm semihosting enable
+}
+
+# Connect to the device.
+init
+
+echo "Stopping..."
+reset
+halt
+echo ""
+
+# Flashing Bootloader
+echo "Flashing bootloader..."
+program ./mynewt_nosemi_4.1.7.elf verify 0x00000000
+
+# Flashing Application
+echo "Flashing application..."
+program ./image.bin verify 0x00008000
+echo ""
+
+# Restart the device and start the bootloader.
+echo "Restarting..."
+reset
+echo ""
+
+echo "**** Done! Press Ctrl-C to exit..."
diff --git a/bootloader/create_dfu.sh b/bootloader/create_dfu.sh
new file mode 100755
index 00000000..078234e4
--- /dev/null
+++ b/bootloader/create_dfu.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application image.bin dfu.zip \ No newline at end of file
diff --git a/bootloader/create_image.sh b/bootloader/create_image.sh
new file mode 100755
index 00000000..14350c05
--- /dev/null
+++ b/bootloader/create_image.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/home/jf/nrf52/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header /home/jf/nrf52/Pinetime/cmake-build-release/src/pinetime-mcuboot-app.bin image.bin \ No newline at end of file
diff --git a/bootloader/flash_bootloader_app.sh b/bootloader/flash_bootloader_app.sh
new file mode 100755
index 00000000..02c7b943
--- /dev/null
+++ b/bootloader/flash_bootloader_app.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/home/jf/nrf52/openocd-code/src/openocd -s /home/jf/nrf52/openocd-code/tcl/ -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -f /home/jf/nrf52/openocd-code/tcl/interface/jlink.cfg -c "transport select swd" -f /home/jf/nrf52/openocd-code/tcl/target/nrf52.cfg -f booloader_app_jlink.ocd \ No newline at end of file