Update bootlogo and pinetime-app with OTA/DFU
#1
Hello everybody,
I am already 4 days new proud owner of PineTime Wink . After some playing with firmware updates, flashing wasp-os and solving bug with hanging bootloader in version 0.8.2, I finally have my PineTime updated to InfiniTime 0.9.0 - I used binary packages from https://github.com/daniel-thompson/wasp-.../350930611 (for other newbies like me: you can download it after logging into github...) which I found on this great video: www.youtube.com/watch?v=lPasAt1LJmo

After that, I started to try changing boot image and to compile my own Infinitime binary - for this first try only with changed day and month names to my native language (czech). And I'm hanging already 2 days on uploading new firmware, which seems to be uploaded correctly, but make no changes on my PineTime  Angry .

I surely don't want to use SWD cable connection, when there is working OTA way with nRF Connect - I don't have JTAG programmer, but for the worst case I can use my Raspberry Pi, but I thing, that it will be more pain, than with DFU.

Can somebody of you help me with this way? I will be glad to write than some beginners tutorial into wiki, to help others make this first step...

My (not working) way:
1) I'm using Ubuntu 20.04 PC and Android Phone, PineTime from last batch with opened flash and firmware as written above.
2) used tutorials are https://github.com/JF002/Pinetime/blob/m.../README.md and https://github.com/JF002/Pinetime/blob/d...Program.md (and many others :-))
3) compiler is package arm-none-eabi from Ubuntu 20.04 repository, nRF-SDK is installed is copied (unzipped) into my home directory, last version SDK_17.0.2_d674dde
4) image is converted using https://www.digole.com/tools/PicturetoC_...verter.php - PNG, 240x240px, changed only hex data in file  bootloader/boot_graphics.h
5) changed constants of day and month names in file src/libs/lvgl/src/lv_objx/lv_calendar.c
6) on root of git data directory: cmake -DNRF5_SDK_PATH=/home/lookin/sandbox/nRF5_SDK_17.0.2_d674dde/ -DUSE_JLINK=0 -DARM_NONE_EABI_TOOLCHAIN_PATH=/usr/ -DUSE_OPENOCD=1
7) on the same directory "make -j" - everything compiled ok
8) mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header src/pinetime-app-0.9.0.bin imageA.bin
9) mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header src/pinetime-graphics-0.9.0.bin imageB.bin
10) ~/.local/bin/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application imageA.bin dfu-imgA.zip
11) ~/.local/bin/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application imageB.bin dfu-imgB.zip
12) with nRF Connect I upload boot image: dfu-imgB.zip - everything is ok, 100 % pass, "image ok", PineTime is rebooting and starts with old "PineTime" picture  Dodgy
13) also imageA.zip is completly loaded, after "image ok" label is device rebooting, hangs for a while on PineTime logo reboots once more and start old app...

I will be thankfull for all ideas, what am I doing wrong...

Hae a nice day
Lukas
#2
Hi @lookin, Congratulations for your PineTime and your first achievements with wasp-os  and InfiniTime Smile

Wow, you tried a lot of things to build and customize your own InfiniTime firmware. The documentation of the project is certainly not complete/clear enough, I'll try to give you more information about all of it Smile

Toolchain & NRF SDK
I recommend you use exactly the same version than the one specified in the project documentation. The compiler from your distro might be older or newer than the one I use to test InfiniTime, and might yield other warnings/errors. 
Same for the NRF SDK. I use version 15.3 and you use version 17. I think NRF follows the semantic versioning, meaning that there can be many breaking changes between 2 different major versions of the SDK. To be honest, I'm surprised that it compiled without errors.

Boot logo
The bootloader fetches the boot logo from the external SPI memory. It does not support PNG or any compressed format. The byte array must contain a raw bitmap of RGB565 pixels (115200 bytes). I recommend you use this converter tool fro lvgl to convert your picture into a byte array.
Then, you need to actually flash it in this external SPI flash memory. You're right, pinetime-graphics is the tool you should use but... It is not designed to be flashed and run by the bootloader. The only way to use this tool is to flash it using a SWD flasher, run it, and then re-flash the bootloader and InfiniTime (yes, pinetime-graphics will overwrite the bootloader and the firmware).

When you tried to OTA this firmware, the bootloader actually tried to run it, but it didn't run properly, the watchdog reset the CPU and MCUBoot reverted to the last working firmware. You've actually validated that the bootloader does its job correctly Wink

Building your own InfiniTime firmware
I think you were mostly right about this part, pinetime-app-0.9.0.bin is the firmware version that does not support the bootloader. You should use pinetime-mcuboot-app-0.9.0.bin instead.
You can easily check that your build is running by opening the SystemInfo app once InfiniTime is running, it displays the date and time of the build.

Changing the month names
The clock app does not use lv_calendar so your changes won't have any effects. The constants that are displayed are defined in Clock.cpp (src/displayapp/screens/Clock.cpp).

I hope these info will help you building and flashing InfiniTime on your device! Feel free to ask more info here or on the chat rooms (all networks are bridged, so you can choose the one you prefer, every one will see your messages).
Working on InfiniTime, the FOSS firmware for the PineTime: https://github.com/InfiniTimeOrg/InfiniTime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
Matrix : @JF002:matrix.org
#3
(11-22-2020, 04:58 AM)JF002 Wrote: Boot logo
The bootloader fetches the boot logo from the external SPI memory. It does not support PNG or any compressed format. The byte array must contain a raw bitmap of RGB565 pixels (115200 bytes). I recommend you use this converter tool fro lvgl to convert your picture into a byte array.
Then, you need to actually flash it in this external SPI flash memory. You're right, pinetime-graphics is the tool you should use but... It is not designed to be flashed and run by the bootloader. The only way to use this tool is to flash it using a SWD flasher, run it, and then re-flash the bootloader and InfiniTime (yes, pinetime-graphics will overwrite the bootloader and the firmware).

Recent versions of wasp-reloader will also write a boot logo although it's not really designed to be user modifiable... it is simply to put back a logo when switching from wasp-bootloader to mcuboot. If you try a more recent build you will see this behavior:
https://github.com/daniel-thompson/wasp-...h%3Amaster

If will program this graphic, which was chosen because this version of the logo is reasonably elegant but it compresses down to less than 800 bytes which means I can easily fit it into the reloader images):
https://github.com/daniel-thompson/wasp-..._small.png
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#4
Thank you very much for both your comments!

I solved the problem with OTA uploading of new firmware. It was really needed to use proper compiler version. With compiler from linux repository package its not working without any warning. And also the right file is pinetime-mcuboot-app-0.9.0.bin :-). At this time it's working and I'm able to change time position, text colors, add seconds etc.

I didn't try to load bootlogo into external memory for the present, that is for me not so important...

Thanks
Lukas


Possibly Related Threads…
Thread Author Replies Views Last Post
  Develop a new firmware for PineTime belushi 2 1,267 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 485 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 681 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,061 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 896 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 1,976 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 1,592 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,522 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 3,845 03-02-2022, 05:58 AM
Last Post: wibble
  Zephyr based Pinetime jandy 4 4,609 11-11-2021, 05:53 AM
Last Post: jandy

Forum Jump:


Users browsing this thread: 1 Guest(s)