# linker will ignore this structure as it has no other files depending on it.
target_link_libraries(${COMPONENT_TARGET} "-u esp_app_desc")
+# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
+string(SUBSTRING "${PROJECT_VER}" 0 31 PROJECT_VER_CUT)
+string(SUBSTRING "${PROJECT_NAME}" 0 31 PROJECT_NAME_CUT)
+
set_source_files_properties(
SOURCE "esp_app_desc.c"
PROPERTIES COMPILE_DEFINITIONS
- PROJECT_VER=\"${PROJECT_VER}\")
+ "PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
# Add custom target for generating empty otadata partition for flashing
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE)
else
PROJECT_VER:= $(PROJECT_VER)
endif
-$(info App "$(PROJECT_NAME)" version: $(PROJECT_VER))
-NEW_DEFINES:= $(PROJECT_VER) $(PROJECT_NAME) $(IDF_VER)
+# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
+PROJECT_VER_CUT := $(shell echo $(PROJECT_VER) | cut -c 1-31)
+PROJECT_NAME_CUT := $(shell echo $(PROJECT_NAME) | cut -c 1-31)
+
+$(info App "$(PROJECT_NAME_CUT)" version: $(PROJECT_VER_CUT))
+
+NEW_DEFINES:= $(PROJECT_VER_CUT) $(PROJECT_NAME_CUT) $(IDF_VER)
ifeq ("$(wildcard ${TMP_DEFINES})","")
OLD_DEFINES:=
else
$(shell echo $(NEW_DEFINES) > $(TMP_DEFINES); rm -f esp_app_desc.o;)
endif
-esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\"$(PROJECT_VER)\" -D PROJECT_NAME=\"$(PROJECT_NAME)\"
+esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\"$(PROJECT_VER_CUT)\" -D PROJECT_NAME=\"$(PROJECT_NAME_CUT)\"
endif
assert_rebuilt ${APP_BINS}
print_status "Change app version"
take_build_snapshot
- echo "project-version-2.0" > ${TESTDIR}/template/version.txt
+ echo "project-version-2.0(012345678901234567890123456789)" > ${TESTDIR}/template/version.txt
make
assert_rebuilt ${APP_BINS}
assert_not_rebuilt ${BOOTLOADER_BINS} esp32/libesp32.a
idf.py build || failure "Failed to build with app version"
print_status "Change app version"
take_build_snapshot
- echo "project-version-2.0" > ${TESTDIR}/template/version.txt
+ echo "project-version-2.0(012345678901234567890123456789)" > ${TESTDIR}/template/version.txt
idf.py build || failure "Failed to rebuild with changed app version"
assert_rebuilt ${APP_BINS}
assert_not_rebuilt ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
list(APPEND compile_options "${CMAKE_C_FLAGS}")
list(APPEND c_compile_options "${CMAKE_C_FLAGS}")
list(APPEND cxx_compile_options "${CMAKE_CXX_FLAGS}")
- add_definitions(-DPROJECT_NAME=\"${PROJECT_NAME}\")
if(CONFIG_OPTIMIZATION_LEVEL_RELEASE)
list(APPEND compile_options "-Os")