編譯報錯信息
bin/libmain2.a(app_main.o): In function `user_uart_wait_tx_fifo_empty':
(.irom0.text+0x678): undefined reference to `user_pre_init'
bin/libmain2.a(app_main.o): In function `system_phy_freq_trace_enable':
(.irom0.text+0x6e4): undefined reference to `user_pre_init'
collect2: error: ld returned 1 exit status
SDK目錄下的README.txt文檔介紹到user_pre_init的作用及編寫要義
Please add user_pre_init() in your project, which will be called before user_init(). And you MUST call system_partition_table_regist() in user_pre_init to register your project partition table.
The following partition address CAN NOT be modified, and you MUST give the correct address. They are retated to the flash map, please refer to ESP8266 SDK Getting Started Guide or ESP8266 SDK 入门指南.
SYSTEM_PARTITION_BOOTLOADER
SYSTEM_PARTITION_OTA_1
SYSTEM_PARTITION_OTA_2
SYSTEM_PARTITION_SYSTEM_PARAMETER
If you donot use Non-FOTA bin, eagle.irom0.text.bin and irom0.text MUST be downloaded the fixed address, which also can be found in ESP8266 SDK Getting Started Guide or ESP8266 SDK 入门指南, and you can define their partition type after SYSTEM_PARTITION_CUSTOMER_BEGIN.
查看SDK入門指南裏面的flash分佈,確認NON-FOTA分別情況與地址分佈
參考SDK提供的example重新編寫適配平臺的user_pre_init函數即可解決