#4770·tock

When building app for RPi Pico I get the error: "ELF contains memory contents for uninitialized memory at 20000000"

Author: potto216Created Apr 1, 2026Updated Sep 8, 2026

When building app for RPi Pico I get the error: "ELF contains memory contents for uninitialized memory at 20000000". An example is:

bash
(tools) user@rpi05-dev001:~/tockos/tock/boards/raspberry_pi_pico $ APP=/home/user/tockos/libtock-rs/target/raspberry_pi_pico/thumbv6m-none-eabi/release/examples/spi_controller_write_read.tbf  make program
    Finished `release` profile [optimized + debuginfo] target(s) in 0.12s
   text    data     bss     dec     hex filename
  98348       0   14364  112712   1b848 /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico
arm-none-eabi-objcopy --set-section-flags .apps=LOAD,ALLOC /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico.elf /home/user/tockos/tock//target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf
arm-none-eabi-objcopy: /home/user/tockos/tock//target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf: section .relocate lma 0x20000000 adjusted to 0x20001500
arm-none-eabi-objcopy --update-section .apps=/home/user/tockos/libtock-rs/target/raspberry_pi_pico/thumbv6m-none-eabi/release/examples/spi_controller_write_read.tbf /home/user/tockos/tock//target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf
elf2uf2-rs /home/user/tockos/tock//target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.uf2
Error: "ELF contains memory contents for uninitialized memory at 20000000"
make: *** [Makefile:48: program] Error 1

Gemini suggested root cause of elf2uf2-rs tool's error message "uninitialized memory at 20000000" is that the elf2uf2-rs utility is designed to create a flashable image and does not deal with RAM which starts at 0x20000000 on the Raspberry Pi Pico.

Its suggested solution worked for me, which is:

bash
APP=/home/user/tockos/libtock-rs/target/raspberry_pi_pico/thumbv6m-none-eabi/release/examples/spi_controller_write_read.tbf make /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf

arm-none-eabi-objcopy -R .stack -R .relocate -R .bss /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf

elf2uf2-rs /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.elf /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.uf2

cp /home/user/tockos/tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico-app.uf2 /media/user/RPI-RP2/

Then I was able to verify the application ran with tockloader listen --board raspberry_pi_pico --openocd