Skip to content

Commit

Permalink
Migration of ESP32 targets from idf 4.4 to 5.3:
Browse files Browse the repository at this point in the history
- fixed GCC 13 (which is used by idf 5.3) compilation issues;
- fixed compatibility issues with idf 5.3 library;
  • Loading branch information
arg7 committed Sep 12, 2024
1 parent 4db5d06 commit b5f0654
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_Filesystem/AP_Filesystem_ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ 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");
#endif
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");
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ESP32/SPIDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 2 additions & 6 deletions libraries/AP_HAL_ESP32/SdCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <sys/types.h>
#include "SPIDevice.h"

#include "soc/rtc_wdt.h"

#ifdef HAL_ESP32_SDCARD

#if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32C3
Expand Down Expand Up @@ -254,8 +252,8 @@ void mount_sdcard()
{
mount_sdcard_spi();
}
#endif // end spi

#endif // end spi

bool sdcard_retry(void)
{
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ESP32/Semaphores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ESP32/UARTDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL_ESP32/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "esp_heap_caps.h"
#include <AP_Common/ExpandingString.h>

#include "esp_mac.h"

extern const AP_HAL::HAL& hal;

Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_HAL_ESP32/WiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_HAL_ESP32/WiFiUdpDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions libraries/AP_HAL_ESP32/i2c_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/SITL/SIM_EFI_MegaSquirt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b5f0654

Please sign in to comment.