Download and Setup Picotool

cd ~/pi_pico
git clone -b master https://github.com/raspberrypi/picotool.git
cd picotool
mkdir build
mkdir install
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=$PICOTOOL_INSTALL_PATH
make
make install

To detect connected pico:

sudo env "PATH=$PATH" picotool info -f

To Flash:

sudo env "PATH=$PATH" picotool load <file.uf2> -f

To reboot:

sudo env "PATH=$PATH" picotool reboot

NOTE: make below modification in your app to reflash over picotool, take care of app_name

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6308572..da5ca93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,12 +3,16 @@ add_executable(app_name
     )
 
 # pull in common dependencies
-target_link_libraries(app_name)
+target_link_libraries(app_name pico_stdlib)
 
 if (PICO_CYW43_SUPPORTED)
     target_link_libraries(app_name pico_cyw43_arch_none)
 endif()
 
+# Enable USB, disable UART
+pico_enable_stdio_usb(app_name 1)
+pico_enable_stdio_uart(app_name 0)
+
 # create map/bin/hex file etc.
 pico_add_extra_outputs(app_name)
 
diff --git a/test.c b/test.c
index e588b0e..7b7b92a 100644
--- a/test.c
+++ b/test.c
@@ -42,6 +42,7 @@ void pico_test_app(bool led_on) {
 }
 
 int main() {
+       stdio_init_all();





©2023-2024 rculock.com