Self-answering, here's a proposed solution:
1. Create a Windows "system" environment variable on the PC, called PICOTOOL_OVERRIDE_DIR and set to (say) C:/development/pico/win_tools/picotool if you have a folder C:/development/pico/win_tools/picotool which contains the picotool.exe file that you desire to be used.
2. Edit the pico-sdk\tools\FindPicotool.cmake file, and insert the following, near the top of the file, immediately after the cmake_minimum_required(VERSION 3.17) line:
Now everything works with the normal cmake -G "NMake Makefiles" .. command.
Then I did a build, and successfully saw the .uf2 file created.
I'll submit this as a PR, in case it gets accepted. It's not pretty, but at least it's benign if that PICOTOOL_OVERRIDE_DIR system env var is not set, so it shouldn't break anything for anyone who doesn't wish to use this override method.
1. Create a Windows "system" environment variable on the PC, called PICOTOOL_OVERRIDE_DIR and set to (say) C:/development/pico/win_tools/picotool if you have a folder C:/development/pico/win_tools/picotool which contains the picotool.exe file that you desire to be used.
2. Edit the pico-sdk\tools\FindPicotool.cmake file, and insert the following, near the top of the file, immediately after the cmake_minimum_required(VERSION 3.17) line:
Code:
# if PICOTOOL_OVERRIDE_DIR system environment variable is set,# then use that as the folder for the picotool executableif (DEFINED ENV{PICOTOOL_OVERRIDE_DIR}) message("PICOTOOL_OVERRIDE_DIR env var is set to '$ENV{PICOTOOL_OVERRIDE_DIR}'") add_executable(picotool IMPORTED GLOBAL) set_property(TARGET picotool PROPERTY IMPORTED_LOCATION $ENV{PICOTOOL_OVERRIDE_DIR}/picotool) # check the picotool version: execute_process(COMMAND $ENV{PICOTOOL_OVERRIDE_DIR}/picotool version OUTPUT_VARIABLE PICOTOOL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "^picotool v${picotool_VERSION_REQUIRED}" PICOTOOL_VERSION_MATCH ${PICOTOOL_VERSION}) if (NOT PICOTOOL_VERSION_MATCH) message("picotool version response was: ${PICOTOOL_VERSION}") message(FATAL_ERROR "PICOTOOL_OVERRIDE_DIR is set to '$ENV{PICOTOOL_OVERRIDE_DIR}', but the version of picotool found is not ${picotool_VERSION_REQUIRED}") endif()endif ()
Then I did a build, and successfully saw the .uf2 file created.
I'll submit this as a PR, in case it gets accepted. It's not pretty, but at least it's benign if that PICOTOOL_OVERRIDE_DIR system env var is not set, so it shouldn't break anything for anyone who doesn't wish to use this override method.
Statistics: Posted by shabaz — Wed Aug 14, 2024 4:52 pm