diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-26 18:21:28 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-26 18:21:28 (GMT) |
| commit | dc4ea4ab6205bcdb27278367f7d5147b56cf78b8 (patch) | |
| tree | 75f4e312f2ad624025d6b71603f1b1be4feec896 | |
| parent | 17a8cfc34638d14167d33c1f2b094813446e5c5b (diff) | |
reloader: OTA flashing tool for wasp-os
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | TODO.md | 6 | ||||
| m--------- | reloader | 0 | ||||
| -rwxr-xr-x | tools/hex2c.py | 37 |
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 @@ -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 @@ -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) |
