Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/Debug/debug.proto
src/Debug/nanopb/**
25 changes: 25 additions & 0 deletions .github/actions/build-wdcli/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build WARDuino CLI
description: Configure and build the WARDuino emulator CLI.

inputs:
build-directory:
description: Directory for CMake build artifacts.
required: false
default: build-emu

outputs:
wdcli:
description: Absolute path to the built CLI executable.
value: ${{ steps.build.outputs.wdcli }}

runs:
using: composite
steps:
- id: build
shell: bash
run: |
cmake -S "$GITHUB_WORKSPACE" -B "${{ inputs.build-directory }}" -D BUILD_EMULATOR=ON
cmake --build "${{ inputs.build-directory }}"
wdcli="$(cd "${{ inputs.build-directory }}" && pwd)/wdcli"
echo "wdcli=$wdcli" >> "$GITHUB_OUTPUT"
echo "EMULATOR=$wdcli" >> "$GITHUB_ENV"
6 changes: 1 addition & 5 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ jobs:
with:
submodules: 'recursive'

- name: Create build folder
run: mkdir build-emu

- name: Build WARDuino CLI
run: cmake .. -D BUILD_EMULATOR=ON ; cmake --build .
working-directory: build-emu
uses: ./.github/actions/build-wdcli

compile-with-arduino:
name: (Arduino) Compile on ${{matrix.board.platform-name}}
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ jobs:
with:
node-version: 20

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
cmake --build .
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
- name: Build WARDuino CLI
uses: ./.github/actions/build-wdcli

- name: Get WABT commit ID
working-directory: lib/wabt
Expand Down Expand Up @@ -99,11 +96,8 @@ jobs:
with:
node-version: 20

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
cmake --build .
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
- name: Build WARDuino CLI
uses: ./.github/actions/build-wdcli

- name: Get WABT commit ID
working-directory: lib/wabt
Expand Down Expand Up @@ -152,11 +146,8 @@ jobs:
with:
node-version: 20

- name: Build warduino cli
run: |
cmake . -D BUILD_EMULATOR=ON
cmake --build .
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
- name: Build WARDuino CLI
uses: ./.github/actions/build-wdcli

- name: Get WABT commit ID
working-directory: lib/wabt
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.idea/
.air/
.vscode/
.ccls

.cache

*.bin
*.ipch
*.o
Expand All @@ -11,6 +14,10 @@ build/
cmake-build-*
build*

# local actions
!/.github/actions/build-wdcli/
!/.github/actions/build-wdcli/action.yml

# CMake
CMakeLists.txt.user
CMakeCache.txt
Expand All @@ -35,3 +42,4 @@ core
venv

*.wasm

21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,28 @@ if (BUILD_ESP)
include($ENV{IDF_PATH}/tools/cmake/project.cmake "${PROJECT_BINARY_DIR}/../include")
endif (BUILD_ESP)

project(WARDuino VERSION 0.8.1)
project(WARDuino VERSION 0.8.99)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

set(WARDUINO_VERSION_STRING "${PROJECT_VERSION}")
configure_file(src/config.h.in include/warduino/config.h)

# Use the checked-in nanopb runtime and schema output on every platform.
add_library(proto STATIC
src/Debug/nanopb/debug.pb.c
src/Debug/nanopb/pb_common.c
src/Debug/nanopb/pb_decode.c
src/Debug/nanopb/pb_encode.c
)
target_include_directories(proto PUBLIC
${PROJECT_SOURCE_DIR}/src/Debug
${PROJECT_SOURCE_DIR}/src/Debug/nanopb
)

# Build the emulator version of WARDuino
if (BUILD_EMULATOR)
set(EXTERNAL_LIB_HEADERS lib/json/single_include)

find_package(Threads REQUIRED)

set(SOURCE_FILES
Expand All @@ -54,6 +65,7 @@ if (BUILD_EMULATOR)
src/Utils/macros.cpp
src/Utils/sockets.cpp
src/Debug/debugger.cpp
src/Debug/nanopb_encoder.cpp
src/Edward/proxy.cpp
src/Edward/proxy_supervisor.cpp
src/Edward/RFC.cpp
Expand All @@ -71,7 +83,7 @@ if (BUILD_EMULATOR)

# WARDuino CLI
add_executable(wdcli platforms/CLI-Emulator/main.cpp ${SOURCE_FILES})
target_link_libraries(wdcli PRIVATE Threads::Threads)
target_link_libraries(wdcli PRIVATE Threads::Threads proto)
target_include_directories(wdcli PRIVATE ${EXTERNAL_LIB_HEADERS} "${PROJECT_BINARY_DIR}/include")
endif (BUILD_EMULATOR)

Expand All @@ -95,6 +107,7 @@ if (BUILD_UNITTEST)
src/Utils/macros.cpp
src/Utils/sockets.cpp
src/Debug/debugger.cpp
src/Debug/nanopb_encoder.cpp
src/Edward/proxy.cpp
src/Edward/proxy_supervisor.cpp
src/Edward/RFC.cpp
Expand Down Expand Up @@ -122,7 +135,7 @@ if (BUILD_UNITTEST)
get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
message(DEBUG "Add executable for " ${TEST_FILE})
add_executable(${TEST_NAME} ${TEST_FILE} ${SOURCE_FILES} ${SHARED_SRC})
target_link_libraries(${TEST_NAME} PRIVATE doctest::doctest)
target_link_libraries(${TEST_NAME} PRIVATE doctest::doctest proto)
target_include_directories(${TEST_NAME} PRIVATE ${EXTERNAL_LIB_HEADERS} "${PROJECT_BINARY_DIR}/include")
add_test(${TEST_NAME} ${TEST_NAME})
endforeach ()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/edward.ino.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void ICACHE_RAM_ATTR handleInput() {
void startDebuggerStd(void* pvParameter) {
int valread;
uint8_t buffer[1024] = {0};
wac->debugger->setChannel(fileno(stdout));
wac->debugger->set_channel(fileno(stdout));
write(fileno(stdout), "Got a message ... \n", 19);
while (true) {
// taskYIELD();
Expand Down
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ all:
WABT="../../lib/wabt/build/" npm run tests:all


## Nanopb

[group('codegen')]
[doc('Regenerate vendored nanopb sources from the debugger schema')]
generate-nanopb: _nanopb
mkdir -p src/Debug/nanopb
protoc -I src/Debug --nanopb_out=src/Debug/nanopb src/Debug/debug.proto
perl -0pi -e 's{#include <pb\.h>}{#include "pb.h"}' src/Debug/nanopb/debug.pb.h


## QoL / Maintenance

[group('maintenance')]
Expand Down
Loading
Loading