User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Jun 09, 2016 5:46 am

Ultibo has just become my favorite Pi IoT tool set.

I made a webserver that served kernel.img files, actually I just complied the example code ;)
Another Pi updated it's kernel.img from this server.
Networked IoT devices just became real simple for me.
Still a work in progress but usable right now.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Jun 30, 2016 10:58 am

Hi everyone,

Just a quick update on the Ultibo core project for those who are following or eagerly awaiting new features.

Since the original release a lot has been happening, here's a quick list of some of the new additions.

New drivers added for:
  • DMA
  • GPIO
  • UART and Serial
  • I2C
  • SPI
  • PL2303 USB to Serial devices
New and enhanced features:
  • Raspberry Pi 3 support (32 bit only)
  • Additional code page support
  • Common cipher and hash algorithms for the beginning of crypto support
  • Real time clock (RTC) support (with driver for DS1307 and similar chips)
  • Static IP support with command line configuration
  • Updated Lazarus IDE with modern docked layout
  • Extra fonts plus new font creation tools
  • Support for common LCD displays like the Adafruit 16x2
Plus lots of fixes and minor improvements, we've also added some new examples like GPIO, Serial, Mouse and RAM Disk. The website includes a new Made with Ultibo section to showcase some of the amazing things Ultibo members are doing already.

To help everyone get started, we've created a new video series called Discovering Ultibo which is available on our YouTube channel.

Ultibo core is 100% open source and written 100% in Free Pascal.

There's a lot more on the way so we'll keep you updated on the progress.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 2:11 am

This is very nice. But darn it - I havent touched Pascal in 25 years.

My choice here is to either brush up on it, or beg you to provide a C compiler in addition. Would it be possible?

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 2:21 am

Brush up ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 3:04 am

xlar54 wrote:My choice here is to either brush up on it, or beg you to provide a C compiler in addition. Would it be possible?
I'd suggest both could work, while we won't be looking to convert the entire project to C anytime soon we also know that getting access to the vast amount of code written in C (and other languages) would be very nice.

Free Pascal allows linking C code into a project and there is work going on to get a version of newlib (portable C library) working on Ultibo, there is a proof of concept already that shows it will work and just needs more work to complete the outstanding items.

Once that option is available then you could have the best of both worlds, use the features from Ultibo but still write some or all of your code in C if you prefer.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 4:32 am

As it sais to nativily support FreePASCAL, you have me curious.

Could you provide an example sesion? That is boot into Ultibo, open a text editor in Ultibo, write a pascal source file, save the source, invoke fpc to compile the source into a Ultibo executable?

I would like more info. It sounds like a complete OS in its own rite, not just something to build on, especialy as it has enough implemented to run the FreePascal compiler.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 6:38 am

Check out the videos
https://ultibo.org/make/

also links to the example and demo code
https://ultibo.org/download/
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 7:13 am

DavidS wrote:I would like more info. It sounds like a complete OS in its own rite, not just something to build on, especialy as it has enough implemented to run the FreePascal compiler.
Different to an OS, more like a set of libraries that do things you might prefer not to have to write yourself.

Ultibo comes with a customised compiler and IDE (Free Pascal and Lazarus) for Windows (they also work fine under WINE) and a set of libraries with source for all of the Ultibo components like threading, memory management, USB, file system, network etc.

You write your application in the IDE and include the components (features) that you want to use, then you compile your application and a kernel.img (or kernel7.img) file is produced which you can copy to an SD card and use to boot the Pi. Free Pascal doesn't run on Ultibo (although since it is written in pascal itself it probably almost could), you use it to compile your Ultibo application which then runs without needing an OS.

Whereas an OS can run multiple applications, Ultibo is always only one application (yours) but that application can be multi-threaded and multi-tasking.

Hope this makes sense, the Getting Started video on YouTube shows the process quite well.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 7:24 am

If you have microcontroller or Arduino experience it makes more sense to think of Ultibo as just another IDE for Arm based PCBs that just happen to be called Pi's ;)
Micros that just happen to do USB, HDMI and network stuff and have lots of memory and run at 1GHz :P

Pascal is not that hard to learn for simple stuff, already some useful examples.
I would say it is easier to learn than C++ and a high level than C or Python.

All the hard stuff is done in the Units(libraries), you just make the application without worrying to much about what happens underneath, very similar to Arduino.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 6:11 pm

My comment of course was in jest - I think this is a wonderful project, and I will definitely be brushing up :). But i am curious as to why the authors decided to go with Pascal. Was it the educational aspect of that language?

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Thu Aug 25, 2016 10:20 pm

Ultibo wrote:
DavidS wrote:I would like more info. It sounds like a complete OS in its own rite, not just something to build on, especialy as it has enough implemented to run the FreePascal compiler.
Different to an OS, more like a set of libraries that do things you might prefer not to have to write yourself.

Ultibo comes with a customised compiler and IDE (Free Pascal and Lazarus) for Windows (they also work fine under WINE) and a set of libraries with source for all of the Ultibo components like threading, memory management, USB, file system, network etc.

You write your application in the IDE and include the components (features) that you want to use, then you compile your application and a kernel.img (or kernel7.img) file is produced which you can copy to an SD card and use to boot the Pi. Free Pascal doesn't run on Ultibo (although since it is written in pascal itself it probably almost could), you use it to compile your Ultibo application which then runs without needing an OS.

Whereas an OS can run multiple applications, Ultibo is always only one application (yours) but that application can be multi-threaded and multi-tasking.

Hope this makes sense, the Getting Started video on YouTube shows the process quite well.
:( .

So it is an OSDev toolkit, and uses a M$ Windows x86 host system, not an ARM based host for development, thus it requires a cross compile :( .

I was interested, though no longer.

I no longer even own an x86 crashdows capable PC.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Fri Aug 26, 2016 1:16 am

xlar54 wrote:But i am curious as to why the authors decided to go with Pascal. Was it the educational aspect of that language?
There are many reasons although none of them really stands out as number one. Part of the inspiration to start this project was seeing that many tutorials for learning to program on the Pi often spend more time describing how to configure Linux than how to write the code, choosing Pascal takes away the temptation to just make it Linux compatible (and include all of those existing libraries) and forces a rethink of everything from the ground up.

It also seemed to me that people using Pascal did not have a lot of options if they wanted to get involved in low level embedded development, lots of libraries and projects for C and assembler and even some for C++, yet there are a huge number of hobby (and even professional) developers out there who prefer to use Pascal but often have no option available.

In the end it isn't really about the language, we need more good programmers in the world and if someone learns from what we are doing then that is great.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Fri Aug 26, 2016 3:44 am

To David S,
So it is an OSDev toolkit, and uses a M$ Windows x86 host system, not an ARM based host for development, thus it requires a cross compile :( .

I was interested, though no longer.

I no longer even own an x86 crashdows capable PC.
Currently the IDE runs on Windows, but I use it on Wine at home on an old Celeron Linux Mint box.

Lazarus/FPC (Free Pascal Compiler) runs on Windows, Linux and even Pi's.
Ultibo is just a special version of Laz/FPC, so one day it will run on Pi's and native on Linux.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Fri Aug 26, 2016 5:11 am

Gavinmc42 wrote:To David S,
So it is an OSDev toolkit, and uses a M$ Windows x86 host system, not an ARM based host for development, thus it requires a cross compile :( .

I was interested, though no longer.

I no longer even own an x86 crashdows capable PC.
Currently the IDE runs on Windows, but I use it on Wine at home on an old Celeron Linux Mint box.

Lazarus/FPC (Free Pascal Compiler) runs on Windows, Linux and even Pi's.
Ultibo is just a special version of Laz/FPC, so one day it will run on Pi's and native on Linux.
I use FreePascal on my RPi when using Linux. I see no reason for a custom IDE, though that is just me (I do not even use Lazarus).

Would Ultibo be useful as just a set of sources and units? If so that may be a better method of distribution. Ultibo targets the ARM CPU and the Raspberry Pi specifically, thus the development enviroment should be completely hosted on one or more Raspberry Pi Operating System(s) (though I would guess likely just Linux will be used for a host [omiting BSD, RISC OS, Plan 9, Commodore Pi, etc]).

Cross Compiling is useful in two situations:
1: Your project will target multiple CPU's or Hardware Architectures and OSes.
2: The target HW does not have enough of an OS to support native compilation.

Though if the project targets only only a single Hardware Architecture and CPU that already has one or more OSes capable of supporting the development environment, the reasonable thing is to have the development environment hosted on the target hardware.

Though that is my view, others will likely see things differently.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Fri Aug 26, 2016 5:38 am

David S.

Apart from the docked IDE there does not seem much difference between Ultibo and Laz.

To update, you copy the core files into the Ultibo/Core/fpc/3.1.1/source/rtl/ folder
https://github.com/ultibohub/Core
Then run the rebuild RTL tool, one day probably automatic updates?

Tools are here
https://github.com/ultibohub?tab=repositories

I want to compile soon on a Pi3 for Zero's, A+, B+,2+,3+ etc

Garry still has a few little things to get going
https://ultibo.org/wiki/Current_Status
I imagine after that he will have some time to do a real port to Linux and Pi.
But if you want to stick your hand up and offer to help... ;)

As you already know the FPC cross compiler does other micros.
FPC Text mode IDE works too if you don't like GUI's.

Discussions about having a scripting language build in have taken place.
Pascalscript has been test compiled, other options are Lua and Oberon.....

Even other boards like the Allwinner Olimex's, Beaglebones, Odroid etc all possible.
Because it is based on FPC, if it works on FPC, chances are it can be got working with Ultibo.

Ultibo was only released in Feb.
One day it will work on every platform and cross compile to any platform, assuming Garry does not get acquired by MS :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 1:06 am

I am sticking my hand up now. I have been beating my head against a proverbial wall trying to get some things going on RISC OS, so I am very much interested in getting into Ultibo.

Though before I start I have a few questions, as the documentation on http://ulitbo.org is lacking, big time.
  • Is there a means of handling SWI's? If not would it be to much effort to implement.
  • Does Ulitbo run in ARM mode (not thumb i hope)?
  • Is there some documentation on the function of the units, and system anywhere, other than all the "To be documented" entries in the wiki?
  • Us there any possibility of implementing Ultibo as a single tasking environment?
It looks as if using Ultibo as a base is the best way forward. Just need a little information that does not seem to be available, without going through the entire source line by line. I would kind of like to know what I just volunteered to dive into.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 1:46 am

Hi,
DavidS wrote:Is there a means of handling SWI's? If not would it be to much effort to implement.
Yes, there is an SWI handler which has been fully tested, what is missing is a way to register and deregister your own SWIs but that is not difficult to complete.
DavidS wrote:Does Ulitbo run in ARM mode (not thumb i hope)?
Yes all of the code is compiled as ARM mode and all of the assembler (small amount) is done in ARM mode. The compiler and tool chain should work with Thumb but since there is plenty of RAM available then ARM is easier to follow.
DavidS wrote:Is there some documentation on the function of the units, and system anywhere, other than all the "To be documented" entries in the wiki?
Documentation is always an issue for open source projects, what is happening is an effort to add a description to the header of each function in every unit and this will become the basis for the wiki documentation as well. It will take some time to document everything but in general the organization of the units is fairly self explanatory.

All of the Free Pascal runtime and language functions work exactly as documented in the Free Pascal reference manual, as for the Ultibo specific units these can be separated into a couple of categories. The primary units are Platform and Threads and these contain much of the core of Ultibo itself but also have API functions for locks, threads and many other things.

The device units are named roughly after what they do, so to draw on the console you need the Console unit (or the GraphicsConsole unit), to use the serial port you need the Serial or UART unit etc. The Ultibo forum contains quite a few examples for specific uses and also answers a lot of 'which function do I use" questions, if something isn't clear then the quickest way is just to ask in the forum.
DavidS wrote:Us there any possibility of implementing Ultibo as a single tasking environment?
Do you mean to run as non pre-emptive or do you mean without threading at all?
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 1:59 am

Probably should ask any questions on the Ultibo forum.
I have always found Garry to be quick with answering any questions, even dumb ones :oops:

Ultibo is based on Laz/FPC so some answers are already there on the FPC forums etc.
Yes documentation is not complete or even started in some cases.
Ultibo is essentially one man's effort and getting the Units to work is of higher priority.
Just guessing here, but second priority is fixing bugs.
Third priority is demos and examples which give clues.

Somewhere in all that is adding and extending capabilities like GUI's and other hardware interfacing.
Of interest is FPC, some/most FPC app code just compiles without errors so porting things like editors, gui's, pascalscript interpreters seem to be easy.

Sure you have to use Pascal but it is not that different than any other language.
It is not an OS but that does not stop you making one with it and with almost everything already working at low level an OS is just another application level bit of code, I think:)

The closest comparison is the Arduino IDE toolset, which is a C++ IDE that allows anyone to write a startup function and a single main loop application. Ultibo is an IDE toolset on steroids, multitasking, multicore and all the network stuff just works now, plus you get remote/local shells and consoles, remote and HDMI etc.

Ultibo is very flexible, I am writing apps for IoT stuff, can very nearly replace a Linux OS with data logging and web servers in a 2MB kernel.bin. Even Linux is not back door proof, ie openSSH issues.
So would you trust Billions of IoT devices running Linux/Win10 or Ultibo where ALL the source is open.

It is not quite ready for this yet as SSH is still not quite done, soon I'm told.
I am sticking with it because of it's native multicore support, multicores are the future of cpu's, at least until something better comes along. Ultibo will/does make it easy for me to learn this.
Do you know any other toolset that can do what Ultibo already does that is free and open?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 3:23 am

Gavinmc42 wrote:Probably should ask any questions on the Ultibo forum.
I have always found Garry to be quick with answering any questions, even dumb ones :oops:
Just signed up over there. Waiting for my first post to be moderated.

Most of my questions have nothing to do with the Pascal Language, though rather with deeper issues of the OS, and the parts of the build environment that are Ultibo specific.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 4:27 am

I am attempting to build the fpc with Ultibo target support. It seems that it does not wish to compile, as it wants to include the arm-linux target, that the source seems to be missing.

So I am going to have to take some time to modify the build process to allow it to be built without that target, keeping it separate from the arm-linux native fpc I have installed.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 7:56 am

DavidS wrote:I am attempting to build the fpc with Ultibo target support.
Continued in this thread https://ultibo.org/forum/viewtopic.php?f=10&t=273 on the Ultibo forum to avoid duplication.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

hippy
Posts: 5782
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 2:04 pm

DavidS wrote:if the project targets only only a single Hardware Architecture and CPU that already has one or more OSes capable of supporting the development environment, the reasonable thing is to have the development environment hosted on the target hardware.
That would make sense if Ultibo generated executables, or hosted the development system itself, so the edit-compile-test process can easily be repeated, but it would require swapping SD Cards and re-boots between the development platform and the target application.

I find a separate development and target setup easier to use in those circumstances; only the target needs re-booting. It probably helps that I am used to cross developing and I tend to cross develop even when I don't have to. And I don't have a disparaging attitude to Windows which makes it a problem.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Sun Sep 04, 2016 3:32 pm

hippy wrote:
DavidS wrote:if the project targets only only a single Hardware Architecture and CPU that already has one or more OSes capable of supporting the development environment, the reasonable thing is to have the development environment hosted on the target hardware.
That would make sense if Ultibo generated executables, or hosted the development system itself, so the edit-compile-test process can easily be repeated, but it would require swapping SD Cards and re-boots between the development platform and the target application.

I find a separate development and target setup easier to use in those circumstances; only the target needs re-booting. It probably helps that I am used to cross developing and I tend to cross develop even when I don't have to. And I don't have a disparaging attitude to Windows which makes it a problem.
Well once I get a good working compiler Raspbian going, get a executable loader project done for Ultibo, then I will see about porting FPC to Ultibo, so it is truely self hosted.

There is such a thing as using 2 RPi, which would make since for Ultibo development, one to host the development enviroment, and one to test/debug the produced programs.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
Gavinmc42
Posts: 3630
Joined: Wed Aug 28, 2013 3:31 am

Re: Ultibo core a bare metal environment for Raspberry Pi

Mon Sep 05, 2016 6:43 am

Use Pi 3's and have them net booting Ultibo kernel.bin code from a Pi3 server.
I have already tested a Pi B updating it's own kernel.bin from a Pi 3 running the Ultibo web server example code.
The server Pi could be running Raspbian and Laz/FPC/Ultibo.

Or easier to just copy the kernel.bin from a Windows/Linux box to the Pi kernel.bin server.
This should work right now.
Other options are update from USB stick on boot etc.
Shell commands allow copy from d:/ to c:/ etc.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Ultibo core a bare metal environment for Raspberry Pi

Wed Sep 07, 2016 2:40 am

The ultibo targeting FPC, and ultibo itself can now be built from Raspbian Linux.
See:
https://ultibo.org/wiki/Building_for_Raspbian

And as long as you do not make any typo's (guilty myself), it should be very simple to get going.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Return to “Bare metal, Assembly language”