zig (a c replacement) linked with ultibo

General discussion about anything related to Ultibo.
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

zig (a c replacement) linked with ultibo

Postby mark » Mon Feb 18, 2019 4:11 pm

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

Re: zig (a c replacement) linked with ultibo

Postby Gavinmc42 » Tue Feb 19, 2019 12:35 am

Mark, you collect languages like I collect Pi's ;)

Not sure if I understand this.
Ultibo is sort of acting as kernel/drivers being called by Zig or is it calling Zig?
This would work for any language?
Rust, Go, Pony, even C :lol:
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: zig (a c replacement) linked with ultibo

Postby mark » Tue Feb 19, 2019 2:03 am

Gavinmc42 wrote:Mark, you collect languages like I collect Pi's ;)

Not sure if I understand this.
Ultibo is sort of acting as kernel/drivers being called by Zig or is it calling Zig?
This would work for any language?
Rust, Go, Pony, even C :lol:


This is just an example of using Garry’s c api so yes c works. Zig works well because it is designed specifically to work well with c libraries. I don’t know what effort it would take to connect the other languages.

Per Garry’s design, the Ultibo kernel starts and pascal can call one or more zig entry points using one or more threads and zig can call back for services like logging in this small example.

Mark
User avatar
Ultibo
Site Admin
Posts: 2150
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: zig (a c replacement) linked with ultibo

Postby Ultibo » Tue Feb 19, 2019 11:02 pm

mark wrote:https://www.reddit.com/r/Zig/comments/arynkj/zig_linked_with_ultibo_pascal_unikernel_for/

https://ziglang.org

Nice work Mark.

Gavinmc42 wrote:Ultibo is sort of acting as kernel/drivers being called by Zig or is it calling Zig?
This would work for any language?

The concept is really very simple, you can make any language available for bare metal development if you can support the run time requirements. Since Ultibo has a whole lot of features normally only provided by an OS then many languages don't need much more.

We'll get the full API completed as soon as we can so we can show the real possibilities that come from it.
Ultibo.org | Make something amazing
https://ultibo.org
Gavinmc42
Posts: 1509
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: zig (a c replacement) linked with ultibo

Postby Gavinmc42 » Tue Feb 19, 2019 11:48 pm

We'll get the full API completed as soon as we can so we can show the real possibilities that come from it.

Cool, I love working examples.
One of the issues I have with Ultibo is it can do so many things in so many ways until I see an example I don't know how to do most of these things.

Those with experience know how, those like me without, might take years to get around to doing things.
Mind you when I do get around to doing it, Ultibo is still faster than any other way I have tried :D

Having Ultibo as kernel "look a like" means any compiled language that Linux(and other OS's?) use, Ultibo can use?
Not sure how interpreted languages could be ported.
Came to Ultibo because it was simple compared to Linux, now we are talking about using it like Linux?
It has come a long way in a few years :D
develone
Posts: 297
Joined: Wed Dec 28, 2016 7:40 pm
Location: El Paso Tx USA

Re: zig (a c replacement) linked with ultibo

Postby develone » Mon Feb 25, 2019 8:27 pm

Mark The author of zig

Andrew Kelly is working on bare metal with the RPi3. his code is at
https://github.com/andrewrk/clashos
I have been trying to get your example to work. I first tried to build from source on Ubuntu x86_64 system.
I then had to switch to binaries of zig see my notes
https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/notesforzig.txt
I just posted on freenode zig IRC
andrewrk, Some of the options cause errors using the x86_64 zig binaries.
--target-environ gnueabihf --target-os freestanding --target-arch armv7 --target-arch armv8
https://github.com/develone/Ultibo_Proj ... forzig.txt lines 24-43
for the errors I get using the zig binaries on a Ubuntu 16. x86_64
This cmd does create a zigmain.o
zig build-obj -isystem ../../include/ -isystem /usr/include/x86_64-linux-gnu/ -isystem /usr/lib/arm-none-eabi zigmain.zig
When I mentioned your post

andrewrk> develonepi3, yes I saw that
<andrewrk> I actually thought you were markfirmware at first


Andrew Kelly RPi3 code might be of interest to other Ultibo users.
User avatar
Ultibo
Site Admin
Posts: 2150
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: zig (a c replacement) linked with ultibo

Postby Ultibo » Mon Feb 25, 2019 10:42 pm

develone wrote:Andrew Kelly is working on bare metal with the RPi3. his code is at
https://github.com/andrewrk/clashos

Thanks develone, that's an interesting example that I think actually highlights exactly what Mark is trying to demonstrate.

While it's cool that Andrew is doing bare metal development with a new language the project only has very basic functionality after two years. For many people the point of bare metal is to tinker and experiment so there is no urgency to expand the functionality but for others their interest is in creating a project that performs a specific task, using the concept shown by Mark it should be possible to take advantage of the feature set of Ultibo while using almost any language you choose (including zig) and avoid having to start from scratch.
Ultibo.org | Make something amazing
https://ultibo.org
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: zig (a c replacement) linked with ultibo

Postby mark » Tue Feb 26, 2019 2:08 am

develone wrote:Mark The author of zig

Andrew Kelly is working on bare metal with the RPi3. his code is at
https://github.com/andrewrk/clashos
I have been trying to get your example to work. I first tried to build from source on Ubuntu x86_64 system.
I then had to switch to binaries of zig see my notes
https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/notesforzig.txt
I just posted on freenode zig IRC
andrewrk, Some of the options cause errors using the x86_64 zig binaries.
--target-environ gnueabihf --target-os freestanding --target-arch armv7 --target-arch armv8
https://github.com/develone/Ultibo_Proj ... forzig.txt lines 24-43
for the errors I get using the zig binaries on a Ubuntu 16. x86_64
This cmd does create a zigmain.o
zig build-obj -isystem ../../include/ -isystem /usr/include/x86_64-linux-gnu/ -isystem /usr/lib/arm-none-eabi zigmain.zig
When I mentioned your post

andrewrk> develonepi3, yes I saw that
<andrewrk> I actually thought you were markfirmware at first


Andrew Kelly RPi3 code might be of interest to other Ultibo users.


Thanks for trying this. I wa s using Debian 9 to test, and also had gcc-arm-none-eabi installed. I’ll have to study your notes a little more to know more. I also installed the zig x86_64 package as you eventually did. I don’t know how the llvm dependency is satisfied in my system. Mark.
develone
Posts: 297
Joined: Wed Dec 28, 2016 7:40 pm
Location: El Paso Tx USA

Re: zig (a c replacement) linked with ultibo

Postby develone » Sat Mar 02, 2019 1:38 pm

Hello All,

updated zig ver c4887d7f. on Ubuntu 16.04
This is the cmd that I used to get zigmain.o using Mark's API/samples/zigtest/zigmain.zig
zig build-obj -isystem ../../include/ -isystem /usr/lib/arm-none-eabi/include -isystem /usr/lib/arm-none-eabi -target armv7-freestanding-gnueabihf zigmain.zig.
The file
https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/zigmain.txt is the result of
arm-none-eabi-objdump -d zigmain.o > zigmain.txt

My notes are found https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/notesforzig.txt
develone
Posts: 297
Joined: Wed Dec 28, 2016 7:40 pm
Location: El Paso Tx USA

Re: zig (a c replacement) linked with ultibo

Postby develone » Sat Mar 02, 2019 6:57 pm

Hello All
https://github.com/develone/Ultibo_Projects/tree/master/ultibo_zig
Started with Mark's zigtestproject.lpr --> ZigTestProject.pas
ZigTestProject.lpi

Using Lazarus on RPi3B+
Building for RPi2B
Adding additional units
telnet 192.168.1.185

https://github.com/develone/Ultibo_Projects/blob/master/ultibo_zig/notesforzig.txt
There is a zigmain.o built with zig cmd zig build-obj -isystem include/ -isystem /usr/lib/arm-none-eabi/include -isystem /usr/lib/arm-none-eabi -target armv7-freestanding-gnueabihf zigmain.zig
Let me know if you have any questions

Return to “Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests