<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> On </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Fri Oct 13 16:09:17 CEST 2017 Tomas Kral wrote:</span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">><br class=""></span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> I have coded simplified `ORX.WriteFile’ in</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> shell for the host computer. It does not do</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> all it should, </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">but I hope carries the idea?</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">>
> #!/bin/sh
> # ORX.WriteFile
>
> i=0; echo -n > prom.mem
> while read hex; do
> echo $hex >> prom.mem
> i=$((i+1))
> done < prom0.mem</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> j=$i; while [ $j -lt 512 ]; do
> echo 00000000 >> prom.mem
> j=$((j+1))
> done
</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">I added a command Builder.WriteFile to the</span></font><span style="white-space: pre-wrap; font-family: monospace;" class=""> building tools:</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> <a href="http://www.github.com/andreaspirklbauer/Oberon-building-tools" class="">www.github.com/andreaspirklbauer/Oberon-building-tools</a></span></font></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">It *should* do what the above script does. H</span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">owever I </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">have</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">no way of testing as I don’t have an FPGA board </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">with me.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">I wrote it “blind” so to speak..</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> </span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Could you please check (and adjust the code if needed)? Any</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">changes needed in order to comply with the </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">Xilinx file format</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">requirements for the PROM file should be rather easy to make.</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">-AP</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Comments:</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">~~~~~~~~~</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">1. </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">The command Builder.WriteFile can be invoked as follows</span></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> ORP.Compile BootLoad.Mod ~</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> Builder.WriteFile BootLoad.rsc 512 prom.mem ~</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">2. The command Builder.WriteFile extracts the code block</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">from the specified object file (BootLoad.rsc) and</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> transfers </span><span style="white-space: pre-wrap; font-family: monospace;" class="">it into a text file (prom.mem), where for</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> each </span><span style="white-space: pre-wrap; font-family: monospace;" class="">4-byte opcode encountered in the code block,</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> an </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">8-digit hex </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">code is written to the output file,</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> with one per line, with a CR + LF added </span><span style="font-family: monospace; white-space: pre-wrap;" class="">at the end</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> of each </span><span style="white-space: pre-wrap; font-family: monospace;" class="">line, and zero-filled to the specified size:</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> E7000151 (line 0)
00000000
...</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> 4EE90014
AFE00000
40000004
...
00000000
00000000 (line 511)</span></font></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">3. Currently ONLY the *code* section (mod.code) is</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> extracted from </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">the object </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">file (BootLoad.rsc) and</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> written </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">out as a sequence of 8-digit hex codes to</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> to the output file.</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> This means that if the source code is compiled </span><span style="font-family: monospace; white-space: pre-wrap;" class="">with</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> the RISC0 </span><span style="font-family: monospace; white-space: pre-wrap;" class="">option (i.e. with an asterisk immediately</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> after the key word </span><span style="font-family: monospace; white-space: pre-wrap;" class="">MODULE), </span><span style="font-family: monospace; white-space: pre-wrap;" class="">the very first </span><span style="font-family: monospace; white-space: pre-wrap;" class="">opcode</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> in the generated PROM file </span><span style="font-family: monospace; white-space: pre-wrap;" class="">is the</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> branch instruction</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> to </span><span style="font-family: monospace; white-space: pre-wrap;" class="">the module initialization sequence generated</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> with the compiler is invoked with the RISC0 option.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">4. The *data* section (mod.data) containing the space</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> for </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">holding the type </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">descriptors, </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">variables and</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""> strings (see </span><span style="white-space: pre-wrap; font-family: monospace;" class="">ch. 6.2 on p.80ff </span><span style="font-family: monospace; white-space: pre-wrap;" class="">of the book Project</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> Oberon 2013) is </span><span style="font-family: monospace; white-space: pre-wrap;" class="">currently NOT written as hex codes</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> to the PROM file. This is in order </span><span style="font-family: monospace; white-space: pre-wrap;" class="">to keep the</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> branch instruction (see 4.) at the beginning of the</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> generated PROM file.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> But it </span><span style="font-family: monospace; white-space: pre-wrap;" class="">also means that type descriptors for</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> declared</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> named record types (one type </span><span style="font-family: monospace; white-space: pre-wrap;" class="">descriptor per record</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> type is generated by </span><span style="font-family: monospace; white-space: pre-wrap;" class="">the </span><span style="font-family: monospace; white-space: pre-wrap;" class="">compiler) are </span><span style="font-family: monospace; white-space: pre-wrap;" class="">not available,</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> so for example type tests cannot be performed)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> It also means</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> that there should be enough space</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> in memory </span><span style="font-family: monospace; white-space: pre-wrap;" class="">right before the location where the PROM</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> file is loaded by fpgaprog.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> Note: If one wanted to make the *data* section part</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> of the PROM file, this COULD of course be done. One</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> would only </span><span style="font-family: monospace; white-space: pre-wrap;" class="">need to prefix it with the same branch</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> instruction </span><span style="font-family: monospace; white-space: pre-wrap;" class="">as the one at the beginning of the</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> code section. But is it needed?</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">5. The *meta* data section (mod.imp, mod.cmd, mod.ent,</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> mod.ptr) </span><span style="font-family: monospace; white-space: pre-wrap;" class="">are currently also NOT written to the PROM</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> file, as these </span><span style="font-family: monospace; white-space: pre-wrap;" class="">are not needed </span><span style="font-family: monospace; white-space: pre-wrap;" class="">(standalone procedures</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> cannot import modules, </span><span style="font-family: monospace; white-space: pre-wrap;" class="">and there is </span><span style="font-family: monospace; white-space: pre-wrap;" class="">also no module</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> loader and no command interpreter </span><span style="font-family: monospace; white-space: pre-wrap;" class="">present when </span><span style="font-family: monospace; white-space: pre-wrap;" class="">a</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> program runs </span><span style="font-family: monospace; white-space: pre-wrap;" class="">on the bare metal)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">6. The module descriptor (mod) itself containing</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> pointers to the </span><span style="font-family: monospace; white-space: pre-wrap;" class="">various sections in the module</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> block is also not transferred </span><span style="font-family: monospace; white-space: pre-wrap;" class="">to the PROM file.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div></div></body></html>