8000 stm32/main: Search for frozen or fs boot.py and main.py. by higstar · Pull Request #4248 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stm32/main: Search for frozen or fs boot.py and main.py. #4248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

higstar
Copy link
Contributor
@higstar higstar commented Oct 18, 2018

To enable boot.py and main.py from either frozen modules, or file system, I have changed to the _any variant of the stat when booting.
Relevant to the STM32 port.

@peterhinch
Copy link
Contributor

+1 This would save clunky workrounds on all ports.

If there is a frozen module and one on the path, which should take precedence?

@pfalcon
Copy link
Contributor
pfalcon commented Oct 19, 2018

This would save clunky workrounds on all ports.

How this would save all ports, if this specifically adds a clunky workaround for just one port?

@higstar
Copy link
Contributor Author
higstar commented Oct 19, 2018

If there is a frozen module and one on the path, which should take precedence?

Great question, I can see value in both directions.
For my use, I'd prefer the frozen only to be used if it is not overridden by one on the FS.

@higstar
Copy link
Contributor Author
higstar commented Oct 19, 2018

This would save clunky workrounds on all ports.

How this would save all ports, if this specifically adds a clunky workaround for just one port?

So you think it is clunky...how so? I'd be interested in better solutions :)

@andrewleech
Copy link
Contributor

I'm not sure if it's better, but another way could be to use a frozen boot/main in preference to the template string in main.c

This way if there is no boot/main on the flash drive the frozen version would be copied and used rather than the template string.
The copied files on the flash could still be customised later if needed.

I get the comments about messy port specific hacks, every port is solving this problem in a different way all mashed into their respective main.c files.
Perhaps it's be good to abstract out "boot_scripts" into a common module to handle selecting, storing and running the early (boot.py) and late (main.py) scripts.

This module could be referenced from all ports with a port specific default file, and I guess any other port specific settings like what to do if there is no fat filesystem etc.

@dpgeorge
Copy link
Member

Thanks for this, but I don't see how it would actually work: if mp_import_stat_any() does find a frozen module, pyexec_file() won't be able to execute it. I tried this PR out and it didn't work for me (putting a main.py in stm32/modules/ directory).

@dpgeorge
Copy link
Member
dpgeorge commented Dec 3, 2018

As I mentioned above, this PR doesn't work, so I'll close it.

@dpgeorge dpgeorge closed this Dec 3, 2018
tannewt added a commit to tannewt/circuitpython that referenced this pull request Feb 23, 2021
set SUPEROPT_VM = 0 on most non-Express SAMD21 boards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0