您尚未登录。

楼主 #1 2020-04-10 16:11:51

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

编译esp-aliyun的两个例程,遇到了问题,求助。

第一个例程,esp-aliyun/examples/mqtt/mqtt-example
idf.py menuconfig里设置了wifi账户和密码,然后就build、下载。
结果运行后不断重启,错误信息如下:

E (3303) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
E (3303) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
E (3313) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!

第二个例程,esp-aliyun/examples/solution/smart_light
menuconfig里没有设置,build,报错:

/home/any/EclipseWorkship/MCU/ESP32/esp-aliyun/examples/solutions/smart_light/components/factory_restore/factory_restore.c:91:9: error: implicit declaration of function 'esp_sleep_get_wakeup_cause' [-Werror=implicit-function-declaration]
     if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/any/EclipseWorkship/MCU/ESP32/esp-aliyun/examples/solutions/smart_light/components/factory_restore/factory_restore.c:91:41: error: 'ESP_SLEEP_WAKEUP_UNDEFINED' undeclared (first use in this function)
     if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED) {
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/any/EclipseWorkship/MCU/ESP32/esp-aliyun/examples/solutions/smart_light/components/factory_restore/factory_restore.c:91:41: note: each undeclared identifier is reported only once for each function it appears in

我搜了整个esp-aliyun文件夹,都没在其他地方找到esp_sleep_get_wakeup_cause()和ESP_SLEEP_WAKEUP_UNDEFINED。

最近编辑记录 Gentlepig (2020-04-10 16:15:24)

离线

#2 2020-04-10 16:39:01

夏雨夜寐
会员
注册时间: 2019-08-23
已发帖子: 82
积分: 76.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

aliyun没跑过
第一个问题,看提示应该是分区表,你检查下你的程序对应的分区表
第二个问题,像你说的一样,配置文件有没有对应的宏关闭了
我是来水贴的 cool

离线

楼主 #3 2020-04-10 16:56:18

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

第一个例程遇到的问题:

https://github.com/espressif/esp-aliyun/blob/master/config/mass_mfg/README.md
按照这个教程,复制single_mfg_config.csv为my_single_mfg_config.csv,里面内容没改。
然后执行

$IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py --input my_single_mfg_config.csv --output my_single_mfg.bin --size 0x4000

结果报错:

usage: nvs_partition_gen.py [-h] {generate,generate-key,encrypt,decrypt} ...
nvs_partition_gen.py: error: argument command: invalid choice: 'my_single_mfg_config.csv' (choose from 'generate', 'generate-key', 'encrypt', 'decrypt')

------------------------------------------------------

第二个例程遇到的问题:

ESP_SLEEP_WAKEUP_UNDEFINED这个宏,在esp-idf的componets/esp32/include里的esp_sleep.h里找到了。
但esp-aliyun这个文件夹里,没有这个esp_sleep.h文件,也没有相关引用。

最近编辑记录 Gentlepig (2020-04-10 17:04:02)

离线

#4 2020-04-10 17:19:26

夏雨夜寐
会员
注册时间: 2019-08-23
已发帖子: 82
积分: 76.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

命令行的问题
参考 $IDF_PATH$/components/nvs_flash/nvs_partition_generator/README_CN.rst

最近编辑记录 夏雨夜寐 (2020-04-10 17:48:36)

离线

楼主 #5 2020-04-10 17:31:13

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

命令行的问题,
$IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py --input my_single_mfg_config.csv --output my_single_mfg.bin --size 0x4000
这是旧的方法,查看了nvs_partition_gen.py同目录下的readme文档,找到了新的用法:
python nvs_partition_gen.py generate [-h] [--version {1,2}] [--outdir OUTDIR]
                                             input output size
最后用的是:
$IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate my_single_mfg_config.csv my_single_mfg.bin 0x40

不过又有了新的疑惑,这个csv里的内容是干啥的?我直接复制的single_mfg_config.csv的,没改,不知道行不行。

----------------------------------------------------------------------

把生成的.bin文件烧录进去了,结果启动后还是报错,不过和之前好像有点不一样:

E (3803) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
E (3803) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
E (3813) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
mqtt_main|124 :: mqtt example
E (3823) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
E (3833) wrapper_product: NVS Flash init fctry failed, Please check that you have flashed fctry partition!!!
[err] IOT_MQTT_Construct(395): Invalid product key, abort!
mqtt_main|227 :: MQTT construct failed
E (3853) FreeRTOS: FreeRTOS Task "mqtt_example" should not return, Aborting now!

最近编辑记录 Gentlepig (2020-04-10 17:36:16)

离线

#6 2020-04-10 17:41:19

夏雨夜寐
会员
注册时间: 2019-08-23
已发帖子: 82
积分: 76.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

分区文件csv各个键值部分的说明
参考分区表 esp32 — ESP-IDF 编程指南 latest 文档
报错信息是分区表不对应bootloader,你跑的aliyun的例程,也应烧对应的例程的Bootloader
可以参考

$IDF_PATH$/components/bootloader_support/src/bootloader_utility.c

最近编辑记录 夏雨夜寐 (2020-04-10 17:46:04)

离线

楼主 #7 2020-04-11 09:42:07

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

嗯,确实是烧录的分区表不对,我不该用esp-aliyun/config/mass_mfg目录下的single_mfg_config.csv.
在esp-aliyun/examples/mqtt/mqtt_example目录下有个partitions_esp32.csv,在menuconfig里设置分区表为自定义的,然后默认的名称是partitions.csv,改成partitions_esp32.csv即可。
然后idf.py build,报错,提示超过2m,按提示进入Menuconfig菜单,串口下载那里配置,把flash容量改成4M。
再次编译,通过,下载,重启,程序成功启动,不过提示mqtt订阅失败。

有两个疑惑点:
1:mqtt/mqtt_example目录下有两个.csv文件,一个是8266的,一个是esp32的。但是esp-idf的esp-idf.py set-target命令,后面跟的参数只能是esp32或者是esp32s2,没法设置成8266吧?
2:默认配置里串口下载参数那里程序大小是2M,为什么是2M呢?买的esp32-wroom模块都是4M flash的啊。

离线

楼主 #8 2020-04-11 10:29:58

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

这是烧写的例程下的分区别表:

# Name,   Type, SubType, Offset,   Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs,      data, nvs,     ,        0x4000,
otadata,  data, ota,     ,        0x2000,
phy_init, data, phy,     ,        0x1000,
ota_0,    app,  ota_0,   ,        1M,
ota_1,    app,  ota_1,   ,        1M,
fctry,    data, nvs,     ,        0x4000

按表上计算fctry nvs分区首地址是0x207000吧,可看“https://github.com/espressif/esp-aliyun/blob/master/config/mass_mfg/README.md”介绍esp32默认地址是0x210000。
我试了,烧写到0x207000,启动失败;烧写到0x210000,可以启动,虽然最后订阅失败。
改成自己的四元组信息后,重新烧录,可以正常订阅了。

最近编辑记录 Gentlepig (2020-04-11 11:00:07)

离线

楼主 #9 2020-04-11 11:57:48

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

第二个问题,在报错文件里加入了#include "esp_sleep.h"后,通过编译。
不过下载程序,启动后,还是报错:

[inf] wrapper_mqtt_subscribe(2879): mqtt subscribe packet sent,topic = /sys/a10FtPOWmu8/esp32_modbus_test1/thing/property/desired/delete_reply!
I (6705) factory_rst: Quick reboot timeout, clear reboot times
I (6715) app main: IOTX_AWSS_BIND_NOTIFY
user_awss_status_event_handler.68: Awss Status 4111

***ERROR*** A stack overflow in task Tmr Svc has been detected.

Backtrace:0x40090623:0x3ffbd480 0x400902e9:0x3ffbd4a0 0x40092ffd:0x3ffbd4c0 0x400946a2:0x3ffbd540 0x400930f0:0x3ffbd560 0x400930a6:0x3ffd6530 0x0000027d:0x401014d4 |<-CORRUPTED
0x40090623: panic_abort at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/esp_system/panic.c:330

0x400902e9: esp_system_abort at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/esp_system/system_api.c:68

0x40092ffd: vApplicationStackOverflowHook at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/port.c:436

0x400946a2: vTaskSwitchContext at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/tasks.c:2769

0x400930f0: _frxt_dispatch at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/portasm.S:431

0x400930a6: _frxt_int_exit at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/portasm.S:231

0x401014d4: sntp_retry at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/lwip/lwip/src/apps/sntp/sntp.c:367

离线

#10 2020-04-11 13:35:59

夏雨夜寐
会员
注册时间: 2019-08-23
已发帖子: 82
积分: 76.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

Gentlepig 说:

第二个问题,在报错文件里加入了#include "esp_sleep.h"后,通过编译。
不过下载程序,启动后,还是报错:

[inf] wrapper_mqtt_subscribe(2879): mqtt subscribe packet sent,topic = /sys/a10FtPOWmu8/esp32_modbus_test1/thing/property/desired/delete_reply!
I (6705) factory_rst: Quick reboot timeout, clear reboot times
I (6715) app main: IOTX_AWSS_BIND_NOTIFY
user_awss_status_event_handler.68: Awss Status 4111

***ERROR*** A stack overflow in task Tmr Svc has been detected.

Backtrace:0x40090623:0x3ffbd480 0x400902e9:0x3ffbd4a0 0x40092ffd:0x3ffbd4c0 0x400946a2:0x3ffbd540 0x400930f0:0x3ffbd560 0x400930a6:0x3ffd6530 0x0000027d:0x401014d4 |<-CORRUPTED
0x40090623: panic_abort at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/esp_system/panic.c:330

0x400902e9: esp_system_abort at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/esp_system/system_api.c:68

0x40092ffd: vApplicationStackOverflowHook at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/port.c:436

0x400946a2: vTaskSwitchContext at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/tasks.c:2769

0x400930f0: _frxt_dispatch at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/portasm.S:431

0x400930a6: _frxt_int_exit at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/freertos/xtensa/portasm.S:231

0x401014d4: sntp_retry at /home/any/EclipseWorkship/MCU/ESP32/esp-idf/components/lwip/lwip/src/apps/sntp/sntp.c:367

从你的log里看,是任务Tmr Svc的栈溢出了,你适当调整下试试

离线

#11 2020-04-11 13:42:11

夏雨夜寐
会员
注册时间: 2019-08-23
已发帖子: 82
积分: 76.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

Gentlepig 说:

嗯,确实是烧录的分区表不对,我不该用esp-aliyun/config/mass_mfg目录下的single_mfg_config.csv.
在esp-aliyun/examples/mqtt/mqtt_example目录下有个partitions_esp32.csv,在menuconfig里设置分区表为自定义的,然后默认的名称是partitions.csv,改成partitions_esp32.csv即可。
然后idf.py build,报错,提示超过2m,按提示进入Menuconfig菜单,串口下载那里配置,把flash容量改成4M。
再次编译,通过,下载,重启,程序成功启动,不过提示mqtt订阅失败。

有两个疑惑点:
1:mqtt/mqtt_example目录下有两个.csv文件,一个是8266的,一个是esp32的。但是esp-idf的esp-idf.py set-target命令,后面跟的参数只能是esp32或者是esp32s2,没法设置成8266吧?
2:默认配置里串口下载参数那里程序大小是2M,为什么是2M呢?买的esp32-wroom模块都是4M flash的啊。

1.因为我用8266的时候,没有用过idf工具,所以没办法回答,不过还是建议先看py工具的源码,最近我的项目是esp32,我自己使用esptool做了生产及相关的具有gui界面的工具,看了下源码,里面是包含了esp8266和esp32的接口,想必最新的idf工具也是这样
2.串口下载,我的esptool工具里,是有flash容量检测的接口的,你可以留意下工具源码,或者menuconfig里flash部分的设置没有设置对

离线

楼主 #12 2020-04-11 15:18:53

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,199
积分: 1139.5

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

menuconfig=>componet=>timer stack size()设大一点,原来是2048,改成4096后,没事了。
可以正常启动,手机配网了。

离线

#13 2020-04-16 16:25:07

zw_mcu
会员
注册时间: 2019-10-14
已发帖子: 0
积分: 0

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

谢谢  分享

离线

#14 2020-04-17 13:06:00

LHK
会员
注册时间: 2020-04-17
已发帖子: 0
积分: 0

Re: 编译esp-aliyun的两个例程,遇到了问题,求助。

很有用啊,感谢分享

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn