Oberon on Ultibo!

The place to share and discuss your Ultibo projects.
captbill
Posts: 48
Joined: Tue Aug 16, 2016 5:47 am

Re: Oberon on Ultibo!

Postby captbill » Wed Aug 17, 2016 3:16 am

Hi Gavinmc42,

The most valuable resource is at http://ProjectOberon.com . This is the FPGA based implementation of Oberon. "Native Project Oberon" runs on an FPGA and is fully described in Verilog, a "hardware description language". The full RISC-V processor, "the chip", was written by Professor Wirth. So it's not "bare metal programming" but more like "carving the bare metal itself". It's all very well documented as well.

The Ultibo version created by Markus is a port of Peter DeWachter's emulator that is intended to parallel the native FPGA RISC processor.
https://github.com/pdewacht/oberon-risc-emu

All the code is right here on this page:
http://www.projectoberon.com/

Here is the Saanlima web site, where the custom FPGA dev boards are available to build Project Oberon in native form:
http://saanlima.com/store/index.php?route=common/home

Here is the Pepino board, which is much like what Ultibo is upon the Rpi. This is the native, non-emulated Project Oberon:
http://www.saanlima.com/pepino/index.php?title=Welcome_to_Pepino
Gavinmc42
Posts: 902
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Oberon on Ultibo!

Postby Gavinmc42 » Wed Aug 17, 2016 3:49 am

Just tried Markus's stuff
https://github.com/MGreim/ultiboberon
But did not hold my tongue the right way and it did not work:oops:
Don't have a Pi2 here which could be the problem?

I did stick a post here, waiting for moderator ;)
http://pascal.hansotten.com/2016/01/08/ ... -relevant/
Would it not be great to get the man himself interested?

Oberon is more than just a language, not sure I can get my head around it.
Is an emulator going to be good enough or is there a way to add the kernel/compiler/GUI parts on top of Ultibo.
Probably both could be done.

Garry has shown native pascal on Pi, next is native Oberon?
next?
Flashback
https://en.wikipedia.org/wiki/NeXT_Computer
Ron's done CP/M, what other old computer thing will pop up?
User avatar
Ultibo
Site Admin
Posts: 1386
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Oberon on Ultibo!

Postby Ultibo » Wed Aug 17, 2016 7:58 am

Gavinmc42 wrote:But did not hold my tongue the right way and it did not work:oops:

For anyone interested in trying this, please note that in addition to the Ultibo code from https://github.com/MGreim/ultiboberon you also need to download a disk image from Peter de Wachter's repository at https://github.com/pdewacht/oberon-risc ... /DiskImage , I tried it with the Oberon-2016-08-02.dsk image but both probably work.

The disk image file needs to be renamed to Oberon.dsk and copied to the root of your SD card so it can be loaded by the emulator on startup.

Gavinmc42 wrote:Don't have a Pi2 here which could be the problem?

I tested with a Pi3 and everything worked correctly as well.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 902
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Oberon on Ultibo!

Postby Gavinmc42 » Wed Aug 17, 2016 8:36 am

Yep got and renamed the disk file.
Will try tmr on a Pi3, only did it on an old B.
Could be the keyboard/mouse issue.
It was only a quick lunch time test.
The fact that at least two people have got it going is encouraging.
captbill
Posts: 48
Joined: Tue Aug 16, 2016 5:47 am

Re: Oberon on Ultibo!

Postby captbill » Wed Aug 17, 2016 7:49 pm

Oberon is more than just a language, not sure I can get my head around it.


It is quite hard to digest it all. Let me try to clarify some.

1) You have the RISC5 processor core written in Verilog. Think of this as an MCU "chip" being fully implemented upon an FPGA fabric...written by Professor Wirth himself. These are the .v files.
2) You have the Project Oberon "OS", which is written in Oberon the language.
3) You have the Oberon "language" which are the ORS.Mod, ORB.Mod, ORG.Mod, ORP.Mod, and ORTool.Mod which are user space "applications".

So all together we have the RISC5 processor running the Project Oberon "OS" preloaded with the "Oberon IDE" ready to roll.

Is an emulator going to be good enough or is there a way to add the kernel/compiler/GUI parts on top of Ultibo.


A development system doesn't need any real-time capability so for a development box no worries. In fact, the RISC5 on the FPGA is only running at 25mhz...and it is still what I would describe as blazing fast. Boots in <2 seconds. You can compile the WHOLE SYSTEM, everything including example files in 10 seconds!! Yes, ten seconds. Crazy! I'm would imagine the emulator running on a quad core with 1ghz will only improve performance, even emulated. Do understand though that the RISC5 core is designed as a "hard real-time, single threaded" processor. Preserving the real-time qualities may require the actual hardware.

What Ultibo does is allow us to use a generic board like the Rpi's and have access to the GPIO's. So now we have an "emulated Pepino" that anyone with an Rpi can get started with the full Project Oberon, except you can only use the emulator. To do any Verilog programming to the RISC5 you will need the FPGA board.

http://www.saanlima.com/pepino/index.php?title=Welcome_to_Pepino

Image
Gavinmc42
Posts: 902
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Oberon on Ultibo!

Postby Gavinmc42 » Wed Aug 17, 2016 11:34 pm

Emulating a RISC micro/Oberon?
It is easy because two people have made it easy, Peter and Markus.

Would it not be better to find a source for the Oberon compiler in Pascal and compile that for Ultibo.
Then compile the Oberon Kernel/OS.

I have seen source in Modula2, still looking for a Pascal version.
If the Oberon compiler becomes a unit in Ultibo then it can be embedded in apps.
Having a fast compiler is just as good or better than having say a Pascalscript interpreter.
However I'm not sure about how Ultibo could run an external file?

We can emulate the Oberon look now, there is a ConsoleWindowCreateEx version that allows for variable window sizes.
So we are not stuck with top left, top right, bottom left, bottom right etc.

For me, Oberon solves the slight lack of GUI and editor etc, Ultibo handles the lower level stuff just fine.
Oberon turns Ultibo into a full blown OS, and if the Oberon compiler is native then with a very fast compiler.
User avatar
Ultibo
Site Admin
Posts: 1386
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Oberon on Utibo!

Postby Ultibo » Fri Aug 19, 2016 1:09 am

Hi Markus,

mgreim wrote:Another thing would be an elegant mechanism to write Procedures in Pascal and publish it for Oberon and maybe vice versa.

Some work has been happening on getting libraries (both static and dynamic) to work in Ultibo and that work might help with making a solution to publish procedures between Pascal and Oberon. Keep an eye out for those changes as they start to appear over coming weeks.

mgreim wrote:By the way Is there any faster or more sophisticated way way to redraw a rectangle part of the screen compared to GrapcsWindowDrawImage?

I had a look at the code in update_texture() and it seems your use of GraphicsWindowDrawImage() is pretty efficient with only one call per screen update, the actual call to GraphicsWindowDrawImage() should perform quite well and ultimately it will result in a call to FramebufferDevicePutRect() which will use DMA to transfer the block to the screen.

I'm not 100% sure about the way you are determining dirty regions, it seems like the code checks each pixel against a cache to determine if it has changed. Perhaps this could be more efficient but I don't fully understand the code yet either so I might be wrong. Dirty region redraw could be implemented with multi-threaded mechanisms but that seems to go against the elegance of the single task model in Oberon and would need all sorts of locks and synchronization etc added.

Ultimately you might be better to use the framebuffer interface itself (FramebufferDevicePutRect etc) which was added as a place to attach other graphics libraries like fpGUI and Asphyre/PXL. The trade off is that the lower down you move in the layers the more things you are responsible for handling yourself.
Ultibo.org | Make something amazing
https://ultibo.org
captbill
Posts: 48
Joined: Tue Aug 16, 2016 5:47 am

Re: Oberon on Ultibo!

Postby captbill » Fri Aug 19, 2016 4:39 am

Ok. Wow. You have FpGUI working with Ultibo? All the pieces look to be falling into place for some really amazing possibilities now.

Have a look at one of the bitfiles that is available for the Pipistrello and the Pepino FPGA boards from Saanlima. (Pepino pictured above). Magnus has ported the OpenBench Logic Sniffer logic analyzer to the FPGA boards. This is not just another logic analyzer either. This bad boy is a serious piece of equipment, not your typical "USB logic analyzer" in the hardware department. Now with Ultibo+FpGUI+ the OLS bitfile all is in place for the ultimate logic analyzer! This could be the foundation for an truly outstanding debugging facility.

http://pipistrello.saanlima.com/index.php?title=Pipistrello_as_Logic_Analyzer
http://saanlima.com/forum/viewtopic.php?f=9&t=8

The SUMP protocol, which the logic analyzer is based on, is quite simple and I have a good start on a Pascal implementation. Very simple, actually.
http://www.sump.org/projects/analyzer/protocol/

Code: Select all

unit SUMP;

{$mode objfpc}{$H+}
{$packset 1}
{$packenum 1}

interface

{Set Trigger Mask (C0h, C4h, C8h, CCh)

Defines which trigger values must match. In parallel mode
each bit represents one channel, in serial mode each bit
represents one of the last 32 samples of the selected channel.
The opcodes refer to stage 0-3 in the order given above.
(Protocol version 0 only supports stage 0.)

Long Commands

Are five bytes long. The first byte contains the opcode.
The bytes are displayed in the order in which they are sent
to the serial port starting left. The bits within one byte are
displayed most significant first.
}

uses
  Classes, SysUtils ;

const

  BUF_SIZE = 512; // Buffer size for reading the output in chunks

  Reset = $0000; Run = $0001; Id = $0002; Xon = $0011; Xoff = $0013; SetFlags = $0082;
  OpMask1 = $00c0; OpMask2 = $00c4; OpMask3 = $00c8; OpMask4 = $00cc;
  OPVals1 = $00c1; OPVals2 = $00c5; OPVals3 = $00c9; OPVals4 = $00cd;
  OpConf1 = $00c2; OpConf2 = $00c6; OpConf3 = $00ca; OpConf4 = $00ce;

Type

  TByteBits = set of (Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7);
  TFlagBits = set of (inverted, extern, grp1, grp2, grp3, grp4, filter, demux);

  TConfBits = set of (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15,
        ch0, ch1, ch2, ch3, unused1, unused2, level1, level2,
        unused3, unused4, unused5, unused6, start, serial, unused7,
        ch4);
var

  OutputStream : TStream;
  BytesRead    : longint;
  Buffer       : array[1..BUF_SIZE] of word;

  Ch1_TMask : TByteBits; Ch2_TMask : TByteBits; Ch3_TMask : TByteBits; Ch4_TMask : TByteBits;

  Flags     : TFlagBits; SetConf   : TConfBits;

implementation
var
  incl : boolean;
begin
  Ch1_TMask := [bit4, bit5, bit6]+[bit2, bit0];

  Flags :=  [inverted, extern, grp1, grp2, grp3, grp4, filter, demux];
  Exclude (Flags, demux);
  Include (Flags, demux);

  SetConf   := [p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
        p13, p14, p15, ch0, ch1, ch2, ch3, level1, level2,
        start, serial, ch4];


end.



Something else that is easy to overlook with all of this is the fact that Ultibo can be touted as a "unique cross platform" development environment, in the same sense that GRBL, the CNC controller is. You have a UART/serial based interface that you drive exclusively over serial. Any "platform" that can talk to a serial port is automatically "compatible". GRBL is the perfect example of this. Fully autonomous "hardware components"?!?

Cheers
Gavinmc42
Posts: 902
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Oberon on Ultibo!

Postby Gavinmc42 » Fri Aug 19, 2016 6:32 am

Use a Zero as a Logic analyser on a PC USB port?
How fast can the GPIO suck data in?
Probably will need DMA.

Multi purpose because you can use any old HDMI TV/monitor as the display too.
Can you get enough power from a TV USB port to power the Zero, to then feed the HDMI back to the TV.
Can HDMI provide power? Chromecast stuff needs external power.

Just went looking to see if there was any web browser plugins that could be used as a GUI
http://lazplanet.blogspot.com.au/2013/1 ... o-pt1.html
Probably a big ask to turn Ultibo into a Web kiosk.

Has anyone done a web browser in the Oberon language?
Chrome OS replacement?
User avatar
Ultibo
Site Admin
Posts: 1386
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Oberon on Ultibo!

Postby Ultibo » Fri Aug 19, 2016 8:29 am

captbill wrote:You have FpGUI working with Ultibo?

Not quite yet but work is progressing nicely. There are a couple of photos in this thread (viewtopic.php?f=10&t=38&hilit=ugfx#p121) of some early work showing many of graphics primitives working and we've actually published the initial porting already on GitHub.

What we are working on is fitting all of the elements together to support fpGUI and other graphics libraries properly, things like mouse and keyboard support which have progressed a lot lately, a framebuffer API that suits what graphics libraries do and support for things like true type fonts.

Most of these are either done or making real progress, one major item remaining is to create a simplified window manager for fpGUI to allow tracking window position, size and order plus handling region redraw when things change etc. This won't be a full on desktop window manager just yet but it will allow familiar windowed user interfaces that support mouse and keyboard input and feature common elements like buttons, labels, text and check boxes as well as images etc.

So it isn't working yet but it certainly will be with a bit more work.
Ultibo.org | Make something amazing
https://ultibo.org

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest