fix picotool installation

This commit is contained in:
rmanach 2025-02-26 10:34:09 +01:00
parent cd5459dac6
commit 0db9d21ec6
6 changed files with 32 additions and 5 deletions

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ build
toolchain
*.orig
*.debug
*.debug
*.swp

View File

@ -1,12 +1,13 @@
export INSTALL_PATH := $(PWD)
SDK_VERSION := 2.1.0
PICOTOOL := $(INSTALL_PATH)/picotool/$(SDK_VERSION)/build/picotool
export PICOTOOL_PATH=$(INSTALL_PATH)/picotool/$(SDK_VERSION)/build
export PICO_SDK_PATH=$(INSTALL_PATH)/sdk/$(SDK_VERSION)
# if using a different platform or arch, set it here
export PICO_PLATFORM=rp2350
picotool = ${PICOTOOL_PATH}/picotool
# project name, need to be passed as make input (ex: make project name=test)
name := ""
@ -37,16 +38,16 @@ endif
@./scripts/scaffold_project.bash $(name) $(SDK_VERSION)
format: .check-name
@test -f "$(shell find /usr/bin/ -name astyle)" && astyle --style=java --indent=spaces=4 -K -xC120 $(name)/*.c
@(test -f "$(shell find /usr/bin/ -name astyle)" && astyle --style=java --indent=spaces=4 -K -xC120 $(name)/*.c) || echo "astyle bin formatter not found, skip it"
run-debug: format
@rm -f ${name}/${name}.debug
@gcc -std=c99 -o2 ${name}/*.c -lm -o ${name}/${name}.debug && ./${name}/${name}.debug
compile: format
rm -f ${name}/build/CMakeCache.txt
@rm -f ${name}/build/CMakeCache.txt
@(test -d ${name} && mkdir -p ${name}/build && cd ${name}/build && cmake .. && make -j$(nproc) && echo "project compile successfully") || echo "error: unable to compile project: $(name)"
push: compile
@(test -f $(name)/build/$(name).elf && $(PICOTOOL) load -fx -v $(name)/build/$(name).elf) || echo "error: unable to push project $(name) to device"
@(test -f $(name)/build/$(name).elf && $(picotool) load -fx -v $(name)/build/$(name).elf) || echo "error: unable to push project $(name) to device"

View File

@ -11,6 +11,12 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(bit_counter C CXX ASM)
# force picotool executable path
add_executable(picotool IMPORTED GLOBAL)
set_target_properties(picotool PROPERTIES
IMPORTED_LOCATION "$(PICOTOOL_PATH)/picotool"
)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()

View File

@ -11,6 +11,13 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(breathing_led C CXX ASM)
# force picotool executable path
add_executable(picotool IMPORTED GLOBAL)
set_target_properties(picotool PROPERTIES
IMPORTED_LOCATION "$(PICOTOOL_PATH)/picotool"
)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()

View File

@ -10,6 +10,12 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(simple_led C CXX ASM)
# force picotool executable path
add_executable(picotool IMPORTED GLOBAL)
set_target_properties(picotool PROPERTIES
IMPORTED_LOCATION "$(PICOTOOL_PATH)/picotool"
)
pico_sdk_init()
set(FREERTOS_SRC_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../freertos)

View File

@ -11,6 +11,12 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(<project_name> C CXX ASM)
# force picotool executable path
add_executable(picotool IMPORTED GLOBAL)
set_target_properties(picotool PROPERTIES
IMPORTED_LOCATION "$(PICOTOOL_PATH)/picotool"
)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()