summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--Makefile2
-rw-r--r--TODO.md6
m---------reloader0
-rwxr-xr-xtools/hex2c.py37
5 files changed, 45 insertions, 3 deletions
diff --git a/.gitmodules b/.gitmodules
index 20c2c34..91d8d9e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -22,3 +22,6 @@
[submodule "tools/ota-dfu"]
path = tools/ota-dfu
url = https://github.com/daniel-thompson/ota-dfu-python
+[submodule "reloader"]
+ path = reloader
+ url = https://github.com/daniel-thompson/wasp-reloader
diff --git a/Makefile b/Makefile
index f0fd8ff..50063a8 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,8 @@ bootloader:
bootloader/_build-$(BOARD)_nrf52832/$(BOARD)_nrf52832_bootloader-*-nosd.hex \
bootloader/lib/softdevice/s132_nrf52_6.1.1/s132_nrf52_6.1.1_softdevice.hex \
-o bootloader.hex
+ python3 tools/hex2c.py bootloader.hex > \
+ reloader/src/boards/$(BOARD)/bootloader.h
softdevice:
micropython/ports/nrf/drivers/bluetooth/download_ble_stack.sh
diff --git a/TODO.md b/TODO.md
index 52b3698..c3a77ca 100644
--- a/TODO.md
+++ b/TODO.md
@@ -46,7 +46,7 @@ applications.
### Bootloader
- * [ ] OTA bootloader update
+ * [X] OTA bootloader update
* [ ] Stay in bootloader after battery run down
* [ ] Implement power off support (no splash screen)
* [ ] RTC time measurement whilst in bootloader
@@ -64,14 +64,14 @@ applications.
* [X] Button driver (interrupt based)
* [X] Touch sensor driver
* [X] Event driven application framework
- * [ ] Stopwatch app
+ * [X] Stopwatch app
* [X] Settings app
* [X] PC-hosted simulation platform
* [.] Documentation
- [X] Sphinx framework and integration with github.io
- [ ] Document bootloader protocols
- [ ] Write full docstring documentation for all WASP components
- * [ ] Application Launcher
+ * [X] Application Launcher
* [X] Debug notifications
* [o] Multi-colour RLE images
- [X] Optimized "2-bit" RLE encoder and decoder
diff --git a/reloader b/reloader
new file mode 160000
+Subproject 5e9a1c85509130af123735aa550ef36b53f772b
diff --git a/tools/hex2c.py b/tools/hex2c.py
new file mode 100755
index 0000000..eb4f34d
--- /dev/null
+++ b/tools/hex2c.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
+import intelhex
+import sys
+
+def generate_c(ihex):
+ print('/* this file is auto-generated - DO NOT EDIT */')
+ print()
+ print('#include <stdint.h>')
+ print()
+ print('struct segment {')
+ print(' uint32_t start;');
+ print(' uint32_t end;');
+ print(' const uint8_t *data;')
+ print('};')
+ print()
+
+ for i, segment in enumerate(ihex.segments()):
+ print(f'static const uint8_t segment{i}[] = {{', end='')
+
+ for j in range(segment[0], segment[1]):
+ if 0 == j % 12:
+ print('\n ', end='')
+ print(f' 0x{ihex[j]:02x},', end='')
+
+ print('\n};\n')
+ print(f'const struct segment segments[] = {{')
+ for i, segment in enumerate(ihex.segments()):
+ print(f' 0x{segment[0]:08x}, 0x{segment[1]:08x}, segment{i},')
+ print('};')
+
+ihex = intelhex.IntelHex()
+ihex.loadhex(sys.argv[1])
+generate_c(ihex)