[Oberon] Standalone BootLoader format

Jörg Straube joerg.straube at iaeth.ch
Tue May 12 22:20:10 CEST 2020


Tomas

What happens during boot is described in chapter 14.1.
https://inf.ethz.ch/personal/wirth/ProjectOberon/PO.Applications.pdf

The boot process is rather for the advanced programmers. And the * mark 
of Modules is for the very advanced programmers writing programs for 
ROM/BRAM.

Now very important: Modules marked with a * are programs for Stage 0. eg 
the booloader itself resides in BRAM/ROM.

As you told us you load your Counter module over serial line, you are 
already at Stage 1. Stage 1 programs are not in BRAM but are loaded into 
normal RAM.
The program loading your program over serial line is called Bootloader, 
resides in ROM, and is at Stage 0. But your program that is read over 
serial line and then gets started is at Stage 1 already.

As a rule: only programs for Stage 0 should get marked with a *. All 
other programs must NOT be marked with a *.
So, if you write a very small program (like Counter) and you load it 
over serial line, it should not be marked with a * but must be linked. I 
will not deep dive into the linking process.

Now, you did something strange: You wrote a program for Stage 0 (marked 
with a *) but loaded it as Stage 1 program. Let me try to explain what 
happens:

Stage 0 programs (eg the bootloader) expect
- its code at large address (eg absolute 0FFE000H = ROM).
- global variables at absolute address 0

Stage1 programs (eg the inner core) expect
- code at absolute address 0
- global variables at a higher address.

So, if you load a Stage 0 program (expecting *global variables* at 
address 0) in a Stage 1 environment (expecting *code* at address 0) your 
own global variables would overwrite your code. The few empty place at 
the beginning of the Stage 0 code is a kind of security measure for 
exactly this case. It's only working if you don't have too many global 
variables. If you have, assignments to your global variables will 
overwrite your code.

br
Jörg

Am 12.05.2020 um 21:11 schrieb Tomas Kral:

> On Tue, 12 May 2020 20:56:06 +0200
> Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
>
>> If, however, you load Counter.rsc to any other location, for example
>> to location 1024
>> Don’t declare more than 1016 bytes worth of global variables,
>> otherwise these will overwrite the code section of Counter.rsc, which
>> starts at address 1024.
> :-)
>
> One day I will get it clear, hope.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20200512/0ddba168/attachment.html>


More information about the Oberon mailing list