diff --git a/README.md b/README.md index 503a1f22f6510337f7006bba04f1cd9c422227c8..bbe5cecb50f4bd95bb6bae3885de33137e6f1abe 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,16 @@ 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: ``` -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. @@ -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: -^ `-g` / `BADGE_GENERATION` value ^ Badge Generation ^ +| `-g` / `BADGE_GENERATION` value | Badge Generation | +|---------------------------------|------------------------------------| | `p1` or `proto1` | Prototype 1 | | `p3` or `proto3` | Prototype 3 (B3xx) | | `p4` or `proto4` | Prototype 4 (B4xx) | @@ -77,6 +78,14 @@ Put badge into bootloader mode by holding left should button down during boot. $ 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. After flashing, remember to powercycle your badge to get it into the user application. diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 6f00a3cd8ba1f52ed9f813baed6ce8bdc5a9a90e..d565400be88f24fac52d64d138a0b94dd8927de6 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -194,3 +194,6 @@ target_compile_definitions(${COMPONENT_TARGET} PUBLIC ) 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) diff --git a/third_party/fatfsgen/fatfs_utils/entry.py b/third_party/fatfsgen/fatfs_utils/entry.py index bb5d9f8f7a108b70d40571af1a9dd61985a31b6f..adc5e3ea7f67688cc96adbad5755734a23d523b8 100644 --- a/third_party/fatfsgen/fatfs_utils/entry.py +++ b/third_party/fatfsgen/fatfs_utils/entry.py @@ -210,8 +210,8 @@ class Entry: 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: raise TooLongNameException( - 'Maximal length of the object name is {} characters and {} characters for extension!'.format( - MAX_NAME_SIZE, MAX_EXT_SIZE + 'Maximal length of the object name ({}) is {} characters and {} characters for extension!'.format( + object_name, MAX_NAME_SIZE, MAX_EXT_SIZE ) ) diff --git a/third_party/fatfsgen/project_include.cmake b/third_party/fatfsgen/project_include.cmake index d945c0e96eddd519a45794bc27e1e70296897625..c7bbbc7e7602ba3433c69184fe77aea9a7e64f11 100644 --- a/third_party/fatfsgen/project_include.cmake +++ b/third_party/fatfsgen/project_include.cmake @@ -11,9 +11,9 @@ function(fatfs_create_partition_image partition base_dir) idf_build_get_property(python PYTHON) 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() - set(fatfsgen_py ${python} ${idf_path}/components/fatfs/fatfsgen.py) + set(fatfsgen_py ${python} ${PROJECT_DIR}/third_party/fatfsgen/fatfsgen.py) endif() if(arg_PRESERVE_TIME) @@ -32,13 +32,7 @@ function(fatfs_create_partition_image partition base_dir) set(fatfs_sector_size 4096) endif() - if("${CONFIG_FATFS_LFN_NONE}") - 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() + set(fatfs_long_names_option --long_name_support) get_filename_component(base_dir_full_path ${base_dir} ABSOLUTE) partition_table_get_partition_info(size "--partition-name ${partition}" "size")