From 49d97943c1c2122f686b7db69b208f7c6aef7177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Mon, 25 Jan 2021 20:17:41 +0100 Subject: [PATCH 1/2] Export the version of the bootloader to the application. Set version to 1.0.0 --- .../include/pinetime_boot/version.h | 11 ++++ libs/pinetime_boot/src/graphic.h | 51 +++++++++---------- libs/pinetime_boot/src/pinetime_boot.c | 2 + libs/pinetime_boot/src/version.c | 9 ++++ 4 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 libs/pinetime_boot/include/pinetime_boot/version.h create mode 100644 libs/pinetime_boot/src/version.c 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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x2, 0xa, + 0x2, 0x11, 0x2, 0x9, 0x2, 0xb, 0x2, 0x9, 0x2, 0x4, 0x2, 0x5, + 0x3, 0x5, 0x3, 0xa, 0x2, 0x11, 0x2, 0x9, 0x2, 0xb, 0x2, 0x9, + 0x2, 0x4, 0x2, 0x6, 0x2, 0x5, 0x2, 0xb, 0x2, 0x11, 0x2, 0x9, + 0x2, 0xb, 0x2, 0x9, 0x2, 0x4, 0x2, 0x6, 0x2, 0x5, 0x2, 0xb, + 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, 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.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; +} From d2a08785a39c5cdf73823463750c2ee5747527ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Mon, 25 Jan 2021 22:22:23 +0100 Subject: [PATCH 2/2] Add picture of the version bitmap and remove previous versions. --- libs/pinetime_boot/src/version-0.0.1.png | Bin 768 -> 0 bytes libs/pinetime_boot/src/version-1.0.0.png | Bin 0 -> 772 bytes .../{version-0.0.1.xcf => version-1.0.0.xcf} | Bin 2725 -> 2725 bytes libs/pinetime_boot/src/version-1.2.3.png | Bin 827 -> 0 bytes libs/pinetime_boot/src/version-1.2.3.xcf | Bin 2700 -> 0 bytes 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 libs/pinetime_boot/src/version-0.0.1.png create mode 100644 libs/pinetime_boot/src/version-1.0.0.png rename libs/pinetime_boot/src/{version-0.0.1.xcf => version-1.0.0.xcf} (67%) delete mode 100644 libs/pinetime_boot/src/version-1.2.3.png delete mode 100644 libs/pinetime_boot/src/version-1.2.3.xcf 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 5cd87f946e607a293df128daf0c596e015f7b230..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmV+b1ONPqP)EX>4Tx04R}tkv&MmP!xqvQ>7vmk#-Pq$WWauNELC^DionYs1;guFnQ@8G%+M8 zE{=k0!NH%!s)LKOt`4q(Aov5~=H{g6A|>9J6k5c1;qgAsyXWxUeSpxYGR^852Q=L_ zGpVGQ%dd!`R|F751OrIO%ra&rDGlHHx~FccyExDC@B6d*)Plu;fJi*U4AUlFC!X50 z4bJ<-QC5~!;&b9LlP*a7$aTfzH_j!O1)do-vza;KD6v@TV5Ngu+0=+9iDRm!Q@)V% zSmnIMS*zAq>z@3D;ex)r#C2N3NMQkskRU=q4HZ;jBTl=bb^8^S!16O+6ztI4uKS{5* zwb&8RzYSbmw>4!CxZD8-pA6ZQT`5RQC>DYDGy0}H5V-|eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{007uYL_t(&-tAaH62u?~BaZ+7GJDx;y9mb8o#bvtGY}#$ zGdF<>2~5;>NCPe;umpZL=7k@l;N@8GdTe|Pli#zv_#Q@45S@&*#Bz z$%@~BA6dS!A-;LRHc%9T&5x?hjE(IC6ON{csF!D}jLlCKIC?2p^(qIq7udDK;0PRT zd)b35qOZVL!%o9Z75x7Kv!mWCqU1K<<(jHl`mLQCr2d14Bp^OvDFdh&wDS+ar7c0000EX>4Tx04R}tkv&MmP!xqvQ$>-ALp!KAWT;LSL`4J_twIqhgj%6h2a}inL6e3g z#l=x@EjakISaoo5*44pP5Cnff+}xZLU8KbOl0u6ZFFfAIdG{RNyAKfRWu{pjV}PdH zW-1XEGuc(K>lFbEAdC=ZWM&z2l9YsRece+x)m@Bd`S<-`&eAtbPfB}fpVpo$X8uo0tOC&faF&f`A*LDw&lOCeVY zj2sK7K!fc1!T;d*Y_0snxR(@)1D!99^Dzu`?E;OO<9r`GPU8d!J_A>J%U`Jj)1Rc* zT3Yl7=-UP^u3MV22VCv|{ZEE$%B~coCFJwK`x$*x76{)0J!{_Fn&&uu0Maz8V-R*Pxx2HM3AC63NvOog_!~g&Q24YJ`L;(K){{a7>y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2ju}76Adf_Iv%qC000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0002nNkl6^LkqQc&sI5|iTu@*N{A{#NK1LvyVy%jT_hBc#rxNsJS8-eUacS%%n4Do5BnCQY&Py8R1g(){J1Mzx>*vJ*3iin;+!_JAKqo#20J~$vf1cd`yvO_W Q8N)LZ=d_UhWb6IRF3v delta 552 zcmbV|!3n}Z5JhJaH*QoE4B|nsgrF_hh80-FcHqShgq#%wFIHd=R^eUN|C1~+n1gtD z%*_8Y$?O!fVs^g9W|gn<_2m|CwN4l2pt?JplBF}!^HVSq^#jlo>&Jk3RZ~-FRUAm< zEr?MkfOCxOwSc`{I{WE|K1TGpa-hTL&?9K1{h=XhYUW3s3rB!UT5-)rZR1<-*F)jO zyvR#@`Kr$s2R(%!7NZ~XKCYeO!dy6Ub;6U5VDKllj!rk?qGy8~CH9#ZpkBfJ4>C#p N1UT7?$mMPy`UamJmnQ%K 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 e1ff9e249e7b40f67cbf3b389ffc7ebef34fbfa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 827 zcmV-B1H}A^P)EX>4Tx04R}tkv&MmKpe$iQ>CJn4ptCx$WWauh>D1lR-p(LLaorMgUO{|(4--0 zad8w}3l4rPRvlcNb#-tR1i=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