设置可高度的Relase版本,不然Usb没法枚举,Debug速度太慢
This commit is contained in:
32
ESP32/my_usb_project/fix_segments.cmake
Normal file
32
ESP32/my_usb_project/fix_segments.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
# CMake script to fix segment overlap issue
|
||||
# This script modifies the ESP32-S3 memory layout to avoid 64KB flash segment overlaps
|
||||
|
||||
string(REPLACE "\\" "/" CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||
set(SECTIONS_LD "${CMAKE_BINARY_DIR}/esp-idf/esp_system/ld/sections.ld")
|
||||
|
||||
if(EXISTS ${SECTIONS_LD})
|
||||
file(READ ${SECTIONS_LD} CONTENT)
|
||||
|
||||
# 检查是否已经应用了修复
|
||||
if(NOT CONTENT MATCHES "Rust segment overlap fix")
|
||||
# 简单的方法:在文件末尾添加 64KB 对齐指令
|
||||
# 这样可以确保所有段都正确对齐
|
||||
set(NEW_CONTENT "${CONTENT}
|
||||
|
||||
/* Rust segment overlap fix */
|
||||
.flash.rodata : ALIGN(0x10000)
|
||||
{
|
||||
*(.flash.rodata .flash.rodata.*)
|
||||
*(.flash.rodata1)
|
||||
*(.flash_rodata_align)
|
||||
} >default_rodata_seg
|
||||
")
|
||||
|
||||
file(WRITE ${SECTIONS_LD} "${NEW_CONTENT}")
|
||||
message(STATUS "Applied segment overlap fix: added 64KB alignment for rodata")
|
||||
else()
|
||||
message(STATUS "Segment overlap fix already applied")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "sections.ld not found at ${SECTIONS_LD}")
|
||||
endif()
|
||||
Reference in New Issue
Block a user