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

Build a C header file #4

Closed microbit-carlos closed 4 years ago

microbit-carlos commented 4 years ago

To include this into DAPLink the preferred method is to just add a c file with an array to the DAPLink source code, similarly to how the flash algo is included: https://github.com/microbit-foundation/DAPLink-microbit/blob/cdbc7d25d2d0ce7d82ab6947ffa6515d86cf0a6b/source/family/nordic/nrf5x/flash_blob.c

To do this we can either update the tooling in DAPLink, or we can include the conversion in this repository. Since we want to keep the DAPLink core files as untouched as possible to help upstreaming, then the best option might be to do the conversion here.

We can do that either as part of the build in the Makefile (or whatever build system its currently used), but if that is complicated for whatever reason, they it would be fine to have as a manual step with instruction in a markdown file o similar.

We could use something like https://helpmanual.io/man1/xxd/ (not sure if this is cross-platform), a Python script with the IntelHex package (this is how DAPLink does it https://github.com/microbit-foundation/DAPLink-microbit/blob/master/tools/post_build_script.py#L200-L214), or anything else really as long as it's easy to implement.

martinwork commented 4 years ago

Added build.py which creates a C header - compared result with corresponding file in DAPLink repo factory_image_v1.47 branch.

microbit-carlos commented 4 years ago

Thanks Martin!