Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/companion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
- 'tools/build-companion.sh'
- 'tools/build-wasm-modules.sh'
- 'cmake/wasm/CMakeLists.txt'
- 'cmake/FetchWamr.cmake'
- 'cmake/wamr-*.patch'

pull_request:
paths:
Expand All @@ -28,6 +30,8 @@ on:
- 'tools/build-companion.sh'
- 'tools/build-wasm-modules.sh'
- 'cmake/wasm/CMakeLists.txt'
- 'cmake/FetchWamr.cmake'
- 'cmake/wamr-*.patch'

workflow_dispatch:
inputs:
Expand Down
33 changes: 29 additions & 4 deletions cmake/FetchWamr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,23 @@ if(NOT wamr_POPULATED)

# WAMR 2.4.4 win_file.c has trailing backslashes in comments that
# clang treats as line continuations, causing compile errors.
# Skip if a previous configure already patched the cached source.
set(_wamr_patch "${CMAKE_CURRENT_LIST_DIR}/wamr-fix-win-backslash-comments.patch")
execute_process(
COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/wamr-fix-win-backslash-comments.patch"
COMMAND git apply --reverse --check "${_wamr_patch}"
WORKING_DIRECTORY "${wamr_SOURCE_DIR}"
RESULT_VARIABLE _patch_result
RESULT_VARIABLE _patch_applied
OUTPUT_QUIET ERROR_QUIET
)
if(_patch_result)
message(WARNING "WAMR win_file.c patch failed (may already be applied)")
if(NOT _patch_applied EQUAL 0)
execute_process(
COMMAND git apply "${_wamr_patch}"
WORKING_DIRECTORY "${wamr_SOURCE_DIR}"
RESULT_VARIABLE _patch_result
)
if(_patch_result)
message(WARNING "WAMR win_file.c patch failed")
endif()
endif()

add_subdirectory("${wamr_SOURCE_DIR}" "${wamr_BINARY_DIR}" EXCLUDE_FROM_ALL)
Expand All @@ -61,4 +71,19 @@ if(NOT wamr_POPULATED)
WASM_API_EXTERN=
)
endif()

if(APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES
AND "x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
# WAMR picks a single BUILD_TARGET_* from the host CPU, so a universal
# build on an arm64 host compiles the x86_64 slice as AARCH64. That breaks
# native call argument marshalling (8 vs 6 integer registers) against
# invokeNative_em64.s. Set the correct target per slice; compile options
# follow the directory -D definitions on the command line, so these win.
target_compile_options(vmlib PRIVATE
"SHELL:-Xarch_x86_64 -UBUILD_TARGET_AARCH64"
"SHELL:-Xarch_x86_64 -DBUILD_TARGET_X86_64"
"SHELL:-Xarch_arm64 -UBUILD_TARGET_X86_64"
"SHELL:-Xarch_arm64 -DBUILD_TARGET_AARCH64"
)
endif()
endif()
9 changes: 9 additions & 0 deletions radio/src/targets/simu/adc_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ uint16_t getRTCBatteryVoltage()
return 300;
}

#if defined(CSD203_SENSOR)
// No CSD203 current/voltage sensors in the simulator
uint16_t getBatteryMidVoltage() { return 0; }
uint16_t getExtModuleVoltage() { return 0; }
int16_t getExtModuleCurrent() { return 0; }
int16_t getSystemCurrent() { return 0; }
int16_t getIntModuleCurrent() { return 0; }
#endif

extern uint16_t simuGetAnalog(uint8_t idx);

// Negative = no override, fall back to the vBatWarn-derived default below.
Expand Down
Loading