|
|
@@ -595,6 +595,31 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
|
|
|
rm idf_project.yml
|
|
|
git checkout main/main.c
|
|
|
|
|
|
+ print_status "Build fails if partitions don't fit in flash"
|
|
|
+ sed -i.bak "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig # remove all flashsize config
|
|
|
+ echo "CONFIG_ESPTOOLPY_FLASHSIZE_1MB=y" >> sdkconfig # introduce undersize flash
|
|
|
+ ( idf.py build 2>&1 | grep "does not fit in configured flash size 1MB" ) || failure "Build didn't fail with expected flash size failure message"
|
|
|
+ mv sdkconfig.bak sdkconfig
|
|
|
+
|
|
|
+ print_status "Flash size is correctly set in the bootloader image header"
|
|
|
+ # Build with the default 2MB setting
|
|
|
+ rm sdkconfig
|
|
|
+ idf.py bootloader || failure "Failed to build bootloader"
|
|
|
+ bin_header_match build/bootloader/bootloader.bin "0210"
|
|
|
+ # Change to 4MB
|
|
|
+ echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y" > sdkconfig
|
|
|
+ idf.py bootloader || failure "Failed to build bootloader"
|
|
|
+ bin_header_match build/bootloader/bootloader.bin "0220"
|
|
|
+ # Change to QIO, bootloader should still be DIO (will change to QIO in 2nd stage bootloader)
|
|
|
+ echo "CONFIG_FLASHMODE_QIO=y" > sdkconfig
|
|
|
+ idf.py bootloader || failure "Failed to build bootloader"
|
|
|
+ bin_header_match build/bootloader/bootloader.bin "0210"
|
|
|
+ # Change to 80 MHz
|
|
|
+ echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y" > sdkconfig
|
|
|
+ idf.py bootloader || failure "Failed to build bootloader"
|
|
|
+ bin_header_match build/bootloader/bootloader.bin "021f"
|
|
|
+ rm sdkconfig
|
|
|
+
|
|
|
print_status "All tests completed"
|
|
|
if [ -n "${FAILURES}" ]; then
|
|
|
echo "Some failures were detected:"
|
|
|
@@ -722,5 +747,17 @@ function clean_build_dir()
|
|
|
rm -rf $PRESERVE_ROOT_ARG ${BUILD}/* ${BUILD}/.*
|
|
|
}
|
|
|
|
|
|
+# check the bytes 3-4 of the binary image header. e.g.:
|
|
|
+# bin_header_match app.bin 0210
|
|
|
+function bin_header_match()
|
|
|
+{
|
|
|
+ expected=$2
|
|
|
+ filename=$1
|
|
|
+ actual=$(xxd -s 2 -l 2 -ps $1)
|
|
|
+ if [ ! "$expected" = "$actual" ]; then
|
|
|
+ failure "Incorrect binary image header, expected $expected got $actual"
|
|
|
+ fi
|
|
|
+}
|
|
|
+
|
|
|
cd ${TESTDIR}
|
|
|
run_tests
|