espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
898 stars 812 forks source link

Current 'Tip Of Tree' Recipe for NINA-W102 Plz #369

Closed jwestmoreland closed 4 years ago

jwestmoreland commented 4 years ago

Hello All,

First off, I want to thank all of the developers that have contributed to this effort. I wasn't even aware until a short time ago that an AT build for the ESP32/NINA W102 was even available.

I've got a custom board - it's basically got everything pinned out for debug including JTAG. I've been able to make successful builds using all of the other approaches including making Arduino sketches and blinking the LED's. I basically copied the RGB LED design from the MKR 1010 and can blink the RGB LEDS running as a background RTOS task - (as an aside - I posted that a while ago on the arduino.cc forums - one for the 1010 and one for the 4K).

No matter what I've tried (and I've looked at probably all of the threads including the one on the espressif site) - it either results in the build crashing when I run or when making a seemingly innocuous change like the partition table - the build fails.

Can someone please give some explicit instructions on how to build using preferably the tip of tree and or all of the explicit steps to make a good build in the 2MB's we have on the NINA-W102? Making the good build is of course preferable as I can work on paring down into the 2MB.

I've tried all of the steps here (on this site) - referring me to an old thread isn't that useful since I don't know how to go back and use all of the versions of the tools that are pointed out. The thread on the espressif site goes into that - but he also used 1.81 of the dlespress download and I don't know how to find that right now. I suppose I can ask for it there if I can't find it. (Edit - the explicit link is there - but it is for the 'old' MSYS32 environment. Would be great to see this for the new version of the build tools under Win10.)

Another question that I have is what basic project is everyone starting with for basic AT functionality of the command set on the NINA W102? I started with the at_http_webserver example and pared that down so it would fit in the 2MB's as a lot have pointed out here (the steps for that). (Edit - OK - I see 'main' under the root dir of the esp-at project - I'm assuming that's the starting point even though no CMakeLists.txt is defined there.)

Here's a log file of the only build that worked - but at runtime it crashes:

putty-log-ninaw10-for-forum-questions.txt

One of the build issues I am seeing is this - I think someone posted something similar - but that thread is a little sparse and unclear as to what the solution really is - I just made the changes to the relevant .csv files as pointed out in threads here:

-- Could NOT find Perl (missing: PERL_EXECUTABLE) CMake Error at C:/esp-idf-2-rb/components/esptool_py/project_include.cmake:197 (file): file RELATIVE_PATH must be passed a full path to the file: FLASH_IN_PROJECT Call Stack (most recent call first):

That's where the error starts. And, do we need to install perl? I'm currently doing this dev on Win10 - I've tried all of this on 3 different machines - all getting pretty much the same result.

Thanks In Advance, John W. (Edit - some progress using new tools - using ESP-AT Branch v2.0 esp32 with IDF rel v3.3. Down to what appears to be defines in config stuff.) (Edit - wow, figuring out how to add libesp32_at_core.a with the 'cmakelists' method is really that hard???) (Edit - OK - I guess it's easier to change the build.ninja file to force the link of a static lib than to decode the Labyrinthal Quagmire of cmake 'include lib' landmine types of rabbit hole instructions ... - the cmake editor in eclipse really no help either...)

jwestmoreland commented 4 years ago

Hello All,

I've been able to make a build now with the new tools - but it is crashing:

b@▒ņ$▒儦▒▒▒▒▒▒▒▒▒ņĄ▒▒ť▒ť▒▒▒▒▒▒▒▒▒▒EC#▒▒▒▒▒ĄĤƇ▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒ĄĄ▒▒▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒n▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒\▒DC#▒▒ħ▒G▒ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:4508 load:0x40078000,len:13452 ho 0 tail 12 room 4 load:0x40080400,len:3608 entry 0x40080654 b@▒ņ$▒儦▒▒▒▒▒▒▒▒▒ņĄ▒▒ť▒ť▒▒▒▒▒▒▒▒▒▒EC#▒▒▒▒▒ĄĤƇ▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒ĄĄ▒▒▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒ĄĤ▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒▒Ą▒▒▒▒▒▒▒▒DC#▒▒ħ▒G▒ets Jun 8 2016 00:22:57

I'm using tip of tree ('master') for the ESP-AT and version 4.0 release of the IDF.

Obviously the configuration isn't correct - at least I think.

Regards, John

jwestmoreland commented 4 years ago

Hello All,

So, to get builds to work - I have a workaround of sorts:

1) Build your ESP-AT app - make sure the partition table is correct. 2) Patch the build.ninja file in your x:/app/build_dir <= build.ninja is in the build dir. (Adding c:/esp-at/build_dir/appxxx_main/libesp32_at_core.a to the link libraries entry - see below.) 3) run ninja from your build dir 4) You should be able to flash now.

At least I can load and run now even though it's still crashing. I would say the cmake environment is on the order of being unbelievably useless - going back to traditional make for the embedded bare metal stuff here may be a good decision if this is so fragile.

I've found the ESP32 DOWNLOAD TOOL V3.6.8 is pretty handy.

So, it would appear the build environment is pretty broke. It makes me wonder what everyone is using. I'm using Win10 but I suppose I can see how this works under Linux.

My 'blinky' only build is OK - it's just the integration of the ESP-AT environment that's apparently unstable.

YMMV.

Regards, John

Ex snippet: #############################################

Link the executable blink_main.elf

build blink_main.elf: CXX_EXECUTABLE_LINKER__blink_main.2eelf CMakeFiles/blink_main.elf.dir/blink_main/blink.c.obj CMakeFiles/blink_main.elf.dir/blink_main/app_mainb.c.obj CMakeFiles/blink_main.elf.dir/blink_main/at_default_config.c.obj CMakeFiles/blink_main.elf.dir/blink_main/at_eth_init.c.obj CMakeFiles/blink_main.elf.dir/blink_main/at_upgrade.c.obj CMakeFiles/blink_main.elf.dir/blink_main/interface/uart/at_uart_task.c.obj | esp-idf/soc/libsoc.a esp-idf/log/liblog.a esp-idf/heap/libheap.a esp-idf/freertos/libfreertos.a esp-idf/vfs/libvfs.a esp-idf/newlib/libnewlib.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/driver/libdriver.a esp-idf/esp_event/libesp_event.a esp-idf/ethernet/libethernet.a esp-idf/mbedtls/libmbedtls.a esp-idf/micro-ecc/libmicro-ecc.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/app_update/libapp_update.a esp-idf/spi_flash/libspi_flash.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/lwip/liblwip.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/pthread/libpthread.a esp-idf/smartconfig_ack/libsmartconfig_ack.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/xtensa-debug-module/libxtensa-debug-module.a esp-idf/espcoredump/libespcoredump.a esp-idf/esp32/libesp32.a esp-idf/cxx/libcxx.a esp-idf/app_trace/libapp_trace.a esp-idf/asio/libasio.a esp-idf/jsmn/libjsmn.a esp-idf/coap/libcoap.a esp-idf/console/libconsole.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/esp_adc_cal/libesp_adc_cal.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_https_ota/libesp_https_ota.a esp-idf/openssl/libopenssl.a esp-idf/esp_https_server/libesp_https_server.a esp-idf/expat/libexpat.a esp-idf/wear_levelling/libwear_levelling.a esp-idf/sdmmc/libsdmmc.a esp-idf/fatfs/libfatfs.a esp-idf/freemodbus/libfreemodbus.a esp-idf/json/libjson.a esp-idf/libsodium/liblibsodium.a esp-idf/mdns/libmdns.a esp-idf/mqtt/libmqtt.a esp-idf/protobuf-c/libprotobuf-c.a esp-idf/protocomm/libprotocomm.a esp-idf/spiffs/libspiffs.a esp-idf/ulp/libulp.a esp-idf/unity/libunity.a esp-idf/wifi_provisioning/libwifi_provisioning.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/soc/libsoc.a esp-idf/log/liblog.a esp-idf/heap/libheap.a esp-idf/freertos/libfreertos.a esp-idf/newlib/libnewlib.a esp-idf/esp32/libesp32.a C$:/ep/esp-idf/components/esp32/libhal.a esp-idf/cxx/libcxx.a esp-idf/esp32/esp32.project.ld esp-idf/esp32/esp32_out.ld C$:/ep/esp-idf/components/esp32/ld/esp32.rom.ld C$:/ep/esp-idf/components/esp32/ld/esp32.peripherals.ld C$:/ep/esp-idf/components/esp32/ld/esp32.rom.libgcc.ld C$:/ep/esp-idf/components/esp32/ld/esp32.rom.spiram_incompatible_fns.ld || esp-idf/app_trace/libapp_trace.a esp-idf/app_update/libapp_update.a esp-idf/asio/libasio.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/coap/libcoap.a esp-idf/console/libconsole.a esp-idf/cxx/libcxx.a esp-idf/driver/libdriver.a esp-idf/efuse/libefuse.a esp-idf/esp-tls/libesp-tls.a esp-idf/esp32/libesp32.a esp-idf/esp_adc_cal/libesp_adc_cal.a esp-idf/esp_event/libesp_event.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_https_ota/libesp_https_ota.a esp-idf/esp_https_server/libesp_https_server.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/espcoredump/libespcoredump.a esp-idf/ethernet/libethernet.a esp-idf/expat/libexpat.a esp-idf/fatfs/libfatfs.a esp-idf/freemodbus/libfreemodbus.a esp-idf/freertos/libfreertos.a esp-idf/heap/libheap.a esp-idf/jsmn/libjsmn.a esp-idf/json/libjson.a esp-idf/ldgen esp-idf/libsodium/liblibsodium.a esp-idf/log/liblog.a esp-idf/lwip/liblwip.a esp-idf/mbedtls/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/mdns/libmdns.a esp-idf/micro-ecc/libmicro-ecc.a esp-idf/mqtt/libmqtt.a esp-idf/newlib/libnewlib.a esp-idf/nghttp/libnghttp.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/openssl/libopenssl.a esp-idf/protobuf-c/libprotobuf-c.a esp-idf/protocomm/libprotocomm.a esp-idf/pthread/libpthread.a esp-idf/sdmmc/libsdmmc.a esp-idf/smartconfig_ack/libsmartconfig_ack.a esp-idf/soc/libsoc.a esp-idf/spi_flash/libspi_flash.a esp-idf/spiffs/libspiffs.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/ulp/libulp.a esp-idf/unity/libunity.a esp-idf/vfs/libvfs.a esp-idf/wear_levelling/libwear_levelling.a esp-idf/wifi_provisioning/libwifi_provisioning.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/xtensa-debug-module/libxtensa-debug-module.a FLAGS = -mlongcalls LINK_FLAGS = -nostdlib LINK_LIBRARIES = -Wl,--cref -Wl,--Map=blink_main.map -Wl,--gc-sections -Wl,--start-group esp-idf/soc/libsoc.a esp-idf/log/liblog.a esp-idf/heap/libheap.a esp-idf/freertos/libfreertos.a esp-idf/vfs/libvfs.a esp-idf/newlib/libnewlib.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/driver/libdriver.a esp-idf/esp_event/libesp_event.a esp-idf/ethernet/libethernet.a esp-idf/mbedtls/libmbedtls.a esp-idf/micro-ecc/libmicro-ecc.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/app_update/libapp_update.a esp-idf/spi_flash/libspi_flash.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/lwip/liblwip.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/pthread/libpthread.a esp-idf/smartconfig_ack/libsmartconfig_ack.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/xtensa-debug-module/libxtensa-debug-module.a esp-idf/espcoredump/libespcoredump.a esp-idf/esp32/libesp32.a esp-idf/cxx/libcxx.a esp-idf/app_trace/libapp_trace.a esp-idf/asio/libasio.a esp-idf/jsmn/libjsmn.a esp-idf/coap/libcoap.a esp-idf/console/libconsole.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/esp_adc_cal/libesp_adc_cal.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_https_ota/libesp_https_ota.a esp-idf/openssl/libopenssl.a esp-idf/esp_https_server/libesp_https_server.a esp-idf/expat/libexpat.a esp-idf/wear_levelling/libwear_levelling.a esp-idf/sdmmc/libsdmmc.a esp-idf/fatfs/libfatfs.a esp-idf/freemodbus/libfreemodbus.a esp-idf/json/libjson.a esp-idf/libsodium/liblibsodium.a esp-idf/mdns/libmdns.a esp-idf/mqtt/libmqtt.a esp-idf/protobuf-c/libprotobuf-c.a esp-idf/protocomm/libprotocomm.a esp-idf/spiffs/libspiffs.a esp-idf/ulp/libulp.a esp-idf/unity/libunity.a esp-idf/wifi_provisioning/libwifi_provisioning.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/soc/libsoc.a esp-idf/log/liblog.a esp-idf/heap/libheap.a esp-idf/freertos/libfreertos.a -Wl,--undefined=uxTopUsedPriority esp-idf/newlib/libnewlib.a -L C:/ep/esp-idf/components/newlib/lib -lc -lm esp-idf/esp32/libesp32.a -L C:/ep/esp-idf/components/esp32/lib -lcoexist -lcore -lespnow -lmesh -lnet80211 -lphy -lpp -lrtc -lsmartconfig -lwpa2 -lwpa -lwps -L C:/ep/esp-at/blink/build/esp-idf/esp32 -T esp32_out.ld -T C:/ep/esp-at/blink/build/esp-idf/esp32/esp32.project.ld -L C:/ep/esp-idf/components/esp32/ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld C:/ep/esp-idf/components/esp32/libhal.a -lgcc -u call_user_start_cpu0 -u ld_include_panic_highint_hdl esp-idf/cxx/libcxx.a c:/ep/esp-at/blink/blink_main/libesp32_at_core.a ### c:/ep/esp-at/blink/blink_main/libesp32_at_core.a**** -lstdc++ -u cxa_guard_dummy -u cxx_fatal_exception -u esp_app_desc -lgcov OBJECT_DIR = CMakeFiles\blink_main.elf.dir POST_BUILD = cd . PRE_LINK = cd . TARGET_FILE = blink_main.elf TARGET_PDB = blink_main.elf.dbg RSP_FILE = CMakeFiles\blink_main.elf.rsp

#############################################

jwestmoreland commented 4 years ago

Hello Again,

Some partial success - log file attached.

new-esptools-win10-partial-success.txt

Regards, John W.

jwestmoreland commented 4 years ago

And, getting this now:

V (7570) tcpip_adapter: check: local, if=1 fn=0x400d6ae0

D (7577) tcpip_adapter: dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1) V (7584) tcpip_adapter: call api in lwip: ret=0x0, give sem V (7589) tcpip_adapter: check: remote, if=1 fn=0x400d6ae0

V (7595) event: exit default callback D (7599) nvs: nvs_open_from_partition UART 0 D (7603) nvs: nvs_get rate 4 D (7607) nvs: nvs_get databits 1 D (7610) nvs: nvs_get stopbits 1 D (7613) nvs: nvs_get parity 1 D (7616) nvs: nvs_get flow_ctrl 1 D (7620) nvs: nvs_close 4 Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. Core 1 register dump: PC : 0x40088591 PS : 0x00060033 A0 : 0x80087d2e A1 : 0x3ffca4f0 A2 : 0x00000048 A3 : 0x00060023 A4 : 0x00060023 A5 : 0x0000abab A6 : 0x0000abab A7 : 0x00060e23 A8 : 0x0000cdcd A9 : 0xb33fffff A10 : 0x0000abab A11 : 0x00060020 A12 : 0x00000000 A13 : 0x00000001 A14 : 0x0000abab A15 : 0x00060023 SAR : 0x00000000 EXCCAUSE: 0x0000001d EXCVADDR: 0x00000048 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

ELF file SHA256: b5807092cd7c3b204b0b9ddc086b1d7ee4cd419625b77bfbaf32aa3a6344d3a2

Backtrace: 0x40088591:0x3ffca4f0 0x40087d2b:0x3ffca510 0x400d139e:0x3ffca550

Regards, John W.

jwestmoreland commented 4 years ago

Annndddd.... some more progress....

D (7983) nvs: nvs_open_from_partition NVM_009 1 D (7989) nvs: nvs_get maxlink 1 D (7991) nvs: nvs_open_from_partition NVM_009 0 D (7995) nvs: nvs_get auth0 1 D (7998) nvs: nvs_open_from_partition NVM_005 1 D (8004) nvs: nvs_get enable 1 D (8006) nvs: nvs_get type 1 D (8009) nvs: nvs_get_str_or_blob r_ip D (8013) nvs: nvs_get r_port 4 D (8016) nvs: nvs_get l_port 4 D (8019) nvs: nvs_get change_mode 1 D (8023) nvs: nvs_get keep_alive 2 D (8026) nvs: nvs_open_from_partition NVM_017 0 factory_parameter partition missed D (8034) nvs: nvs_open_from_partition NVM_013 0 D (8038) nvs: nvs_open_from_partition NVM_013 1 D (8044) nvs: nvs_set apmode 4 0 D (8048) nvs: nvs_close 8

ready I (57529) wifi: new:<1,1>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1 I (57531) wifi: station: dc:85:de:4a:43:89 join, AID=1, bgn, 40U D (57533) event: SYSTEM_EVENT_AP_STACONNECTED, mac:dc:85:de:4a:43:89, aid:1 +STA_CONNECTED:"dc:85:de:4a:43:89" I (57623) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 D (57624) event: SYSTEM_EVENT_AP_STAIPASSIGNED V (57625) esp_adapter: thread sem get: sem=0x3ffc9dd4 +DIST_STA_IP:"dc:85:de:4a:43:89","192.168.4.2"

Regards, John W.

jwestmoreland commented 4 years ago

Hello All,

Attached is a build of what's above except running the JTAG debugger using the OpenOCD I/F with the Eclipse environment.

target-running-esp-at-idf-5-pub-rel1

Best Regards, John W.

jwestmoreland commented 4 years ago

closing