piStorm – Getting started

In this guide, I explain how I set up the piStorm, beginning from a fresh board (with just the pins and pi header soldered onto it) until it starts up the Kickstart “insert disk” screen. This is not the only way to do things, and necessarily not the best way, it’s my way 🙂

Pi setup

Use the official Raspberry Pi Imager or a third party tool like BalenaEtcher to write the Lite version of Raspberry Pi OS to a SD-card and start up the pi
Using raspi-config, set wifi-credentials (System Options) and activate SSH (Interface Options).
(everything except the basic installation can be done without network connectivity, but it is easier to do it over SSH than at the terminal)

sudo su -
apt -y update
apt -y upgrade

Updating will take about 10 minutes. Usually a reboot is recommended here, but in this case not necessary, so continue with the section below and install some packages and test the GPIOs.

Install required packages

apt -y install git
apt -y install libsdl2-dev
apt -y install openocd
exit

Testing your Pi’s GPIO pins

Testing your Pi’s GPIO pins. This MUST be run disconnected from the PiStorm, just power up the Pi with USB and do it outside the Amiga entirely.
Info from https://www.raspberrypi.org/forums/viewtopic.php?t=180505

sudo apt -y install pigpio
wget http://abyz.me.uk/rpi/pigpio/code/gpiotest.zip
unzip gpiotest.zip
sudo pigpiod
./gpiotest

Expected output:

Get and build piStorm software

git clone https://github.com/captain-amygdala/pistorm.git
cd pistorm
make

Expected output:

Optional step, get and build wip-crap development version

Only build the emulator for use/test later on – skip the CPLD update for now and do that when the wip-crap build is going to be used.
piStorm – experimental stuff wip-crap

Shut down the pi

This is as far as you get without the piStorm connected, so it’s time to shut down the pi and then stuff it away until you get your piStorm (- shutdown and continue as below if you already have it).
‘pigpiod’ (for testing the GPIOs) above keeps the pi waiting for 90 sec if not killed before shutdown.

sudo killall -9 pigpiod
sudo halt -p

Update CPLD bitstream

Shut down the pi, take a look 20 pixels above :), disconnect power and connect the piStorm adapter to the GPIO

Connect power and let the pi start, check network connectivity or re-setup if necessary.

Build the program to test access to chip RAM

cd pistorm
chmod +x ./build_buptest.sh
./build_buptest.sh

For EPM240

chmod +x nprog_240.sh
./nprog_240.sh

For EPM570

chmod +x nprog.sh
./nprog.sh

Expected output (nprog.sh for EPM240):

Installing the piStorm in the Amiga

Shut down the pi, disconnect everything and separate the adapter from it.
Replace the CPU in the Amiga with the adapter board (the Pi connector should be on the left side). Align both rows of pins with the CPU socket, then, without any pressure on the board, move the adapter up and down (front and back) on the socket to feel the point in which the pins are centered in the socket.
Check that all pins go into the socket an press it down until it bottoms.

Mount the pi on the adapter with the USB port facing towards you, and the HDMI connector on the right side.

Connect the HDMI output and a keyboard.

Starting the emulator

Power on the Amiga, the pi will be powered and boot up (the output from the Amiga will be just a black screen (or any other single-colored screen, I usually get a red one before the emulator starts) until the CPU emulator is started).
Login as ‘pi’ and change directory to ‘pistorm’.

Initial check – can the piStorm read and write to the CHIP RAM ?

sudo ./buptest

Expected output:

In case of any error, check that the piStorm adapter is pressed down firmly in the CPU-socket. It should be pressed down so it bottoms (plastic on the pins touching the socket). Once fixed, re-run buptest. Repeat until zero errors are reported.

Start the emulator

sudo ./emulator

Expected output (untouched default.cfg in pistorm directory). If the kickstart file (kick.rom) for softkicking is not found it defaults to using the KS on the mainboard.

On my test computer (A500 r6) it falls back to the 3.1.4 ROM:

From here on, you can use the Amiga as any other floppy-only Amiga. I will document the features (kickstart switch, RAM, hard drive, RTG) in another post to keep these at readable length.

Autostart the emulator on system boot – the simple method

In /etc/rc.local, add before the “exit 0” line:

cd /home/pi/pistorm/ && sudo ./emulator&

Autostart the emulator on system boot – advanced method

The CPU-emulator will be started a lot earlier if adding it as a systemd service.
Become root (the ugly way):

sudo su -

Create the file “pistorm.service” in /lib/systemd/system:

[Unit]
Description=Start piStorm 68k emulator
After=local-fs.target

[Service]
ExecStart=/home/pi/start-emulator.sh

[Install]
WantedBy=local-fs.target

Create the file “start-emulator.sh” in /home/pi:

#!/bin/sh
cd /home/pi/pistorm/
sudo ./emulator
exit 0

Make “start-emulator.sh” executable:

chmod 755 /home/pi/start-emulator.sh

Reload/regenerate systemd configuration files:

systemctl daemon-reload

Enable the automatic start of the CPU-emulator:

systemctl enable pistorm.service

Now, in case you need to restart the emulator (and Amiga as well), this can be done without having to find the ’emulator’ process:

systemctl restart pistorm

Other similar guides for the piStorm

Lightning Amiga Performance With PiStorm (LinuxJedi)

5 thoughts to “piStorm – Getting started”

  1. There’s an error in the start-emulator.sh script. It’s cd’ing to the directory “/home/pi/pistorm”; however, this directory has not been created and, since it also tries to start the service from that directory, it fails.
    So it should either cd to /home/pi, or have the script pointing to a different path, such as an absolute path “/home/pi/start-emulator.sh” or with “..” etc.

    1. You were too fast 🙂
      Useful comment anyway (about the non-error in the guide), because some other people “following” my instructions has also made the same or similar mistakes. The only thing that is (or should be) incorrect in my instructions is referral to the default.cfg which is no longer named that in the files you get from GitHub. This was a change made to prevent users from having problems updating their installations and possibly overwriting their config if they kept the name.
      As you see in my guides, I put the default.cfg outside the ‘pistorm’ folder to have it protected, and in follow-up guides only have the file named that when it’s a temporary file (used with my config-switcher by shift+F-keys)

Leave a Reply

Your email address will not be published. Required fields are marked *