Skip to content

v0.2.2-dev #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 262 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
262 commits
Select commit Hold shift + click to select a range
e7c1752
restore working woodDump
Apr 13, 2022
59fde68
fix incorrect index j
Apr 13, 2022
09e2f7f
bug fix: writing to memory bytes
Apr 13, 2022
ca60111
dump fully as json
Apr 19, 2022
ff2ac94
bug fix: incorrect loop end condition
Apr 19, 2022
3ad13d0
clang-format
Apr 19, 2022
8dbca8a
Fix WOOD offset JSON format
tolauwae Apr 19, 2022
53afb4d
Split primitive file
tolauwae Apr 19, 2022
75a9c7d
Fix common header multiple implementation for Arduino
tolauwae Apr 20, 2022
7acdbe3
Fix warnings
tolauwae Apr 20, 2022
30e399f
add other blink examples
Apr 20, 2022
6a0dfec
compile and flash for esp32doit-devkit-v1
Apr 20, 2022
749059d
add other blink example wasm
Apr 20, 2022
0972ea7
add util functions for wood
Apr 20, 2022
6c6c5ba
add emulator's socket communication to mcu
Apr 20, 2022
1e115a5
add remote function call class
Apr 20, 2022
3d3ce38
add rfc and proxy_server source files
Apr 20, 2022
552bf8d
add interrupts to monitor and perform rfc
Apr 20, 2022
e497b9d
interpret performs or answers RFC
Apr 20, 2022
b11af42
Merge branch 'feat/wood' of github.com:TOPLLab/WARDuino into feat/wood
Apr 20, 2022
4398556
format
Apr 20, 2022
ae494c2
format
Apr 20, 2022
109bf07
save draft socket server
Apr 21, 2022
5927f20
add SocketServer.cpp
Apr 21, 2022
61f11f6
code refactor
Apr 21, 2022
9e96e46
include SocketServer.h when deployed on MCU
Apr 21, 2022
aab9b37
restore original arduino template
Apr 21, 2022
1f4ee73
rename static method + bug fix: reorder include RTOS
Apr 21, 2022
07b2a4b
add arduino socket template
Apr 21, 2022
f97c143
remove unneeded scripts
Apr 21, 2022
c626e78
clang-format ignore includes
Apr 21, 2022
748ea58
Format
tolauwae Apr 21, 2022
e9b4fc2
include libs for socketserver support
Apr 21, 2022
73c40d4
Merge branch 'feat/wood' of github.com:TOPLLab/WARDuino into feat/wood
Apr 21, 2022
5ebb563
Update CI
tolauwae Apr 21, 2022
8678d37
Fix Arduino compilation
tolauwae Apr 21, 2022
4c7de41
Templatize Arduino-socket + add Makefile
tolauwae Apr 22, 2022
eec646f
Fix Arduino socket compilation + add to CI
tolauwae Apr 22, 2022
191fc14
Fix compilation and clang tidy warnings
tolauwae Apr 26, 2022
7b11dc3
Add button demo in Rust
tolauwae Apr 26, 2022
129204e
Clang format
tolauwae Apr 26, 2022
1fa70e6
Move connection code to createConnection function
tolauwae Apr 27, 2022
caeb192
Add skeleton code push connection
tolauwae Apr 27, 2022
86663bd
Set push port on MCU register
tolauwae Apr 27, 2022
50b815d
Add push socket pthread and mutex lock
tolauwae Apr 28, 2022
e96e2cb
Fix print + add empty parseJSON function
tolauwae Apr 28, 2022
3ef6b8b
Fix macos compilation errors
tolauwae Apr 28, 2022
c18e26c
Fix Arduino compilation
tolauwae Apr 28, 2022
70b0b6c
fix merge conflict
Apr 28, 2022
7e81438
Merge branch 'feat/wood' of github.com:TOPLLab/WARDuino into HEAD
Apr 28, 2022
6caed71
add temporary button example pin 37
Apr 28, 2022
cfbd7ac
add printf + push event as comment
Apr 28, 2022
b293df8
use 2th socketserver + commented functionality
Apr 28, 2022
fd2a9b2
temporariy printf
Apr 28, 2022
b67a30e
define 2th socketserver + commented functionality
Apr 28, 2022
e0ab335
activate use of push server
Apr 28, 2022
70b3d7d
remove the use of printf
Apr 28, 2022
f67b598
use updated write2Client
Apr 28, 2022
1ef3148
push events when pushmode activated
Apr 28, 2022
eea1f1d
activate push mode when dumping
Apr 28, 2022
a5bd57a
update template
Apr 28, 2022
a3e4d99
delete unneeded files
Apr 28, 2022
ab63df0
format
Apr 28, 2022
0b2b306
bug fix: add missing header
Apr 28, 2022
b74e065
bug fix: pushmode only for MCU
Apr 28, 2022
23d7ffc
Fix template cache
tolauwae Apr 29, 2022
2a093be
bug fix: push event one single time
Apr 29, 2022
7fae5c9
disable starting in pause mode
Apr 29, 2022
b673733
Merge branch 'feat/wood' of github.com:TOPLLab/WARDuino into feat/wood
Apr 29, 2022
d4e6e88
Add event debug interrupts to enum
tolauwae Apr 29, 2022
b1a1287
Fix Makefile
tolauwae Apr 29, 2022
b5eeeec
Update Arduino ESP install instructions
tolauwae Apr 29, 2022
8526a40
Add nlohmann/json library
tolauwae May 3, 2022
419dd23
Make WARDuino a singleton
tolauwae May 3, 2022
745f301
Parse event json
tolauwae May 3, 2022
2da13e1
Add interruptDronify to enum
tolauwae May 4, 2022
4cab2a8
bug fix: push client uses push port
May 4, 2022
9e9e84c
use seperate adress struct for pushclient
May 4, 2022
52d640e
Add Event interrupts
tolauwae May 4, 2022
21b5708
Quickfix Arduino compilation
tolauwae May 4, 2022
a127c08
bug fix: no longer starts a socketserver
May 4, 2022
3bb3b1f
OSX compilation issue fix: removed Event forward reference
May 4, 2022
3b34fae
changed parameter to be a pointer
May 4, 2022
38ebdfb
bug fix: disable mutex + remove &
May 4, 2022
61eadbd
bug fix: removed hardcoded socket descriptor
May 4, 2022
61e9dc8
Restore mutex
tolauwae May 5, 2022
a874ef1
Fix `continuing` function for mutex lock
tolauwae May 5, 2022
ed07248
bug fix: resolving_event set to false once done
May 5, 2022
e18f3af
bug fix: resolving_event disabled for pushmode
May 5, 2022
6860bb9
bug fix: pushing events despite of paused VM
May 5, 2022
7191fe9
delete unneeded printf
May 5, 2022
6c3f474
add interrupt to toggle event push mode
May 5, 2022
b6544d1
increase emulator's event buffer size
May 5, 2022
82ded9d
Enalbe the update of the proxy list more than once
May 5, 2022
0b90a8e
bug fix: json parse error
May 5, 2022
0dfa0c7
add comment
May 5, 2022
aa7bfae
increase pushbuffer socket size if needed
May 6, 2022
e82c316
Add events to full dump
tolauwae May 6, 2022
e8b1fba
Merge branch 'master' into feat/wood
tolauwae May 6, 2022
2cb6f54
Add subscribe_interrupt EMU
tolauwae May 6, 2022
0a8d956
Make `pushingMode` default true
tolauwae May 6, 2022
72ea40b
Fix push code in `CallbackHandler::resolve_event`
tolauwae May 6, 2022
3b3de27
Remove `pushingMode` + add `manual_event_resolution`
tolauwae May 6, 2022
a40ecc3
Fix json parse + compilation
tolauwae May 6, 2022
8631430
Update documentation
tolauwae May 7, 2022
5ca94b2
Remove extra `manual_event_resolution = true`
tolauwae May 7, 2022
9cc9859
Add new pushed event notification + remove breaking print
tolauwae May 7, 2022
f5001d6
Fix events
tolauwae May 7, 2022
bd087c3
Fix `notifyPushedEvent` + support paused drone
tolauwae May 9, 2022
84be87f
Clang format + update README
tolauwae May 9, 2022
96585bf
Add force arg to `resolve_event`
tolauwae May 9, 2022
24f4898
Add callback interrupts + implement dump
tolauwae May 9, 2022
7d91618
Fix compile error + fix infinite loop
tolauwae May 9, 2022
0978acd
Quickfix no binary payload for `0x75`
tolauwae May 9, 2022
7ab5c97
Add import callbackmapping
tolauwae May 10, 2022
8832cca
Update docs + small fix for ci
tolauwae May 10, 2022
d97ee71
Fix nullptr exception
tolauwae May 10, 2022
fd4c18e
added primitives for ESP32 analogwrite
May 11, 2022
bced0f5
Merge branch 'feat/wood' of github.com:TOPLLab/WARDuino into feat/wood
May 11, 2022
546d980
Fix compilation error
tolauwae May 25, 2022
a766d50
Add socket server to warduino template in benchmarks
tolauwae May 25, 2022
505d1bb
Update boardmanager install instructions
tolauwae May 25, 2022
7896022
Fix some compile errors in benchmarks
tolauwae May 25, 2022
0bd2e7b
Use arduino-cli in scripts/upload
tolauwae May 25, 2022
5a00e34
Fix ino template benchmarks
tolauwae May 25, 2022
e9741a8
Fix makefile
tolauwae May 25, 2022
ab21f50
Fix bench upload
tolauwae May 25, 2022
99ca305
Fix upload script
tolauwae May 25, 2022
6e7a5ff
Move socket bench to seperate edward.ino
tolauwae May 25, 2022
2d09e9a
Use singleton WD in warduino.ino.template
tolauwae May 25, 2022
c85bc8e
Add edward to tasks/.gitignore
tolauwae May 25, 2022
d7cdccd
Merge branch 'master' into feat/wood
tolauwae May 30, 2022
2824cb0
Make example more stable
tolauwae May 30, 2022
85a4cc8
Clean examples
tolauwae May 30, 2022
d139b0b
Start ESP-IDF primitive implementations
tolauwae May 30, 2022
16db317
Fix ESP-IDF compilation
tolauwae May 31, 2022
c4db33d
Re-enabled TWDT init on startup
tolauwae May 31, 2022
edeccdc
Fix blink example for ESP IDF
tolauwae May 31, 2022
8b6fd35
Add missing upload.h + update .gitignore
tolauwae May 31, 2022
67e3a48
Update IDF CI action
tolauwae May 31, 2022
9b8157b
Fix ESP compile CI action
tolauwae Jun 2, 2022
662ce39
Allow `updateCallbackmapping` on Arduino
tolauwae Jun 2, 2022
1ba1568
Add dependencies to README
beardhatcode Jun 3, 2022
8ff733c
Clang Tidy and Format `src/Debug/`
tolauwae Jun 3, 2022
959410c
Allow `interruptRecvCallbackmapping` on Arduino
tolauwae Jun 3, 2022
a59000d
Ask for cbkmapping dump after Proxy Call
tolauwae Jun 3, 2022
f2b938f
Add dronify instruction
beardhatcode Jun 3, 2022
b8cf8ed
Clang format
tolauwae Jun 3, 2022
f1bbc1a
Fix Arduino compilation
tolauwae Jun 3, 2022
ddece62
Allow lowercase in debug messages
tolauwae Jun 3, 2022
fed7737
Start SocketServer on interruptDronify
tolauwae Jun 3, 2022
9cb7d26
Clean up. Closes #70
tolauwae Jun 3, 2022
74b8466
Remove scripts/signal
tolauwae Jun 4, 2022
ca1bcdd
Make write2client iterative istead of recursive
beardhatcode Jun 4, 2022
cdeb15d
Reformulate shoud_push event in terms of WARDuino
beardhatcode Jun 4, 2022
c6eed6b
Remove debug print in the middle of capturing events
beardhatcode Jun 4, 2022
000a8e3
Fix wrong buffer length used
beardhatcode Jun 4, 2022
4603ace
Fix request for callback mappting DEC->HEX
beardhatcode Jun 4, 2022
fca41c9
Add notification for missing handlers
beardhatcode Jun 4, 2022
7433590
Improve callback handeling logic
beardhatcode Jun 4, 2022
13cc7f2
CI: remove fill template
beardhatcode Jun 4, 2022
b146ee3
Fix compile CI
tolauwae Jun 6, 2022
66d6865
Fix: don't change `resolving_event` in debugger thread
tolauwae Jun 7, 2022
ced41f2
Add callback guard
tolauwae Jun 7, 2022
6b2fbab
Clang format
tolauwae Jun 7, 2022
107a4d8
Remove socket ino from compile.yml
tolauwae Jun 7, 2022
396facf
Fix ESP IDF compilation
tolauwae Jun 7, 2022
fb76fff
Add retry to assemblyscript examples
tolauwae Jun 7, 2022
174f36f
Fix typos and clang warnings
tolauwae Jun 15, 2022
392eecb
Rename Proxy Server to Proxy Supervisor
tolauwae Jun 15, 2022
b70fbbb
Clang format
tolauwae Jun 16, 2022
52d4eef
Refactor RFC to Proxy
tolauwae Jun 17, 2022
d0557a3
Add `Channel` class to abstract comms socket
tolauwae Jun 17, 2022
b549864
Use debugger channel for oop debugging
tolauwae Jun 17, 2022
5e149ce
Delete SocketServer
tolauwae Jun 17, 2022
e2501d3
Clang-format
tolauwae Jun 17, 2022
1e32d45
Fix Arduino compilation
tolauwae Jun 17, 2022
c44631f
Fix IDF compilation
tolauwae Jun 17, 2022
9b93fd5
Add Carlos to authors
tolauwae Jun 17, 2022
fbd5777
Use serial connection to proxy
tolauwae Jun 17, 2022
3a964e3
Clang-format
tolauwae Jun 17, 2022
e260d33
Clean split Proxy and ProxySupervisor
tolauwae Jul 26, 2022
d9f9d83
Clang format + fix some header includes
tolauwae Jul 28, 2022
91aa40a
Fix include errors
tolauwae Jul 29, 2022
c8de5af
Handle proxy guard (return result)
tolauwae Jul 29, 2022
0a5b5bf
Track proxied calls in supervisor
tolauwae Jul 29, 2022
1eef397
Forward exception in proxy call
tolauwae Jul 29, 2022
ee506a7
Add `--socket` arg to cli
tolauwae Aug 1, 2022
a4285a5
Fix segmentation fault at call instr
tolauwae Aug 1, 2022
559b355
Fix call_indirect
tolauwae Aug 1, 2022
d14ac3f
Merge branch 'feat/wood' into fix/comms
tolauwae Aug 1, 2022
89a83c8
Set version number to v0.2.1
tolauwae Aug 1, 2022
ae2171b
Use espressif/esp-idf-ci-action@v1
tolauwae Aug 1, 2022
d2173a5
Remove valread completely
tolauwae Aug 1, 2022
df10025
Remove unecessary `#ifndef ARDUINO` guards
tolauwae Aug 1, 2022
62130c8
Remove breaking import
tolauwae Aug 1, 2022
124661d
Remove unused variables
tolauwae Aug 1, 2022
128b100
Fix dump_callbacks
tolauwae Aug 1, 2022
13b0a43
Fix nullptr exception on ESP
tolauwae Aug 1, 2022
17b1167
Update main
tolauwae Aug 2, 2022
e34f2c8
Connect to proxy via local socket
tolauwae Aug 2, 2022
a0f03ab
Move connection code to main
tolauwae Aug 2, 2022
2742ad6
Move RFC to Edward
tolauwae Aug 2, 2022
8ed7b7c
Merge pull request #77 from TOPLLab/fix/comms
tolauwae Aug 2, 2022
4dfb65f
Add `--mode` to cli
tolauwae Aug 2, 2022
e2a4c05
Fix: remove unnecessary writes to stdout from Arduino.ino
tolauwae Sep 2, 2022
868d628
Fix ESP-IDF compilation error
Sep 9, 2022
2114dd1
Fix Arduino subscribe interrupt with macros
tolauwae Sep 5, 2022
cfb362b
Rename analog write primitive
tolauwae Sep 5, 2022
5f293dc
Free `interruptData` buffer
tolauwae Sep 16, 2022
39f22cf
Allow connections to proxy over serial in cli
tolauwae Sep 16, 2022
882139d
Fix build of benchmarks
tolauwae Sep 20, 2022
b2a4f7f
Add Rebench config with native tests
tolauwae Sep 20, 2022
83e2580
Add WARDuino executor to Rebench config
tolauwae Sep 20, 2022
7b1e6f0
Rename rebench conf file + remove native executor
tolauwae Sep 20, 2022
3d73519
Add `--no-debug` flag
tolauwae Sep 21, 2022
ee12182
Fix segmentation fault in `disconnect_proxy`
tolauwae Sep 21, 2022
e7cedca
Remove \n from emu print_string primitive
tolauwae Sep 21, 2022
0483510
Move interpret loop to main thread
tolauwae Sep 22, 2022
a657473
Make `Channel` virtual + add open and close methods
tolauwae Sep 23, 2022
71fc608
Update code to use new Channel classes
tolauwae Sep 24, 2022
c79dc23
Update mcu platforms
tolauwae Sep 24, 2022
baed0be
Refactor Channel types to self-documenting names
tolauwae Sep 24, 2022
5fd063b
Add `debugger.stop` function
tolauwae Sep 24, 2022
237620e
Fix #91
tolauwae Sep 24, 2022
24c91f5
Quickfix compilation
tolauwae Sep 24, 2022
f2e7b28
Merge pull request #93 from TOPLLab/fix/91
tolauwae Sep 24, 2022
e7b738b
Remove "got a message ..."
tolauwae Sep 26, 2022
0c5336d
Change `startPushDebuggerSocket()` to also receive proxy replies
tolauwae Oct 6, 2022
facb3ca
RFC returns JSON
Oct 6, 2022
4125fe6
Fix Arduino compilation
tolauwae Oct 6, 2022
79e91ca
replace type to be int
Oct 6, 2022
a2c41e0
Update readReply to handle json
tolauwae Oct 6, 2022
03e3e70
Clang format
tolauwae Oct 7, 2022
9f6590e
Hotfix: add missing install step of ISRs + fix ISR indexing
tolauwae Oct 7, 2022
512e959
Introduce `INTERRUPT_TOPIC_PREFIX` macro
tolauwae Oct 7, 2022
ce0b417
Remove verbose Arduino compilation output
tolauwae Oct 7, 2022
2e79e1f
Update to new CI ubuntu runtimes
tolauwae Aug 11, 2022
d7aea39
Merge pull request #108 from TOPLLab/fix/ci
tolauwae Oct 14, 2022
f810f90
Fix #95
tolauwae Oct 11, 2022
ab5b6c7
Fix #102
tolauwae Oct 11, 2022
bafcd77
Fix readReply for proxy calls over serial
tolauwae Oct 12, 2022
8c13441
Use boolean in json reply for proxy call
tolauwae Oct 12, 2022
aca2b0d
Fix mistake in default case for `printValue` in proxy
tolauwae Oct 14, 2022
7a15951
Fix: don't send a value in proxy result when the call has no return v…
tolauwae Oct 14, 2022
2074174
Improve self-documentation of supervisor
tolauwae Oct 14, 2022
dde0f99
Add acknowledgement of successful proxy.
tolauwae Oct 14, 2022
d36bb7b
Merge pull request #106 from TOPLLab/fix/87
carllocos Oct 17, 2022
d8f3f02
Merge pull request #103 from TOPLLab/fix/95
carllocos Oct 17, 2022
addd9c7
Add disclaimer for ESP IDF primitives
tolauwae Oct 18, 2022
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
18 changes: 11 additions & 7 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true # Cancel in-flight jobs for the same branch or PR

env:
BENCHMARKS_CACHE: "build-benchmarks"

jobs:
formatting-check:
name: Formatting Check
Expand All @@ -29,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -45,7 +42,7 @@ jobs:

compile-with-arduino:
name: (Arduino) Compile on ${{matrix.board.platform-name}}
needs: formatting-check
needs: [formatting-check]
runs-on: ubuntu-latest
env:
SKETCHES_REPORTS_PATH: sketches-reports
Expand All @@ -56,6 +53,7 @@ jobs:
- name: HTTPClient
- name: PubSubClient
- name: Adafruit NeoPixel
- source-url: https://github.com/me-no-dev/AsyncTCP.git
strategy:
fail-fast: false
matrix:
Expand All @@ -72,7 +70,11 @@ jobs:
sketches: |
- platforms/Arduino
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Compile sketches
uses: arduino/compile-sketches@v1
with:
Expand All @@ -84,6 +86,7 @@ jobs:
${{ env.LIBRARIES }}
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Upload sketches report to workflow artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -107,9 +110,10 @@ jobs:
submodules: 'recursive'

- name: Build WARDuino for ESP-IDF
uses: espressif/esp-idf-ci-action@main
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: latest
target: esp32
command: idf.py build -DBUILD_ESP=ON
path: .

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ _deps
.AppleDouble
.LSOverride

*.old

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "tests/sexpr-parser"]
path = tests/integration/sexpr-parser
url = [email protected]:benthepoet/c-sexpr-parser.git
[submodule "lib/json"]
path = lib/json
url = https://github.com/nlohmann/json
33 changes: 20 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (BUILD_ESP)
if (NOT EXISTS $ENV{IDF_PATH}/tools/cmake/project.cmake)
message(FATAL_ERROR "Can't find $IDF_PATH/tools/cmake/project.cmake. Make sure ESP-IDF is installed and $IDF_PATH is set.")
endif ()

message(VERBOSE "Using ESP-IDF toolchain")

set(EXTRA_COMPONENT_DIRS "platforms/ESP-IDF")
Expand All @@ -25,23 +25,29 @@ project(WARDuino)

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

find_package(Threads REQUIRED)

set(SOURCE_FILES
src/WARDuino/WARDuino.cpp
src/WARDuino/CallbackHandler.cpp
src/Primitives/emulated.cpp
src/Interpreter/instructions.cpp
src/Memory/mem.cpp
src/Utils/util.cpp
src/Utils/util_arduino.cpp
src/Debug/debugger.cpp
src/Utils/macros.cpp
src/WARDuino/WARDuino.cpp
src/WARDuino/CallbackHandler.cpp
src/Primitives/primitives.cpp
src/Interpreter/instructions.cpp
)
src/Utils/sockets.cpp
src/Debug/debugger.cpp
src/Edward/proxy.cpp
src/Edward/proxy_supervisor.cpp
src/Edward/RFC.cpp)

set(TEST_FRAMEWORK
tests/integration/wasm_tests.cpp
tests/integration/assertion.cpp
tests/integration/sexpr-parser/src/sexpr.c
)
tests/integration/wasm_tests.cpp
tests/integration/assertion.cpp
tests/integration/sexpr-parser/src/sexpr.c)

add_definitions(-DINFO=0)
add_definitions(-DDEBUG=0)
Expand All @@ -52,11 +58,12 @@ if (BUILD_EMULATOR)
set(CMAKE_CXX_STANDARD 11)

# Set default compile flags for GCC
if(CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-g -v -Wall -Wextra -Wunused)
endif(CMAKE_COMPILER_IS_GNUCXX)
endif (CMAKE_COMPILER_IS_GNUCXX)

# WARDuino CLI
add_executable(wdcli platforms/CLI-Emulator/main.cpp ${SOURCE_FILES} ${TEST_FRAMEWORK})
target_link_libraries(wdcli PRIVATE Threads::Threads)
target_include_directories(wdcli PRIVATE ${EXTERNAL_LIB_HEADERS})
endif (BUILD_EMULATOR)
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<a href="https://github.com/TOPLLab/WARDuino/blob/cleanup/LICENSE"><img src="https://img.shields.io/badge/License-MPL_2.0-blue.svg"></a>
</p>

This project is released under the Mozilla Public License 2.0, and is being developed as part of an active research project at the University of Ghent's [TOPL](https://github.com/TOPLLab) lab.
This project is released under the Mozilla Public License 2.0, and is being developed as part of an active research project at the University of Ghent's [TOPL Lab](https://github.com/TOPLLab).

The WARDuino virtual machine is a WebAssembly runtime for microcontrollers, which runs both under the Arduino and ESP-IDF toolchains.
The WARDuino project also includes a [VS Code extension](https://github.com/TOPLLab/WARDuino-VSCode) to use the remote debugging facilities offered by the virtual machine.
The WARDuino project also includes a [VS Code extension](https://github.com/TOPLLab/WARDuino-VSCode) to use both the remote debugging and the out-of-place debugging facilities offered by the virtual machine.

<p align="center">
<a href="./README.md#build-and-development-instructions">Installation</a> | <a href="./examples/">Examples</a> | <a href="./README.md#webassembly-specification-tests">Run Specification tests</a> | <a href="./documentation/">Documentation</a>
Expand All @@ -22,7 +22,7 @@ Supported platforms: Linux (Ubuntu), macOS, ESP-IDF, Arduino
The project uses CMake. Quick install looks like this:

```bash
git clone [email protected]:TOPLLab/WARDuino.git
git clone --recursive [email protected]:TOPLLab/WARDuino.git
cd WARDuino
mkdir build-emu
cd build-emu
Expand All @@ -36,6 +36,8 @@ The WARDuino VM can be compiled with both the Arduino and ESP-IDF toolchains, an

### Build for ESP-IDF

> warning: primitive support for IDF is under construction

Before you can compile and flash with ESP-IDF, you must install and enable [the toolchain](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html).
You also need to disable the watchdog timer:

Expand All @@ -62,22 +64,35 @@ Or simply run `idf.py flash`.
### Build for Arduino

First, install the [arduino-cli](https://arduino.github.io/arduino-cli/0.21/installation/).
You will also need python3 with the pyserial pacakge.

Second, create the config file:

```bash
arduino-cli config init
```

If you need additional boards, such as the esp32 boards, you can add them in the generated config file. More information [here](https://arduino.github.io/arduino-cli/0.21/getting-started/).
If you need additional boards, such as the esp32 boards, you can add them in the generated config file. More information on how to install the esp32 boards can be found <a href="./documentation/InstallArduinoESP32.md">here</a>.
(_note: WARDuino requires at least version 2.0.2 of the esp32 board manager when using esp32 devices)_

Thirdly, make sure you install the `PubSubClient` and `Adafruit NeoPixel` library. (used for MQTT and pixel primitives)

```bash
arduino-cli lib install "PubSubClient"
arduino-cli lib install "Adafruit NeoPixel"
arduino-cli lib install "PubSubClient" # for MQTT
arduino-cli lib install "Adafruit NeoPixel" # for some primitives
```

To build for Arduino with WIFI support you need to also install the following third-party libraries.
(Wou might need to set `enable_unsafe_install` to `true` in your arduino config ) <!-- Todo remove one day ---!>

```bash
arduino-cli lib install FreeRTOS
arduino-cli lib install --git-url https://github.com/me-no-dev/AsyncTCP.git
```

If you haven't done so already, clone (or symlink) this repository to `~/Arduino/libraries` to make WARDuino availible to Arduino.


After this initial installation steps you can start using WARDuino with the Arduino toolchain.
You can upload the example file as follows, starting from the project root:

Expand Down
3 changes: 3 additions & 0 deletions benchmarks/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ bin/

output
*.csv

*.json
*.data
12 changes: 9 additions & 3 deletions benchmarks/all_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ to_csv() {
sed -i -n '0~2{N;s/\n/,/p}' $1
}

sleep 5
./espruino_bench.sh $tmpdir/espruino
to_csv $tmpdir/espruino
#sleep 5
#./espruino_bench.sh $tmpdir/espruino
#to_csv $tmpdir/espruino

sleep 5
./warduino_bench.sh $tmpdir/warduino
to_csv $tmpdir/warduino

sleep 5
./edward_bench.sh $tmpdir/edward
to_csv $tmpdir/edward

sleep 5
./wasm3_bench.sh $tmpdir/wasm3
to_csv $tmpdir/wasm3
Expand All @@ -38,6 +42,8 @@ echo "# Espruino"
cat $tmpdir/espruino
echo "# Warduino"
cat $tmpdir/warduino
echo "# Edward"
cat $tmpdir/edward
echo "# Wasm3"
cat $tmpdir/wasm3
echo "# Native"
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/benchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#include <iostream>

#include "../debug.h"
#include "../src/Debug/debugger.h"
#include "../src/Utils/macros.h"
#include "../src/WARDuino.h"
#include "timer.h"

Expand Down Expand Up @@ -48,7 +49,7 @@ int run_benchmarks(size_t num_benchmarks, string benchmarks[],
char path[MAX_PATH];
unsigned char bytes[MAX_BYTE_CODE_SIZE];
unsigned int bytes_length;
auto *w = new WARDuino();
auto *w = WARDuino::instance();
size_t correct = 0;
for (size_t i = 0; i < num_benchmarks; i++) {
string name = benchmarks[i];
Expand Down
88 changes: 88 additions & 0 deletions benchmarks/edward.ino.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#include "Arduino.h"
#include "WARDuino.h"

WARDuino* wac = WARDuino::instance();

SocketServer* server;
ServerCredentials serverCredentials = {"{{SSID}}", "{{Password}}"};
uint16_t pullportno = 8080;
uint16_t pushportno = 8081;

#define D1 5

volatile bool handelingInterrupt = false;
uint8_t buff[100] = {0};
uint8_t buff_len = 0;

void ICACHE_RAM_ATTR handleInput() {
if (handelingInterrupt) return;
handelingInterrupt = true;
interrupts();

while (Serial.available()) {
size_t buff_len = 0;
while (Serial.available()) {
buff[buff_len++] = (int8_t)Serial.read();
}
if (buff_len) {
wac->handleInterrupt(buff_len, buff);
}
}
handelingInterrupt = false;
}

void startDebuggerStd(void* pvParameter) {
int valread;
uint8_t buffer[1024] = {0};
wac->debugger->setChannel(fileno(stdout));
write(fileno(stdout), "Got a message ... \n", 19);
while (true) {
// taskYIELD();
// vTaskDelay(100 / portTICK_PERIOD_MS);
yield();

while (Serial.available()) {
size_t buff_len = 0;
while (Serial.available()) {
buffer[buff_len++] = (int8_t)Serial.read();
}
if (buff_len) {
write(fileno(stdout), "Reading message ..... \n", 19);
fflush(stdout);
wac->handleInterrupt(valread - 1, buffer);
write(fileno(stdout), buffer, valread);
fflush(stdout);
}
}
}
}

void handleInterrupt(size_t len, uint8_t* buff) {
wac->handleInterrupt(len, buff);
}

void setup() {
Serial.begin(115200);
attachInterrupt(D1, handleInput, CHANGE);

// create & connect SocketServer
SocketServer::createServer(pullportno, pushportno, &handleInterrupt);
server = SocketServer::getServer();
server->connect2Wifi(&serverCredentials);
}

void loop() {
disableCore0WDT();
Module* m = wac->load_module(impl_wasm, impl_wasm_len, {});
server->begin();

printf("LOADED \n\n");
xTaskCreate(startDebuggerStd, "Debug Thread", 5000, NULL, 1, NULL);
printf("START\n\n");
for (int i = 0; i < 10; i++) {
wac->run_module(m);
printf("%d: %u\n", i, m->stack->value.uint32);
}
wac->unload_module(m);
printf("DONE\n\n");
}
23 changes: 23 additions & 0 deletions benchmarks/edward_bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/sh
# Name: Upload all programs in bench.list to arduino (WARDuino) and time
# By Robbert Gurdeep Singh
################################################################################
tmpfile="$(mktemp --tmpdir)"
trap "rm '$tmpfile'" EXIT
cd "$(dirname "$0")"
date >$1
make clean all
make -C tasks all

cat bench.list | while read l; do
echo $l | tee -a $1
../scripts/upload ${BOARD:-ESP32WROVER} ./tasks/$l/wast/edward/edward.ino -p /dev/ttyUSB0 2>&1 >"$tmpfile"
if [ "$?" -eq "0" ]; then
echo "flashed"
python3 flash_and_check.py | tee -a $1
else
cat $tmpfile
echo "FAILED!"
exit 1
fi
done
Loading