G’day everyone, this is Discovering Ultibo Episode 3 and it’s Garry from Ultibo.org here. We’re going to do something a little different today, we’re going to do Building the RTL, now to some
of you that might sound a little intimidating, scary, why would you want to do that. Well there are many reasons why you might want to rebuild the RTL for Ultibo. Biggest one is to get access to new features as they become available. We’ll be putting out updates and fixes
to the RTL every few days every couple weeks, pretty regularly anyway, and we’ll only be
updating the Lazarus installer maybe every few months and that’s sort of the
most. So the simplest way to get yourself up to date with all the latest
features is to actually update your RTL. It’s not that hard to do we’ve made the
process pretty simple and straightforward and we’re just going to
run through it today and explain a bit along the way why certain things are the way they are.
So we’re not actually going to use the Pi, we’ve got it here running a little demo,
you might have noticed that the font handling in Ultibo has had quite
a bit of enhancement lately and just for fun we’ve created a little demo scrolling
a couple of different size fonts on the screen in colors so that’s just a bit of fun, you can try it out yourself it’s quite
easy to do with all the new font enhancements. So we’ll move over to the computer and
we’ll open up Lazarus, and first question with Building the RTL
or rebuilding the RTL is what version do you already have. So I’ve got installed here the latest
release version of Lazarus and the simplest and quickest way to figure out
what version you’re up to is to create a new project. So we go New, Project and choose any type of project, select the GlobalConst unit, right click on it and go Find Declaration of GlobalConst. That will actually open the unit in a new tab and
then you can just scroll down to the header bit and the very first thing that
comes up is the version information about Ultibo. So the release date, the release name
which is currently Cucumber, but we’ll increment to something else soon and the
actual release version, so right now I’m on 1.2.009. So that’s the quickest way to find out your version and whether
you’re up to date. So if I now go and close Lazarus, and
we’ll bring up Firefox to the Ultibo home page, and we just scroll down to the
very bottom of the page where you find all the links to all of our different
sites and we’ll click on the GitHub link, and then we select the Core repository and it takes us to Ultibo Core. So this is
all the source for Ultibo Core, the latest version always brings up by default and
over on the right there’s a button for Clone or Download. So if we click that and we go Download
zip it will provide us with a zip file of the latest version of the code. We can
go OK on Save file, choose somewhere to save to C:Downloads I like, and the
file name is Core-master. Now that’s not very big so by the time I
bring up the progress bar it’s already completed, we can clear that
and put Firefox away. Now if I go to Computer C:Downloads
and there’s my Core-master zip that I just downloaded. I can double click that
and open it up and there’s a Core-master folder inside and inside that is a
Source folder, inside Source is RTL and inside RTL is Ultibo. Now where do we copy that to, so if we bring up another window and
move it over to the left here and go to where Ultibo is installed, which normally
is C:UltiboCore, you’ll find all these folders, under FPC which is Free Pascal
compiler 3.1, Source, we find RTL and then down the list a little bit we find Ultibo, that’s the same folder
as what’s in our zip. So we can simply take the Ultibo
folder from the zip, copy that, paste it in the RTL folder under
Source and when Windows prompts us for replacing the folder we say Yes, and
it’ll prompt again do you want to replace all the files, we
say Yes do that for all of them, copy and replace, and it asks again do you want to replace all the folders, and we say Yes again. So a couple of seconds it copies all of that across, and that’s done. Now we have the latest source we can
close that, close that one as well, but we have to update the RTL by rebuilding it
so that we can use the new source. So we’ll open up Lazarus again and we’ve
conveniently provided under Tools menu in Lazarus, a Build Ultibo RTL tool.
Click on that, and we come up with the Ultibo RTL Builder window. Now by
default it’s got both platforms selected, so for Raspberry Pi A and A+, or Zero and also for the Raspberry Pi 2B and 3B, you can choose to build one or the other but
it’s quite simple just to build them both at once. So if we’re happy to go ahead, we click
on the Build button and that will start the process of Building the RTL. Now that
takes a couple of minutes so while that’s happening I’m just going
to minimize Lazarus and bring up a little diagram that we’ve created, just to
explain what is the RTL. Well obviously the RTL is the Run Time Library and in
many instances it’s the code that your programming interfaces with, the services
that you use. So in this little diagram this is a
typical Ultibo application, right at the bottom level we’ve got the hardware,
the Raspberry Pi itself and any USB devices you have, maybe other things like
LCD displays and things, they’re the hardware. Above that we have some of the
boot code and then the compiler magic to make it all hang together and above
that is the Run Time Library and all the drivers. So things like the console, the
USB drivers, the GPIO and Serial drivers, even the drivers for
the network and the file system all fall in to the Run Time Library and
drivers. Above that we can have packages which might include some of the Free
Pascal packages like FCL image, or even things like fpGUI which we
are working on, Synapses a third-party internet sockets library, above that we
have your program code. And I know what you’re thinking right now is hang on don’t we get direct access to the
hardware in Ultibo, and the answer of course is yes. You can interface with any
of the layers below your program code, you don’t always have to interface
directly with the hardware and that’s why Ultibo’s different to some other things. You can use a lot of the services directly out of the Run Time Library and use the drivers without having to know what they’re doing talking to the hardware, you just use it as is. So it gives you a little bit of a run down of where the Run Time Library fits in the whole process, and why it is actually so important. So we keep updating the Run Time Library with new
features, new drivers, new capabilities and fixing bugs at the same time, and
your program code takes advantage of it every time you rebuild the Run Time
Library. So we’ll just go back to our RTL Builder tool and we’ll see where it’s up to. You’ll see it displays a lot of messages on the screen but it is working its way
through quite a lot of compiling as it goes, and we’re waiting basically till it
comes up and says Build Completed and and then we’ll be able to go ahead and
actually use the new functionality. So, of course you don’t have to sit there
and watch it, you can simply click Build, walk away for a couple minutes, come back. So here we see on the screen Build RTL Completed successfully, Completed Build and that’s what you’re
looking for. If for any reason an error did occur, it
will actually inform you on the screen, you’ll get a message to say an error occurred and some error output. Now it’s always best to check what you did, did you copy things to the right places, did you
accidentally overwrite something you shouldn’t have before you sort of try again, and if you get stuck please post in the forum. So now we can
close the RTL Builder and go back to Lazarus and its best at this point to go Restart on Lazarus, and let’s do that
exercise again. We’ll go Project, New Project and we’ll go 2B again, our GlobalConst unit, Find Declaration and now if we scroll down through the header
you’ll find that we’re on 1.2.021. So we’ve updated our version, our new empty Raspberry Pi 2 project we can go Run, Compile, and we get Success. The project
won’t do much but it succeeded, you’ve got the new RTL, you’re all up to date. So that’s all there is for Building the RTL, it’s a pretty simple process and it only takes you a couple of minutes, but it keeps you up to date and means you can use all the latest features all the time. Next time on Discovering Ultibo, come
back and join us when we see what we can do with one of these. This is a breadboard and we’re going to
do some GPIO, so thanks for watching, see you next time, bye.

Discovering Ultibo – Episode 3 Building the RTL
Tagged on:                                 

3 thoughts on “Discovering Ultibo – Episode 3 Building the RTL

  • May 8, 2018 at 4:44 am

    RTL… So the pascal code is compiled to bytecode like .NET?

  • April 11, 2019 at 7:09 pm

    Hello Garry look this question about Ultibo: http://prntscr.com/napdsa

  • October 8, 2019 at 6:40 pm

    Orange pi support would be nice!


Leave a Reply

Your email address will not be published. Required fields are marked *