<div dir="ltr"><div>Hi Chris,</div><div>Great to hear from you.</div><div><br></div><div>&gt;I used BlackBox Component Pascal v1.6 on Windows 7 as much of the Project Oberon source code (Files.mod and FileDir.mod) can be used with minimal changes, SYSTEM.VAL is compatible with Project Oberon and BlackBox has access to the relevent WinApi system calls:</div><div><br></div><div>What about an Astrobe based solution? How about the MMC.Mod to handle it? I have been wanting to use an LPC1768 in between the FPGA and the NRF24l01 and use the LPC1768 as a type of SPI switcher. I want to be able to toggle from the network card to whatever SPI module I may want to utilize using the (only) available SPI channel. Perhaps I should be considering adding the Oberon fs functionality as a utility function. Seems like a perfect place for these types of tasks. I am already looking at doing a &#39;flash utility&#39; just like this.</div><div><br></div><div>I am wondering if this would be an easier approach for me vs. using BlackBox? I have installed BlackBox but have little experience with it. I like the &#39;hardware/peripheral&#39; approach of using Astrobe and interfacing over serial if possible.</div><div><br></div><div>I am still trying to consider the details. Astrobe will need to be able to speak to the Oberon SDcard directly (ideal) or simply use two SDcards, one on the FPGA and another on the MC.</div><div><br></div><div>Any thoughts or concerns with this approach?</div><div><br></div><div>Best Regards,</div><div>Bill</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 10, 2015 at 6:00 AM,  <span dir="ltr">&lt;<a href="mailto:oberon-request@lists.inf.ethz.ch" target="_blank">oberon-request@lists.inf.ethz.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Oberon mailing list submissions to<br>
        <a href="mailto:oberon@lists.inf.ethz.ch">oberon@lists.inf.ethz.ch</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:oberon-request@lists.inf.ethz.ch">oberon-request@lists.inf.ethz.ch</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:oberon-owner@lists.inf.ethz.ch">oberon-owner@lists.inf.ethz.ch</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of Oberon digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Project Oberon - Copying files to the SD card (Chris Burrows)<br>
   2. Re: Project Oberon - Copying files to the SD card (J?rg Straube)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 10 Jan 2015 09:22:36 +1030<br>
From: &quot;Chris Burrows&quot; &lt;<a href="mailto:chris@cfbsoftware.com">chris@cfbsoftware.com</a>&gt;<br>
Subject: [Oberon] Project Oberon - Copying files to the SD card<br>
To: &quot;ETH Oberon and related systems&quot; &lt;<a href="mailto:oberon@lists.inf.ethz.ch">oberon@lists.inf.ethz.ch</a>&gt;<br>
Message-ID: &lt;000f01d02c5e$f733cee0$e59b6ca0$@<a href="http://cfbsoftware.com" target="_blank">cfbsoftware.com</a>&gt;<br>
Content-Type: text/plain;       charset=&quot;utf-8&quot;<br>
<br>
&gt;<br>
&gt; From: Bill Buzzell [mailto:<a href="mailto:captbill279@gmail.com">captbill279@gmail.com</a>]<br>
&gt; Sent: Thursday, 8 January 2015 4:51 AM<br>
&gt; To: <a href="mailto:oberon@lists.inf.ethz.ch">oberon@lists.inf.ethz.ch</a><br>
&gt; Subject: Re: [Oberon] Oberon Digest, Vol 128, Issue 6<br>
&gt;<br>
&gt; How do you move files onto the SD card? Anyone know? I tried<br>
&gt; extracting the ISO and adding files and un-extracting it again. None<br>
&gt; of the files appear visible to Oberon though. Am I using the wrong<br>
&gt; encoding somehow?<br>
&gt;<br>
<br>
If you want files on the SD card to be visible from Project Oberon then you need to create them with the appropriate file headers and directory entries as explained in great detail in Chapter 7 The File System of the Project Oberon documentation.<br>
<br>
You should write a program to do this on the system you want to transfer files from. As the Project Oberon source code is provided most of the hard work is already done for you. However, before you do this you need to understand:<br>
<br>
a) how to access the SD Card on your system<br>
b) how to perform low-level block IO to / from a storage device on your system<br>
c) the Project Oberon modules Files, FileDir and the disk IO procedures from Kernel.<br>
<br>
I used BlackBox Component Pascal v1.6 on Windows 7 as much of the Project Oberon source code (Files.mod and FileDir.mod) can be used with minimal changes, SYSTEM.VAL is compatible with Project Oberon and BlackBox has access to the relevent WinApi system calls:<br>
<br>
  <a href="http://www.oberon.ch/blackbox.html" target="_blank">http://www.oberon.ch/blackbox.html</a><br>
<br>
If you plan to transfer files from a Windows 7 system to / from the SD Card the following should help get you started:<br>
<br>
<br>
a) how to access the SD Card on your system<br>
<br>
If you cannot access the SD card via SPI on your system you need to find out how to access it as a raw (i.e. not formatted) device. On Windows the device name convention is \\.\&lt;drivenumber&gt;. On my system the drivenumber is &quot;6&quot; because my SD card appears as Drive 6 in:<br>
<br>
  Admin Tools &gt; Computer Management &gt; Storage &gt; Disk Management<br>
<br>
The 8GB Project Oberon SDHC Card appears with a 255MB FAT partition, a 64 MB Primary partition and 7.09GB unallocated<br>
<br>
<br>
b) how to perform low-level block IO to / from a storage device on your system<br>
<br>
The corresponding BlackBox procedure to access this drive using WinApi.CreateFileW is:<br>
<br>
  PROCEDURE Open*(driveName: FullName);<br>
  VAR<br>
    physicalName: FullName;<br>
  BEGIN<br>
    physicalName := &quot;\\.\&quot; + driveName;<br>
    drive.handle :=<br>
      WinApi.CreateFileW(<br>
        physicalName,<br>
        WinApi.GENERIC_READ + WinApi.GENERIC_WRITE,<br>
        WinApi.FILE_SHARE_READ + WinApi.FILE_SHARE_WRITE,<br>
        NIL,<br>
        WinApi.OPEN_EXISTING,<br>
        {},<br>
        0)<br>
  END Open;<br>
<br>
You also need to implement the equivalent of the low-level sector read / write functions (i.e. Kernel.GetSector and Kernel.PutSector). On Windows the WinApi calls you can use to do this are<br>
<br>
  WinApi.SetFilePointer<br>
  WinApi.ReadFile<br>
  WinApi.WriteFile<br>
  WinApi.GetLastError<br>
  WinApi.CloseHandle<br>
<br>
e.g PutSector becomes:<br>
<br>
  PROCEDURE PutSector*(sectorNo: INTEGER; sector: ARRAY OF BYTE);<br>
  VAR<br>
    i, org, count, bytesWritten, res: INTEGER;<br>
  BEGIN<br>
    ASSERT(sectorNo MOD 29 = 0);<br>
    sectorNo := sectorNo DIV 29;<br>
    sectorNo := sectorNo * 2 + FSoffset;<br>
    org := sectorNo * (SectorSize DIV 2);<br>
    i := 0;<br>
    i := WinApi.SetFilePointer(drive.handle, org, i, WinApi.FILE_BEGIN);<br>
    count := SectorSize;<br>
    IF (WinApi.WriteFile(drive.handle, SYSTEM.ADR(sector), count, bytesWritten, NIL) = 0)<br>
      OR (bytesWritten &lt; SectorSize) THEN<br>
        res := WinApi.GetLastError();<br>
        HALT(102)<br>
    END;<br>
  END PutSector;<br>
<br>
NOTE: Windows requires you to run programs that access raw storage devices in &#39;Administrator Mode&#39;.<br>
<br>
Regards,<br>
<br>
Chris Burrows<br>
CFB Software<br>
Astrobe: Oberon for ARM Microcontrollers<br>
<a href="http://www.astrobe.com" target="_blank">http://www.astrobe.com</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sat, 10 Jan 2015 00:29:11 +0100<br>
From: J?rg Straube &lt;<a href="mailto:joerg.straube@iaeth.ch">joerg.straube@iaeth.ch</a>&gt;<br>
Subject: Re: [Oberon] Project Oberon - Copying files to the SD card<br>
To: &quot;&lt;<a href="mailto:chris@cfbsoftware.com">chris@cfbsoftware.com</a>&gt;&quot; &lt;<a href="mailto:chris@cfbsoftware.com">chris@cfbsoftware.com</a>&gt;,  ETH Oberon and<br>
        related systems &lt;<a href="mailto:oberon@lists.inf.ethz.ch">oberon@lists.inf.ethz.ch</a>&gt;<br>
Message-ID: &lt;<a href="mailto:D56A1095-A20A-465E-A973-011166A8D69C@iaeth.ch">D56A1095-A20A-465E-A973-011166A8D69C@iaeth.ch</a>&gt;<br>
Content-Type: text/plain;       charset=utf-8<br>
<br>
I have a prototype of this running under ETHOberon on Windows.<br>
Some hints:<br>
- My Oberon code finds the physical drive nbr itself by enumerating all drives and checking capabilities.<br>
- Being able to have lowlevel access to the SD card, I had to prevent Windows to access the SD card by unmounting the drive first.<br>
- As Chris wrote ETHOberon must be &quot;run as admin&quot;.<br>
br, J?rg<br>
<br>
Am 09.01.2015 um 23:52 schrieb Chris Burrows &lt;<a href="mailto:chris@cfbsoftware.com">chris@cfbsoftware.com</a>&gt;:<br>
<br>
&gt;&gt;<br>
&gt;&gt; From: Bill Buzzell [mailto:<a href="mailto:captbill279@gmail.com">captbill279@gmail.com</a>]<br>
&gt;&gt; Sent: Thursday, 8 January 2015 4:51 AM<br>
&gt;&gt; To: <a href="mailto:oberon@lists.inf.ethz.ch">oberon@lists.inf.ethz.ch</a><br>
&gt;&gt; Subject: Re: [Oberon] Oberon Digest, Vol 128, Issue 6<br>
&gt;&gt;<br>
&gt;&gt; How do you move files onto the SD card? Anyone know? I tried<br>
&gt;&gt; extracting the ISO and adding files and un-extracting it again. None<br>
&gt;&gt; of the files appear visible to Oberon though. Am I using the wrong<br>
&gt;&gt; encoding somehow?<br>
&gt;<br>
&gt; If you want files on the SD card to be visible from Project Oberon then you need to create them with the appropriate file headers and directory entries as explained in great detail in Chapter 7 The File System of the Project Oberon documentation.<br>
&gt;<br>
&gt; You should write a program to do this on the system you want to transfer files from. As the Project Oberon source code is provided most of the hard work is already done for you. However, before you do this you need to understand:<br>
&gt;<br>
&gt; a) how to access the SD Card on your system<br>
&gt; b) how to perform low-level block IO to / from a storage device on your system<br>
&gt; c) the Project Oberon modules Files, FileDir and the disk IO procedures from Kernel.<br>
&gt;<br>
&gt; I used BlackBox Component Pascal v1.6 on Windows 7 as much of the Project Oberon source code (Files.mod and FileDir.mod) can be used with minimal changes, SYSTEM.VAL is compatible with Project Oberon and BlackBox has access to the relevent WinApi system calls:<br>
&gt;<br>
&gt;  <a href="http://www.oberon.ch/blackbox.html" target="_blank">http://www.oberon.ch/blackbox.html</a><br>
&gt;<br>
&gt; If you plan to transfer files from a Windows 7 system to / from the SD Card the following should help get you started:<br>
&gt;<br>
&gt;<br>
&gt; a) how to access the SD Card on your system<br>
&gt;<br>
&gt; If you cannot access the SD card via SPI on your system you need to find out how to access it as a raw (i.e. not formatted) device. On Windows the device name convention is \\.\&lt;drivenumber&gt;. On my system the drivenumber is &quot;6&quot; because my SD card appears as Drive 6 in:<br>
&gt;<br>
&gt;  Admin Tools &gt; Computer Management &gt; Storage &gt; Disk Management<br>
&gt;<br>
&gt; The 8GB Project Oberon SDHC Card appears with a 255MB FAT partition, a 64 MB Primary partition and 7.09GB unallocated<br>
&gt;<br>
&gt;<br>
&gt; b) how to perform low-level block IO to / from a storage device on your system<br>
&gt;<br>
&gt; The corresponding BlackBox procedure to access this drive using WinApi.CreateFileW is:<br>
&gt;<br>
&gt;  PROCEDURE Open*(driveName: FullName);<br>
&gt;  VAR<br>
&gt;    physicalName: FullName;<br>
&gt;  BEGIN<br>
&gt;    physicalName := &quot;\\.\&quot; + driveName;<br>
&gt;    drive.handle :=<br>
&gt;      WinApi.CreateFileW(<br>
&gt;        physicalName,<br>
&gt;        WinApi.GENERIC_READ + WinApi.GENERIC_WRITE,<br>
&gt;        WinApi.FILE_SHARE_READ + WinApi.FILE_SHARE_WRITE,<br>
&gt;        NIL,<br>
&gt;        WinApi.OPEN_EXISTING,<br>
&gt;        {},<br>
&gt;        0)<br>
&gt;  END Open;<br>
&gt;<br>
&gt; You also need to implement the equivalent of the low-level sector read / write functions (i.e. Kernel.GetSector and Kernel.PutSector). On Windows the WinApi calls you can use to do this are<br>
&gt;<br>
&gt;  WinApi.SetFilePointer<br>
&gt;  WinApi.ReadFile<br>
&gt;  WinApi.WriteFile<br>
&gt;  WinApi.GetLastError<br>
&gt;  WinApi.CloseHandle<br>
&gt;<br>
&gt; e.g PutSector becomes:<br>
&gt;<br>
&gt;  PROCEDURE PutSector*(sectorNo: INTEGER; sector: ARRAY OF BYTE);<br>
&gt;  VAR<br>
&gt;    i, org, count, bytesWritten, res: INTEGER;<br>
&gt;  BEGIN<br>
&gt;    ASSERT(sectorNo MOD 29 = 0);<br>
&gt;    sectorNo := sectorNo DIV 29;<br>
&gt;    sectorNo := sectorNo * 2 + FSoffset;<br>
&gt;    org := sectorNo * (SectorSize DIV 2);<br>
&gt;    i := 0;<br>
&gt;    i := WinApi.SetFilePointer(drive.handle, org, i, WinApi.FILE_BEGIN);<br>
&gt;    count := SectorSize;<br>
&gt;    IF (WinApi.WriteFile(drive.handle, SYSTEM.ADR(sector), count, bytesWritten, NIL) = 0)<br>
&gt;      OR (bytesWritten &lt; SectorSize) THEN<br>
&gt;        res := WinApi.GetLastError();<br>
&gt;        HALT(102)<br>
&gt;    END;<br>
&gt;  END PutSector;<br>
&gt;<br>
&gt; NOTE: Windows requires you to run programs that access raw storage devices in &#39;Administrator Mode&#39;.<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; Chris Burrows<br>
&gt; CFB Software<br>
&gt; Astrobe: Oberon for ARM Microcontrollers<br>
&gt; <a href="http://www.astrobe.com" target="_blank">http://www.astrobe.com</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; <a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
&gt; <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
<br>
<br>
<br>
------------------------------<br>
<br>
--<br>
<a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
<br>
<br>
End of Oberon Digest, Vol 128, Issue 8<br>
**************************************<br>
</blockquote></div><br></div>