Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:10 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pi Bare Metal

     Page 1 of 2    
Author Message
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:37pm 12 Feb 2022
Copy link to clipboard 
Print this post

I have been doing a lot of research and I found the following information
IF anyone is interested in trying to make an MMBasic Pi Bare Metal Port

I'm not saying it's possible, but it looks like it might be, I just don't have the knowledge to do it myself

What started me looking was the fact that CircuitPython on Raspberry Pi (Bare Metal / No OS) can be run on the following Pi boards:
Raspberry Pi Zero W
Raspberry Pi Zero 2 W
Raspberry Pi 4 Model B - 2 GB RAM
Raspberry Pi Compute Module 4 IO Board
Raspberry Pi Compute Module 4 - 4GB RAM, 32GB MMC and WiFi

The information for that is here

I then done more searching and I found the following
MicroPython on bare metal Raspberry Pi Zero / Zero W / 2 here

Quick reference for the Raspberry Pi Zero W MicroPython here

Bare Metal Wi-Fi driver for the Raspberry Pi

The latest Linux Wi-Fi driver for the Pi by the manufacturer of the chip used here

Datasheet for the Wi-Fi/Bluetooth chips used in the Raspberry Pi in  the Pi Zero W [https://www.infineon.com/dgdl/Infineon-YW43438_Single-Chip_IEEE_802.11_b_g_n_MAC_Baseband_Radio_with_Integrated_Bluetooth_5.1_Compliance-AdditionalTechnicalInformation-v14_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee1ee20680a]here

Datasheet for the Wi-Fi/Bluetooth chip in the Pi 3B+ here

Datasheet for the Wi-Fi/Bluetooth chip in the Pi 3B+ here

Software and tools Raspberry Pi Wi-Bluetooth here contains several

this for Pi Zero


drivers.zip


Anyone able to make anything out of them?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 05:51pm 12 Feb 2022
Copy link to clipboard 
Print this post

It's a pity that none of the bare metal CircuitPython supported boards appears to be available ...
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 06:02pm 12 Feb 2022
Copy link to clipboard 
Print this post

There was (and is still alive) such an interesting project Ultibo (microkernel compiled in fpc). It is a pity that it is little known.
I think he just ran out of a built-in Interpreter for some language.

Michal
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 06:13pm 12 Feb 2022
Copy link to clipboard 
Print this post

There doesn't seem to be much bare metal stuff for the Pi boards. I think Peter has a good point - what you write for one won't run on the next version, especially if the GPU or Broadcom SOC has changed. A minor change in the GPU can stop the Broadcom booting at all.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 06:24pm 12 Feb 2022
Copy link to clipboard 
Print this post

Lewis

Anyone can look up the references and it is almost certainly do-able.

HOWEVER, my estimate would be 500-1000 hours of work (my hours). It is vanishingly unlikely that anyone is going to take it on. Some time ago someone contacted me via Geoff with a view to a joint effort on a bare metal port. I said no and he said he would take it on himself - that was 2 years ago.....

Feel free to keep raising it but there are few TBS members who could do it and fewer still with the time and probably none with the inclination
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 06:47pm 12 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  HOWEVER, my estimate would be 500-1000 hours of work (my hours).

And the implementation of your version (for Windows) on Debian is a very big effort?

Michal
Edited 2022-02-13 04:48 by Michal
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:48pm 12 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  Feel free to keep raising it but there are few TBS members who could do it and fewer still with the time and probably none with the inclination


For what it's worth I'm with Peter. I'm really quite an accomplished C programmer and I suspect by cribbing from other bare metal Pi projects I could fill in the missing pieces of hardware knowledge in my arsenal. Even so I would double Peter's estimate and at 10 hours a week available for such a project on my best week I'd probably be looking at 3+ years, potentially many more ... ain't going to happen .

Best wishes,

Tom
Edited 2022-02-13 04:50 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 06:55pm 12 Feb 2022
Copy link to clipboard 
Print this post

  Quote  And the implementation of your version (for Windows) on Debian is a very big effort?

About 50 hours so far and other than sound all the hard stuff is now done
Edited 2022-02-13 04:56 by matherp
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 07:14pm 12 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  
About 50 hours so far and other than sound all the hard stuff is now done

wow!
Can we expect your Debian (hopefully also on Raspberry) version in the near future?

Michal
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 07:16pm 12 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Can we expect your Debian (hopefully also on Raspberry) version in the near future?

No: I don't do Linux but its a simple WIN32 app so I assume it should "Wine"
Edited 2022-02-13 05:28 by matherp
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 07:43pm 12 Feb 2022
Copy link to clipboard 
Print this post

One question (not to imply that I have any interest in doing the work): is "bare metal" the same on the Pi-ZW and the the Pi-Z2W and PIs 3 & 4?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 08:07pm 12 Feb 2022
Copy link to clipboard 
Print this post

  Quote   is "bare metal" the same on the Pi-ZW and the the Pi-Z2W and PIs 3 & 4?

No: and that is a major issue. Each one is a different port
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 02:20pm 13 Feb 2022
Copy link to clipboard 
Print this post

Does the Kernel contain the information (drivers) for the board?
or what does it actually contain?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 02:55pm 13 Feb 2022
Copy link to clipboard 
Print this post

A linux kernel usually contains some of the drivers (basic display, keyboard, mouse but it can be a lot more), but not all. Exactly what is in it depends on what was included when it was compiled so it can vary.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 02:55pm 13 Feb 2022
Copy link to clipboard 
Print this post

  lew247 said  Does the Kernel contain the information (drivers) for the board?
or what does it actually contain?

If you mean Linux kernel, effectively yes.  (And all the painfully different hardware is effectively coped with there.)

Bare metal of course has no Linux kernel/drivers & would have to re-do all that stuff.

John
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 03:01pm 13 Feb 2022
Copy link to clipboard 
Print this post

  Michal said  And the implementation of your version (for Windows) on Debian is a very big effort?

Michal

If you consider
1. a version (for Windows)
and
2. on Debian

Then #1 would be huge had it been bare metal, but isn't because the OS does so much.

#2 depends either on WINE or on compiling/linking with code which mimics whatever APIs etc Peter has used.

John
Edited 2022-02-14 01:02 by JohnS
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 04:29pm 13 Feb 2022
Copy link to clipboard 
Print this post

  JohnS said  
  lew247 said  Does the Kernel contain the information (drivers) for the board?
or what does it actually contain?

If you mean Linux kernel, effectively yes.  (And all the painfully different hardware is effectively coped with there.)

Bare metal of course has no Linux kernel/drivers & would have to re-do all that stuff.

John

So If we had the "bare metal" Kernal used for the Pi Zero W,Pi Zero 2 W and the Pi 4B then we could use that IF anyone was to try and port MMBasic?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 04:59pm 13 Feb 2022
Copy link to clipboard 
Print this post

If you know what drivers are in it and how to use them it would be a start. Then you need the specific drivers for each of those boards.

True bare metal doesn't need drivers but in practice you don't know how to use the GPU or the Broadcom chip and at least some of that info isn't available unless you sign NDA agreements. Hence you will probably need at least some of the firmware from Raspberry Pi. That will be in the form of libraries that may or may not be published. Not only that, but the different boards don't use the same chipset - or they may do but with different parts/modes enabled by Broadcom.

The best you'll probably manage is with a stripped down kernel. Take out everything that's not needed to make it ultralight then write for that. It's not bare metal but at least you stand a chance of getting something to work. Even then, there's no official way (yet) to give access to the GPIO at user level, only as root. That's not safe.

It was so much easier when CPU manufacturers went out of their way to give you lots and lots of information on their products!
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 05:14pm 13 Feb 2022
Copy link to clipboard 
Print this post

The Ultibo I mentioned, created such kernels:

30-10-2021  04:32         3115720 kernel.img
30-10-2021  04:32         3156720 kernel7.img
30-10-2021  04:33         3181616 kernel7l.img

Michal
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 05:35pm 13 Feb 2022
Copy link to clipboard 
Print this post

I think RPi list a minimal kernel. I'm pretty sure they used to anyway. There's no desktop or anything.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025