Oberon RTS consists of the following modules.
No major changes with respect to Embedded Oberon.
- Kernel: heap memory allocation, garbage collection, SD card IO. Allows to set the stack size.
- FileDir, Files: file system
- Modules: dynamic module loader-linker. Gets stack size from Kernel. Clears out unused slots at the top of the module memory space when a module, is discarded with Modules.Free.
Modules other than the Inner Core, but required to boot and operate Oberon RTS, are considered to be part of the Outer Core.
Outer Core modules based on Embedded Oberon:
Oberon: entry point for the Outer Core to “put together” and start the system. Sets up the system processes: scheduler, command handler, garbage collector, and audit process. The Loop and the command handling are moved to modules
System: system commands.
System.Watchare extended, plus a new command
System.ShowProcesses. The trap and abort handlers have been moved to module
Texts: formatted text output and input. In EPO, the writer, usually denoted using parameter
W, is a dummy, as all output is hardwired to the Astrobe terminal. In Oberon RTS, output can be directed to different outputs, and parameter
Wdenotes an actual Texts.Writer, which needs to be created and initialialised. Module Console creates and exports such a writer to the Astrobe terminal.
Input: replaced by module
Upload: transfer files from host PC to target’s SD card, rewritten for buffered RS232, and the corresponding drivers (see below). The transfer protocol still has the known timeout issues when uploading many files, as this needs a change to the Astrobe IDE.
Added modules in Oberon RTS:
Console: read from, and write to, the Astrobe terminal, using a buffered serial RS232 device. As mentioned above, a
Texts.Writeris created and exported for all modules that need to write to the terminal (there are variants of this module).
Cmds: implements the process code to read and execute Oberon commands. Also, as in EPO, the upload of modules is handled (using module
Upload). In addition, if set-up and armed accordingly, start-up commands are read from the selected start-up command table (see module Start).
Processes: implements the process scheduler, and provides all definitions and procedures to create, initialise, and otherwise manage system and control processes.
Coroutines: simple coroutines to implement the processes. The stack monitor and calltrace stacks are set during the coroutine transfer, too.
ProcTimers, ProcDelay, ProcDevsig: drivers for control devices in the FPGA for periodic timing, delay, and device-signals for process scheduling. Each process has its own set of these hardware devices.
Errors: run-time error handling, trap and abort handlers. These handlers are substantially changed for a more elaborate error handling.
Interrupts: driver for the multi-channel interrupt controller, as well as installing and enabling interrupts in general. Used for the various interrupts upon run-time errors, such as stack overflow, or the watchdog.
Start: upon system reset, the command handling process will read start-up commands from “reset-surviving” tables in the FPGA, eg. to automatically (re-)start a control program when recovering from a run-time error. More than one start-up tables are available, to allow several control programs, eg. for different modes.
SysCtrl: read and write the System Control Register
RS232dev, RS232b, RS232sig: buffered serial device.
These modules are not strictly part of the system, but are currently in use. That is, the system could be modified to not make use of them.
Log, LogView: FPGA-based logger. Defined events with its corresponding data can be logged in a circular buffer in the FPGA with module Log. Module LogView provides commands to “translate” the event data into readable text, and output them on the console.
StackMonitor: driver for the stack overflow monitor in the FPGA.
Calltrace: driver and output command for the procedure calltrace device in the FPGA.
Watchdog: driver for the watchdog device in the FPGA.
ProcMonitor: driver for the process execution monitor in the FPGA.
RTC: driver for the hardware real-time clock.
SPIdev, various SPI drivers: extended SPI device.
- The boot loader in the FPGA loads the boot file with the Inner Core from the SD card and terminates with a branch to address 0.
- The branch to address 0 transfers control to the body of Modules, which initialises the bodies of Files, Kernel, and FileDir (in this order). This establishes a working file system. From here on, the compiled modules of the Outer Core can be loaded from the SD card.
- Then Modules loads Oberon. The body of module Oberon is the entry point to the Outer Core.
- Loading Oberon loads, via imports, modules Processes, Cmds, Console, SysCtrl, Errors, Log, StackMonitor, Log, and RTC.
- installs the real time clock RTC, which is needed for the start-up logging.
- creates and installs garbage collector system process (defined in module Oberon).
- creates and installs the audit process (defined in module Processes).
- creates and installs the command handler system process (defined in module Cmds).
- installs the trap and abort handlers, plus the error interrupt handlers (defined in module Errors).
- runs the garbage collector to free all memory that was used by loading the system modules to ensure that sufficient heap space is available to run the start-up commands.
- transfers control to the scheduler (in module Processes).
- The scheduler will start to execute the above system processes.
- The command system process executes the commands found in the selected start-up table, eg. to start a control program with its processes.
- After the system runs without errors for a defined period of time, the audit process will reset any error state.
Notably absent from the start-up sequence is module System, which is not required of for a working system, and will be loaded as any other module when a command in System is executed.
All important steps are logged.
Here’s a typical log output of a system start-up:
2021-12-19 05:12:59 SYS RESTART: load system. SCR: 00001000 error state: 0 RSTB 2021-12-19 05:12:59 SYS RTC installed: 0 1 2021-12-19 05:12:59 PROC INST: gc 1 2021-12-19 05:12:59 PROC INST: adt 2 2021-12-19 05:12:59 SYS start stack: 10180 heap: 49600 SP: 272 2021-12-19 05:12:59 PROC INST: cmd 3 2021-12-19 05:12:59 SYS GC: 0 49664 1280 2021-12-19 05:13:04 SYS OK SCR: 00001000
System.ShowProcesses right after start-up:
id ty pr tm n st rt rtm ovfl stk adr size hot used unused adt 0 0 7 2 6 10 196 0 0000F0EC 256 0 120 136 gc 0 0 7 1 6 10 11 0 00014BFC 512 0 40 472 cmd 0 3 4 3 3 497 631 0 0006C000 15872 512 1636 14236 scheduler 0006FE00 512 0 92 420 timers: t0: 5 t1: 10 t2: 20 t3: 50 t4: 100 t5: 200 t6: 500 t7: 1000
name base adr code adr code end data code slot refs num System 00014FA0 000153C8 0001774C 984 9092 10688 0 30 LogView 00013A60 00013E78 00014E40 968 4040 5440 0 29 Oberon 00013240 000134C8 000138FC 568 1076 2080 1 28 Errors 00012860 00012910 000130FC 96 2028 2528 1 27 Cmds 00011C80 00011E08 00012708 312 2304 3040 2 26 Start 00011120 000115FC 00011B50 1164 1364 2912 2 25 Upload 00010D60 00010DB4 00010FF8 4 580 960 1 24 Processes 0000F140 0000F354 00010AB4 452 5984 7200 4 23 ProcMonitor 0000EDE0 0000EE30 0000EFD0 0 416 864 1 22 Log 0000E940 0000E9B4 0000ECA0 36 748 1184 5 21 RTC 0000E180 0000E1D8 0000E7FC 8 1572 1984 2 20 SPIu 0000DC00 0000DC50 0000E05C 0 1036 1408 1 19 SPIdev 0000D960 0000D9C4 0000DAF8 20 308 672 3 18 Interrupts 0000D680 0000D6D0 0000D824 0 340 736 2 17 Watchdog 0000D460 0000D4B4 0000D564 4 176 544 3 16 SysCtrl 0000CEC0 0000CF18 0000D298 8 896 1440 4 15 ProcDevsig 0000CC40 0000CC90 0000CDB4 0 292 640 1 14 ProcDelay 0000C980 0000C9D0 0000CB28 0 344 704 1 13 ProcTimers 0000C680 0000C6D0 0000C868 0 408 768 1 12 Coroutines 0000C2C0 0000C324 0000C558 20 564 960 1 11 Calltrace 0000B9A0 0000BA30 0000C15C 64 1836 2336 4 10 StackMonitor 0000B740 0000B790 0000B88C 0 252 608 4 9 Console 0000B420 0000B47C 0000B600 12 388 800 6 8 RS232b 0000AD40 0000AD90 0000B2F0 0 1376 1760 2 7 RS232dev 0000A900 0000A964 0000AC20 20 700 1088 3 6 Texts 00009420 000094E8 0000A7D0 120 4840 5344 12 5 Modules 00007E20 00007F08 000092E0 152 5080 5632 6 4 Files 00005660 00005744 00007C7C 148 9528 10176 3 3 FileDir 00003620 000036AC 00005530 60 7812 8256 1 2 Kernel 00000100 0000218C 000034AC 8252 4896 13600 6 1 total 96352