espressif / esp-hosted

Hosted Solution (Linux/MCU) with ESP32 (Wi-Fi + BT + BLE)
Other
695 stars 162 forks source link

Compiling issues with esp-hosted-fg #240

Closed lawrencerb closed 1 year ago

lawrencerb commented 1 year ago

Tools used: VSCode: ESP-IDF extension Compiling the code for either esp32-c3 or esp32-c6 results in:

/home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c: In function 'req_get_ap_config_handler': /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c:653:13: error: the comparison will always evaluate as 'true' for the address of 'ssid' will never be NULL [-Werror=address] 653 | if (ap_info->ssid) { | ^~~ In file included from /home/lawrence/esp/esp-idf/components/esp_wifi/include/esp_private/wifi.h:28, from /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c:19: /home/lawrence/esp/esp-idf/components/esp_wifi/include/esp_wifi_types.h:207:13: note: 'ssid' declared here 207 | uint8_t ssid[33]; /*< SSID of AP / | ^~~~ /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c: In function 'req_get_softap_config_handler': /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c:797:13: error: the comparison will always evaluate as 'true' for the address of 'ssid' will never be NULL [-Werror=address] 797 | if (get_conf.ap.ssid) { | ^~~~ /home/lawrence/esp/esp-idf/components/esp_wifi/include/esp_wifi_types.h:285:13: note: 'ssid' declared here 285 | uint8_t ssid[32]; /*< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. / | ^~~~ /home/lawrence/esp-hosted/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c:801:13: error:

  • The terminal process "/usr/bin/bash '-c', 'ninja '" terminated with exit code: 1.

It appears this specific section of the code is complaining that the condition is always true. There is an easy fix identifying if the pointer has ended the information with \0 but from source it does not compile.

Verified the same issue for either Windows or Linux using ninja ans VSCode

lawrencerb commented 1 year ago

Found a fix using the idf.py:

  1. Clean your build directory with idf.py fullclean.
  2. Set the target to ESP32-C6 with idf.py --preview set-target esp32c6.
  3. Run idf.py menuconfig and make sure you select the right settings for your chip.
  4. Navigate to 'Compiler options' and choose 'Disable new warnings introduced in GCC 12'.
  5. Rebuild your project with idf.py build.
  6. Run: .espressif/python_env/idf5.1_py3.10_env/bin/python ../../../../../esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32c6 write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0xd000 build/ota_data_initial.bin 0x10000 build/network_adapter.bin
mantriyogesh commented 1 year ago

Noted and thank you for pointing out the issue you had faced..

These changes are taken into consideration for next release.

For now you can just change:

if(<Condition>)

To

if(strlen((char*)<Condition>))

We suggest not to suppress any kind of compiler warning you face.