Skip to content

Commit 2e1a66e

Browse files
authored
Merge pull request #2 from JF002/develop
Export the version of the bootloader to the application.
2 parents 53918c7 + d2a0878 commit 2e1a66e

File tree

9 files changed

+47
-26
lines changed

9 files changed

+47
-26
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef PINETIME_RUST_MYNEWT_VERSION_H
2+
#define PINETIME_RUST_MYNEWT_VERSION_H
3+
4+
#define PINETIME_BOOTLOADER_VERSION_MAJOR 1u
5+
#define PINETIME_BOOTLOADER_VERSION_MINOR 0u
6+
#define PINETIME_BOOTLOADER_VERSION_PATCH 0u
7+
#define PINETIME_BOOTLOADER_VERSION ((PINETIME_BOOTLOADER_VERSION_MAJOR << 16u) | (PINETIME_BOOTLOADER_VERSION_MINOR << 8u) | (PINETIME_BOOTLOADER_VERSION_PATCH))
8+
9+
void pinetime_set_version(void);
10+
11+
#endif

libs/pinetime_boot/src/graphic.h

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,32 +112,31 @@ struct imgInfo bootLogoInfo = {
112112

113113
// /home/jf/nrf52/Pinetime/tools/rle_encode.py /home/jf/nrf52/pinetime-rust-mynewt/libs/pinetime_boot/src/version-0.0.1.png --c
114114
static const uint8_t versionRle[] = {
115-
0x59, 0x56, 0x2, 0x56, 0x2, 0x56, 0x2, 0x56, 0x2, 0x2, 0x2, 0xd,
116-
0x2, 0x6, 0x5, 0x13, 0x5, 0x12, 0x4, 0xa, 0x2, 0x3, 0x2, 0xb,
117-
0x2, 0x5, 0x9, 0xf, 0x9, 0xe, 0x6, 0xa, 0x2, 0x3, 0x2, 0xb,
118-
0x2, 0x5, 0x2, 0x5, 0x2, 0xf, 0x2, 0x5, 0x2, 0xe, 0x2, 0x2,
119-
0x2, 0xa, 0x2, 0x3, 0x3, 0x9, 0x3, 0x4, 0x2, 0x7, 0x2, 0xd,
120-
0x2, 0x7, 0x2, 0x11, 0x2, 0xa, 0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2, 0x4, 0x2, 0x6, 0x2, 0x5, 0x2, 0xb,
129+
0x2, 0x11, 0x2, 0x9, 0x2, 0xb, 0x2, 0x9, 0x2, 0x4, 0x2, 0x7,
130+
0x2, 0x3, 0x2, 0xc, 0x2, 0x11, 0x2, 0x9, 0x2, 0xb, 0x2, 0x9,
131+
0x2, 0x4, 0x2, 0x7, 0x2, 0x3, 0x2, 0xc, 0x2, 0x11, 0x2, 0x9,
132+
0x2, 0xb, 0x2, 0x9, 0x2, 0x4, 0x2, 0x7, 0x2, 0x3, 0x2, 0xc,
133+
0x2, 0x12, 0x2, 0x7, 0x2, 0xd, 0x2, 0x7, 0x2, 0x5, 0x2, 0x8,
134+
0x2, 0x1, 0x2, 0xd, 0x2, 0x12, 0x2, 0x7, 0x2, 0xd, 0x2, 0x7,
135+
0x2, 0x5, 0x2, 0x8, 0x2, 0x1, 0x2, 0xd, 0x2, 0xa, 0x2, 0x7,
136+
0x2, 0x5, 0x2, 0x6, 0x2, 0x7, 0x2, 0x5, 0x2, 0x6, 0x2, 0x8,
137+
0x5, 0x9, 0xa, 0x6, 0x2, 0x7, 0x9, 0x6, 0x2, 0x7, 0x9, 0x6,
138+
0x2, 0x9, 0x3, 0xa, 0xa, 0x6, 0x2, 0x9, 0x5, 0x8, 0x2, 0x9,
139+
0x5, 0x8, 0x2, 0x56, 0x2, 0x56, 0x59,
141140
};
142141

143142

libs/pinetime_boot/src/pinetime_boot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pinetime_boot/pinetime_factory.h"
3131
#include "pinetime_boot/pinetime_delay.h"
3232
#include <hal/hal_watchdog.h>
33+
#include "pinetime_boot/version.h"
3334

3435
#define PUSH_BUTTON_IN 13 // GPIO Pin P0.13: PUSH BUTTON_IN
3536
#define PUSH_BUTTON_OUT 15 // GPIO Pin P0.15/TRACEDATA2: PUSH BUTTON_OUT
@@ -49,6 +50,7 @@ static void relocate_vector_table(void *vector_table, void *relocated_vector_tab
4950
/// Init the display and render the boot graphic. Called by sysinit() during startup, defined in pkg.yml.
5051
void pinetime_boot_init(void) {
5152
console_printf("Starting Bootloader...\n"); console_flush();
53+
pinetime_set_version();
5254

5355
// Init the push button. The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.
5456
// While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.
-768 Bytes
Binary file not shown.
772 Bytes
Loading
2.66 KB
Binary file not shown.
-827 Bytes
Binary file not shown.
-2.64 KB
Binary file not shown.

libs/pinetime_boot/src/version.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "pinetime_boot/version.h"
2+
#include <hal/nrf_timer.h>
3+
4+
void pinetime_set_version(void) {
5+
/* Store the bootloader version into NRF_TIMER2->CC[0]
6+
* The application needs to read this register before using TIMER2
7+
* This is how adafruit-bootloader exports its version to the application */
8+
NRF_TIMER2->CC[0] = PINETIME_BOOTLOADER_VERSION;
9+
}

0 commit comments

Comments
 (0)