#include "esp_log.h" #include "../utils/str_builder.h" #include "../utils/str_replace.h" #define COMPONENT_TAG "erofs" static void erofs_get_tag(char **buf, const char *name, const char *sfx) { str_builder_t *sb = str_builder_create(); str_builder_add_str(sb, "_binary_", 0); //str_builder_add_str(sb, name, 0); char *rs = str_replace((char *) name, ".", "_"); str_builder_add_str(sb, rs, 0); str_builder_add_str(sb, sfx, 0); *buf = str_builder_dump(sb, NULL); str_builder_destroy(sb); free(rs); } void erofs_size(const char *name) { ESP_LOGI(COMPONENT_TAG, "verifying %s", name); char *buf_start; erofs_get_tag(&buf_start, name, "_start"); char *buf_end; erofs_get_start(&buf_end, name, "_end"); ESP_LOGI(COMPONENT_TAG, "%s", buf_start); ESP_LOGI(COMPONENT_TAG, "%s", buf_end); extern const uint8_t bin_start[] asm(buf_start); //... free(buf_start); free(buf_end); }
And here is the surprise, you can't call asm() with varibale name. asm() is a compile-time construct. The argument must be a string literal, and not a variable.