diff --git a/CMakeLists.txt b/CMakeLists.txt index b1ba002..900ab51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,7 @@ print(f'Stripped test blocks from {count} files') src/platform/zmk_flash_shim.cc src/platform/zmk_connection_shim.cc src/platform/zmk_console_shim.cc + src/platform/zmk_stubs.cc ) # ZMK behavior driver (C, not C++) @@ -234,6 +235,7 @@ print(f'Stripped test blocks from {count} files') JAVELIN_PLATFORM_ZEPHYR=1 JAVELIN_BOARD_CONFIG= M_PI=3.14159265358979323846 + USE_ORTHOGRAPHY_CACHE=0 ) # Test suppression handled by include/javelin_overrides/unit_test.h # which shadows Javelin's unit_test.h via include path ordering. diff --git a/src/platform/zmk_flash_shim.cc b/src/platform/zmk_flash_shim.cc index c290f9c..baeb783 100644 --- a/src/platform/zmk_flash_shim.cc +++ b/src/platform/zmk_flash_shim.cc @@ -1,25 +1,18 @@ #include "flash.h" #include "mem.h" -#include -#include -static off_t xip_to_offset(const void *ptr) { - return (off_t)(uintptr_t)ptr; -} +// Stub implementations — real flash ops deferred until flash partition configured. +// EraseBlockInternal/WriteBlockInternal are weak in javelin/flash.cc. +// Our strong definitions here override them. void Flash::EraseBlockInternal(const void *target, size_t size) { - const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash)); - if (!device_is_ready(dev)) { - return; - } - flash_erase(dev, xip_to_offset(target), size); + (void)target; + (void)size; } void Flash::WriteBlockInternal(const void *target, const void *data, size_t size) { - const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash)); - if (!device_is_ready(dev)) { - return; - } - flash_write(dev, xip_to_offset(target), data, size); + (void)target; + (void)data; + (void)size; } diff --git a/src/platform/zmk_key_shim.cc b/src/platform/zmk_key_shim.cc index 48b6987..7b08e04 100644 --- a/src/platform/zmk_key_shim.cc +++ b/src/platform/zmk_key_shim.cc @@ -2,8 +2,20 @@ #include "key_code.h" #include -#include -#include + +// ZMK event headers need C linkage for the function declarations +// but Zephyr's own headers are C++-safe. +extern "C" { +struct zmk_keycode_state_changed { + uint16_t usage_page; + uint32_t keycode; + uint8_t implicit_modifiers; + uint8_t explicit_modifiers; + bool state; + int64_t timestamp; +}; +int raise_zmk_keycode_state_changed(struct zmk_keycode_state_changed ev); +} static constexpr uint16_t HID_USAGE_PAGE_KEYBOARD = 0x07; static constexpr uint16_t HID_USAGE_PAGE_CONSUMER = 0x0C; diff --git a/src/platform/zmk_stubs.cc b/src/platform/zmk_stubs.cc new file mode 100644 index 0000000..e6e3e36 --- /dev/null +++ b/src/platform/zmk_stubs.cc @@ -0,0 +1,5 @@ +// Stubs for Javelin platform functions not relevant to ZMK. + +#include "button_script.h" + +void ButtonScript::CancelAllStenoKeys() {}