Why do `rshell` and `ampy` run boot.py and main.py for every command?
Posted: Thu Aug 11, 2022 4:14 pm
Hi,
I'm new to MicroPython, so definitely could be missing something, but it seems that whenever I'm running `ampy` or `rshell` they constantly keep running `boot.py` and `main.py`.
I see that for every `ampy` command, even just `ls`, and with `rshell` I notice that when it starts, it tries to initialize different variables from the board itself (name, chip_type, even the list of files under '/'), and it seems that for every such command, it runs boot+main.
This causes me several problems:
1. This is slow. I'm initializing network, sdcard and other peripherals in boot.py and main.py, so it does so repeatedly, even without I need that for the command itself.
2. If I have a bug in main.py it could make these stuck and sometimes I even need to erase flash and copy a "commented-out" main.
[*] Do `ampy` and `rshell` really need to run the init scripts?
[*] Is there a flag to turn that off?
[*] If not - what should be my best practice? On one hand - my app needs the initializations (network, sdcard,...), but on the other hand I don't need them just for copying files, or testing another new module. Can I have 2 "modes" for boot?
Thanks!
Zach
I'm new to MicroPython, so definitely could be missing something, but it seems that whenever I'm running `ampy` or `rshell` they constantly keep running `boot.py` and `main.py`.
I see that for every `ampy` command, even just `ls`, and with `rshell` I notice that when it starts, it tries to initialize different variables from the board itself (name, chip_type, even the list of files under '/'), and it seems that for every such command, it runs boot+main.
This causes me several problems:
1. This is slow. I'm initializing network, sdcard and other peripherals in boot.py and main.py, so it does so repeatedly, even without I need that for the command itself.
2. If I have a bug in main.py it could make these stuck and sometimes I even need to erase flash and copy a "commented-out" main.
[*] Do `ampy` and `rshell` really need to run the init scripts?
[*] Is there a flag to turn that off?
[*] If not - what should be my best practice? On one hand - my app needs the initializations (network, sdcard,...), but on the other hand I don't need them just for copying files, or testing another new module. Can I have 2 "modes" for boot?
Thanks!
Zach