Skip to content

Setting Up RaspberryPi and Linux Hosted CPC Development Environments

revaldinho edited this page Nov 17, 2019 · 1 revision

Instructions are provided here for setting up development areas on an Ubuntu Linux machine, to compile C code and assembler libraries for the CPC, and a RaspberryPi, to act as a co-processor.

Setting Up a Dev Environment Hosted on Linux for the CPC

Cloning the CPC-CPlink GitHub Area

Clone this GitHub area from https://github.com/revaldinho/cpc-cplink/wiki

git clone https://github.com/revaldinho/cpc-cplink.git

This will install all code into a cpc-cplink/ directory.

All the software examples are in cpc-cplink/sw/examples

Setting up CPCTelera (SDCC)

On Ubuntu 18.04 - install build environment for C coding (all done from xterm console)

  1. Install Mono from https://www.mono-project.com/download/stable/#download-lin following their instructions

Ensure you "sudo apt install mono-complete"

  1. Go to https://lronaldo.github.io/cpctelera/files/readme-txt.html#Installing_CPCtelera to install CPCtelera which includes an environment to build with SDCC c compiler.

Install the following:

sudo apt-get install build-essential
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install libboost-dev
sudo apt-get install libfreeimage-dev
sudo apt-get install git
  1. Clone the github repo for cpctelera
git clone https://github.com/lronaldo/cpctelera
cd cpctelera/
./setup.sh

Shut and open a new terminal to pickup changes.

  1. Test your installation by compiling the loopback example
cd cpclink/sw/examples/loopback/cpc_cpct/fifo
make

You have just built the cpc c program with assembly fifo routines.

The CPC binary is in obj/fifo.bin. A CDT (tape image) and DSK (disk image) file are created in the current directory. Transfer any of these to the CPC and unpack as required.

NB the obj/fifo.bin does not have an AMSDOS header. If using Duke's M4 card to upload/download files directy, then use his cpcxfer utility to add the necessary header:

xfer -u <ip-addr-of-your-M4-card> obj/fifo.bin dev/cpctel 2 0x4000 0x4000

Setting up a Raspberry Pi C Environment

Setting up GCC + WiringPi

On a raspberry pi (done using buster-lite on a pi4). I use mine headless with ssh enabled over wifi.

  1. Install the following:
sudo apt-get install git
sudo apt-get install wiringpi
  1. Again, clone the GitHub repository onto the Pi.
git clone https://github.com/revaldinho/cpc-cplink.git
cd cpclink/sw/examples/loopback/rpi_c

Type make to see the loopback c test program compile.

You should have loopback_wpi binary ready to run - run it at the command line and run fifo.bin on the CPC

RaspberryPi> ./loopback_wpi
AmstradCPC>  RUN "FIFO.BIN

Setting up a Python2 and Python3 Environment with WiringPi

  1. Install the following:
sudo apt-get install python-dev
sudo apt-get install python3-dev
  1. To install the wiringPi library for the Python examples
sudo pip install wiringpi
sudo pip3 install wiringpi
  1. Run the example code.
cd cpclink/sw/examples/loopback/rpi_python

RaspberryPi>  python loopback_wpi.py
AmstradCPC>   RUN "FIFO.BIN

Acknowlegement

Thanks to Shifters74 for providing this HowTo.