Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:57 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 2 of 2    
Author Message
JohnS
Guru

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

  lew247 said  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?

What kernel is that?  Is there one?

If there is, where is it?  What documentation?
Is it suitable? What licence?

John
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 06:41pm 13 Feb 2022
Copy link to clipboard 
Print this post

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


The Raspberry Pi Imager program gives you as a default "A port of Debian Bullseys with the Raspberry Pi Desktop". Choosing "Other" gives you Raspberry Pi OS Lite (Bullseye 32-bit and 64-bit and Debian Buster (which is 32-bit, I believe) in versions with and without Desktop.

I always use Lite with a PiZW or Z2W and access headless with SSH.

Other OSs are available, and I think some not accessed by Imager.

  Mixtel90 said  there's no official way (yet) to give access to the GPIO at user level, only as root.


All of these Raspberry Pi images give access to GPIO through at least two methods--sysfs (which is deprecated but works (including with MMB4L)) and official? (semi-official?) userspace libgpiod, although the version of libgpiod which you get with sudo install libgpiod is limited compared to the libgpiod under development. The libgpiod under development can do a pretty good job of providing MMBasic GPIO under MMB4L (I've downloaded it and tested building it and MMB4L and believe it will do the job).

Neither sysfs nor libgpiod requires root access.

~
Edited 2022-02-14 04:43 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Mixtel90

Guru

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

There's no guarantee that sysfs will carry on working now, but there's a hell of a lot to do before the GPIO gets involved anyway. lol

And, of course, neither system gives you bare metal access in the same way that other platforms do. The GPIO is still under control of the Broadcom chip.
Edited 2022-02-14 04:59 by Mixtel90
Mick

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

Guru

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

  JohnS said  
  lew247 said  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?

What kernel is that?  Is there one?

If there is, where is it?  What documentation?
Is it suitable? What licence?

John

If you actually checked out the links and documentation I linked to you'd have answered most of those questions yourself instead of asking the question

As to the licence I don't understand this but maybe someone does
from here
  Quote  Copyright (c) 2006, Broadcom Corporation.
Copyright (c) 2015, Raspberry Pi (Trading) Ltd
All rights reserved.

Redistribution.  Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:

* This software may only be used for the purposes of developing for,
 running or using a Raspberry Pi device, or authorised derivative
 device manufactured via the element14 Raspberry Pi Customization Service
* Redistributions must reproduce the above copyright notice and the
 following disclaimer in the documentation and/or other materials
 provided with the distribution.
* Neither the name of Broadcom Corporation nor the names of its suppliers
 may be used to endorse or promote products derived from this software
 without specific prior written permission.

DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.


I don't know the licence for this because I can't find it but as it's public and posted on Adafruit's website I assume it's ok to use?
pi Zero w, Zero W 4, Pi 4B links to kernels

Edit also found this Writing a "bare metal" operating system for Raspberry Pi 4
Edited 2022-02-14 07:24 by lew247
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 09:27pm 13 Feb 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  neither system gives you bare metal access in the same way that other platforms do. The GPIO is still under control of the Broadcom chip.


I think "bare metal" on the pi (whatever that might mean) is a dead letter. I was talking about GPIO without root access on the Raspberry Pi released OSes.

Re sysfs, while some things which are deprecated are phased out, others remain, but generally fall out of use because better ways to do things come along. I suspect that will be the case with sysfs access of GPIOs (because a lot of designs use this, including some non-pi subsystems of my own) (but I have no way of knowing whether or not that will actually be what happens).
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Michal
Senior Member

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

https://wiki.lazarus.freepascal.org/Ultibo_core
Michal
Edited 2022-02-14 07:49 by Michal
 
JohnS
Guru

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

  lew247 said  If you actually checked out the links and documentation I linked to you'd have answered most of those questions yourself instead of asking the question

I took a quick look but could not easily find it, thus my questions.

The more I look the less viable this looks.

I wish I had not bothered.

John
Edited 2022-02-14 08:21 by JohnS
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:16am 14 Feb 2022
Copy link to clipboard 
Print this post

A C++ Bare metal enviroment for the Pi with USB (32 and 64 bit)
This link tells you in easy step by step details how to make a bare metal boot for the Pi 3 and blink an led using the GPIO
Pi 4 Bare metal step by step
Bare metal resources
Datasheets for the Broadcom CPU's including GPIO registers
BCM2835 Pi Zero
BCM2837 Pi B3+
BCM2711 Pi 4
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 09:21am 14 Feb 2022
Copy link to clipboard 
Print this post

Oh, you have the info, you have the PicoMite source on Github so all you need to do is put them together, lew. :)

I know I won't be doing it. My love of C and C++ is similar to my love of being bashed round the head with a lump of 2x2.
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: 09:22am 14 Feb 2022
Copy link to clipboard 
Print this post

  Quote  
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
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:00am 14 Feb 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Oh, you have the info, you have the PicoMite source on Github so all you need to do is put them together, lew. :)

If I could understand it I would have a go, but considering I struggle with Basic I don't have any chance of that unfortunately
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 10:36am 14 Feb 2022
Copy link to clipboard 
Print this post

It's not the sort of job you take on unless you are already very familiar with the way the Raspberry Pi hardware works and are looking for the challenge to do just this. That's not going to be many people in the world. Almost everyone who wants to program a Pi will want to do it in Python under some linux or other.

There have been several attempts to get BBC basic running "bare metal" on the Pi. I think all of them have been abandoned now. It'll never boot into basic as fast as a CMM2 (or even a PicoMite) anyway as the GPU has to start, sort out the hardware then boot the Broadcom chip and hand over control to it. Even a bare metal basic couldn't start until that point. RISC-OS booting BBC basic is probably as fast as you'll get, after all, you'll need graphics handling, keyboard recognition and a file system to do anything on the Pi unless you are going to rewrite all that stuff. I think the Pi 400 broke RISC-OS anyway.
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: 11:01am 14 Feb 2022
Copy link to clipboard 
Print this post

  Mixtel90 said   It'll never boot into basic as fast as a CMM2 (or even a PicoMite) anyway as the GPU has to start, sort out the hardware then boot the Broadcom chip and hand over control to it. Even a bare metal basic couldn't start until that point.
https://www.youtube.com/watch?v=TMNoba17FXc

https://www.youtube.com/watch?v=7l2lzfapa88

Michal
Edited 2022-02-14 21:20 by Michal
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 11:24am 14 Feb 2022
Copy link to clipboard 
Print this post

Not bad. It gives you an idea of the minimum possible time. :)
The GPU/Broadcom boot is probably taking 1 to 1.5 of those seconds. Then the emulator has to be loaded.
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: 11:33am 14 Feb 2022
Copy link to clipboard 
Print this post

Here are a few examples:
https://www.youtube.com/c/UltiboLive/videos
Eg GPIO:
https://www.youtube.com/watch?v=yfsuwbfyjgM

Michal
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025