mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-11 08:22:52 +00:00
Fix Debug builds
This commit is contained in:
+23
-6
@@ -14,6 +14,10 @@ add_compile_options(
|
|||||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-threadsafe-statics>
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-threadsafe-statics>
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||||
|
# Debug must not be -O0: both the vendored usart.h and avr-libc's
|
||||||
|
# <util/delay.h> #warning when __OPTIMIZE__ is undefined, and -Werror makes
|
||||||
|
# that fatal.
|
||||||
|
$<$<CONFIG:Debug>:-Og>
|
||||||
$<$<CONFIG:Debug>:-fanalyzer>
|
$<$<CONFIG:Debug>:-fanalyzer>
|
||||||
$<$<CONFIG:Debug>:-Wno-analyzer-use-of-uninitialized-value>)
|
$<$<CONFIG:Debug>:-Wno-analyzer-use-of-uninitialized-value>)
|
||||||
|
|
||||||
@@ -72,6 +76,25 @@ add_library(avclan STATIC
|
|||||||
target_include_directories(avclan PUBLIC
|
target_include_directories(avclan PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/avclan)
|
${CMAKE_CURRENT_SOURCE_DIR}/src/avclan)
|
||||||
|
|
||||||
|
add_executable(mockingboard
|
||||||
|
src/sniffer.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(mockingboard avclan)
|
||||||
|
|
||||||
|
# Report firmware section sizes on every build, when the toolchain provides a
|
||||||
|
# size tool (CMAKE_SIZE). A standalone custom target (rather than a POST_BUILD
|
||||||
|
# command on mockingboard) so it prints even when the link is up to date:
|
||||||
|
# custom targets with no output are always considered stale and re-run.
|
||||||
|
# add_dependencies orders it after the link.
|
||||||
|
if(CMAKE_SIZE)
|
||||||
|
add_custom_target(mockingboard-size ALL
|
||||||
|
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:mockingboard>
|
||||||
|
COMMENT "Section sizes: mockingboard firmware"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_dependencies(mockingboard-size mockingboard)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Pull in the selected hardware target: its port sources, per-target headers,
|
# Pull in the selected hardware target: its port sources, per-target headers,
|
||||||
# hardware-specific compile options/definitions, device-pack handling, and the
|
# hardware-specific compile options/definitions, device-pack handling, and the
|
||||||
# flashing target. Added after the targets above so it can extend them.
|
# flashing target. Added after the targets above so it can extend them.
|
||||||
@@ -145,9 +168,3 @@ endif()
|
|||||||
# INTERFACE ${tl_optional_SOURCE_DIR}/include)
|
# INTERFACE ${tl_optional_SOURCE_DIR}/include)
|
||||||
# target_link_libraries(avclan PUBLIC tl_optional_hdr)
|
# target_link_libraries(avclan PUBLIC tl_optional_hdr)
|
||||||
# endif()
|
# endif()
|
||||||
|
|
||||||
add_executable(mockingboard
|
|
||||||
src/sniffer.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(mockingboard avclan)
|
|
||||||
|
|||||||
+39
-7
@@ -22,7 +22,7 @@
|
|||||||
"hidden": true,
|
"hidden": true,
|
||||||
"description": "AVR ATtiny3216 cross-compile toolchain + matching port",
|
"description": "AVR ATtiny3216 cross-compile toolchain + matching port",
|
||||||
"toolchainFile": "${sourceDir}/cmake/avr-gcc-toolchain.cmake",
|
"toolchainFile": "${sourceDir}/cmake/avr-gcc-toolchain.cmake",
|
||||||
"binaryDir": "${sourceDir}/out/build/attiny3216",
|
"binaryDir": "${sourceDir}/out/build/avr-attiny3216",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"AVCLAN_TARGET": "avr-attiny3216",
|
"AVCLAN_TARGET": "avr-attiny3216",
|
||||||
"FREQSEL": "20MHz",
|
"FREQSEL": "20MHz",
|
||||||
@@ -34,8 +34,6 @@
|
|||||||
"name": "debug-base",
|
"name": "debug-base",
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
"description": "Debug build settings",
|
"description": "Debug build settings",
|
||||||
"generator": "Unix Makefiles",
|
|
||||||
"binaryDir": "${sourceDir}/out/build",
|
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
}
|
}
|
||||||
@@ -49,13 +47,30 @@
|
|||||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-relwithdebinfo",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "ATtiny3216 RelWithDebInfo build,",
|
||||||
|
"inherits": [
|
||||||
|
"avr-attiny3216",
|
||||||
|
"relwithdebinfo-base"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug",
|
||||||
|
"hidden": true,
|
||||||
|
"description": "ATtiny3216 Debug build",
|
||||||
|
"inherits": [
|
||||||
|
"avr-attiny3216",
|
||||||
|
"debug-base"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "attiny3216-relwithdebinfo-usb0",
|
"name": "attiny3216-relwithdebinfo-usb0",
|
||||||
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB0)",
|
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB0)",
|
||||||
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB0",
|
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB0",
|
||||||
"inherits": [
|
"inherits": [
|
||||||
"avr-attiny3216",
|
"attiny3216-relwithdebinfo",
|
||||||
"relwithdebinfo-base",
|
|
||||||
"usb0"
|
"usb0"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -64,8 +79,25 @@
|
|||||||
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB1)",
|
"displayName": "ATtiny3216 RelWithDebInfo (ttyUSB1)",
|
||||||
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB1",
|
"description": "ATtiny3216 RelWithDebInfo build, program over /dev/ttyUSB1",
|
||||||
"inherits": [
|
"inherits": [
|
||||||
"avr-attiny3216",
|
"attiny3216-relwithdebinfo",
|
||||||
"relwithdebinfo-base",
|
"usb1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug-usb0",
|
||||||
|
"displayName": "ATtiny3216 Debug (ttyUSB0)",
|
||||||
|
"description": "ATtiny3216 Debug build, program over /dev/ttyUSB0",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-debug",
|
||||||
|
"usb0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attiny3216-debug-usb1",
|
||||||
|
"displayName": "ATtiny3216 Debug (ttyUSB1)",
|
||||||
|
"description": "ATtiny3216 Debug build, program over /dev/ttyUSB1",
|
||||||
|
"inherits": [
|
||||||
|
"attiny3216-debug",
|
||||||
"usb1"
|
"usb1"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
find_program(AVR_CC avr-gcc REQUIRED)
|
find_program(AVR_CC avr-gcc REQUIRED)
|
||||||
find_program(AVR_CXX avr-g++ REQUIRED)
|
find_program(AVR_CXX avr-g++ REQUIRED)
|
||||||
|
# Section-size reporter; consumed by an optional POST_BUILD in the top-level
|
||||||
|
# CMakeLists (left unset -> no size report) so the top level stays HW-agnostic.
|
||||||
|
find_program(CMAKE_SIZE avr-size)
|
||||||
|
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR avr)
|
set(CMAKE_SYSTEM_PROCESSOR avr)
|
||||||
|
|||||||
+1
-1
@@ -423,7 +423,7 @@ auto Bus::send(const Frame &out, Frame::Print print) -> Send {
|
|||||||
|
|
||||||
Bus::Handle Bus::get() { return Handle{*this}; };
|
Bus::Handle Bus::get() { return Handle{*this}; };
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if !defined(NDEBUG) && defined(MEASURE_BUS)
|
||||||
// Debug bit-timing measurement on the one physical bus; instance-scoped for the
|
// Debug bit-timing measurement on the one physical bus; instance-scoped for the
|
||||||
// same reason as is_active().
|
// same reason as is_active().
|
||||||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ Bit phy_read_bits_u8(uint8_t *bits, uint8_t len);
|
|||||||
Bit phy_read_bits_u16(uint16_t *bits, int8_t len);
|
Bit phy_read_bits_u16(uint16_t *bits, int8_t len);
|
||||||
Bit phy_read_byte(uint8_t *byte);
|
Bit phy_read_byte(uint8_t *byte);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if !defined(NDEBUG) && defined(MEASURE_BUS)
|
||||||
// Sample and dump bus bit timing over the serial link (REPL `M`).
|
// Sample and dump bus bit timing over the serial link (REPL `M`).
|
||||||
void phy_measure(void);
|
void phy_measure(void);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ set_property(CACHE USART_RXMODE PROPERTY STRINGS
|
|||||||
set(RTC_STATUS_PERIOD_MS 1000 CACHE STRING "Measured ms per nominal RTC status period (1000 = no correction)")
|
set(RTC_STATUS_PERIOD_MS 1000 CACHE STRING "Measured ms per nominal RTC status period (1000 = no correction)")
|
||||||
|
|
||||||
# --- Firmware configuration options ----------------------------------------
|
# --- Firmware configuration options ----------------------------------------
|
||||||
set(AVCLAN_FRAME_POOL_N 32 CACHE STRING "Frame pool depth (pooled targets)")
|
set(AVCLAN_FRAME_POOL_N 24 CACHE STRING "Pool allocator capacity for avclan::Frame (must be <= incoming/outgoing queue size)")
|
||||||
|
|
||||||
try_compile(LIBC_VERSION_TEST
|
try_compile(LIBC_VERSION_TEST
|
||||||
SOURCES "${CMAKE_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
SOURCES "${CMAKE_SOURCE_DIR}/cmake/libc-version-test.cpp"
|
||||||
|
|||||||
@@ -176,7 +176,9 @@ int main() {
|
|||||||
while (peripheral.device<CDChanger>().media_busy()) {}
|
while (peripheral.device<CDChanger>().media_busy()) {}
|
||||||
puts("end");
|
puts("end");
|
||||||
break;
|
break;
|
||||||
|
#ifdef MEASURE_BUS
|
||||||
case 'M': peripheral.get_bus().measure(); break;
|
case 'M': peripheral.get_bus().measure(); break;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 0x10: // Signals binary sequence incoming
|
case 0x10: // Signals binary sequence incoming
|
||||||
|
|||||||
Reference in New Issue
Block a user