ESP IDF引入外部资源文件

1、将资源文件存入数据分区

1、在分区表创建分区

storage,  data, spiffs,  ,        1M  

2、main文件中添加(将 ../data 中的文件存入storage分区)

spiffs_create_partition_image(storage ../data FLASH_IN_PROJECT)

2、将资源文件引入组件

idf_component_register(
SRCS "xxxx.c"
INCLUDE_DIRS "."
PRIV_REQUIRES xxxx
EMBED_FILES  "file1"
        "file2"
        "file3"
)

extern const char index_start[] asm("_binary_xxx_xxx_start");
extern const char index_end[] asm("_binary_xxx_xxx_end");
const size_t index_size = (index_end -index_start);

posted @ 2025-07-27 08:56  *^VV^*  阅读(46)  评论(0)    收藏  举报