Error: app partition is too small for binary light-test.bin size 0x1838a0:

1.项目根目录新增文件partitions.csv

# ESP-IDF Partition Table
# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x4000,
otadata,  data, ota,     0xd000,  0x2000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000,  3M,

2.修改sdkconfig文件

  1. 找到CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv",在上面添加CONFIG_PARTITION_TABLE_CUSTOM=y
#
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table
  1. 找到CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y注释,添加以下内容
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y