Raspberry Pi baremetal port?

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.1.0

Moderators: simonsunnyboy, thothy, Moderator Team

ranix
Atari maniac
Atari maniac
Posts: 81
Joined: Sun Jan 14, 2018 8:01 pm

Re: Raspberry Pi baremetal port?

Postby ranix » Fri May 04, 2018 2:57 am

ctirad wrote:
Foxie wrote:Linux has a very bad level of performance with anything that needs a fast response. That means it's a poor choice for MIDI. Even if your thread goes real-time, I'm pretty sure Linux still preempts your thread for up to 5ms every second.


Fortunately, that's not true at all.


I disagree. I am not sure of the specifics of thread pre-emption but it is unsuitable for real-time applications such as music production in my opinion.

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 745
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Raspberry Pi baremetal port?

Postby mfro » Fri May 04, 2018 5:14 am

Foxie wrote:Linux has a very bad level of performance with anything that needs a fast response. That means it's a poor choice for MIDI. Even if your thread goes real-time, I'm pretty sure Linux still preempts your thread for up to 5ms every second. Not good enough.


Uuh.

You are comparing apples to oranges. There is no fixed time that's "lost to preemption" in Linux. This is a function of system load. Your task only gets interrupted if there is a competing task with higher priority or longer waiting time. If you run a single task on your Linux system, it will not be preempted at all.

In fact, a "task" will be "preempted" with TOS a lot more often than on an Linux system with no load: you have the Hz200 interrupt and a screen refresh 50, 60 or 70 times a second where at least the latter does not occur on a Linux system since it's delegated to hardware (that TOS doesn't have). The difference is just that - since it's usually a fixed time raster (provided you did not do fancy things with VBL or timer interrupts) - it is a lot more predictable than on a multitasking system.

Realtime performance is usually measured in interrupt latency time (i.e. the time your machine needs to react on an external device signalling an event). Ataris are still pretty good regarding this. Basically just because they do not have lots of internal interrupt sources besides what's mentioned above - TOS itself is busy waiting for most devices and these busy waiting loops can be interrupted anytime. Drawback is that it's burning cycles most of the time while it could do more useful things. Not sure if this was done by intention or just because it was simpler to code when they hurried to get TOS out of the door...

joska
Hardware Guru
Hardware Guru
Posts: 3997
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Raspberry Pi baremetal port?

Postby joska » Fri May 04, 2018 8:05 am

Faucon2001 wrote:So I see a bare metal option as an excellent optimization and simplification


Yes, exactly. A PC is used (mainly) for other tasks than the emulator, which makes a "bare metal" emulator not very useful. Not to mention the hardware issue - you need hundreds of megabytes with drivers to make things works on a reasonable amount of PC's. A Raspberry Pi OTOH is super cheap and can be dedicated to the emulator. And the size opens up a lot of possibilities too, there's tons of screen- and case-options for the Pi.
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

mikro
Atari God
Atari God
Posts: 1582
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Raspberry Pi baremetal port?

Postby mikro » Fri May 04, 2018 12:20 pm

Faucon2001: actually I remember that ctirad had done something very close to what you describe (super minimal linux distro without X but still accelerated via mesa+sdl2 just for aranym) but he, as usual, hasn't published anything (shame! :-))

ctirad
Captain Atari
Captain Atari
Posts: 243
Joined: Sun Jul 15, 2012 9:44 pm

Re: Raspberry Pi baremetal port?

Postby ctirad » Fri May 04, 2018 3:46 pm

ranix wrote:I disagree. I am not sure of the specifics of thread pre-emption but it is unsuitable for real-time applications such as music production in my opinion.


There is nothing wrong with music production on Linux. WIth jack, rt core and decent hardware you can reach latencies between 1-2ms with a rock stable operation. There are even a linux based standalone synths, FX processors and VST host boxes, on the market.

ctirad
Captain Atari
Captain Atari
Posts: 243
Joined: Sun Jul 15, 2012 9:44 pm

Re: Raspberry Pi baremetal port?

Postby ctirad » Fri May 04, 2018 4:06 pm

mikro wrote:Faucon2001: actually I remember that ctirad had done something very close to what you describe (super minimal linux distro without X but still accelerated via mesa+sdl2 just for aranym) but he, as usual, hasn't published anything (shame! :-))


I'm still working on the even more lighweight backend. The current one based on the MESA+EGL+SDL2 is still too bloated (about 100MB of compressed initramfs, while more than a half of that space is occupied by mesa and its deps ). However, the SDL2 recently got the ability to use the linux kernel KMS/DRM directly and that is the way I want to go.

I've also made some experiments with my Khadas VIM (ARM S905X box), but all its standard roms are aarch64 and that would require to adapt aranym jit for that arch.

ThorstenOtto
Captain Atari
Captain Atari
Posts: 296
Joined: Sun Aug 03, 2014 5:54 pm

Re: Raspberry Pi baremetal port?

Postby ThorstenOtto » Sat May 05, 2018 6:20 am

ctirad wrote:[I've also made some experiments with my Khadas VIM (ARM S905X box), but all its standard roms are aarch64 and that would require to adapt aranym jit for that arch.


It's not really required, you can always use the normal version, i will just be a bit slower.

ctirad
Captain Atari
Captain Atari
Posts: 243
Joined: Sun Jul 15, 2012 9:44 pm

Re: Raspberry Pi baremetal port?

Postby ctirad » Sat May 05, 2018 7:56 am

It is actually much slower, than just "a bit". But it's not a real problem, the khadas can run the 32bit system as well.

mikro
Atari God
Atari God
Posts: 1582
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Raspberry Pi baremetal port?

Postby mikro » Sat May 05, 2018 10:21 am

ctirad wrote:I'm still working on the even more lighweight backend. The current one based on the MESA+EGL+SDL2 is still too bloated (about 100MB of compressed initramfs, while more than a half of that space is occupied by mesa and its deps ). However, the SDL2 recently got the ability to use the linux kernel KMS/DRM directly and that is the way I want to go.

Man, this sounds awesome!

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Re: Raspberry Pi baremetal port?

Postby Foxie » Sat May 05, 2018 5:43 pm

ctirad wrote:There is nothing wrong with music production on Linux. WIth jack, rt core and decent hardware you can reach latencies between 1-2ms with a rock stable operation. There are even a linux based standalone synths, FX processors and VST host boxes, on the market.


1-2ms is still quite high compared to say, OS X. But the real thing I'm interested in is MIDI. I haven't done any MIDI-specific testing on Linux, but I did try to set up a real time thread to poll the printer port and toggle an output when the input was toggled. I was seeing incredibly bad unpredictability with response time, even with not much else running (I think I used Mint for testing, at the command prompt with no X - only those background daemons which it pre-loads). It was over a millisecond at times.

TOS is quite slow on response time too, but an order of magnitude better. I measured 0.5 milliseconds peak to respond to an interrupt at 8MHz. Unlike Linux, you have the possibility of turning off timer C and writing your own ACIA interrupt routine to mostly eliminate these delays. Interestingly I didn't see much performance loss from leaving VBL enabled.

I'm going to make a little benchmarking tool for MIDI for the Atari. I hope this will answer the question of performance by plugging a Linux machine into the Atari and measuring. Also Windows, OS X and another Atari.

ctirad
Captain Atari
Captain Atari
Posts: 243
Joined: Sun Jul 15, 2012 9:44 pm

Re: Raspberry Pi baremetal port?

Postby ctirad » Sat May 05, 2018 9:42 pm

Higher latency is just the price one has to pay when use the real preemptive OS and high level API. The situation is completely different for ATARI/TOS MIDI and audio applications that have direct access to the hardware registers. Totaly uncomparable.

ctirad
Captain Atari
Captain Atari
Posts: 243
Joined: Sun Jul 15, 2012 9:44 pm

Re: Raspberry Pi baremetal port?

Postby ctirad » Sat May 05, 2018 10:01 pm

mikro wrote:
ctirad wrote:I'm still working on the even more lighweight backend. The current one based on the MESA+EGL+SDL2 is still too bloated (about 100MB of compressed initramfs, while more than a half of that space is occupied by mesa and its deps ). However, the SDL2 recently got the ability to use the linux kernel KMS/DRM directly and that is the way I want to go.

Man, this sounds awesome!


But it does not work for me, yet :( The lightest backend I currently have uses directfb in between kms/drm and sdl2. The resulting backend is now roughly 20MB (gzipped initramfs + linux kernel). Not bad, but I'm not sure I didn't lost the accceleration. For the plain framebuffer I can use te SDL1.x with no effort.

What about to implement a direct KMS/DRM video, Alsa and event iface directly into aranym? :angel:

ThorstenOtto
Captain Atari
Captain Atari
Posts: 296
Joined: Sun Aug 03, 2014 5:54 pm

Re: Raspberry Pi baremetal port?

Postby ThorstenOtto » Sun May 06, 2018 6:54 am

ctirad wrote:What about to implement a direct KMS/DRM video, Alsa and event iface directly into aranym? :angel:


You can try, but don't forget that Aranym does not only run on linux. Also, even on linux, directly using eg. alsa would badly interact with modern desktop setups where sound output is managed by some server.

Faucon2001
Atari Super Hero
Atari Super Hero
Posts: 684
Joined: Sat Oct 26, 2013 11:19 pm
Location: Brasil
Contact:

Re: Raspberry Pi baremetal port?

Postby Faucon2001 » Mon May 07, 2018 1:07 pm

ctirad wrote:But it does not work for me, yet :( The lightest backend I currently have uses directfb in between kms/drm and sdl2. The resulting backend is now roughly 20MB (gzipped initramfs + linux kernel). Not bad, but I'm not sure I didn't lost the accceleration.

Wow, it sounds amazing ! I am looking forward to have it available to port and test Beekey on it. Tell me when you are ready to share it.
Philippe

Firebee, Falcon, STE, Aranym Box, Hatari Pi Box.
My music http://www.philippeworld.net/
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/emaappsarch/home

ranix
Atari maniac
Atari maniac
Posts: 81
Joined: Sun Jan 14, 2018 8:01 pm

Re: Raspberry Pi baremetal port?

Postby ranix » Tue May 08, 2018 2:51 am

ctirad wrote:Higher latency is just the price one has to pay when use the real preemptive OS and high level API. The situation is completely different for ATARI/TOS MIDI and audio applications that have direct access to the hardware registers. Totaly uncomparable.


I don't really think it's incomparable. For my purposes (interacting with external hardware, never using a VST plugin) TOS is strictly superior to Linux in every possible way. It's a dedicated single-purpose single-threaded real-time application, which is in my humble opinion the only tool for the job.

mzry
Captain Atari
Captain Atari
Posts: 395
Joined: Tue Jan 26, 2016 12:39 pm

Re: Raspberry Pi baremetal port?

Postby mzry » Tue May 08, 2018 6:10 am

Faucon2001 wrote:
ctirad wrote:But it does not work for me, yet :( The lightest backend I currently have uses directfb in between kms/drm and sdl2. The resulting backend is now roughly 20MB (gzipped initramfs + linux kernel). Not bad, but I'm not sure I didn't lost the accceleration.

Wow, it sounds amazing ! I am looking forward to have it available to port and test Beekey on it. Tell me when you are ready to share it.


I second this, I hope you guys can work together to make an even leaner and high performance beekey & beepi!
Falcon ct63e 060 - 256mb ram - phantom bus and dsp accel // Atari TT - Thunder and Storm IDE 64mb ram - SCSI2SD - ET4000 vme graphics

arf
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Thu May 17, 2012 9:56 pm
Location: Germany

Re: Raspberry Pi baremetal port?

Postby arf » Sat May 19, 2018 11:39 pm

ranix wrote:I don't really think it's incomparable. For my purposes (interacting with external hardware, never using a VST plugin) TOS is strictly superior to Linux in every possible way. It's a dedicated single-purpose single-threaded real-time application, which is in my humble opinion the only tool for the job.


TOS isn’t a real-time operating system.

arf
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Thu May 17, 2012 9:56 pm
Location: Germany

Re: Raspberry Pi baremetal port?

Postby arf » Sat May 19, 2018 11:40 pm

joska wrote:
arf wrote:And you would still benefit of having a userland below Hatari, for networking, or the filesystem.


I would call that a disadvantage, not a benefit. The entire point of a baremetal port would be to let the "visible" OS (TOS/MiNT) be *the* OS, not an application under Linux. You don't need another OS for networking or filesystem access, TOS/MiNT is perfectly able to handle this itself just like on a real Atari.


On an Raspberry Pi, native? Didn’t know that TOS-based ARM ports already exist. </irony>

joska
Hardware Guru
Hardware Guru
Posts: 3997
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Raspberry Pi baremetal port?

Postby joska » Sun May 20, 2018 6:14 am

Where did you read the word "native"?
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

mzry
Captain Atari
Captain Atari
Posts: 395
Joined: Tue Jan 26, 2016 12:39 pm

Re: Raspberry Pi baremetal port?

Postby mzry » Sun May 20, 2018 2:47 pm

I think it is easy for people to get confused between the way the emulation and 'baremetal' aspects work. Also the relationship between Aranym, Mint and Hatari. Even I am confused :) Does a 'baremetal' version of Hatari mean that we can dispose of the need for Aranym and Linux? Does that mean that Hatari can talk to the hardware direct? etc. These questions are where people are not seeing the same story and where most of the confusion in this thread stems. But I am not the person to explain as I understand the concepts but not the workings well enough.
Falcon ct63e 060 - 256mb ram - phantom bus and dsp accel // Atari TT - Thunder and Storm IDE 64mb ram - SCSI2SD - ET4000 vme graphics

arf
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Thu May 17, 2012 9:56 pm
Location: Germany

Re: Raspberry Pi baremetal port?

Postby arf » Sun May 20, 2018 3:34 pm

joska wrote:Where did you read the word "native"?


Okay, what is the overall goal now? Run TOS/MiNT "native" on a RasPi, without an underlying other OS kernel like Linux? But TOS/MiNT being 68k, not ARM binaries? How’d you do that, which layer would do the 68k->ARM emulation?

And a silent voice keeps asking “and why would that be better than a minimalist Linux kernel setup plus Hatari on top”.

mikro
Atari God
Atari God
Posts: 1582
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Raspberry Pi baremetal port?

Postby mikro » Sun May 20, 2018 8:09 pm

arf wrote:How’d you do that, which layer would do the 68k->ARM emulation?

Erm, Hatari? That is what is this whole debate about.

joska
Hardware Guru
Hardware Guru
Posts: 3997
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Raspberry Pi baremetal port?

Postby joska » Sun May 20, 2018 8:54 pm

arf wrote:Okay, what is the overall goal now? Run TOS/MiNT "native" on a RasPi, without an underlying other OS kernel like Linux? But TOS/MiNT being 68k, not ARM binaries? How’d you do that, which layer would do the 68k->ARM emulation?


The emulator - being an Atari ST emulator - will of course provide emulation and also access to the hardware. Drivers can be written in a mix of ARM and 68k, using a "NatFeat"-type interface.

arf wrote:And a silent voice keeps asking “and why would that be better than a minimalist Linux kernel setup plus Hatari on top”.


It will be simpler and boot quicker. So why not?
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

ThorstenOtto
Captain Atari
Captain Atari
Posts: 296
Joined: Sun Aug 03, 2014 5:54 pm

Re: Raspberry Pi baremetal port?

Postby ThorstenOtto » Mon May 21, 2018 11:07 am

joska wrote:It will be simpler and boot quicker. So why not?


Simpler: definitely not (at least not for the developers of the emulator ;) Faster: maybe. The question is: how much faster, and is that worth the effort.

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1700
Joined: Sun Jul 31, 2011 1:11 pm

Re: Raspberry Pi baremetal port?

Postby Eero Tamminen » Mon May 21, 2018 8:54 pm

ThorstenOtto wrote:Faster: maybe. The question is: how much faster, and is that worth the effort.


At least there's the placebo effect. :-)


Social Media

     

Return to “Hatari”

Who is online

Users browsing this forum: Raibearth and 2 guests