diff --git a/libraries/AP_Filesystem/AP_Filesystem_ESP32.cpp b/libraries/AP_Filesystem/AP_Filesystem_ESP32.cpp index 9cb031d86795d..9f71c8d281be0 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_ESP32.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_ESP32.cpp @@ -42,7 +42,7 @@ int AP_Filesystem_ESP32::close(int fd) return ::close(fd); } -ssize_t AP_Filesystem_ESP32::read(int fd, void *buf, size_t count) +int32_t AP_Filesystem_ESP32::read(int fd, void *buf, uint32_t count) { #if FSDEBUG printf("DO read \n"); @@ -50,7 +50,7 @@ ssize_t AP_Filesystem_ESP32::read(int fd, void *buf, size_t count) return ::read(fd, buf, count); } -ssize_t AP_Filesystem_ESP32::write(int fd, const void *buf, size_t count) +int32_t AP_Filesystem_ESP32::write(int fd, const void *buf, uint32_t count) { #if FSDEBUG printf("DO write \n"); diff --git a/libraries/AP_HAL_ESP32/SPIDevice.cpp b/libraries/AP_HAL_ESP32/SPIDevice.cpp index 35006a48bea88..98e5f126198dd 100644 --- a/libraries/AP_HAL_ESP32/SPIDevice.cpp +++ b/libraries/AP_HAL_ESP32/SPIDevice.cpp @@ -60,7 +60,7 @@ SPIDevice::SPIDevice(SPIBus &_bus, SPIDeviceDesc &_device_desc) set_device_bus(bus.bus); set_device_address(_device_desc.device); set_speed(AP_HAL::Device::SPEED_LOW); - gpio_pad_select_gpio(device_desc.cs); + esp_rom_gpio_pad_select_gpio(device_desc.cs); gpio_set_direction(device_desc.cs, GPIO_MODE_OUTPUT); gpio_set_level(device_desc.cs, 1); diff --git a/libraries/AP_HAL_ESP32/SdCard.cpp b/libraries/AP_HAL_ESP32/SdCard.cpp index 0f91711e1a9a9..4644797cf32e3 100644 --- a/libraries/AP_HAL_ESP32/SdCard.cpp +++ b/libraries/AP_HAL_ESP32/SdCard.cpp @@ -32,8 +32,6 @@ #include #include "SPIDevice.h" -#include "soc/rtc_wdt.h" - #ifdef HAL_ESP32_SDCARD #if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32C3 @@ -254,8 +252,8 @@ void mount_sdcard() { mount_sdcard_spi(); } -#endif // end spi +#endif // end spi bool sdcard_retry(void) { @@ -265,16 +263,14 @@ bool sdcard_retry(void) return sdcard_running; } - void unmount_sdcard() { if (card != nullptr) { - esp_vfs_fat_sdmmc_unmount(); + esp_vfs_fat_sdcard_unmount( "/SDCARD", card); } sdcard_running = false; } - #else // empty impl's void mount_sdcard() diff --git a/libraries/AP_HAL_ESP32/Semaphores.cpp b/libraries/AP_HAL_ESP32/Semaphores.cpp index d76ca820aeae1..cd4189ca1ea9e 100644 --- a/libraries/AP_HAL_ESP32/Semaphores.cpp +++ b/libraries/AP_HAL_ESP32/Semaphores.cpp @@ -106,7 +106,7 @@ void BinarySemaphore::signal_ISR() { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xSemaphoreGiveFromISR(_sem, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + portYIELD_FROM_ISR_ARG(xHigherPriorityTaskWoken); } BinarySemaphore::~BinarySemaphore(void) diff --git a/libraries/AP_HAL_ESP32/UARTDriver.cpp b/libraries/AP_HAL_ESP32/UARTDriver.cpp index 2cf293a350482..90befdb6cc1bf 100644 --- a/libraries/AP_HAL_ESP32/UARTDriver.cpp +++ b/libraries/AP_HAL_ESP32/UARTDriver.cpp @@ -55,7 +55,7 @@ void UARTDriver::_begin(uint32_t b, uint16_t rxS, uint16_t txS) uart_desc[uart_num].rx, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); //uart_driver_install(p, 2*UART_FIFO_LEN, 0, 0, nullptr, 0); - uart_driver_install(p, 2*UART_FIFO_LEN, 0, 0, nullptr, 0); + uart_driver_install(p, 2*UART_HW_FIFO_LEN(p), 0, 0, nullptr, 0); _readbuf.set_size(RX_BUF_SIZE); _writebuf.set_size(TX_BUF_SIZE); diff --git a/libraries/AP_HAL_ESP32/Util.cpp b/libraries/AP_HAL_ESP32/Util.cpp index c5d68386686fc..8585e23fc8151 100644 --- a/libraries/AP_HAL_ESP32/Util.cpp +++ b/libraries/AP_HAL_ESP32/Util.cpp @@ -35,6 +35,7 @@ #include "esp_heap_caps.h" #include +#include "esp_mac.h" extern const AP_HAL::HAL& hal; diff --git a/libraries/AP_HAL_ESP32/WiFiDriver.cpp b/libraries/AP_HAL_ESP32/WiFiDriver.cpp index 9d8b5cfd5c469..f1c7eb9e97276 100644 --- a/libraries/AP_HAL_ESP32/WiFiDriver.cpp +++ b/libraries/AP_HAL_ESP32/WiFiDriver.cpp @@ -145,7 +145,7 @@ bool WiFiDriver::start_listen() bool WiFiDriver::try_accept() { struct sockaddr_in sourceAddr; - uint addrLen = sizeof(sourceAddr); + socklen_t addrLen = sizeof(sourceAddr); short i = available_socket(); if (i != WIFI_MAX_CONNECTION) { socket_list[i] = accept(accept_socket, (struct sockaddr *)&sourceAddr, &addrLen); @@ -246,7 +246,7 @@ static void _sta_event_handler(void* arg, esp_event_base_t event_base, void WiFiDriver::initialize_wifi() { #ifndef WIFI_PWD - #default WIFI_PWD "ardupilot1" + #define WIFI_PWD "ardupilot1" #endif //Initialize NVS esp_err_t ret = nvs_flash_init(); diff --git a/libraries/AP_HAL_ESP32/WiFiUdpDriver.cpp b/libraries/AP_HAL_ESP32/WiFiUdpDriver.cpp index 9348f56cc7ac8..d6a247e13c5d6 100644 --- a/libraries/AP_HAL_ESP32/WiFiUdpDriver.cpp +++ b/libraries/AP_HAL_ESP32/WiFiUdpDriver.cpp @@ -32,7 +32,7 @@ #include "lwip/sys.h" #include "lwip/netdb.h" -#include "soc/rtc_wdt.h" +#include "freertos/idf_additions.h" using namespace ESP32; @@ -215,7 +215,7 @@ static void _sta_event_handler(void* arg, esp_event_base_t event_base, void WiFiUdpDriver::initialize_wifi() { #ifndef WIFI_PWD - #default WIFI_PWD "ardupilot1" + #define WIFI_PWD "ardupilot1" #endif //Initialize NVS esp_err_t ret = nvs_flash_init(); diff --git a/libraries/AP_HAL_ESP32/i2c_sw.c b/libraries/AP_HAL_ESP32/i2c_sw.c index 6caf9e5c6064e..e2ae274774cb4 100644 --- a/libraries/AP_HAL_ESP32/i2c_sw.c +++ b/libraries/AP_HAL_ESP32/i2c_sw.c @@ -126,8 +126,9 @@ void i2c_init(_i2c_bus_t* bus) case 160: bus->delay = _i2c_delays[bus->speed][1]; break; case 240: bus->delay = _i2c_delays[bus->speed][2]; break; default : DEBUG("i2c I2C software implementation is not " - "supported for this CPU frequency: %d MHz\n", - ets_get_cpu_frequency()); + "supported for this CPU frequency: %u MHz\n", + (unsigned int)ets_get_cpu_frequency() + ); return; } diff --git a/libraries/SITL/SIM_EFI_MegaSquirt.cpp b/libraries/SITL/SIM_EFI_MegaSquirt.cpp index 2935024ce0b0a..2a5e7152be8a1 100644 --- a/libraries/SITL/SIM_EFI_MegaSquirt.cpp +++ b/libraries/SITL/SIM_EFI_MegaSquirt.cpp @@ -107,7 +107,7 @@ void EFI_MegaSquirt::update() if (crc == crc2) { send_table(); } else { - printf("BAD EFI CRC: 0x%08x 0x%08x\n", crc, crc2); + printf("BAD EFI CRC: 0x%08x 0x%08x\n", (unsigned int)crc, (unsigned int)crc2); } ofs = 0; }