File tree Expand file tree Collapse file tree 15 files changed +34
-61
lines changed
Expand file tree Collapse file tree 15 files changed +34
-61
lines changed Original file line number Diff line number Diff line change @@ -50,19 +50,18 @@ include_directories(include/esp-stub-lib)
5050add_compile_definitions (${STUB_COMPILE_DEFS} )
5151
5252# Three-layer architecture:
53- # - entry: Main stub code (src/)
54- # - common: Generic implementations using base headers + target's soc.h + (weak functions)
55- # - target: Target-specific code + soc.h + overrides (weak functions)
56- # - base: Interface headers (target/*.h, private/*.h) - serves to common and target
53+ #
54+ # Layer structure and locations:
55+ # - entry: Main stub code → src/
56+ # - common: Generic implementations (weak) → src/target/common/
57+ # - target: Target-specific overrides (strong) → src/target/${ESP_TARGET}/
58+ # - base: Interface headers only → src/target/base/
5759#
5860# Dependency flow: entry → common → target
5961# ↓ ↓
6062# base base
6163
62- add_subdirectory (src/target/base ${ESP_BASE_LIB} )
63- add_subdirectory (src/target/${ESP_TARGET} ${ESP_TARGET_LIB} )
64- add_subdirectory (src/target/common ${ESP_COMMON_LIB} )
64+ add_subdirectory (src/target )
6565
66- target_link_libraries (${ESP_TARGET_LIB} PUBLIC ${ESP_BASE_LIB} )
67- target_link_libraries (${ESP_COMMON_LIB} PUBLIC ${ESP_BASE_LIB} ${ESP_TARGET_LIB} )
66+ # Link to common library (which transitively includes target and base)
6867target_link_libraries (${ESP_STUB_LIB} PUBLIC ${ESP_COMMON_LIB} )
Original file line number Diff line number Diff line change 1+ # Parent CMakeLists for all target directories
2+ # This file contains common setup for all targets
3+
4+ # Build base (interface headers)
5+ add_subdirectory (base ${ESP_BASE_LIB} )
6+
7+ # Build target-specific library
8+ add_subdirectory (${ESP_TARGET} ${ESP_TARGET_LIB} )
9+
10+ # Build common library
11+ add_subdirectory (common ${ESP_COMMON_LIB} )
12+
13+ # Apply common configurations to target library
14+ # This ensures strong symbols override weak ones
15+ target_link_options (${ESP_TARGET_LIB}
16+ PUBLIC -Wl,--whole-archive
17+ )
18+
19+ # Set common include directories for target library
20+ target_include_directories (${ESP_TARGET_LIB}
21+ PUBLIC ${CMAKE_CURRENT_LIST_DIR} /${ESP_TARGET}/include
22+ )
23+
24+ # Setup dependency chain: target → base, common → base + target
25+ target_link_libraries (${ESP_TARGET_LIB} PUBLIC ${ESP_BASE_LIB} )
26+ target_link_libraries (${ESP_COMMON_LIB} PUBLIC ${ESP_BASE_LIB} ${ESP_TARGET_LIB} )
Original file line number Diff line number Diff line change @@ -5,10 +5,6 @@ set(srcs
55
66add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
77
8- target_include_directories (${ESP_TARGET_LIB}
9- PUBLIC include
10- )
11-
128target_link_options (${ESP_TARGET_LIB}
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32.rom.ld
1410 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32.rom.libc-funcs.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c2.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c2.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c5.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c5.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c6.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c6.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c61.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c61.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h2.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h2.rom.api.ld
Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ set(srcs
44
55add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
66
7- target_include_directories (${ESP_TARGET_LIB}
8- PUBLIC include
9- )
10-
117target_link_options (${ESP_TARGET_LIB}
128 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h21.rom.ld
139 PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h21.rom.api.ld
You can’t perform that action at this time.
0 commit comments