Skip to content
Snippets Groups Projects
Commit f1ed23aa authored by q3k's avatar q3k
Browse files

fatfsgen: pre-generate image from python_payload

parent 48d70443
No related branches found
No related tags found
No related merge requests found
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
See python_payload/README.md for a demo application. See python_payload/README.md for a demo application.
Files can be transferred with mpremote, such as: Files can be transferred either by performing an `idf.py flash` or with mpremote, such as:
``` ```
mpremote fs cp python_payload/boot.py :boot.py mpremote fs cp python_payload/main.py :main.py
``` ```
Alternatively, adafruit-ampy may work more reliably sometimes: Alternatively, adafruit-ampy may work more reliably sometimes:
``` ```
ampy -p /dev/ttyACM0 -d3 put boot.py ampy -p /dev/ttyACM0 -d3 put main.py
``` ```
Please transfer all .py files in python_payload/ for using the demo payload. Please transfer all .py files in python_payload/ for using the demo payload.
...@@ -62,7 +62,8 @@ $ idf.py build ...@@ -62,7 +62,8 @@ $ idf.py build
By default, code for the fourth generation prototype will be built. To select a different generation, either set `-g`/`--generation` during an `idf.py build` (which will get cached for subsequent builds) or set the BADGE_GENERATION environment variable to one of the following values: By default, code for the fourth generation prototype will be built. To select a different generation, either set `-g`/`--generation` during an `idf.py build` (which will get cached for subsequent builds) or set the BADGE_GENERATION environment variable to one of the following values:
^ `-g` / `BADGE_GENERATION` value ^ Badge Generation ^ | `-g` / `BADGE_GENERATION` value | Badge Generation |
|---------------------------------|------------------------------------|
| `p1` or `proto1` | Prototype 1 | | `p1` or `proto1` | Prototype 1 |
| `p3` or `proto3` | Prototype 3 (B3xx) | | `p3` or `proto3` | Prototype 3 (B3xx) |
| `p4` or `proto4` | Prototype 4 (B4xx) | | `p4` or `proto4` | Prototype 4 (B4xx) |
...@@ -77,6 +78,14 @@ Put badge into bootloader mode by holding left should button down during boot. ...@@ -77,6 +78,14 @@ Put badge into bootloader mode by holding left should button down during boot.
$ idf.py -p /dev/ttyACM0 flash $ idf.py -p /dev/ttyACM0 flash
``` ```
The following targets are available for flashing:
| Target | Flashes |
|--------------------|-------------------------------------------------|
| `idf.py flash` | Bootloader, C code, Python Code / FAT partition |
| `idf.py app-flash` | C code |
| `idf.py vfs-flash` | Python Code / FAT partition |
You can skip `-p /dev/ttyACM0` if you set the environment variable `ESPPORT=/dev/ttyACM0`. This environment variable is also set by default when using Nix. You can skip `-p /dev/ttyACM0` if you set the environment variable `ESPPORT=/dev/ttyACM0`. This environment variable is also set by default when using Nix.
After flashing, remember to powercycle your badge to get it into the user application. After flashing, remember to powercycle your badge to get it into the user application.
......
...@@ -194,3 +194,6 @@ target_compile_definitions(${COMPONENT_TARGET} PUBLIC ...@@ -194,3 +194,6 @@ target_compile_definitions(${COMPONENT_TARGET} PUBLIC
) )
include("${MICROPY_DIR}/py/mkrules.cmake") include("${MICROPY_DIR}/py/mkrules.cmake")
include("${PROJECT_DIR}/third_party/fatfsgen/project_include.cmake")
fatfs_create_spiflash_image(vfs ${PROJECT_DIR}/python_payload FLASH_IN_PROJECT)
...@@ -210,8 +210,8 @@ class Entry: ...@@ -210,8 +210,8 @@ class Entry:
exceeds_short_name: bool = len(object_name) > MAX_NAME_SIZE or len(object_extension) > MAX_EXT_SIZE exceeds_short_name: bool = len(object_name) > MAX_NAME_SIZE or len(object_extension) > MAX_EXT_SIZE
if not self.fatfs_state.long_names_enabled and exceeds_short_name: if not self.fatfs_state.long_names_enabled and exceeds_short_name:
raise TooLongNameException( raise TooLongNameException(
'Maximal length of the object name is {} characters and {} characters for extension!'.format( 'Maximal length of the object name ({}) is {} characters and {} characters for extension!'.format(
MAX_NAME_SIZE, MAX_EXT_SIZE object_name, MAX_NAME_SIZE, MAX_EXT_SIZE
) )
) )
......
...@@ -11,9 +11,9 @@ function(fatfs_create_partition_image partition base_dir) ...@@ -11,9 +11,9 @@ function(fatfs_create_partition_image partition base_dir)
idf_build_get_property(python PYTHON) idf_build_get_property(python PYTHON)
if(arg_WL_INIT) if(arg_WL_INIT)
set(fatfsgen_py ${python} ${idf_path}/components/fatfs/wl_fatfsgen.py) set(fatfsgen_py ${python} ${PROJECT_DIR}/third_party/fatfsgen/wl_fatfsgen.py)
else() else()
set(fatfsgen_py ${python} ${idf_path}/components/fatfs/fatfsgen.py) set(fatfsgen_py ${python} ${PROJECT_DIR}/third_party/fatfsgen/fatfsgen.py)
endif() endif()
if(arg_PRESERVE_TIME) if(arg_PRESERVE_TIME)
...@@ -32,13 +32,7 @@ function(fatfs_create_partition_image partition base_dir) ...@@ -32,13 +32,7 @@ function(fatfs_create_partition_image partition base_dir)
set(fatfs_sector_size 4096) set(fatfs_sector_size 4096)
endif() endif()
if("${CONFIG_FATFS_LFN_NONE}") set(fatfs_long_names_option --long_name_support)
set(fatfs_long_names_option)
elseif("${CONFIG_FATFS_LFN_HEAP}")
set(fatfs_long_names_option --long_name_support)
elseif("${CONFIG_FATFS_LFN_STACK}")
set(fatfs_long_names_option --long_name_support)
endif()
get_filename_component(base_dir_full_path ${base_dir} ABSOLUTE) get_filename_component(base_dir_full_path ${base_dir} ABSOLUTE)
partition_table_get_partition_info(size "--partition-name ${partition}" "size") partition_table_get_partition_info(size "--partition-name ${partition}" "size")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment