Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lcago authored Dec 13, 2024
2 parents e95243c + 72f56ee commit 0351464
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 7 deletions.
10 changes: 4 additions & 6 deletions libraries/AP_HAL_ChibiOS/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,14 @@ void panic(const char *errormsg, ...)
INTERNAL_ERROR(AP_InternalError::error_t::panic);
va_list ap;

va_start(ap, errormsg);
vprintf(errormsg, ap);
va_end(ap);

hal.scheduler->delay_microseconds(10000);
uint16_t delay_ms = 10000;
while (1) {
va_start(ap, errormsg);
vprintf(errormsg, ap);
va_end(ap);
hal.scheduler->delay(500);
printf("\n");
hal.scheduler->delay(delay_ms);
delay_ms = 500;
}
#else
// we don't support variable args in bootlaoder
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ESP32/SdCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void mount_sdcard_spi()
ESP_LOGI(TAG, "Initializing SD card as SDSPI");
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = 10,
.max_files = 5,
.allocation_unit_size = 16 * 1024
};

Expand Down
73 changes: 73 additions & 0 deletions libraries/AP_HAL_ESP32/targets/esp32/esp-idf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,76 @@ idf_build_executable(${elf_file})

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

# Additional targets for measuring RAM use: size, size-components, size-files
# - Adapted from ${IDF_PATH}/tools/cmake/project.cmake
#
# Reference:
# - https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s3/api-guides/performance/size.html#minimizing-binary-size
#
# Usage:
# cd ./build/esp32s3xxx/esp-idf_build
# ninja -v -v size
#
set(mapfile "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map")
# Add cross-reference table to the map file
target_link_options(${elf_file} PRIVATE "-Wl,--cref")
# Add this symbol as a hint for esp_idf_size to guess the target name
target_link_options(${elf_file} PRIVATE "-Wl,--defsym=IDF_TARGET_${idf_target}=0")
# Enable map file output
target_link_options(${elf_file} PRIVATE "-Wl,--Map=${mapfile}")
# Check if linker supports --no-warn-rwx-segments
execute_process(COMMAND ${CMAKE_LINKER} "--no-warn-rwx-segments" "--version"
RESULT_VARIABLE result
OUTPUT_QUIET
ERROR_QUIET)
if(${result} EQUAL 0)
# Do not print RWX segment warnings
target_link_options(${elf_file} PRIVATE "-Wl,--no-warn-rwx-segments")
endif()
if(CONFIG_ESP_ORPHAN_SECTION_WARNING)
# Print warnings if orphan sections are found
target_link_options(${elf_file} PRIVATE "-Wl,--orphan-handling=warn")
endif()

idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(python PYTHON)

set(idf_size ${python} -m esp_idf_size)

# Add size targets, depend on map file, run esp_idf_size
# OUTPUT_JSON is passed for compatibility reasons, SIZE_OUTPUT_FORMAT
# environment variable is recommended and has higher priority
add_custom_target(size
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)

add_custom_target(size-files
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "IDF_SIZE_MODE=--files"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)

add_custom_target(size-components
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "IDF_SIZE_MODE=--archives"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)
74 changes: 74 additions & 0 deletions libraries/AP_HAL_ESP32/targets/esp32s3/esp-idf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,77 @@ target_link_libraries(${elf_file}
idf_build_executable(${elf_file})

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

# Additional targets for measuring RAM use: size, size-components, size-files
# - Adapted from ${IDF_PATH}/tools/cmake/project.cmake
#
# Reference:
# - https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s3/api-guides/performance/size.html#minimizing-binary-size
#
# Usage:
# cd ./build/esp32s3xxx/esp-idf_build
# ninja -v -v size
#
set(mapfile "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map")
# Add cross-reference table to the map file
target_link_options(${elf_file} PRIVATE "-Wl,--cref")
# Add this symbol as a hint for esp_idf_size to guess the target name
target_link_options(${elf_file} PRIVATE "-Wl,--defsym=IDF_TARGET_${idf_target}=0")
# Enable map file output
target_link_options(${elf_file} PRIVATE "-Wl,--Map=${mapfile}")
# Check if linker supports --no-warn-rwx-segments
execute_process(COMMAND ${CMAKE_LINKER} "--no-warn-rwx-segments" "--version"
RESULT_VARIABLE result
OUTPUT_QUIET
ERROR_QUIET)
if(${result} EQUAL 0)
# Do not print RWX segment warnings
target_link_options(${elf_file} PRIVATE "-Wl,--no-warn-rwx-segments")
endif()
if(CONFIG_ESP_ORPHAN_SECTION_WARNING)
# Print warnings if orphan sections are found
target_link_options(${elf_file} PRIVATE "-Wl,--orphan-handling=warn")
endif()

idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(python PYTHON)

set(idf_size ${python} -m esp_idf_size)

# Add size targets, depend on map file, run esp_idf_size
# OUTPUT_JSON is passed for compatibility reasons, SIZE_OUTPUT_FORMAT
# environment variable is recommended and has higher priority
add_custom_target(size
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)

add_custom_target(size-files
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "IDF_SIZE_MODE=--files"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)

add_custom_target(size-components
COMMAND ${CMAKE_COMMAND}
-D "IDF_SIZE_TOOL=${idf_size}"
-D "IDF_SIZE_MODE=--archives"
-D "MAP_FILE=${mapfile}"
-D "OUTPUT_JSON=${OUTPUT_JSON}"
-P "${idf_path}/tools/cmake/run_size_tool.cmake"
DEPENDS ${mapfile}
USES_TERMINAL
VERBATIM
)

0 comments on commit 0351464

Please sign in to comment.