Using the BOOTSEL button as an input for the Pico.


Instructions

Usually we can’t use BOOTSEL as a regular button. The reason for this is it is connected the Pico’s builtin flash’ chip select pin. This means that if the Pico wants to read the state of the button, it needs to suspend accessing the flash memory. This means code has to be run from RAM and not flash.

Open bootsel-button.cpp and run it. When you press the BOOTSEL button, the builtin LED turns on.

Notice how in the code, functions are annotated with __no_inline_not_in_flash_func, which means that the function gets run from RAM and not flash.

This technique is quite cursed and not recommended unless you have a very good reason for an additional button.