🛰️Zafer Satılmış - Aviora

Generator Script — Detailed Explanation

Customers/generate_fs_port_config.py converts customer JSON configuration into build-ready C headers and macros. Invoked via command line; results appear in cus_fs_port_config.h and FS_Port_Config.h.

Input and output

Input

  • `Customers/NAME/Fs/fs_config.json`
  • `store.activeFsName` and selected `fsLib` branch

Output

  • `Customers/NAME/Fs/cus_fs_port_config.h`
  • `Customers/FS_Port_Config.h`

Selection logic

  • Map fs name to `USE_*` macro
  • Emit selected `fs_port_*.h` include block
  • Emit FS specific macros from JSON values
  • Emit `FS_HARDWARE_INIT(error_out)`

The generated header is the bridge between static app API and dynamic customer configuration.

Generator pipeline animation

Generator flow

Internal call graph

Mermaid call graph
flowchart TD
  main["main()"] --> read["read fs_config.json"]
  read --> map["map activeFsName to USE macro"]
  map --> branch{activeFs}
  branch --> FL[_append_flashlink_defines]
  branch --> LF[_append_littlefs_defines]
  branch --> FF[_append_flashfs_defines]
  FL --> write1["write cus_fs_port_config.h"]
  LF --> write1
  FF --> write1
  write1 --> write2["write FS_Port_Config.h"]
[Fallback call graph]
main
  -> read fs_config.json
  -> map activeFsName to USE macro
  -> branch by active fs
     -> _append_flashlink_defines
     -> _append_littlefs_defines
     -> _append_flashfs_defines
  -> write cus_fs_port_config.h
  -> write Customers/FS_Port_Config.h

Example: --customer ZD_2622 + flashlink

When .\generate_fs_port_config.py --customer ZD_2622 is run with activeFsName: "flashlink": Console shows SELECTED FS NAME: flashlink; cus_fs_port_config.h is generated with USE_FLASHLINK, flashlink port, HW driver include, and FS_HARDWARE_INIT macro.

ZD_2622 flashlink example

Example: activeFsName: "littlefs"

With activeFsName littlefs, console shows SELECTED FS NAME: littlefs; output includes USE_LITTLEFS, LITTLEFS_GEOMETRY_* macros, fs_littlefs_helper_func include, and FS_HARDWARE_INIT with Storage init + mutex create.

littlefs scenario

Command Summary

python Customers/generate_fs_port_config.py --customer ZD_2622

Input: Customers/ZD_2622/Fs/fs_config.json

Output: Customers/ZD_2622/Fs/cus_fs_port_config.h, Customers/FS_Port_Config.h