A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://microbit-micropython.readthedocs.io/en/latest/devguide/hexformat.html below:

Website Navigation


MicroPython Hex File — BBC micro:bit MicroPython 1.1.1 documentation

MicroPython Hex File

When MicroPython is built, the compiler produces an Intel Hex file containing the MicroPython firmware. Additional data can then be added to this file to contain information about the MicroPython version, or the Python code to execute on start-up.

The general memory layout used is:

Note

If you append any data or modify the Intel Hex file, please ensure the addresses of the data stored progress in incremental order. If there is an address jump backwards DAPLink will fail to flash the file.

UICR format

The User Information Configuration Registers (UICR) is a region of Non-Volatile Memory available to store user-specific settings. The first 128 Bytes are reserved, but we can use the other 128 Bytes to store any arbitrary data.

MicroPython stores the following information, in little endian, starting from the UICR customer[16] register:

Steps to create the firmware.hex file

The yotta tool is used to build MicroPython, but before that takes place additional files have to be generated by the Makefile in preparation for the build, and additional data is added to the hex file after.

Running the make all command executes the following steps:

Including a user script

User scripts are stored in the MicroPython filesystem and if a main.py script exists it is run when MicroPython starts. Additional Python scripts can also be included and executed from the main.py file, or the REPL.

The Python Editor uses microbit-fs to create the filesystem and include it in the HEX file. The Python Editor must add the filesystem to HEX files for MicroPython V1 & V2, and then combine both into a Universal HEX file to ensure compatibility with both hardware variants.

Appended script format (Deprecated)

This method of appending the script to the end of MicroPython is no longer used. Python files are now stored in the filesystem and main.py is the program entry point.

MicroPython checks the first 2 bytes at address 0x0003e000 for a magic string to indicate if there is an appended script. If the magic string is found, it will automatically execute the Python code stored there, unless there is a main.py file stored in the MicroPython filesystem.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4