AP_HAL_ESP32: new mcu: esp32s3

This commit is contained in:
Nicholas Kruzan 2023-05-15 17:46:03 +00:00 committed by Tom Pittenger
parent d16cde3b31
commit 575422fdf5
6 changed files with 1292 additions and 1 deletions

View File

@ -35,7 +35,8 @@
#include <stdio.h>
#include "esp_attr.h"
#include "esp32/rom/ets_sys.h"
#include "rom/ets_sys.h" // seems to work for both...for now..deprecated
#include "soc/gpio_reg.h"
#include "soc/gpio_struct.h"

View File

@ -0,0 +1,2 @@
/sdkconfig.old
/board.txt

View File

@ -0,0 +1,110 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_TOOLCHAIN_FILE $ENV{IDF_PATH}/tools/cmake/toolchain-esp32s3.cmake CACHE STRING "")
project(ardupilot)
# Include for ESP-IDF build system functions
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
# Create idf::esp32 and idf::freertos static libraries
idf_build_process(esp32s3
# try and trim the build; additional components
# will be included as needed based on dependency tree
#
# although esptool_py does not generate static library,
# processing the component is needed for flashing related
# targets and file generation
COMPONENTS esp32s3
freertos
tcpip_adapter
fatfs
esp_adc_cal
nvs_flash
esptool_py
app_update
SDKCONFIG ${CMAKE_CURRENT_LIST_DIR}/sdkconfig
BUILD_DIR ${CMAKE_BINARY_DIR})
set(elf_file ardupilot.elf)
add_executable(${elf_file} main.c)
if(NOT DEFINED ARDUPILOT_CMD)
set(ARDUPILOT_CMD "none")
endif()
IF(${ARDUPILOT_CMD} STREQUAL "plane")
message("Building for plane")
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarduplane.a")
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduPlane_libs.a")
ENDIF()
IF(${ARDUPILOT_CMD} STREQUAL "copter")
message("Building for copter")
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libarducopter.a")
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduCopter_libs.a")
ENDIF()
IF(${ARDUPILOT_CMD} STREQUAL "rover")
message("Building for rover")
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardurover.a")
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libRover_libs.a")
ENDIF()
IF(${ARDUPILOT_CMD} STREQUAL "sub")
message("Building for submarine")
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libardusub.a")
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libArduSub_libs.a")
ENDIF()
IF(${ARDUPILOT_CMD} STREQUAL "antennatracker")
message("Building AntennaTracker")
target_link_libraries(${elf_file} "${ARDUPILOT_BIN}/libantennatracker.a")
target_link_libraries(${elf_file} "${ARDUPILOT_LIB}/libAntennaTracker_libs.a")
ENDIF()
add_custom_target(showinc ALL
COMMAND echo -e
"$<TARGET_PROPERTY:${elf_file},INCLUDE_DIRECTORIES>"
> includes.list
VERBATIM
BYPRODUCTS includes.list
COMMAND_EXPAND_LISTS
)
#Find files name lib to link
#function(SUBLINK target curdir)
# FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
# FOREACH(child ${children})
# IF(NOT IS_DIRECTORY ${curdir}/${child})
# SET(PATH "${curdir}/${child}")
# message("Linking ${PATH}")
# target_link_libraries(${target} "${PATH}")
# ENDIF()
# ENDFOREACH()
#endfunction()
#IF (DEFINED ARDUPILOT_BIN)
# SUBLINK(${elf_file} ${ARDUPILOT_BIN})
#ENDIF()
#IF (DEFINED ARDUPILOT_LIB)
# SUBLINK(${elf_file} ${ARDUPILOT_LIB})
#ENDIF()
# Link the static libraries to the executable
target_link_libraries(${elf_file}
idf::esp32s3
idf::freertos
idf::fatfs
idf::esp_adc_cal
idf::nvs_flash
idf::spi_flash
idf::tcpip_adapter
idf::app_update
)
# Attach additional targets to the executable file for flashing,
# linker script generation, partition_table generation, etc.
idf_build_executable(${elf_file})
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

View File

@ -0,0 +1,14 @@
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stddef.h>
int main(int argc, char *argv[]);
void app_main()
{
main(0, NULL);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
# Name, Type, SubType, Offset, Size
nvs, data, nvs, , 0x6000
phy_init, data, phy, , 0x1000
factory, app, factory, , 3M
storage, 0x45, 0x0, , 128K
1 # Name Type SubType Offset Size
2 nvs data nvs 0x6000
3 phy_init data phy 0x1000
4 factory app factory 3M
5 storage 0x45 0x0 128K