8266学习篇 - user_rf_cal_sector_set 编译错误解决

8266学习篇 - user_rf_cal_sector_set 编译错误解决_第1张图片

/mnt/hgfs/8266share/ESP8266_RTOS_SDK-master/lib/libmain.a(app_main.o): In function `flash_data_check':

(.irom0.text+0x578): undefined reference to ` user_rf_cal_sector_set '
/mnt/hgfs/8266share/ESP8266_RTOS_SDK-master/lib/libmain.a(app_main.o): In function `flash_data_check':
(.irom0.text+0x6cc): undefined reference to ` user_rf_cal_sector_set '
collect2: error: ld returned 1 exit status

make: *** [.output/eagle/debug/image/eagle.app.v6.out] 错误 1


根据官网公布的新版本SDK可知http://www.mr-wu.cn/espressif-esp8266_nonos_sdk_v2-0-0/


出现user_rf_cal_sector_set错误的原因是没有加以下函数

/******************************************************************************
 * FunctionName : user_rf_cal_sector_set  新版本都要加上这个函数,用户程序必须实现此接口
 * Description  : SDK just reversed 4 sectors, used for rf init data and paramters.
 *                We add this function to force users to set rf cal sector, since
 *                we don't know which sector is free in user's application.
 *                sector map for last several sectors : ABCCC
 *                A : rf cal
 *                B : rf init data
 *                C : sdk parameters
 * Parameters   : none
 * Returns      : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
{
    flash_size_map size_map = system_get_flash_size_map();
    uint32 rf_cal_sec = 0;

    switch (size_map) {
        case FLASH_SIZE_4M_MAP_256_256:
            rf_cal_sec = 128 - 5;
            break;

        case FLASH_SIZE_8M_MAP_512_512:
            rf_cal_sec = 256 - 5;
            break;

        case FLASH_SIZE_16M_MAP_512_512:
        case FLASH_SIZE_16M_MAP_1024_1024:
            rf_cal_sec = 512 - 5;
            break;

        case FLASH_SIZE_32M_MAP_512_512:
        case FLASH_SIZE_32M_MAP_1024_1024:
            rf_cal_sec = 1024 - 5;
            break;
        case FLASH_SIZE_64M_MAP_1024_1024:
            rf_cal_sec = 2048 - 5;
            break;
        case FLASH_SIZE_128M_MAP_1024_1024:
            rf_cal_sec = 4096 - 5;
            break;
        default:
            rf_cal_sec = 0;
            break;
    }

    return rf_cal_sec;
}


在user_main.c里面添加该函数,无需调用,系统会根据函数名称来进行判断

在变量声明完后面添加,如下图

8266学习篇 - user_rf_cal_sector_set 编译错误解决_第2张图片


输入 gen_misc.sh  成功编译

8266学习篇 - user_rf_cal_sector_set 编译错误解决_第3张图片


你可能感兴趣的:(linux命令,8266)