ESP8266 SDK3.0编译 【安信可一体化开发环境】

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lingcoln/article/details/90171498

最近遭遇ESP8266 SDK3.0出现编译错误的问题,如下:

user_main.c:30:2: error: #error "The flash map is not supported"
 #error "The flash map is not supported"
  ^
user_main.c:153:58: error: 'SYSTEM_PARTITION_OTA_SIZE' undeclared here (not in a function)
     { SYSTEM_PARTITION_OTA_1,         0x1000,            SYSTEM_PARTITION_OTA_SIZE},
                                                          ^
user_main.c:154:39: error: 'SYSTEM_PARTITION_OTA_2_ADDR' undeclared here (not in a function)
     { SYSTEM_PARTITION_OTA_2,         SYSTEM_PARTITION_OTA_2_ADDR,       SYSTEM_PARTITION_OTA_SIZE},
                                       ^
user_main.c:155:39: error: 'SYSTEM_PARTITION_RF_CAL_ADDR' undeclared here (not in a function)
     { SYSTEM_PARTITION_RF_CAL,        SYSTEM_PARTITION_RF_CAL_ADDR,       0x1000},
                                       ^
user_main.c:156:40: error: 'SYSTEM_PARTITION_PHY_DATA_ADDR' undeclared here (not in a function)
     { SYSTEM_PARTITION_PHY_DATA,       SYSTEM_PARTITION_PHY_DATA_ADDR,      0x1000},
                                        ^
user_main.c:157:46: error: 'SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR' undeclared here (not in a function)
     { SYSTEM_PARTITION_SYSTEM_PARAMETER,     SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR,    0x3000},
                                              ^
user_main.c:158:43: error: 'SYSTEM_PARTITION_AT_PARAMETER_ADDR' undeclared here (not in a function)
     { SYSTEM_PARTITION_AT_PARAMETER,      SYSTEM_PARTITION_AT_PARAMETER_ADDR,     0x3000},
                                           ^
user_main.c:159:48: error: 'SYSTEM_PARTITION_SSL_CLIENT_CERT_PRIVKEY_ADDR' undeclared here (not in a function)
  { SYSTEM_PARTITION_SSL_CLIENT_CERT_PRIVKEY,   SYSTEM_PARTITION_SSL_CLIENT_CERT_PRIVKEY_ADDR,   0x1000},
                                                ^
user_main.c:160:41: error: 'SYSTEM_PARTITION_SSL_CLIENT_CA_ADDR' undeclared here (not in a function)
  { SYSTEM_PARTITION_SSL_CLIENT_CA,      SYSTEM_PARTITION_SSL_CLIENT_CA_ADDR,     0x1000},
                                         ^
make[2]: *** [../../Makefile:346: .output/eagle/debug/obj/user_main.o] Error 1
make[2]: Leaving directory '/cygdrive/d/ESP_IDE/my_projects/ESP8266_NONOS_SDK-3.0/app/user'
make[1]: *** [../Makefile:331: .subdirs] Error 2
make[1]: Leaving directory '/cygdrive/d/ESP_IDE/my_projects/ESP8266_NONOS_SDK-3.0/app'
make: *** [Makefile:331: .subdirs] Error 2

问题在于SPI_SIZE_MAP的设置上,解决方式如下:

1、以ESP8266_NONOS_SDK-3.0为例,下载源码后解压到合适的目录下。

2、将 sdk 目录下的 driver_lib 重命名为 app

3、拷贝/examples/at 下的所有文件到刚才的 app 目录(提示覆盖则确认),完成后目录结构如下

4、将ESP8266_NONOS_SDK/third_party/makefile 重命名为 makefile.bak

5、导入项目

6、清理项目

7、由于sdk3.0只支持1024+1024的flash分布,所以按以上步骤直接编译会出现问题。esp8266的SPI_SIZE_MAP的定义为:

0:512KB(256+256)

1:256KB

2:1MB(512+512)

3:2MB(512+512)

4:4MB(512+512)

5:2MB-C1(1024+1024)

6:4MB-C1(1024+1024)

所以ESP8266模组的FLASH必须大于2MB,我以前的1MB模组只能上到sdk2.0,为了上sdk3.0我又搞了一块4MB版本的模组。

接下来就要修改SDK顶层目录的MAKFILE了,第25-29行改为:

BOOT?=new
APP?=1
SPI_SPEED?=40
SPI_MODE?=QIO
SPI_SIZE_MAP?=6

然后就可以进行编译了,结果如下:

8、要下载ESP8266_NONOS_SDK-3.0-at\bin\upgrade目录下的bin文件到相应的flash地址中。下载截图如下:

展开阅读全文

没有更多推荐了,返回首页