[Oberon] Easter eggs in Oberon

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sun Apr 12 10:26:07 CEST 2020


  > you mention one that I don't know: boot module: could you give an example and a place where we can find it?

This is an undocumented feature and not officially part of the Oberon-07 language. It is however briefly described at the end chapter 14.1. on p.77 of the book Project Oberon 2013 Edition.

In sum, when the programmer compiles a module with the "RISC-0" option of the regular Oberon compiler (which is achieved by inserting an asterisk “*” immediately after the keyword MODULE), the compiler generates a so-called "standalone program” rather than a module that can be loaded by the regular module loader. Standalone programs are completely self-contained, relocatable instruction streams for inclusion directly in the hardware, i.e. they can run on the bare metal even when no module loader is present.

As compared with regular Oberon modules, such standalone programs have different starting and ending sequences: The first location contains an implicit branch instruction to the initialization code of the standalone program, and the last instruction is a branch instruction to absolute memory location 0. In addition, the processor register holding the stack pointer SP (R14) is also initialized to a fixed value in the initialization sequence of a standalone program. These modified starting and ending sequences are generated in ORG.Header and ORG.Close, respectively.

An example of a standalone program is the Oberon boot loader (module BootLoad.Mod) itself:

   MODULE* BootLoad;    (*the asterisk (=RISC-0 option) indicates that the compiler will generate a standalone program*)
      ...
   END BootLoad.

The Oberon boot loader is typically loaded to a fixed memory location once using proprietary tools provided by the FPGA manufacturer, such as the Xilinx downloader tools. Once the boot loader is started, its task is to load the pre-linked Oberon inner core from a valid boot source to absolute memory location 0 and then to just branch location 0 (where the branch instruction itself is generated by the compiler, not the programmer).

Note that standalone are not allowed to import other modules (as the module loader is not assumed to be present). In Extended Oberon, this rule is somewhat relaxed as follows: standalone programs can import other modules. so long as only constants are imported from them. In the future, pre-linked standalone programs will also be supported, allowing one to write a boot loader consisting of multiple modules.

-ap


More information about the Oberon mailing list