masking/removing machine.bootloader()
#18798
-
|
I have an application for a USB keyboard device for which MicroPython would be perfect. Except: one of the user requirements is that the device never present itself as mass storage, even as a UF2 boot loader device. Is there a way to hide the The Bootsel button isn't a problem: we can cover/hide/remove it, as necessary. My worry is that a user could interrupt the running program, (somehow) gain access to the REPL, and be able to enter the bootloader from there. One of the locations where the device would be used has a very strong IT policy against removable storage of any kind. Having one detected on a machine sounds alarms, and could cause the user to lose their job. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
|
You did not mention the port you use. As far as I can tell, there is not 100% foolproof way of doing so. Even if you remove the bootloader method from the sources, there is still the mechanism in ROM which starts the bootloader. But a Pythonic way may be (Inspired by ESP32 Encoder): If you add that or call it in boot.py, it will get active before USB is initialized. |
Beta Was this translation helpful? Give feedback.
-
|
You can re-build/compile the microPython uf2 with the UART REPL enabled, then the rp2040 does not present a REPL on the USB port. I have example in the MTC version of my 'PT-Thrifty' project: If you want to go a step further; I accidentally discovered if you replace the XTAL with something that is not 12MHZ then USB timing is wrong and can not be connected to the PC.... even with 'boot' mode active. You can/have to connect via the SWD pins to (re)flash FW. The timing of the USB port can be 'corrected' within a custom microPython, so it would still work for your application. |
Beta Was this translation helpful? Give feedback.
-
|
Are you 100% for the RP2040? The RP2350 has much strong security model, though I don't know if you can disable the 'boot' mode via the e-fuses... |
Beta Was this translation helpful? Give feedback.
-
|
I just cross-checked that at RP2 the bootloader cannot be enabled with the |
Beta Was this translation helpful? Give feedback.
Starting boot.py with
del machinewill remove it. But of course, a command sequence likewould restore the builtin machine module. The more robust way is to create a firmware without support for bootloader().