Skip to content

Commit

Permalink
Merge pull request #2 from JF002/develop
Browse files Browse the repository at this point in the history
Export the version of the bootloader to the application.
  • Loading branch information
JF002 authored Jan 26, 2021
2 parents 53918c7 + d2a0878 commit 2e1a66e
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 26 deletions.
11 changes: 11 additions & 0 deletions libs/pinetime_boot/include/pinetime_boot/version.h
Original file line number Diff line number Diff line change
@@ -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
51 changes: 25 additions & 26 deletions libs/pinetime_boot/src/graphic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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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x2, 0xc, 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,
};


Expand Down
2 changes: 2 additions & 0 deletions libs/pinetime_boot/src/pinetime_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "pinetime_boot/pinetime_factory.h"
#include "pinetime_boot/pinetime_delay.h"
#include <hal/hal_watchdog.h>
#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
Expand All @@ -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.
Expand Down
Binary file removed libs/pinetime_boot/src/version-0.0.1.png
Binary file not shown.
Binary file added libs/pinetime_boot/src/version-1.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed libs/pinetime_boot/src/version-1.2.3.png
Binary file not shown.
Binary file removed libs/pinetime_boot/src/version-1.2.3.xcf
Binary file not shown.
9 changes: 9 additions & 0 deletions libs/pinetime_boot/src/version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "pinetime_boot/version.h"
#include <hal/nrf_timer.h>

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;
}

0 comments on commit 2e1a66e

Please sign in to comment.