Issue getting set up

I am using an RPi4 with Raspbian.
I am a linux novice.
I have tried to follow what seem to me to be pretty fragmented bits of help on what to do. Most of it has come from the git repo documents and MikeRed’s thread.

I have had some success, in that I have been able to compile and run an example on the pi, the palette-cycle one.

When I moved on to send it to the 32blit, although the process said it had worked, the 32blit now only shows a blank screen and is unresponsive to any keypresses.

At that point I thought I needed to compile the firmware and load it into the 32blit to recover it. So I trawled what documentation I could find on that and eventually did the following.

From within the 32blit-stm directory:

mkdir build.stm32
cd build.stm32
cmake … -DCMAKE_TOOLCHAIN_FILE=…/32blit.toolchain

The above worked with comments but no errors.

Now to build the firmware binary.
Yes, but how and where. Tried this in firmware, in firmware/flash-loader and in the above build.stm32 dir but no luck.
After more reading I tried this.

From the firmware directory:

mkdir build
cd build
cmake …
make

This got to 97% before failing saying CDCCommandHandler.h, referenced inflash-loader.hpp, did not exist. I rooted about and found that file with a bunch of other include files in 32blit-stm32/Inc.

But now I am stuck. My limited Linux experience means I don’t know what is wrong causing the compiler not to be able to find the “missing” h file(s).

I think for my level, there needs to be a simple guide that doesn’t assume any knowledge of how cmake and make work etc. Anyway, If anyone has any pointers they would be most welcome.

After some very patient tutoring from jon and Daft_Freak on discord I got my 32blit flashed with the latest firmware.
Some of my problem was missing the pip3 install 32blit.
Some of it was the fact that doing what I had done in my first post was overwrite the device firmware with the demo binary I had flashed over.
And some of it was/is my noobiness with all things Linux.

Afterwards I wrote up some notes, nuked my 32Blit-beta directory and started again.
Consequently I believe these to be the correct steps for me on my RPi Raspbian OS.

First install the required tools:
sudo apt install git gcc g++ gcc-arm-none-eabi cmake make python3 python3-pip libsdl2-dev libsdl2-image-dev
pip3 install construct bitstring
pip3 install 32blit

Grab the 32blit repo
git clone https://github.com/pimoroni/32blit-beta

From the root of the repository prepare cmake to target 32Blit:
From the 32blit-beta dir

mkdir build.stm32
cd build.stm32
cmake … -DCMAKE_TOOLCHAIN_FILE=…/32blit.toolchain

then, still in the build.stm32 dir, either make an individual binary, eg:

make flash-loader

or all of them with just:

make

I was then able to flash the firmware.
From the 32blit-beta/build.stm32/firmware/flash-loader dir, and with the 32blit connected by usb cable and in DFU mode (hold x,y and reset down)
sudo dfu-util -a 0 -s 0x08000000 -D flash-loader.bin

Finally, this snippet of a conversation with jon has greatly helped me understand the architecture.

“there are three possible locations on 32blit, the SD card, the internal flash of the MCU, and the external 32MB QSPI flash
our “normal” setup is to have the firmware in the internal flash, then the firmware acts as the “loader” to copy new things to the SD card (though you can copy them as just a normal disk too)
when you launch a program from the SD card, the firmware will copy it into the external flash to run”

1 Like