<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Tomas</p>
<p>What happens during boot is described in chapter 14.1.<br>
<a class="moz-txt-link-freetext" href="https://inf.ethz.ch/personal/wirth/ProjectOberon/PO.Applications.pdf">https://inf.ethz.ch/personal/wirth/ProjectOberon/PO.Applications.pdf</a><br>
</p>
<p>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.<br>
</p>
<p>Now very important: Modules marked with a * are programs for
Stage 0. eg the booloader itself resides in BRAM/ROM.</p>
<p>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.<br>
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.</p>
<p>As a rule: only programs for Stage 0 should get marked with a *.
All other programs must NOT be marked with a *.<br>
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.<br>
</p>
<p>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:<br>
</p>
<p>Stage 0 programs (eg the bootloader) expect<br>
- its code at large address (eg absolute 0FFE000H = ROM).<br>
- global variables at absolute address 0<br>
</p>
<p>Stage1 programs (eg the inner core) expect<br>
- code at absolute address 0<br>
- global variables at a higher address.</p>
<p>So, if you load a Stage 0 program (expecting <b>global variables</b>
at address 0) in a Stage 1 environment (expecting <b>code</b> 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>
</p>
br<br>
Jörg
<p>Am 12.05.2020 um 21:11 schrieb Tomas Kral:</p>
<blockquote type="cite"
cite="mid:20200512211105.297cd3dd@raspberrypi">
<pre class="moz-quote-pre" wrap="">On Tue, 12 May 2020 20:56:06 +0200
Andreas Pirklbauer <a class="moz-txt-link-rfc2396E" href="mailto:andreas_pirklbauer@yahoo.com"><andreas_pirklbauer@yahoo.com></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">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.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
:-)
One day I will get it clear, hope.
</pre>
</blockquote>
</body>
</html>