Upload firmware on ATmega1284P/ATmega32u2

I have a Goldilocks board (v1.1, not the latest Analogue). I am trying to upload the latest firmware (22 MHz overclock) with avrdude. I downloaded the board profile from here and from here (with same result).

I am following the instructions from the repository. I am using an Arduino Uno r3 as programmer.

I connected the Arduino Uno to the 32u2 ICSP pins and ran:

avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p atmega32u2 -Uflash:w:BootloaderDFU.hex:a -Ulfuse:w:0xdf:m -Uhfuse:w:0xd9:m -Uefuse:w:0xf0:m -Ulock:w:0x0f:m
avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p m32u2 -Uflash:w:U2duino.hex:a -D -Ulock:w:0x0f:m

The bootloader and software uploads fine. However, in the instructions it says to use "-Ulock:w:0xcf:m", but this gives verification error. It might be one of the cause why it does not work, although I read in some post that it doesn't matter.

I connected the Arduino to the 1284p ICSP pins and ran:

avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p m1284p -u -Uflash:w:stk500boot_v2_goldilocks_22.hex:a -Ulfuse:w:0xd7:m -Uhfuse:w:0xd8:m -Uefuse:w:0xfc:m -Ulock:w:0x0f:m

Again, it uploads fine.

However, when I select the "Goldilocks 22Mhz" board and I am trying to upload a sketch, it does not work.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
An error occured while uploading the sketch

Am I missing something/doing anything wrong? Any help would be greatly appreciated.