Raspberry Pi 4 update for pidp8i

569 views
Skip to first unread message

Obsolescence

unread,
Aug 14, 2019, 6:13:50 PM8/14/19
to PiDP-8
Warren (most of all), all,

Attached is a patched version of "gpio-common.c.in" to accommodate the Pi 4.
Drop the file into ~/pidp8i/src/pidp8i/src/pidp8i, replacing the old one. Then, in the ~/pidp8i directory:
  
   ./configure && make && sudo make install

and you'll have the fastest PDP-8 you ever saw... but the Pi 4 sure runs hot. I've opened a large slot in the back of my PiDP-8 and that seems OK, but a little fan will be needed if you do not want an open back panel.

Note! The Pi 4 needs the new "Buster" version of Raspbian, so install that first, then follow the instructions here (link).
Once you're done, overwrite the old "gpio-common.c.in"as per above.

For me, the Pi Zero W is still the best choice for pure PDP-8 enjoyment, to be honest. The Pi 4 is so fast it becomes silly, you'll want to use the throttle command. But if you're thinking of a multi-PDP-8 cluster, the Pi 4 certainly provides the hardware part of such a project for you ;)

Warren - as you know I'm clumsy at fossil. Well, worse than that but why elaborate. If you perhaps have the time to put in the changes, that might be the more controlled option. All three code changes are enclosed by // -- Pi4 and // -- end Pi4 markers. Otherwise let me know and I'll take the risk!


Kind regards,

Oscar.
gpio-common.c.in

Warren Young

unread,
Aug 14, 2019, 8:40:13 PM8/14/19
to PiDP-8
On Wednesday, August 14, 2019 at 4:13:50 PM UTC-6, Obsolescence wrote:

Attached is a patched version of "gpio-common.c.in" to accommodate the Pi 4.

Thank you!
 
Warren - as you know I'm clumsy at fossil. Well, worse than that but why elaborate.

It's just as well...I ended up wanting to do quite a few changes to the code as posted above before checking it in. I've retroactively reassigned credit for the check-in to you, though.

Still, if you decide to learn Fossil, there's introductory material in our HACKERS.md file and links from there to plenty more tutorial and reference material. I'm a committer to Fossil, focusing mainly on its docs, so if you find yourself confused by the official docs, I can fix that, too.

My version of your changes is now checked in on the new pi4-gpio-hack branch, which is based on the check-in just prior to my recent check-in switching the project over to libbcm_host instead of using our custom version of the same code, since this hack assumes that locally-hackable copy of the libbcm_host code is available. 

Hopefully the Raspberry Pi Foundation will release an update to libbcm_host that at least lets us get rid of the redundant copy of get_dt_ranges() and the hacked version of bcm_host_get_peripheral_address().

Meanwhile, we have this branch for people to play with. Try it with:

$ cd ~/pidp8i
$ fossil up pi4-gpio-hack
$ ./configure --and-whatever-flags-you-like
$ tools/mmake && sudo make install

I've tested it on my Pi 3 based PiDP-8/I, and it doesn't appear to have broken backwards compatibility. That said, I'd welcome some tests on other Pi <= 3 models. This branch isn't intended to be Pi 4-specific. It may indeed become the basis of the next release.

Warren Young

unread,
Aug 14, 2019, 8:43:32 PM8/14/19
to PiDP-8
By the way, note that this new code has no "serial mod" support. Until someone either verifies that one or both of the old serial mods still functions on the Pi 4 and/or sends in the necessary GPIO changes to make them work, we're running under the assumption that the "serial mod" concept is obsolete as of the Pi 4.

Tom Lake

unread,
Aug 15, 2019, 6:41:23 AM8/15/19
to PiDP-8
Thanks, Oscar. It works great! I'm now running OS/8 on my PiDP-8 with a Raspberry Pi 4B. Love it!

You're right about it being fast!

Tom L

Obsolescence

unread,
Aug 15, 2019, 11:35:14 AM8/15/19
to PiDP-8
Warren,

I tested on my PiDP-8 with Pi 4 and can confirm it's working fine, thanks!

Short how-to is on this page, under 'Option 2B'.

Kind regards,

Oscar.

Warren Young

unread,
Aug 15, 2019, 7:03:49 PM8/15/19
to PiDP-8
On Thursday, August 15, 2019 at 9:35:14 AM UTC-6, Obsolescence wrote:

I tested on my PiDP-8 with Pi 4 and can confirm it's working fine, thanks!

Glad to hear it. Thanks for testing the branch.

Now I just have to decide if I'm going to merge that to trunk or wait for a more portable solution from the Foundation to appear in the Buster package repos.

Short how-to is on this page, under 'Option 2B'.

There are a few improvements you can make.

In both the 2A and 2B sections, this command will run faster:

     ./configure && tools/mmake && sudo make install

The substitution uses a small script shipped with the PiDP-8/I software to generate "make -jN" commands suitable for the platform's available core count, which allows parallel building, which can greatly speed things up.

As for the "about 10 minutes" comment, I think you should just say something more like "this can take many minutes," because it varies wildly between the Pi 1 through the Pi 4. Time them all, and you'll probably find a factor of 3 or more difference in the build time between the extremes.

The biggest single contributor to that build time is in the OS/8 pack building step, which isn't parallelizable, but it does still benefit from faster CPU cores.

You should point people at the README.md file from that page, particularly the bit on "configure" options: https://tangentsoft.com/pidp8i/doc/trunk/README.md#options

Next, the "cd pidp8" in section 2A should be "cd pidp8i".

Finally, I'd put a space in "pidp8i>>" to make it clearer.

-----------

In the 2B section, you can make many improvements:
  1. There's no good reason to give the "apt-get install" commands separately. Just list all of the packages you need on a single line. It's faster because it saves multiple round-trips to the server and requires only a single dependency resolution pass.
  2. It's better to use "apt" for interactive use. apt-get remains available primarily for automated uses, as in the Makefile's "make install" step, which installs a few things that can wait until then, such as GNU screen.
  3. You no longer need to use the Fossil binary I distribute. As of Buster, Debian (and thus Raspbian) is finally shipping a version compatible with my repo. I've updated our documentation, but the short-and-sweet is "sudo apt install fossil".
  4. You need a "cd ~/src/pidp8i/trunk" command before the "fossil open" command. The way you have it, the PiDP-8/I source tree will most likely end up unpacked at the top level of the user's home directory, intermixed with all their other stuff.
  5. Switching to the pi4-gpio-hack branch in the check-out directory called "trunk" is confusing. Instead of combining both the Pi <= 3 and Pi 4 cases in a single command set, I'd provide two sets of commands:

    Pi 4:

    mkdir -p ~/museum ~/src/pidp8i/trunk ~/src/pidp8i/pi4-gpio-hack
    fossil clone https://tangentsoft.com/pidp8i ~/museum/pidp8i.fossil
    cd ~/src/pidp8i/trunk
    fossil open ~/museum/pidp8i.fossil
    cd ../pi4-gpio-hack
    fossil open ~/museum/pidp8i.fossil pi4-gpio-hack
    ./configure && tools/mmake && sudo make install
    sudo reboot

    Pi <= 3:

    mkdir -p ~/museum ~/src/pidp8i/trunk
    fossil clone https://tangentsoft.com/pidp8i ~/museum/pidp8i.fossil
    cd ~/src/pidp8i/trunk
    fossil open ~/museum/pidp8i.fossil
    ./configure && tools/mmake && sudo make install
    sudo reboot

    Fossil doesn't require that the check-out directory name matches the branch name. It's just a convention to make thinking about your directory tree clearer. It lets you use "cd" to switch among branch check-outs rather than "fossil up" commands, which invalidate the build artifacts for all of the files that change when switching branches. Branch-per-checkout lets you have multiple independent working states with minimal rebuild times when switching among them.

    The double-open in the Pi 4 case isn't strictly necessary, but it does let the user "cd ../trunk" when they later want to switch to the trunk branch without throwing away the state they built up in the pi4-gpio-hack check-out directory, That's the whole point of multiple checkouts, which is one of many improvements in Fossil relative to Git.

Tom Lake

unread,
Aug 17, 2019, 2:27:59 AM8/17/19
to PiDP-8
When I try to follow your instructions, I get the following and nothing in trunk

pi@PiDP-8:~ $ mkdir -p ~/museum ~/src/pidp8i/trunk ~/src/pidp8i/pi4-gpio-hack
pi@PiDP-8:~ $ fossil clone https://tangentsoft.com/pidp8i ~/museum/pidp8i.fossil
Round-trips: 4   Artifacts sent: 0  received: 7513
Clone done, sent: 1070  received: 17397984  ip: 2.0.1.187
Rebuilding repository meta-data...
  100.0% complete...
Extra delta compression... 
Vacuuming the database... 
project-id: 9c3b901a7270b5644096a9f3bf5ce7ac6a7303d1
server-id:  d69af2d466f324cc5e123ddb9c23cdcdedc45116
admin-user: pi (password is "542619")
pi@PiDP-8:~ $ cd ~/src/pidp8i/trunk
pi@PiDP-8:~/src/pidp8i/trunk $ fossil open ~/museum/pidp8i.fossil
WARNING: The repository database has been replaced by a clone.
Bisect history and undo have been lost.
already within an open tree rooted at /home/pi/
pi@PiDP-8:~/src/pidp8i/trunk $ cd ../pi4-gpio-hack
pi@PiDP-8:~/src/pidp8i/pi4-gpio-hack $ fossil open ~/museum/pidp8i.fossil pi4-gpio-hack
already within an open tree rooted at /home/pi/
pi@PiDP-8:~/src/pidp8i/pi4-gpio-hack $ ls
pi@PiDP-8:~/src/pidp8i/pi4-gpio-hack $ 

Warren Young

unread,
Aug 17, 2019, 3:03:28 AM8/17/19
to PiDP-8
On Saturday, August 17, 2019 at 12:27:59 AM UTC-6, Tom Lake wrote:
pi@PiDP-8:~/src/pidp8i/trunk $ fossil open ~/museum/pidp8i.fossil
WARNING: The repository database has been replaced by a clone.

This is telling you that you already had a clone and you just overwrote it. Fossil didn't prevent you from doing that because it's not necessarily wrong. In this case, it's just inefficient. From an end-user's perspective like yours, the rule is simple: you only need to clone once. After that, just reuse the existing clone repo.

To update your existing clone, cd into one of the check-out directories and say "fossil up", as in "update". (You can also spell it out if you prefer. Fossil lets you abbreviate commands to the shortest unambiguous prefix.)

already within an open tree rooted at /home/pi/

This is the real problem, which I called out in my critique up-thread of Oscar's section 2B, my point 4. If you don't cd into the check-out directory before you open the repo, it'll get opened wherever you are at the moment, which might well be your home directory, as in this case: /home/pi.

You've got a choice:


Option 1: Continue with the Old Checkout

Simply ignore all that stuff about ~/src and mkdir and whatever in the instructions. Your check-out directory for the Fossil repo is now your home directory, so you don't need to open the clone again, you just need to switch to the branch:

$ cd 
$ fossil up pi4-gpio-hack

This option is easy, but it means you're intermixing repo check-out and build artifacts with your normal user home directory contents. You must never give the command "fossil clean" under this condition; that will delete everything in your home directory that isn't part of the PiDP-8/I project repository!


Option 2: Clean Up the Mess and Restart

$ cd
$ fossil close -f
$ cd ~/src/pidp8i/pi4-gpio-hack
$ fossil open ~/museum/pidp8i.fossil pi4-gpio-hack
$ find . -depth -exec rm -f ~/{} \;

The "find" command at the end is optional. It removes the unwanted home dir check-out files without removing anything else. It isn't a complete clean-up; it'll leave behind build artifacts and such. You can skip it. The real fix is the "fossil close -f" step.

Now you can continue with my instructions above following the "fossil open" step.

Tom Lake

unread,
Aug 17, 2019, 4:16:49 AM8/17/19
to PiDP-8
I had a problem with Rasbian so I reimaged the SD card. Then, of course, your instructions worked perfectly. Thanks!

Tom L

Warren Young

unread,
Aug 17, 2019, 7:23:13 PM8/17/19
to PiDP-8
Would those of you trying this out update to the new pi4-gpio-clean branch? This is a merger of the trunk and pi4-gpio-hack versions with the hacky parts of the old branch being replaced with the nicer GPIO peripheral address detection code from trunk.

Before you do this, you will want to update your host OS's packages, because the change was only published recently.

$ sudo apt update && sudo apt upgrade
$ sudo apt install libraspberrypi-dev            # might already be installed
$ cd ~/src/pidp8i/pi4-gpio-hack
$ fossil up
$ mkdir ../pi4-gpio-clean
$ cd ../pi4-gpio-clean
$ fossil open ~/museum/pidpi8.fossil pi4-gpio-clean
$ ./configure --with-your-favorite-flags
$ tools/mmake && sudo make install

Those of you using the single ~/pidp8i directory scheme can just update to the new branch in place. This shows the advantage of branch-per-checkout: if this new branch doesn't work out, you can just "cd ../pi4-gpio-hack" and "sudo make install" to restore the working version without recompiling anything. The cost is some SD card space, but we've got plenty of space even on a 2GB card, the smallest we bother trying to work with any more.

Tom Lake

unread,
Aug 27, 2019, 10:09:02 PM8/27/19
to PiDP-8
I just tried Option 2B again and get a 404 error. Have the filenames changed?

Tom L

On Wednesday, August 14, 2019 at 6:13:50 PM UTC-4, Obsolescence wrote:

Warren Young

unread,
Aug 28, 2019, 1:05:59 AM8/28/19
to PiDP-8
On Tuesday, August 27, 2019 at 8:09:02 PM UTC-6, Tom Lake wrote:
I just tried Option 2B again and get a 404 error. Have the filenames changed?

There's about a dozen steps in that sequence, so it would help if you'd say which one gives this symptom.

I'm going to make a wild guess that it's this one:  "wget https://tangentsoft.com/pidp8i/uv/fossil-2.8-raspbian-9.6-stretch"  If so, then that's why my version above uses "sudo apt install fossil" instead. That file is unnecessary since Buster includes a much newer version of Fossil.
Reply all
Reply to author
Forward
0 new messages