Skip to content

picotool incompatible with SDK #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eroom1966 opened this issue Jun 4, 2025 · 14 comments
Closed

picotool incompatible with SDK #51

eroom1966 opened this issue Jun 4, 2025 · 14 comments

Comments

@eroom1966
Copy link

Hi All

Installing via this script works perfectly
But when trying to build the entire set of examples there is a failure at this point when building hello_serial_enc for a target of rp2350

the commands I submitted were

mkdir -p build
pushd build
  cmake -DPICO_PLATFORM=rp2350 ${PICO_EXAMPLES_PATH}
  make
popd

the error

ERROR: This picotool version (2.1.2-develop) is not compatible with SDK versions <=2.1.1 - you must manually build & install picotool version 2.1.1 to use those SDK versions with encryption
bootloaders/encrypted/CMakeFiles/hello_serial_enc.dir/build.make:969: recipe for target 'bootloaders/encrypted/hello_serial_enc.elf' failed
make[2]: *** [bootloaders/encrypted/hello_serial_enc.elf] Error 255
make[2]: *** Deleting file 'bootloaders/encrypted/hello_serial_enc.elf'
CMakeFiles/Makefile2:6655: recipe for target 'bootloaders/encrypted/CMakeFiles/hello_serial_enc.dir/all' failed
make[1]: *** [bootloaders/encrypted/CMakeFiles/hello_serial_enc.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

Interestingly, there was a warning earlier in the process, which indicates that there is no available picotool 2.1.1

Build type is Release
CMake Warning at /home/USER/pi-pico/pico/pico-sdk/tools/Findpicotool.cmake:30 (message):
  No installed picotool with version 2.1.1 found - building from source

  It is recommended to build and install picotool separately, or to set
  PICOTOOL_FETCH_FROM_GIT_PATH to a common directory for all your SDK
  projects
Call Stack (most recent call first):
  /home/USER/pi-pico/pico/pico-sdk/tools/CMakeLists.txt:138 (find_package)
  /home/USER/pi-pico/pico/pico-sdk/src/cmake/on_device.cmake:34 (pico_init_picotool)
  /home/USER/pi-pico/pico/pico-sdk/src/rp2350/boot_stage2/CMakeLists.txt:57 (pico_add_dis_output)
  /home/USER/pi-pico/pico/pico-sdk/src/rp2350/boot_stage2/CMakeLists.txt:98 (pico_define_boot_stage2)

how can I fix this ?

@eroom1966
Copy link
Author

Update:
If I run with 'bootloaders' commented out from the CMakeList.txt, all examples build to completion

@lurch
Copy link
Contributor

lurch commented Jun 4, 2025

@will-v-pi This script checks out the master branch of pico-sdk and pico-examples, so to keep things "compatible" perhaps it also ought to check out the master branch of picotool?

@will-v-pi
Copy link
Contributor

will-v-pi commented Jun 4, 2025

This is a known bug in the 2.1.0 and 2.1.1 SDK releases (raspberrypi/pico-sdk#2401) - as the error message states, the fix is to install picotool 2.1.1 separately, which is fixed by #43

@lurch
Copy link
Contributor

lurch commented Jun 4, 2025

Closing as duplicate of #43

@lurch lurch closed this as completed Jun 4, 2025
@eroom1966
Copy link
Author

This is a known bug in the 2.1.0 and 2.1.1 SDK releases (raspberrypi/pico-sdk#2401) - as the error message states, the fix is to install picotool 2.1.1 separately, which is fixed by #43

This is useful.
I can checkout and build the picotool in my tree somewhere
but, how do I stop the examples make process from attempting to download and build its own copy ?
do I just ensure that picotool is in the searchpath ?
I am not sure how the decision is made to download a version of picotool or not

@lurch
Copy link
Contributor

lurch commented Jun 4, 2025

@eroom1966
Copy link
Author

eroom1966 commented Jun 4, 2025

@lurch apologies if I appear a little naive :-/
I already have picotool version 2.1.1 built and installed in /usr/local/bin

My problem is that when building the sdk examples, it downloads and builds its own local copy (version 2.1.2-develop)
How do I stop it from doing that, and instead use the version I already installed in /usr/local/bin
Thx

UPDATE : aah you posted a link above, let me take a look

@eroom1966
Copy link
Author

eroom1966 commented Jun 4, 2025

@lurch
OK to clarify, I have picotool version 2.1.1 installed at /usr/local/bin/picotool
I can find no way of telling the build system to use this in preference to downloading a local copy, I have tried setting the following environment variables, or command line options

option 1

export picotool_DIR=/usr/local/bin
cmake -DPICO_PLATFORM=rp2350 ${PICO_EXAMPLES_PATH}

option 2

export picotool_INSTALL_DIR=/usr/local/bin
cmake -DPICO_PLATFORM=rp2350 ${PICO_EXAMPLES_PATH}

option 3 (directly to cmake)

cmake -Dpicotool_DIR=/usr/local/bin -DPICO_PLATFORM=rp2350 ${PICO_EXAMPLES_PATH}

None of these options seem to stop the downloading of a newer version of picotool, very confused as to what I am doing wrong here, but in all cases I get

CMake Warning at /home/USER/pi-pico/pico/pico-sdk/tools/Findpicotool.cmake:30 (message):
  No installed picotool with version 2.1.1 found - building from source

  It is recommended to build and install picotool separately, or to set
  PICOTOOL_FETCH_FROM_GIT_PATH to a common directory for all your SDK
  projects
Call Stack (most recent call first):
  /home/USER/pi-pico/pico/pico-sdk/tools/CMakeLists.txt:138 (find_package)
  /home/USER/pi-pico/pico/pico-sdk/src/cmake/on_device.cmake:34 (pico_init_picotool)
  /home/USER/pi-pico/pico/pico-sdk/src/rp2350/boot_stage2/CMakeLists.txt:57 (pico_add_dis_output)
  /home/USER/pi-pico/pico/pico-sdk/src/rp2350/boot_stage2/CMakeLists.txt:98 (pico_define_boot_stage2)

to test it is correct

/usr/local/bin/picotool version
picotool v2.1.1 (Linux, GNU-7.5.0, Release)

I should also add, I have a built version of picotool(2.1.1) here
/home/USER/pi-pico/pico/picotool
executable is here /home/USER/pi-pico/pico/picotool/build/picotool

All I need to know, is how to direct the build system to use this version of picotool, but it seems to ignore the variables from above ?

@will-v-pi
Copy link
Contributor

Just to confirm, when you built & installed picotool, did you definitely follow the instructions (ie use sudo make install or similar)? And did you delete your pico-examples build directory afterwards?

You should have these additional files installed, which are the files the SDK actually searches for

/usr/local/lib/cmake/picotool/picotoolTargets.cmake
/usr/local/lib/cmake/picotool/picotoolTargets-release.cmake
/usr/local/lib/cmake/picotool/picotoolConfig.cmake
/usr/local/lib/cmake/picotool/picotoolConfigVersion.cmake

Do not use any of your three options - the picotool_DIR variable should not need setting for a normal install, it only needs to be set when you install it in a custom location using the -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR -DPICOTOOL_FLAT_INSTALL=1 arguments. If it's still not finding your picotool, you can pass --debug-find-pkg=picotool to your cmake command, and it will print the paths it searches:

find_package considered the following locations for picotool's Config
  module:

    ...

    /usr/local/picotoolConfig.cmake
    /usr/local/picotool-config.cmake
    /usr/local/lib/cmake/picotool/picotoolConfig.cmake

  The file was found at

    /usr/local/lib/cmake/picotool/picotoolConfig.cmake

@eroom1966
Copy link
Author

@will-v-pi forgive me - I am not quite correct in what I am saying, picotool was actually downloaded and built by the pico-setup.sh script itself, but it looks like it does not do a "make install" it just copies the binary file itself, so the files you describe above would not exist.

# Debugprobe and picotool
for REPO in debugprobe picotool
do
    DEST="$OUTDIR/$REPO"
    REPO_URL="${GITHUB_PREFIX}${REPO}${GITHUB_SUFFIX}"
    git clone $REPO_URL

    # Build both
    cd $DEST
    git submodule update --init
    mkdir build
    cd build
    cmake ../
    make -j$JNUM

    if [[ "$REPO" == "picotool" ]]; then
        echo "Installing picotool to /usr/local/bin/picotool"
        sudo cp picotool /usr/local/bin/
    fi

    cd $OUTDIR
done

in which case should my actual flow be as follows ?

  1. build install picotool (version 2.1.1)
  2. run the pico-setup.sh script

@will-v-pi
Copy link
Contributor

Yep, that's the bug in pico_setup.sh which is fixed by #43, so you should use the pico_setup.sh from that PR until it's merged

@eroom1966
Copy link
Author

OK, I went back the folder that pico-setup.sh downloaded and built picotool and issued
sudo make install
this seems to have fixed my issue, is this the same as #43 ?

@will-v-pi
Copy link
Contributor

Yes

@lurch
Copy link
Contributor

lurch commented Jun 4, 2025

@will-v-pi This script checks out the master branch of pico-sdk and pico-examples, so to keep things "compatible" perhaps it also ought to check out the master branch of picotool?

See #52 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants