MicroBlaze PID Firmware on PYNQ-Z2: Compiling with PMODB BSP

Hello PYNQ community,

I am working on a MicroBlaze-based PID controller for a drone on the PYNQ-Z2 board. My setup involves:

  • A custom MicroBlaze project (pid_mb.c) that reads an MPU sensor via I²C and controls motors using a PCA9685 via a PMOD.

  • Python control code using pynq.lib.MicroblazeLibrary to communicate with the firmware.

  • I intend to use PMODB in my Python code as the hardware interface.

What I am trying to achieve:

  • Compile the pid_mb.c firmware using the MicroBlaze toolchain.

  • Run the firmware on the PYNQ-Z2.

  • Control the drone’s motors through PMODB using Python.

The issue I am encountering:

  • The BSP on the board is only for PMODA (bsp_iop_pmod/iop_pmoda_mb). There is no bsp_iop_pmod/iop_pmodb_mb

  • In my makefile, to build My project I want to use PMODB(bsp_iop_pmod/iop_pmodb_mb) :

pid_mb.elf: $(OBJS) ../src/lscript.ld $(USER_OBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: MicroBlaze gcc linker'
	mb-gcc -Wl,-gc-sections \
	       -Wl,-T ../src/lscript.ld \
	       -L../../bsp_iop_pmod/iop_pmodb_mb/lib \
	       -mlittle-endian -mcpu=v11.0 -mxl-soft-mul \
	       -Wl,--no-relax \
	       -o "pid_mb.elf" $(OBJS) $(USER_OBJS) $(LIBS)
	@echo 'Finished building target: $@'
	@echo ' '
  • But Im getting this error because it does not exist:
xilinx@pynq:~/pynq/lib/pmod$ make
cd pid_mb/Debug && make clean && make

make[1]: Entering directory '/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/pmod/pid_mb/Debug'
rm -rf ./src/pid_mb.o ./src/pid_mb.d pid_mb.elf.size pid_mb.elf pid_mb.bin
make[1]: Leaving directory '/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/pmod/pid_mb/Debug'

make[1]: Entering directory '/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/pmod/pid_mb/Debug'

Building file: ../src/pid_mb.c
Invoking: MicroBlaze gcc compiler
mb-gcc -Wall -O0 -g3 -c -fmessage-length=0 \
       -MT "src/pid_mb.o" \
       -I ../../bsp_iop_pmod/iop_pmoda_mb/include \
       -mlittle-endian -mcpu=v11.0 -mxl-soft-mul -Wl,--no-relax \
       -MMD -MP -MF "src/pid_mb.d" -MT "src/pid_mb.d" \
       -o "src/pid_mb.o" "../src/pid_mb.c"

Finished building: ../src/pid_mb.c

Building target: pid_mb.elf
Invoking: MicroBlaze gcc linker
mb-gcc -Wl,-gc-sections \
       -Wl,-T ../src/lscript.ld \
       -L ../../bsp_iop_pmod/iop_pmodb_mb/lib \
       -mlittle-endian -mcpu=v11.0 -mxl-soft-mul \
       -Wl,--no-relax \
       -o "pid_mb.elf" ./src/pid_mb.o \
       -Wl,--start-group,-lxil,-lgcc,-lc,--end-group

/opt/microblazeel-xilinx-elf/bin/../lib/gcc/microblazeel-xilinx-elf/9.2.0/../../../../microblazeel-xilinx-elf/bin/ld: cannot find -lxil
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:40: pid_mb.elf] Error 1
make[1]: Leaving directory '/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/pmod/pid_mb/Debug'

make: *** [makefile:38: pid_mb.bin] Error 2

So my question would be Is there a way to create or obtain a PMODB BSP for PYNQ-Z2 so I can compile the firmware to work with PMODB?