1
0
Fork 0

reloader: OTA flashing tool for wasp-os

pull/24/head
Daniel Thompson 2020-04-26 19:21:28 +01:00
parent 17a8cfc346
commit dc4ea4ab62
5 changed files with 46 additions and 3 deletions

3
.gitmodules vendored
View File

@ -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

View File

@ -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

View File

@ -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

1
reloader 160000

@ -0,0 +1 @@
Subproject commit 5e9a1c85509130af123735aa550ef36b53f772b7

37
tools/hex2c.py 100755
View File

@ -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)