Initial filesystem creation
Initial filesystem creation
Is there a way to create an initial filesystem that contains custom files (eg. index.html, .css, ...)?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Initial filesystem creation
You can copy data files to the target's filesystem exactly as per MicropPython programs. There are various tools available to do this. I favour rshell.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Initial filesystem creation
Thanks. Yes, this works. But I need to build an image that can be flashed alongside the firmware.
Re: Initial filesystem creation
I'm not aware that this is a feature that exists. I do wonder if you were to make a FAT filesystem image, and add that to the .dfu file with the right offsets, it might actually be quite close to working.
The closest you can get with current features is to extend what the firmware currently does to generate the default boot.py e.g. look at ports/stm32/factoryreset.c
The disadvantage is that you'll now have two copies of your static resources in flash (once in the code ROM, and then in the filesystem too).
One (fairly terrible but less wasteful) option might be to write a tool to bundle up your static resources into a Python file (e.g. static.py), then add that as a frozen module to the build. Then serve those resources directly from `static.INDEX_HTML` or something.
The closest you can get with current features is to extend what the firmware currently does to generate the default boot.py e.g. look at ports/stm32/factoryreset.c
The disadvantage is that you'll now have two copies of your static resources in flash (once in the code ROM, and then in the filesystem too).
One (fairly terrible but less wasteful) option might be to write a tool to bundle up your static resources into a Python file (e.g. static.py), then add that as a frozen module to the build. Then serve those resources directly from `static.INDEX_HTML` or something.