Change Note 2025-05-17
lib/v2.1
, run-time error recovery
Overview
- Initiate
lib/v2.1
, with a first focus on run-time error recovery.
- See Error Recovery.
- Example program Recovery.
Framework
General
- The run-time error handling uses watchdog scratch register 0 to keep restart data across system restarts. This can be configured.
- The currently unused CPU register
r12
is used to contain the kernel status, currently only the id of the current coroutine, which corresponds to the current thread’s id. Yes, register r12
is “reserved” by Astrobe, but it’s a pity to leave such a valuable resource unused. Should a future version of Astrobe make use of r12
, another solution will be found. Using r12
makes the data easily accessible from low-level error handlers, and does not mandate the use of the kernel for the recovery mechanism, which is implemented in an independent module.
Module RuntimeErrors
New Module Stacktrace
- Create stack traces and read error exception-stacked registers, as formerly implemented in
RuntimeErrors
.
- This module may be renamed and extended going forward to add more programmer’s tools.
Module RuntimeErrorsOut
- Rewrite module according to Error Recovery.
- Remove the dependency on module
Memory
.
New Module Recovery
- First jab at autonomous error recovery.
- See example program
Recovery
.
Module Kernel
- Thread timing period is now defined as number of ticks, not milliseconds. This avoids possible misalignment between the system tick and thus scheduler period, and the thread timing.
SetPeriod
and SetPrio
are now in-process APIs, to be called from the thread’s init code.
- Former in-process
ChangePeriod
and ChangePrio
are removed.
- The objective here to make each thread self-contained, so it can be reset and restarted without running the whole program initialisation code, which sets up the threads.
Module Coroutines
Init
puts the Coroutine
record pointer on initial stack.
Transfer
stores current coroutine ID in register r12.
Module Watchdog
- Add procedure
GetScratchReg
.
Module Errors
- Adjust
GetErrorMsg
and GetErrorType
according to changes in RuntimeErrors
.
GetErrorMsg
replaces GetExceptionMsg
, GetErrorType
replaces GetExceptionType
.
Module StartUp
- New procedure
ReleaseResets
. ReleaseReset
(singular) is deprecated.
- Fix
SetWatchdogBootVector
(RP2040, RP2350) and SetPowmanBootVector
(RS2350).
- Rename some procedures for better consistency.
Module Main
- Adjust default (“print and halt”) run-time error reporting for changes in
RuntimeErrors
and RuntimeErrorsOut.
Module LEDext
- Add CONST that addresses all eight LEDs.
Module MCU2
- Add values for watchdog restart causes.
Other Modules
- Small changes due to changed modules as outlined above.
Config Files
- Extend config files for
lib/v2.0
for Astrobe v10.
- Add config files for
lib/v2.1
for Astrobe v10.
Example Programs
Recovery
- Recover from run-time errors and watchdog timeouts.
- Use new module
Recovery
.
- Description: Recovery
RestartEval
- Evaluate different kinds of restarts, and the use of the watchdog boot functionality.
Other
- Port a first set of example programs to
lib/v2.1
, mainly for the changes in Kernel
as outlined above.
Updated: 2025-05-18