Browse Source

Pass CONFIG_LITTLEFS_OBJ_NAME_LEN to the mklittlefs build command (#79)

* Pass CONFIG_LITTLEFS_OBJ_NAME_LEN to the mklittlefs build command

* fix stray typo

* According to lfs.h, LFS_NAME_MAX caps out at 1022

* set LFS_NAME_MAX envvar for mklittlefs compilation

* update LITTLEFS_OBJ_NAME kconfig doc

* rebuild mklittlefs if sdkconfig changes
Brian Pugh 11 months ago
parent
commit
5a375263fb
2 changed files with 8 additions and 3 deletions
  1. 6 2
      Kconfig
  2. 2 1
      project_include.cmake

+ 6 - 2
Kconfig

@@ -22,9 +22,13 @@ menu "LittleFS"
     config LITTLEFS_OBJ_NAME_LEN
         int "Maximum object name length including NULL terminator."
         default 64
-        range 16 1024
+        range 16 1022
         help
-            Includes NULL-terminator.
+            Includes NULL-terminator. If flashing a prebuilt filesystem image,
+            rebuild the filesystem image if this value changes.
+            mklittlefs, the tool that generates the image will automatically be rebuilt.
+            If downloading a pre-built release of mklittlefs, it was most-likely
+            built with LFS_NAME_MAX=32 and should not be used.
 
     config LITTLEFS_READ_SIZE
         int "Minimum size of a block read."

+ 2 - 1
project_include.cmake

@@ -20,8 +20,9 @@ function(littlefs_create_partition_image partition base_dir)
 
 	add_custom_command(
 		OUTPUT ${MKLITTLEFS}
-		COMMAND make dist
+		COMMAND make clean && make dist LFS_NAME_MAX=${CONFIG_LITTLEFS_OBJ_NAME_LEN}
 		WORKING_DIRECTORY ${MKLITTLEFS_DIR}
+		DEPENDS ${SDKCONFIG}
 	)
 
 	if("${size}" AND "${offset}")