Standalone BootLoader format
> I have older Oberon=0, compiler, too. That starts with B (PC+off+1), but > I seem to miss in the code an instruction setting SB to a reasonable value. .. > Most confusion arises here, that in PO2013, I cannot clearly see how SB > is handled, for me is rather obscured. The documentation in the book Project Oberon 2013 s indeed sometimes lagging behind or quite simply no longer in 100% snyc the latest implementation on the website. That’s a bit unfortunate. But the book simply is not updated each time a change is made. PS: I noted that you have referred a few times to the SB register in previous posts. Please note that in PO 2013 the SB = R13 register is no longer used since July 20th, 2018. So the book is indeed out of date in this regard as well. Before July 20th, 2019, ORG.GetSB and ORG.Header read: PROCEDURE GetSB(base: LONGINT); BEGIN IF (version # 0) & ((base # curSB) OR (base # 0)) THEN Put2(Ldr, SB, -base, pc-fixorgD); fixorgD := pc-1; curSB := base END END GetSB; PROCEDURE Header*; BEGIN entry := pc*4; IF version = 0 THEN code[0] := 0E7000000H-1 + pc; Put1a(Mov, SB, 0, VarOrg0); Put1a(Mov, SP, 0, StkOrg0) (*RISC-0*) ELSE Put1(Sub, SP, SP, 4); Put2(Str, LNK, SP, 0); invalSB END END Header; Here you can see how SB was set for standalone programs, namely via Put1a(Mov, SB, 0, VarOrg0). For regular programs, GetSB generates an LD SB.. instruction, which is fixed up by the loader. Since July 20th, 2019, ORG.GetSB and ORG.Header now read: PROCEDURE GetSB(base: LONGINT); BEGIN IF version = 0 THEN Put1(Mov, RH, 0, VarOrg0) (*no more SB used here!!!*) ELSE Put2(Ldr, RH, -base, pc-fixorgD); fixorgD := pc-1 END END GetSB; PROCEDURE Header*; BEGIN entry := pc*4; IF version = 0 THEN code[0] := 0E7000000H-1 + pc; Put1a(Mov, SP, 0, StkOrg0) (*RISC-0*) ELSE Put1(Sub, SP, SP, 4); Put2(Str, LNK, SP, 0) END END Header; So you can see that the SB = R13 register is not used AT ALL in PO 2013. Instead, RH is used, and there is no more need to initialize SB to a reasonable value (namely VaroOrg0 = 0) in ORG.Header. I don’t know about the compiler you are using (probably the Oberon-0 compiler described in the book Compiler Construction), but if you you know the compiler well enough, you can always figure out what is going on. Don’t rely too much on the book for little details like that, for they may have changed in the official PO 2013 release, without updating the book.
On Wed, 13 May 2020 11:25:14 +0200 Andreas Pirklbauer <andreas_pirklbauer@yahoo.com> wrote:
So you can see that the SB = R13 register is not used AT ALL in PO 2013. Instead, RH is used, and there is no more need to initialize SB to a reasonable value (namely VaroOrg0 = 0) in ORG.Header.
Interesting, no SB then. Does this imply SB was to 0 most of the time, so R13 is now free for general purpose? Does this lead to a shorter more compact code? I wish I could say I am now less confused :-) -- Tomas Kral <thomas.kral@email.cz>
I don’t know about the compiler you are using (probably the Oberon-0)
Yes, Oberon-0 emitting instructions into an array code[0..pc]. It produces standalone code, that can be executed in a small RISC emulator module (it sets R[13] := pc, i.e. past the last instruction before execution). OSP.Compile @ OSG.Decode OSG.Execute ~ OSG.StoreBoot (* RISC standalone code *) MODULE TestLED; VAR x, y, z: INTEGER; BEGIN z := 0; REPEAT LED(z); x := 1000; REPEAT y := 1000; REPEAT y := y-1 UNTIL y = 0; x := x-1 UNTIL x = 0; z := z+1 UNTIL FALSE END TestLED. I have added StoreBoot to get the executable, and it sets SB to PC after the last instruction. PROCEDURE Close*; BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); Put1(Mov, SB, 0, (pc+1)*4); END Close; OSG.Decode 0 E7000000 B 0 1 40000000 MOV R0 R0 0 2 A0D00008 STW R0 SB 8 3 80D00008 LDW R0 SB 8 ... 27 40000000 MOV R0 R0 0 28 C7000000 B R0 29 4D000074 MOV, SB, R0 116 When storing to file, I store last instruction in code[pc+1] as first, then followed by code[0] .. code[pc]. Note file is 116 bytes long. So it becomes 0 4D000074 MOV, SB, R0 116 1 E7000000 B 0 2 40000000 MOV R0 R0 0 3 A0D00008 STW R0 SB 8 4 80D00008 LDW R0 SB 8 ... 27 40000000 MOV R0 R0 0 28 C7000000 B R0 In hope I managed to set SB to a sensible value, not overwriting the standalone code. After booting with BRAM BootLoad, it does not work. I must still misunderstand something??? -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
Yes, Oberon-0 emitting instructions into an array code[0..pc].
Normally Prof. Wirth's compilers store instructions into an array 0..(pc-1) and pc is reported as the size. As already stated, if using standalone mode (MODULE* ), the first instruction is a branch to the body (over any procedures) and there are a further seven instructions reserved, e.g. for a branch when using interrupts in a von-Neumann (as opposed to modified Harvard) setup. The initial jump is a relative jump, so if you wanted to move it to the end of the program, you would need a negative displacement. But how will this help when the bootloader jumps to location 0? Note that the serial bootfile format is different from the on-disk format, it is same as the standard format from the original Project Oberon (ie len, adr, data, len, adr, data etc.) except that the start address field in the final (len=0) block is not used, it jumps to 0 regardless. See BootLoad.Mod for details. HTH, Paul
Tomas We can try to help but we need a little bit of background info: - What compiler do you use? Standard or modified by you? - What environment do you want to run your program in? FPGA? which? Emulator? which? - What is the task you would like to reach? br Jörg
Am 14.05.2020 um 12:20 schrieb Paul Reed <paulreed@paddedcell.com>:
Hi Tomas,
Yes, Oberon-0 emitting instructions into an array code[0..pc].
Normally Prof. Wirth's compilers store instructions into an array 0..(pc-1) and pc is reported as the size.
As already stated, if using standalone mode (MODULE* ), the first instruction is a branch to the body (over any procedures) and there are a further seven instructions reserved, e.g. for a branch when using interrupts in a von-Neumann (as opposed to modified Harvard) setup.
The initial jump is a relative jump, so if you wanted to move it to the end of the program, you would need a negative displacement. But how will this help when the bootloader jumps to location 0?
Note that the serial bootfile format is different from the on-disk format, it is same as the standard format from the original Project Oberon (ie len, adr, data, len, adr, data etc.) except that the start address field in the final (len=0) block is not used, it jumps to 0 regardless.
See BootLoad.Mod for details.
HTH, Paul -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Joerg, Tomas has already given the setup - investigating the Compiler Construction compiler on RISC5 on the FPGA with a serial bootloader and his own program to create the serial bootfile. I was just checking some details. Please correct me if I'm wrong Tomas. Thanks, Paul
Prof. Wirth's compilers store instructions into an array 0..(pc-1) and pc is reported as the size.
Yes, and I try setting SB pointing to pc when storing this array to file. This mimics what RISC.Mod emulator does R[13] := pc*4 prior execution.
the first instruction is a branch to the body over any procedures there are a further seven instructions reserved, e.g. for a branch when using interrupts in a von-Neumann (as opposed to modified > Harvard) setup.
Actually I thought we are branching over boot limits, did not know about interrupts in a von-Neumann 0 A branch instruction to the initializing body of module Modules (* set by OLR.Link *) 12 The limit of available memory 16 The address of the end of the module space loaded 20 The current root of the links of loaded modules 24 The current limit of the module area
Note that the serial bootfile format is different from See BootLoad.Mod for details.
Yes, now it works. But I have two jumps, not neat, but with more understanding, I can improve further, to have a single branch. 0 E7000007 B 7 (* currently hardcoded *) 1 00000000 (* boot limit area *) 2 00000000 (* 7 words *) 3 00000000 4 00000000 5 00000000 6 00000000 7 00000000 (* setting SB past the code block *) 8 4D000090 MOV SB R0 144 (* branch over procedures, no procedures := 0 *) 9 E7000000 B 0 10 40000000 MOV R0 R0 0 11 A0D00008 STW R0 SB 8 12 80D00008 LDW R0 SB 8 13 5100FFC4 MOV R1 R0 -60 14 A0100000 STW R0 R1 0 15 400003E8 MOV R0 R0 1000 16 A0D00000 STW R0 SB 0 17 400003E8 MOV R0 R0 1000 18 A0D00004 STW R0 SB 4 19 80D00004 LDW R0 SB 4 20 40090001 SUB R0 R0 1 21 A0D00004 STW R0 SB 4 22 80D00004 LDW R0 SB 4 23 40090000 SUB R0 R0 0 24 E9FFFFFA BNE -6 25 80D00000 LDW R0 SB 0 26 40090001 SUB R0 R0 1 27 A0D00000 STW R0 SB 0 28 80D00000 LDW R0 SB 0 29 40090000 SUB R0 R0 0 30 E9FFFFF2 BNE -14 31 80D00008 LDW R0 SB 8 32 40080001 ADD R0 R0 1 33 A0D00008 STW R0 SB 8 34 E7FFFFE9 B -23 35 40000000 MOV R0 R0 0 36 C7000000 B R0 PROCEDURE Close*; (* added SB *) BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); (* setting SB *) Put1(Mov, SB, 0, (pc+8)*4); END Close; In the OSG.Mod there is a `dc := 0' what is the meaning; Code displacement??? Perhaps I could learn to use. PROCEDURE StoreBoot*; VAR F: Files.File; R: Files.Rider; i: INTEGER; BEGIN F := Files.New("Risc.bin"); Files.Set(R, F, 0); Texts.WriteString(W, "store Risc.bin"); Texts.Append(Oberon.Log, W.buf); Files.WriteInt(R, 0E7000007H); (* B 7 relative*) FOR i := 1 TO 7 DO Files.WriteInt(R, 0H) END ; (* 7 words reserved *) Files.WriteInt(R, code[pc-1]); DEC(pc); i := 0; REPEAT Files.WriteInt(R, code[i]); INC(i) UNTIL i = pc; Files.Register(F); Texts.WriteString(W, " done."); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END StoreBoot; -- Tomas Kral <thomas.kral@email.cz>
Tomas PROCEDURE Close*; (* added SB *) BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); (* setting SB *) Put1(Mov, SB, 0, (pc+8)*4); END Close; Are you sure, Close() is a good place to initialize SB? Try to find out, when your added instruction is executed. br Jörg
Am 14.05.2020 um 15:08 schrieb Tomas Kral <thomas.kral@email.cz>:
Prof. Wirth's compilers store instructions into an array 0..(pc-1) and pc is reported as the size.
Yes, and I try setting SB pointing to pc when storing this array to file. This mimics what RISC.Mod emulator does R[13] := pc*4 prior execution.
the first instruction is a branch to the body over any procedures there are a further seven instructions reserved, e.g. for a branch when using interrupts in a von-Neumann (as opposed to modified > Harvard) setup.
Actually I thought we are branching over boot limits, did not know about interrupts in a von-Neumann
0 A branch instruction to the initializing body of module Modules (* set by OLR.Link *) 12 The limit of available memory 16 The address of the end of the module space loaded 20 The current root of the links of loaded modules 24 The current limit of the module area
Note that the serial bootfile format is different from See BootLoad.Mod for details.
Yes, now it works. But I have two jumps, not neat, but with more understanding, I can improve further, to have a single branch.
0 E7000007 B 7 (* currently hardcoded *) 1 00000000 (* boot limit area *) 2 00000000 (* 7 words *) 3 00000000 4 00000000 5 00000000 6 00000000 7 00000000 (* setting SB past the code block *) 8 4D000090 MOV SB R0 144 (* branch over procedures, no procedures := 0 *) 9 E7000000 B 0 10 40000000 MOV R0 R0 0 11 A0D00008 STW R0 SB 8 12 80D00008 LDW R0 SB 8 13 5100FFC4 MOV R1 R0 -60 14 A0100000 STW R0 R1 0 15 400003E8 MOV R0 R0 1000 16 A0D00000 STW R0 SB 0 17 400003E8 MOV R0 R0 1000 18 A0D00004 STW R0 SB 4 19 80D00004 LDW R0 SB 4 20 40090001 SUB R0 R0 1 21 A0D00004 STW R0 SB 4 22 80D00004 LDW R0 SB 4 23 40090000 SUB R0 R0 0 24 E9FFFFFA BNE -6 25 80D00000 LDW R0 SB 0 26 40090001 SUB R0 R0 1 27 A0D00000 STW R0 SB 0 28 80D00000 LDW R0 SB 0 29 40090000 SUB R0 R0 0 30 E9FFFFF2 BNE -14 31 80D00008 LDW R0 SB 8 32 40080001 ADD R0 R0 1 33 A0D00008 STW R0 SB 8 34 E7FFFFE9 B -23 35 40000000 MOV R0 R0 0 36 C7000000 B R0
PROCEDURE Close*; (* added SB *) BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); (* setting SB *) Put1(Mov, SB, 0, (pc+8)*4); END Close;
In the OSG.Mod there is a `dc := 0' what is the meaning; Code displacement??? Perhaps I could learn to use.
PROCEDURE StoreBoot*; VAR F: Files.File; R: Files.Rider; i: INTEGER; BEGIN F := Files.New("Risc.bin"); Files.Set(R, F, 0); Texts.WriteString(W, "store Risc.bin"); Texts.Append(Oberon.Log, W.buf); Files.WriteInt(R, 0E7000007H); (* B 7 relative*) FOR i := 1 TO 7 DO Files.WriteInt(R, 0H) END ; (* 7 words reserved *) Files.WriteInt(R, code[pc-1]); DEC(pc); i := 0; REPEAT Files.WriteInt(R, code[i]); INC(i) UNTIL i = pc; Files.Register(F); Texts.WriteString(W, " done."); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END StoreBoot;
-- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Thu, 14 May 2020 15:59:32 +0200 JR <joerg.straube@iaeth.ch> wrote:
Are you sure, Close() is a good place to initialize SB?
It is not, perhaps Open() would be better? But at that stage, appropriate value for SB is not know yet. It is known when the code size is known, i.e. after compilation, when pc = code size. Currently I deposit it as the last instruction, but I write it to the file as the very first. (does not affect execution in RISC.Mod)
Files.WriteInt(R, code[pc-1]); DEC(pc); i := 0; REPEAT Files.WriteInt(R, code[i]); INC(i) UNTIL i = pc; Files.Register(F);
Now thinking about putting it in Open(), or Header() Then would need somehow to fixup the SB value in the instruction field, after Close(). Not sure, am I close? -- Tomas Kral <thomas.kral@email.cz>
On Thu, 14 May 2020 15:59:32 +0200 JR <joerg.straube@iaeth.ch> wrote:
Are you sure, Close() is a good place to initialize SB? Try to find out, when your added instruction is executed.
This seems doing the work better. entry, fixlist (*not used*): LONGINT; PROCEDURE Header*(size: LONGINT); BEGIN entry := pc; fix(0, pc-1); Put1(Mov, SB, 0, 0) END Header; PROCEDURE Close*; BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); fix(entry, pc*4) END Close; It also makes StoreBoot simple, but needing two jumps. PROCEDURE StoreBoot*; VAR F: Files.File; R: Files.Rider; i: INTEGER; BEGIN F := Files.New("Risc.bin"); Files.Set(R, F, 0); Texts.WriteString(W, "store Risc.bin"); Files.WriteInt(R, 0E7000007H); (* B 7 *) FOR i := 1 TO 7 DO Files.WriteInt(R, 0H) END ; (* reserved *) i := 0; REPEAT Files.WriteInt(R, code[i]); INC(i) UNTIL i = pc; Files.Register(F); Texts.WriteString(W, " done."); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END StoreBoot; -- Tomas Kral <thomas.kral@email.cz>
On Thu, 14 May 2020 15:59:32 +0200 JR <joerg.straube@iaeth.ch> wrote:
Are you sure, Close() is a good place to initialize SB? Try to find out, when your added instruction is executed.
This seems even better, one jump only. entry, fixlist (*not used*): LONGINT; PROCEDURE Open*; VAR i: INTEGER; BEGIN curlev := 0; pc := 0; RH := 0; Put3(2, 7, 0); FOR i := 1 TO 7 DO code[pc] := 0H; INC(pc) END END Open; PROCEDURE Header*(size: LONGINT); BEGIN entry := pc; fix(0, pc-1); Put1(Mov, SB, 0, 0) END Header; PROCEDURE Close*; BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); fix(entry, pc*4) END Close; PROCEDURE StoreBoot*; VAR F: Files.File; R: Files.Rider; i: INTEGER; BEGIN i := 0; F := Files.New("Risc.bin"); Files.Set(R, F, 0); Texts.WriteString(W, "store Risc.bin"); REPEAT Files.WriteInt(R, code[i]); INC(i) UNTIL i = pc; Files.Register(F); Texts.WriteString(W, " done."); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END StoreBoot; -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
Yes, and I try setting SB pointing to pc when storing this array to file. This mimics what RISC.Mod emulator does R[13] := pc*4 prior execution.
Unfortunately, as has already been pointed out, this won't be sufficient, because the instructions loading SB are special. They are laid down by the Oberon-0 compiler in a linked list in OSG: PROCEDURE GetSB; BEGIN IF curSB = 1 THEN Put2(Ldw, SB, 0, pc-fixorgD); fixorgD := pc-1; curSB := 0 END END GetSB; The offsets are used as a linked list (a common technique in Prof. Wirth's compilers). At the end of compilation, fixorgD will end up pointing at the last instruction which needs to be patched, which contains the pc value of the previous one, and so on. You will need to follow this chain back while patching the instructions. OSG.fix() can be used to do this. You stop when the link is 0. (If you are doing your work in a module outside OSG, you will need to change OSG to export OSG.fixorgD and procedure OSG.fix. At the moment the only variables of relevance here which are exported are OSG.pc and OSG.code - but the others are used, for example, in OSG.Close. All this comes about because the Oberon-0 compiler generates normal module code which is intended to run inside the Oberon System, ie it is not "standalone" anymore. The full Oberon-07 compiler does both standalone [MODULE* ] and a normal module. So quite some changes are necessary to do what you want.)
the first instruction is a branch to the body over any procedures there are a further seven instructions reserved, e.g. for a branch when using interrupts in a von-Neumann (as opposed to modified > Harvard) setup.
Actually I thought we are branching over boot limits, did not know about interrupts in a von-Neumann
0 A branch instruction to the initializing body of module Modules (* set by OLR.Link *) 12 The limit of available memory 16 The address of the end of the module space loaded 20 The current root of the links of loaded modules 24 The current limit of the module area
The only variable set by the bootloader is at 12, the limit of memory, so you definitely need to load your code before or later than that. The others are created by the Oberon boot linker and loaded when the boot loader loads the Oberon Inner Core from disk. They are not relevant here and you can ignore them.
Note that the serial bootfile format is different from See BootLoad.Mod for details.
Yes, now it works. But I have two jumps, not neat, but with more understanding, I can improve further, to have a single branch.
You will always need two jumps in general because you need a jump to somewhere where you set up SB, then you need to jump to the body of the module. The body is not always the beginning because procedures come first, and you can't insert because the displacements to procedures will be wrong. Also note the bootloader has set the stack to 80000H (StkOrg) and this grows downwards. Mainly I think, you need a more advanced Storeboot procedure - you still don't seem to be creating a correct bootfile, I think this is where some confusion occurs. Your first word of the bootfile should be the length of the first section, the second word should be the address, and then the subsequent words should be the data you want to put at that address. Any subsequent section must also be like this. You need to finish with a section with a word len of zero. From section 14.1 of the book: BootFile = {block}. block = size address {byte}. (size and address are words) and size = 0 indicates the end of the file. {} means possibly repeated. This is read by the code in BootLoad.Mod: PROCEDURE RecInt(VAR x: INTEGER); VAR z, y, i: INTEGER; BEGIN z := 0; i := 4; REPEAT i := i-1; REPEAT UNTIL SYSTEM.BIT(rsCtrl, 0); <--- wait for RS232 byte SYSTEM.GET(rsData, y); <--- read RS232 byte z := ROR(z+y, 8) <--- rollup byte into 4-byte integer UNTIL i = 0; x := z END RecInt; PROCEDURE LoadFromLine; VAR len, adr, dat: INTEGER; BEGIN RecInt(len); WHILE len > 0 DO RecInt(adr); REPEAT RecInt(dat); SYSTEM.PUT(adr, dat); adr := adr + 4; len := len - 4 UNTIL len = 0; RecInt(len) END END LoadFromLine; So an example bootfile with three sections might be 04 00 00 00 size = 4 (first section) 00 00 00 00 address = 0 xx yy 00 E7 E700yyxx B start <--- need to calculate this displacement 08 00 00 00 size = 8 (second section) aa bb cc dd address = ddccbbaa 0C 00 00 4D 4D00000C MOV SB 0000000C uu vv 00 E7 E700vvuu B body <--- need to calculate this displacement pp qq 00 00 size = 0000qqpp pc * 4 (third section) ee ff gg hh address = hhggffee 00 00 00 40 40000000 MOV R0 0 <--- body (happens to be at beginning if no procedures) 08 00 D0 A0 A0D00008 STW R0 SB 8 ... rest of module code 00 00 00 00 size = 0 (fourth section, end of file marker)
In the OS[P].Mod there is a `dc := 0' what is the meaning; Code displacement???
Probably "declaration counter" or something. It tracks the displacement from SB of each declared variable. Interestingly this is finalised before code is output, because in Oberon, module variable declarations have to come before procedures and the body. But you shouldn't need to change this because you just need to load SB with a suitable value at startup. In the above I have suggested 12, because for free you will get the size of memory in the first declared (integer) variable, in case you are interested in it. HTH, Paul
Hi Tomas,
...You will need to follow this chain back while patching the instructions. OSG.fix() can be used to do this. You stop when the link is 0.
Actually you could patch these instructions to one which loads an absolute value to SB, then you really could get back to only one jump! Anyway, read my other email first. :)
On Thu, 14 May 2020 15:34:54 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
All this comes about because the Oberon-0 compiler generates normal module code which is intended to run inside the Oberon System, ie it is not "standalone" anymore.
Reading ... Just to be sure. I am toying with older version of Oberon-0, producing standalone MODULE* (no imports/exports, no sections, relative code), no asterisk needed. I know Oberon-0 now generates regular `Module.Load()' compatible code, it has changed. The version of Oberon-0 I work in this example, is the old if not 2013 original one. Just one block of code, that's it. -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
Just to be sure. I am toying with older version of Oberon-0, producing standalone MODULE* (no imports/exports, no sections, relative code), no asterisk needed.
OK thanks. Then ignore my second message and look mainly at the sample bootfile. You'll probably have to live with two jumps. :) Cheers, Paul
On Thu, 14 May 2020 15:57:41 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
OK thanks. Then ignore my second message and look mainly at the sample bootfile.
Will read as well, as SB linked list did not occur to me yet. But that plays its part in regular modular compiler, right? Standalone module has just one fixed SB, set early in the code, even if we had inside module several procedures? Multi section boot file is kind of cool, I currently have only one single small (or big section Oberon0.bin interpreter), that loads everything in one chunk. I use `ORC.Load Risc.bin', under Oberon@arm (RPI). Or right from RPI, it has hardcoded load address, and is also limited to one (size block 0000). #!/bin/sh # ORC.Load file=$1 # convert file size to little endian fs=$( stat -c%s $file ) fs=$( printf %08x $fs ) /bin/echo -ne \\x$( echo $fs | cut -b7-8 ) > /dev/ttyUSB1 /bin/echo -ne \\x$( echo $fs | cut -b5-6 ) > /dev/ttyUSB1 /bin/echo -ne \\x$( echo $fs | cut -b3-4 ) > /dev/ttyUSB1 /bin/echo -ne \\x$( echo $fs | cut -b1-2 ) > /dev/ttyUSB1 # load address printf '\0\0\0\0' > /dev/ttyUSB1 cp $file /dev/ttyUSB1 # zero size terminates stream printf '\0\0\0\0' > /dev/ttyUSB1 -- Tomas Kral <thomas.kral@email.cz>
... SB linked list ...plays its part in regular modular compiler, right?
Not anymore - as has already been noted it was removed from the standard Oberon-07 RISC compiler.
Standalone module has just one fixed SB, set early in the code, even if we had inside module several procedures?
Yes. I looked at the old OSG code, not sure why it wasn't set in OSG.Header as I suggested just now.
... I currently have only one single small ... that loads everything in one chunk. ...printf '\0\0\0\0' > /dev/ttyUSB1
Wow. Ok. Just make sure what you are sending is exactly what is required, ie lengths and addresses correct, words in littleendian binary. The serial bootloader has no error checking, as you can see from BootLoad.Mod. It might still "kinda" work, but not work correctly, when bogus data is received. Cheers, Paul
On Thu, 14 May 2020 15:34:54 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
All this comes about because the Oberon-0 compiler generates normal module code which is intended to run inside the Oberon System, ie it is not "standalone" anymore.
Reading ... Just to be sure. I am toying with older version of Oberon-0, producing standalone MODULE* (no imports/exports, no sections, relative code), no asterisk needed. I know Oberon-0 now generates regular `Module.Load()' compatible code, it has changed. The version of Oberon-0 I work in this example, is the old if not 2013 original one. Just one block of code, that's it. EDIT My only intention is booting over serial line with BRAM BootLoad, and do some experiments. -- Tomas Kral <thomas.kral@email.cz>
participants (4)
-
Andreas Pirklbauer -
JR -
Paul Reed -
Tomas Kral