October 31, 2023

Let's learn USB! -- Papoon

Papoon USB is a USB stack written for the STM32F103 in C++. I gave up on it the first time around, then returned about a week later for a second look. My idea was to try building it, and if I managed to build something that might run, to try running it on a blue pill. I am curious to find out if the issue of the wrong resistor value on USBDP will actually cause enumeration problems.

But that aside, Papoon looks like nice code. I cringe at C++, but the author makes some statements that reassure me. He says that the C++ crowd will hate him for not doing fully Object oriented programming, which to me sounds great.

Give it a try

He has just one plain and simple Makefile in the "examples/blue_pill" directory, so:
cd papoon_usb/examples/blue_pill
make
This fails because CXX is undefined and defaults to the host system "g++" command. I am running on an x86 host, so this clearly won't work. He also uses plain CC to compile some things, which will have the same problem.

I try adding these lines to the makefile:

TOOLS = arm-none-eabi
CC = $(TOOLS)-gcc
CXX = $(TOOLS)-g++
Now I get a long list of missing references at link time for these things:
_exit, _kill, _getpid, _sbrk
These are things that would be expected on a linux system, but not an embedded system.

Now this becomes an unwanted project for me, namely figuring out how to build code that includes C++ source for an embedded system. I am not willing to invest that energy.

Game over -- for me anyway. I may study this code, but it seems all but impossible to run it on a blue pill. Perhaps the writer did so, but I wish he would have included at least a description of his build environment and how he downloaded the code.

This code is clearly not complete. It would need to be studied and integrated into a system. Take for example the routine "interrupt_handler()" -- who should call this? If you look in the README, he says, "client code must implement an ARM NVIC interrupt handler". So papoon is just a chunk off of a complete system and you need to supply the rest.


Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]