Skip to content

Commit

Permalink
Add config for build-time version data + update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tolauwae committed Mar 18, 2024
1 parent c80d2e1 commit d92442f
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 62 deletions.
1 change: 1 addition & 0 deletions warduino/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ basement_dist
.idea
*.sh
.obsidian
.temp
12 changes: 12 additions & 0 deletions warduino/.vitepress/config.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
load() {
return {
vm: {
version: '0.4.3'
},
plugin: {
version: '0.4.1'
}
}
}
}
102 changes: 66 additions & 36 deletions warduino/guide/get-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
next: 'Examples'
---

<script setup>
import { data } from '../.vitepress/config.data.ts'
</script>

# Getting Started

In this guide, you will find instructions on how to start programming software for microcontrollers in AssemblyScript and Rust by using WARDuino.
Expand All @@ -24,7 +29,7 @@ You can download them from [GitHub](https://github.com/TOPLLab/WARDuino-libs).
::: code-group

```bash [AS]
npm install as-warduino
npm install 'https://gitpkg.now.sh/TOPLLab/WARDuino-libs/glue/assemblyscript?main'
```

```bash [Rust]
Expand All @@ -36,60 +41,38 @@ cargo install warduino
The language library provides access to the [primitives](/reference/primitives) of WARDuino directly from AssemblyScript or Rust.
Once you have written your program and compiled it to WebAssembly, you need to install WARDuino and the toolchains of the platform you are targeting.

```bash

```bash-vue
cd $HOME/Arduino/libraries/
git clone --recurse-submodules --branch v0.4.3 git@github.com:TOPLLab/WARDuino.git
git clone --recurse-submodules --branch v{{ data.vm.version }} git@github.com:TOPLLab/WARDuino.git
```

WARDuino currently supports both the Arduino and ESP-IDF toolchains. To use Arduino, you need to install the [arduino-cli](https://github.com/arduino/arduino-cli). For ESP-IDF you need to install the full toolchain, instructions can be found on the [official website](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#get-started-step-by-step).

## 🛠️ Arduino Toolchain Setup {#arduino}

In order to setup the Arduino toolchain for WARDuino, you need to first install the [arduino-cli](https://arduino.github.io/arduino-cli/0.21/installation/).
You will also need `python3` with the `pyserial` package.

Second, create the config file:

```bash
arduino-cli config init
```
WARDuino currently supports both the Arduino and ESP-IDF toolchains. To use Arduino, you need to install the [arduino-cli](https://github.com/arduino/arduino-cli). For ESP-IDF you need to install the full toolchain, instructions can be found on the [official website](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#get-started-step-by-step).

If you need additional boards, such as the esp32 boards, you can add them in the generated config file.
## 🎉 Your First Project

To find the location of your config file you can run:
To get started quickly, you can use the [AssemblyScript template](https://github.com/TOPLLab/as-warduino-template).

```bash
arduino-cli config dump --verbose
git clone git@github.com:TOPLLab/as-warduino-template.git
cd as-warduino-template
npm i
```

Add the ESP32 board manager URL to the config file:

```yaml
board_manager:
additional_urls:
- https://espressif.github.io/arduino-esp32/package_esp32_index.json
```

Then, update the index and install the ESP32 platform.
Now you can compile the example program.

```bash
arduino-cli core update-index
arduino-cli core install esp32:esp32
npm run build
```

::: warning
To use ESP32 boards with WARDuino you need at least version 2.0.2 of the board manager.
:::

Thirdly, make sure you install the `PubSubClient` and `Adafruit NeoPixel` library, which are used by some primitives.
Now you can flash your program.

```bash
arduino-cli lib install "PubSubClient" # for MQTT
arduino-cli lib install "Adafruit NeoPixel"
cd ~/Arduino/libraries/WARDuino/
```

If you haven't done so already, clone (or symlink) the WARDuino repository to `~/Arduino/libraries/WARDuino` to make it available to Arduino. (see [#installation](#installation))

## 📸 Flashing using Arduino

After setting up the Arduino toolchain, you can upload your programs with the Makefile in the `platforms/Arduino` folder of the WARDuino virtual machine.
Expand Down Expand Up @@ -140,3 +123,50 @@ make flash

Or simply run `idf.py flash`.

## 🛠️ Arduino Toolchain Setup {#arduino}

In order to setup the Arduino toolchain for WARDuino, you need to first install the [arduino-cli](https://arduino.github.io/arduino-cli/0.21/installation/).
You will also need `python3` with the `pyserial` package.

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.

To find the location of your config file you can run:

```bash
arduino-cli config dump --verbose
```

Add the ESP32 board manager URL to the config file:

```yaml
board_manager:
additional_urls:
- https://espressif.github.io/arduino-esp32/package_esp32_index.json
```

Then, update the index and install the ESP32 platform.

```bash
arduino-cli core update-index
arduino-cli core install esp32:esp32
```

::: warning
To use ESP32 boards with WARDuino you need at least version 2.0.2 of the board manager.
:::

Thirdly, make sure you install the `PubSubClient` and `Adafruit NeoPixel` library, which are used by some primitives.

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

If you haven't done so already, clone (or symlink) the WARDuino repository to `~/Arduino/libraries/WARDuino` to make it available to Arduino. (see [#installation](#installation))

7 changes: 5 additions & 2 deletions warduino/guide/plugin/get-started.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<script setup>
import { data } from '../../.vitepress/config.data.ts'
</script>
# Getting Started

## Launch the Plugin {#launch}
Expand All @@ -18,9 +21,9 @@ The template contains the correct launch file.
To use the WARDuino plugin to debug your project, you need to create a `launch.json` file in the `.vscode` subfolder of your project root directory [<sup>\[1\]</sup>](https://code.visualstudio.com/docs/editor/debugging).
The file should look like this:

```json
```json-vue
{
"version": "0.4.1",
"version": "{{ data.plugin.version }}",
"configurations": [
{
"type": "WARDuinoDBG",
Expand Down
10 changes: 8 additions & 2 deletions warduino/guide/plugin/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<script setup>
import { data } from '../../.vitepress/config.data.ts'

const vm = "https://github.com/TOPLLab/WARDuino/releases/tag/v" + data.vm.version;
const plugin = "https://github.com/TOPLLab/WARDuino-VSCode/releases/tag/v" + data.plugin.version;
</script>
# VS Code Plugin

::: tip WARDuino VS Code 0.4.1
::: tip WARDuino VS Code {{ data.plugin.version }}

This page describes the VS Code plugin [version 0.4.1](https://github.com/TOPLLab/WARDuino-VSCode/releases/tag/v0.4.1), which works with WARDuino [version 0.4.2](https://github.com/TOPLLab/WARDuino/releases/tag/v0.4.2).
This page describes the VS Code plugin <a :href="plugin" target="_blank">version {{ data.plugin.version }}</a>, which works with WARDuino <a :href="vm" target="_blank">version {{ data.vm.version }}</a>.

:::

Expand Down
9 changes: 7 additions & 2 deletions warduino/reference/debug-protocol.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
---
next: EDWARD
---
<script setup>
import { data } from '../.vitepress/config.data.ts'

const url = "https://github.com/TOPLLab/WARDuino/releases/tag/v" + data.vm.version;
</script>
# Debug Protocol Reference Sheet

::: tip Debug protocol 0.4.3
::: tip Debug protocol {{ data.vm.version }}

This page describes the debug protocol of WARDuino [version 0.4.3](https://github.com/TOPLLab/WARDuino/releases/tag/v0.4.3).
This page describes the debug protocol of WARDuino <a :href="url" target="_blank">version {{ data.vm.version }}</a>.

:::

Expand Down
19 changes: 11 additions & 8 deletions warduino/reference/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ This is a major constraint for some microcontrollers, however all other parts of

The following table lists the devices on which the WARDuino VM has been verified to work.

| Device Family / OS | CLI | Arduino | ESP IDF | Callbacks |
|:---------------------------------------------------------------------------------------------------------------------------- |:------------------:|:------------------:|:-----------------------------------------------------------------:|:------------------:|
| Windows | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
| Linux | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| macOS | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| [ESP8266](https://www.espressif.com/en/products/socs/esp8266) | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |
| [ESP32 WROOM](https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32e_esp32-wroom-32ue_datasheet_en.pdf) | :heavy_minus_sign: | :white_check_mark: | :exclamation:[\*](https://github.com/TOPLLab/WARDuino/issues/210) | :exclamation: |
| [ESP32 WROVER](https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf) | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Device Family / OS | CLI | Arduino | Zephyr | ESP IDF | Callbacks |
|:---------------------------------------------------------------------------------------------------------------------------- |:------------------:|:------------------:|:------------------:|:-----------------------------------------------------------------:|:------------------:|
| Windows | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |
| Linux | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| macOS | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |
| [ESP8266](https://www.espressif.com/en/products/socs/esp8266) | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: |
| [ESP32 WROOM](https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32e_esp32-wroom-32ue_datasheet_en.pdf) | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :exclamation:[\*](https://github.com/TOPLLab/WARDuino/issues/210) | :exclamation: |
| [ESP32 WROVER](https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf) | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
| [Openbot Brain](https://github.com/OpenBotBrain) | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| STM32 Cortex M4 | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| [Adafruit ESP32 Feather V2](https://www.adafruit.com/product/5400) | :heavy_minus_sign: | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: |

:white_check_mark: = supported | :exclamation: = unstable | :heavy_minus_sign: = not supported

24 changes: 12 additions & 12 deletions warduino/reference/primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ The WARDuino virtual machine includes built-in primitives that provide access to

The built-in primitives are divided conceptually into different modules, according to the functionality they provide. The primitives are hardware dependent and so have to be implemented for each hardware platform separately. The table below list all modules, and on which platforms they are supported.

| Module | Arduino | ESP IDF | Raspberry Pi |
|:------------------- |:---------------------:|:---------------------:|:------------------:|
| analog I/O | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| digital I/O | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |
| external interrupts | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| http | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| mqtt | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| neopixel | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| serial | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| spi | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| time | :white_check_mark: | :construction_worker: | :heavy_minus_sign: |
| wifi | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| Module | Arduino | ESP IDF | Zephyr |
|:------------------- |:---------------------:|:---------------------:|:---------------------:|
| analog I/O | :white_check_mark: | :heavy_minus_sign: | :construction_worker: |
| digital I/O | :white_check_mark: | :white_check_mark: | :construction_worker: |
| external interrupts | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| http | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| mqtt | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| neopixel | :construction_worker: | :heavy_minus_sign: | :heavy_minus_sign: |
| serial | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| spi | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |
| time | :white_check_mark: | :construction_worker: | :heavy_minus_sign: |
| wifi | :white_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: |

:white_check_mark: = implemented | :construction_worker: = partially implemented | :heavy_minus_sign: = not implemented

Expand Down

0 comments on commit d92442f

Please sign in to comment.