Updates to MicroBitDisplay::setBrightness() to perform a NOP for out of bound parameters.
This aligns the functionality of the runtime with the TD simulator.
Updates the MicroBitMessageBus implementation to use fork_on_block() calls rather
than create_fiber() calls when servicing events. This provides greater optimisation
for non-blocking event handlers.
More specifically, this update:
- Replaces calls to create_fiber() ith fork_on_block during event send operations.
- Adds a queue of events, to ensure events generated from interrupt context are not serviced in interrupt context.
- Registers a listener with the idle process to empty the event queue.
The microbit fiber scheduler is often used to service event handlers by the microbit message bus.
This provides a very elegant decoupling of user code from system code, interrupt handlers and
also allows users to make blocking calls within event handlers. However, many event handlers are
non-blocking, so launching a dedicated fiber is wasteful in terms of time and SRAM.
This patch adds fork_on_block() to the scheduler. Inspired by the UNIX copy_on_write
technique, this optimisation is semantically equivalent to a create_fiber() call, but will first attempt
to execute the given function in the context of the currently running fiber, and *only* create a fiber
if the given code attempts a blocking operation.
More specifically, this update:
- adds fork_on_block() functions for parameterised and non-parameterised functions.
- adds fields to the fiber context to record the status of parent/child fibers.
- adds optimised ASM functions to store and restore Cortex M0 register context.
- adds a utility function to determine if the processor is executing in interrupt context.
- updates to sleep() and wait_for_event() to handle fork_on_block semantics.
- minor code optimsations within the scheduler.
NO_BLE can now be defined to determine whether ble
will be brought up or not at initialisation of uBit.
This is especially useful for two new Yotta targets:
bbc-microbit-classic-gcc-nosd,
bbc-microbit-classic-armcc-nosd, which do not use
softdevice.
This is the first commit of the microbit-dal on GitHub.
This repository contains the runtime, which is a light
weight operating system developed by Lancaster University.