microbit-foundation / standalone-error-program

A small, standalone (No CODAL) bit of code to display errors on the micro:bit, for use in DAPLink and as a template for BLE bootloader
MIT License
0 stars 1 forks source link

DAPLink & Bootloader: Small display driver for nRF52 (COMP003) #1

Closed jaustin closed 3 years ago

jaustin commented 4 years ago

Depends on

Third parties:

Description

Related: https://github.com/microbit-foundation/DAPLink-microbit/issues/33

One of the features we want to add to DAPLink is to scroll error codes in the micro:bit display. This will be useful for errors like trying to flash a v1 hex file into a v2. This is tricky because the KL27 where DAPLink runs doesn't have access to the display, so needs to 'ask' the nRF to do it for us.

Errors should be in the form: Sad face-->E-->error number https://support.microbit.org/support/solutions/articles/19000016969-micro-bit-error-codes

Therefore we need a small CODAL-less display driver for the nRF52 so that DAPLink can flash errors and the code can then drive the display.

Existing panic code https://github.com/lancaster-university/microbit-dal/blob/master/source/core/MicroBitDevice.cpp#L172

(may have own display stuff in there?)

This will be bundled in the DAPLink builds/binary as a standalone hex that DAPLink can flash in times of emergency so it needs to be small.

Goal for size is under 10kB, but we really want it to be 5kB. Benchmark to say this achievable: the blinky for the Nordic SDK without softdevice is 6kb in hex format. radio_test copy.zip

This could be loaded in the nRF52 to memory, like the flash algo (although this option is likely discarded), or into the nRF52 flash (better option for error permanence). This program needs to read a number of message from somewhere (from a different location in Flash?) to scroll in the display.

Things we have at our disposal

We'd like the same code to be useful in the bluetooth bootloader for displaying progress and errors. This should probably be a library that the bootloader can use and a nordic sdk sample that uses that library to build a tiny program that can display errors.

For now, the code should display on, non-configurable error, E70. Once we have this working we can decide the error 'passing' mechanism with Gerardo

The code should live in this repository https://github.com/microbit-foundation/standalone-error-program And ideally will use the same SDK repo that Sam has created for the DAL

If the program could run out of flash or RAM (not just flash) it would allow us to use it in cases where we haven't already erased the nRF52 (say, someone drops an image onto the DAPlink drive, or another error that shouldn't erase the whole nRF52.

This COULD build on the Nordic SDK or it could just write the registers natively - the goal is small first, so if the SDK is roping in size without bringing much upside, we can ditch it.

See also https://github.com/matthewelse/microbit-bootloader/commit/5b31e6beed370a53f7f7726f9c854545c4988b1c for a tiny display driver!

Todo

Tracking

This task will likely be assigned to Martin.

Testing Required

Reviewer

Completion Criteria

Conclusion

WIP.

jaustin commented 4 years ago

@microbit-sam FYI created this here, invited @martinwork and let him know some context via email.

jaustin commented 4 years ago

See also https://github.com/matthewelse/microbit-bootloader/commit/5b31e6beed370a53f7f7726f9c854545c4988b1c for a tiny display driver!

martinwork commented 4 years ago

PR https://github.com/microbit-foundation/standalone-error-program/pull/2

martinwork commented 4 years ago

@jaustin Would you like me to use the standalone-error-program as a basis for a non-CODAL, small display driver for use by the bootloader? In the v2-bootloader repo would be simplest.

microbit-pauline commented 3 years ago

@jaustin and @martinwork - Is there any further work to be done on this?

martinwork commented 3 years ago

@microbit-pauline I think most of the above has been covered, either here or in the bootloader repo, except the possibility to run the error display from RAM.

microbit-pauline commented 3 years ago

@martinwork - can you please estimate how much work is involved for having the error display from RAM?

martinwork commented 3 years ago

@microbit-pauline I don't think it should take very long at all. I guess it just needs a modified linker script, but I have never done this so I really don't know. I'm happy to take a quick look.

microbit-pauline commented 3 years ago

Yes please @martinwork

martinwork commented 3 years ago

PR https://github.com/microbit-foundation/standalone-error-program/pull/12