diff --git a/libs/pinetime_boot/include/pinetime_boot/version.h b/libs/pinetime_boot/include/pinetime_boot/version.h new file mode 100644 index 0000000..c02f0cb --- /dev/null +++ b/libs/pinetime_boot/include/pinetime_boot/version.h @@ -0,0 +1,11 @@ +#ifndef PINETIME_RUST_MYNEWT_VERSION_H +#define PINETIME_RUST_MYNEWT_VERSION_H + +#define PINETIME_BOOTLOADER_VERSION_MAJOR 1u +#define PINETIME_BOOTLOADER_VERSION_MINOR 0u +#define PINETIME_BOOTLOADER_VERSION_PATCH 0u +#define PINETIME_BOOTLOADER_VERSION ((PINETIME_BOOTLOADER_VERSION_MAJOR << 16u) | (PINETIME_BOOTLOADER_VERSION_MINOR << 8u) | (PINETIME_BOOTLOADER_VERSION_PATCH)) + +void pinetime_set_version(void); + +#endif diff --git a/libs/pinetime_boot/src/graphic.h b/libs/pinetime_boot/src/graphic.h index 1591b55..4b0fd2f 100644 --- a/libs/pinetime_boot/src/graphic.h +++ b/libs/pinetime_boot/src/graphic.h @@ -112,32 +112,31 @@ struct imgInfo bootLogoInfo = { // /home/jf/nrf52/Pinetime/tools/rle_encode.py /home/jf/nrf52/pinetime-rust-mynewt/libs/pinetime_boot/src/version-0.0.1.png --c static const uint8_t versionRle[] = { - 0x59, 0x56, 0x2, 0x56, 0x2, 0x56, 0x2, 0x56, 0x2, 0x2, 0x2, 0xd, - 0x2, 0x6, 0x5, 0x13, 0x5, 0x12, 0x4, 0xa, 0x2, 0x3, 0x2, 0xb, - 0x2, 0x5, 0x9, 0xf, 0x9, 0xe, 0x6, 0xa, 0x2, 0x3, 0x2, 0xb, - 0x2, 0x5, 0x2, 0x5, 0x2, 0xf, 0x2, 0x5, 0x2, 0xe, 0x2, 0x2, - 0x2, 0xa, 0x2, 0x3, 0x3, 0x9, 0x3, 0x4, 0x2, 0x7, 0x2, 0xd, - 0x2, 0x7, 0x2, 0x11, 0x2, 0xa, 0x2, 0x4, 0x2, 0x9, 0x2, 0x5, - 0x2, 0x7, 0x2, 0xd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xc, 0x2, 0x11, 0x2, 0x9, 0x2, 0xb, 0x2, 0x9, + 0x2, 0x4, 0x2, 0x7, 0x2, 0x3, 0x2, 0xc, 0x2, 0x11, 0x2, 0x9, + 0x2, 0xb, 0x2, 0x9, 0x2, 0x4, 0x2, 0x7, 0x2, 0x3, 0x2, 0xc, + 0x2, 0x12, 0x2, 0x7, 0x2, 0xd, 0x2, 0x7, 0x2, 0x5, 0x2, 0x8, + 0x2, 0x1, 0x2, 0xd, 0x2, 0x12, 0x2, 0x7, 0x2, 0xd, 0x2, 0x7, + 0x2, 0x5, 0x2, 0x8, 0x2, 0x1, 0x2, 0xd, 0x2, 0xa, 0x2, 0x7, + 0x2, 0x5, 0x2, 0x6, 0x2, 0x7, 0x2, 0x5, 0x2, 0x6, 0x2, 0x8, + 0x5, 0x9, 0xa, 0x6, 0x2, 0x7, 0x9, 0x6, 0x2, 0x7, 0x9, 0x6, + 0x2, 0x9, 0x3, 0xa, 0xa, 0x6, 0x2, 0x9, 0x5, 0x8, 0x2, 0x9, + 0x5, 0x8, 0x2, 0x56, 0x2, 0x56, 0x59, }; diff --git a/libs/pinetime_boot/src/pinetime_boot.c b/libs/pinetime_boot/src/pinetime_boot.c index 0411f22..0bad594 100644 --- a/libs/pinetime_boot/src/pinetime_boot.c +++ b/libs/pinetime_boot/src/pinetime_boot.c @@ -30,6 +30,7 @@ #include "pinetime_boot/pinetime_factory.h" #include "pinetime_boot/pinetime_delay.h" #include +#include "pinetime_boot/version.h" #define PUSH_BUTTON_IN 13 // GPIO Pin P0.13: PUSH BUTTON_IN #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 /// Init the display and render the boot graphic. Called by sysinit() during startup, defined in pkg.yml. void pinetime_boot_init(void) { console_printf("Starting Bootloader...\n"); console_flush(); + pinetime_set_version(); // 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. // While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed. diff --git a/libs/pinetime_boot/src/version-0.0.1.png b/libs/pinetime_boot/src/version-0.0.1.png deleted file mode 100644 index 5cd87f9..0000000 Binary files a/libs/pinetime_boot/src/version-0.0.1.png and /dev/null differ diff --git a/libs/pinetime_boot/src/version-1.0.0.png b/libs/pinetime_boot/src/version-1.0.0.png new file mode 100644 index 0000000..7161839 Binary files /dev/null and b/libs/pinetime_boot/src/version-1.0.0.png differ diff --git a/libs/pinetime_boot/src/version-0.0.1.xcf b/libs/pinetime_boot/src/version-1.0.0.xcf similarity index 67% rename from libs/pinetime_boot/src/version-0.0.1.xcf rename to libs/pinetime_boot/src/version-1.0.0.xcf index 8683ce3..15b13c5 100644 Binary files a/libs/pinetime_boot/src/version-0.0.1.xcf and b/libs/pinetime_boot/src/version-1.0.0.xcf differ diff --git a/libs/pinetime_boot/src/version-1.2.3.png b/libs/pinetime_boot/src/version-1.2.3.png deleted file mode 100644 index e1ff9e2..0000000 Binary files a/libs/pinetime_boot/src/version-1.2.3.png and /dev/null differ diff --git a/libs/pinetime_boot/src/version-1.2.3.xcf b/libs/pinetime_boot/src/version-1.2.3.xcf deleted file mode 100644 index 5c480ec..0000000 Binary files a/libs/pinetime_boot/src/version-1.2.3.xcf and /dev/null differ diff --git a/libs/pinetime_boot/src/version.c b/libs/pinetime_boot/src/version.c new file mode 100644 index 0000000..9e744b5 --- /dev/null +++ b/libs/pinetime_boot/src/version.c @@ -0,0 +1,9 @@ +#include "pinetime_boot/version.h" +#include + +void pinetime_set_version(void) { + /* Store the bootloader version into NRF_TIMER2->CC[0] + * The application needs to read this register before using TIMER2 + * This is how adafruit-bootloader exports its version to the application */ + NRF_TIMER2->CC[0] = PINETIME_BOOTLOADER_VERSION; +}