Propeller hat with propgcc produced binaries


#1

hey there,

happy propeller hat user here. Things work with openspin and p1load as advertised - I can run SPIN and obviously through that PASM programs.

However, I would like to code in propeller gcc. Installing SimpleIDE on my PI2 worked without a hitch, I get propeller-elf-gcc, and can use it to code.

But the problem is the resulting output-file. It’s not a binary as the ones generated by openspin. SimpleIDE comes with it’s own propeller-load - but that refuses to work, probably because it assumes the FTDI-based propeller USB connector.

Any suggestions on how to continue?


#2

It’s been a while since I used it, but you should find a “.binary” file alongside the “.elf” one in SimpleIDE’s output folder within your project.

With a bit of bash script wrapper magic, you should be able to trick SimpleIDE into using propterm to upload code. This is something I had set up waaay back when I was tinkering with SimpleIDE. I’ll install SimpleIDE and see if I can make it work again.

Edit: This is the dirtiest code ever, but if you move /opt/parallax/bin/propeller-load to /opt/parallax/bin/propeller-load-orig and create a new file called /opt/parallax/bin/propeller-load with these contents, and set as executable ( chmod +x ) then it should upload:

#!/bin/bash

NAME=$0
LDR_DIR_SW=$1
LDR_DIR=$2

if [ "$LDR_DIR_SW" == "-s" ]; then
        echo "Making .binary"
        /opt/parallax/bin/propeller-load-orig -s $2
        exit 0;
fi

BOARD_TYPE_SW=$3
BOARD_TYPE=$4
FILE=$5
FILE="${FILE/\.elf/\.binary}"

echo $FILE

propman $FILE

It looks like SimpleIDE does two called to propeller-load, the first is something like propeller-load -s MyProject.elf which causes propeller-load to output a binary file. This script attempts to trap that call and route it accordingly.

Any attempts to upload are then routed to propman. This is a very naive implementation that will break easily, but it appears to work for me.

The second challenge is getting the right config. I created a file at /opt/parallax/propeller-load/propellerhat.cfg with the following contents:

  # Propeller HAT configuration.
  # IDE:SDXMMC
       clkfreq: 96000000
       clkmode: XTAL1+PLL16X
       baudrate: 115200
       rxpin: 31
       txpin: 30