Standalone BootLoader format
Small clarification: The command which *literally* extracts the code section of M.rsc AND outputs it in PROM format to a file prom.mem is actually: ORX.WriteFile M.rsc prom.mem ~ Where prom.mem looks something like this: E7000151 ; BR 7, i.e. jumps to the MOV instruction below 00000000 00000000 00000000 00000000 00000000 00000000 00000000 5E00FFC0 ; MOV SP R0 -64 ... i.e. “just” the code section in PROM format. And THIS is what gets transferred to the starting address of the standalone program when you load it to that address. Nothing more! See also: http://github.com/andreaspirklbauer/Oberon-building-tools/blob/master/Source...
Hi Andreas, Still not any wiser. Just updating comments. (* Standalone module booted over serial, with BRAM loader *) MODULE* Counter; VAR x, y, z: INTEGER; BEGIN LED(1); 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 Counter. (* B, Branch to (PC+offset+1) *) 0 E7000007 B 7, VAR y (branch overwritten by code) 1 00000000 VAR x 2 00000000 VAR z 3 00000000 4 00000000 5 00000000 6 00000000 7 00000000 (* Static base SB points to addr 0 *) 8 4D000000 MOV SB R0 0 9 5E00FFC0 MOV SP R0 -64 (* LED(1), mem[-60] := 1*) 10 40000001 MOV R0 R0 1 11 5100FFC4 MOV R1 R0 -60 12 A0100000 STR R0 R1 0 (* z := 0, mem[SB+8] := R0 *) 13 40000000 MOV R0 R0 0 14 A0D00008 STR R0 SB 8 ... (* y := 1000, mem[SB+0] := R0 *) 18 400003E8 MOV R0 R0 1000 19 A0D00000 STR R0 SB 0 (* x := 1000, mem[SB+4] := R0 *) 20 400003E8 MOV R0 R0 1000 21 A0D00004 STR R0 SB 4 ... Do these 7 words' gap map over these limits below, set by the BRAM loader? 0 A branch instruction to the initialising body of module Modules 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 Loader code as per `BootLoad.Mod' 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 U NTIL len = 0; RecInt(len) END END LoadFromLine; Where address adr is set to 0. Tomas -- Tomas Kral <thomas.kral@email.cz>
participants (2)
-
Andreas Pirklbauer -
Tomas Kral