mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-26 23:30:15 +00:00
Redesign (simplify) top-level avclan interface to use expected/nullable unique_ptr
- Peripheral::read/send now return `expected<unique_ptr<Frame>, Error>` for a unified success/error interface. - Peripheral::route returns `expected<unique_ptr<Frame>, Error>` to distinguish intent: (intentional) non-response vs unable to respond - Other functions with optional message semantics (handle,poll,react) return a unique_ptr whose ownership-state indicates response intent (i.e. send new message) Bundled necessary changes: - Switch Frame allocation from global to local (enabled via member function new/delete) - Add new header-library tl::expected to shim avr-libstdcpp Unrelated: Defensive `continue` added after `route`, to reduce Bus activity check latency Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,9 @@ set_property(CACHE USART_RXMODE PROPERTY STRINGS
|
||||
# tick. 1000 = no correction; set per-board in CMakeUserPresets.json.
|
||||
set(RTC_STATUS_PERIOD_MS 1000 CACHE STRING "Measured ms per nominal RTC status period (1000 = no correction)")
|
||||
|
||||
# --- Firmware configuration options ----------------------------------------
|
||||
set(AVCLAN_FRAME_POOL_N 32 CACHE STRING "Frame pool depth (pooled targets)")
|
||||
|
||||
try_compile(LIBC_VERSION_TEST
|
||||
SOURCES "${CMAKE_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
||||
COMPILE_DEFINITIONS -mmcu=${AVR_MCU}
|
||||
@@ -85,11 +88,14 @@ FetchContent_Declare(
|
||||
avr_libstdcpp
|
||||
GIT_REPOSITORY https://github.com/modm-io/avr-libstdcpp.git
|
||||
GIT_TAG 5354296040a2289c911062daa82336762231e897
|
||||
SYSTEM
|
||||
)
|
||||
FetchContent_MakeAvailable(avr_libstdcpp)
|
||||
add_library(libstdcpp INTERFACE)
|
||||
target_include_directories(libstdcpp SYSTEM
|
||||
INTERFACE ${avr_libstdcpp_SOURCE_DIR}/include)
|
||||
add_library(libstdcpp STATIC ${avr_libstdcpp_SOURCE_DIR}/src/new_handler.cc)
|
||||
target_include_directories(libstdcpp
|
||||
PUBLIC ${avr_libstdcpp_SOURCE_DIR}/include)
|
||||
# Let --gc-sections drop the unused set/get_new_handler functions.
|
||||
target_compile_options(libstdcpp PRIVATE -ffunction-sections -fdata-sections)
|
||||
target_link_libraries(avclan PUBLIC libstdcpp)
|
||||
|
||||
if(NOT LIBC_VERSION_TEST)
|
||||
@@ -142,6 +148,7 @@ target_compile_definitions(avclan PUBLIC
|
||||
__CLK_PRESCALE_DIV=__${CLK_PRESCALE_DIV}
|
||||
TCB_CLKSEL=${TCB_CLKSEL}
|
||||
RTC_STATUS_PERIOD_MS=${RTC_STATUS_PERIOD_MS}
|
||||
AVCLAN_FRAME_POOL_N=${AVCLAN_FRAME_POOL_N}
|
||||
)
|
||||
target_compile_options(avclan PUBLIC
|
||||
--param=min-pagesize=0
|
||||
|
||||
Reference in New Issue
Block a user