Skip to content

Commit ddfa8b0

Browse files
committed
Update the README.md with the new automatic workflow
1 parent 132624c commit ddfa8b0

File tree

1 file changed

+45
-27
lines changed

1 file changed

+45
-27
lines changed

README.md

+45-27
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,40 @@ Unlike traditional Arduino implementations, where the final output is a standalo
8080

8181
The `loader` is responsible for managing the interaction between your sketches and the underlying Zephyr system. After the initial bootloader installation, the `loader` takes over the sketch loading process automatically.
8282

83-
To ensure flexibility, the `loader` project is designed to be generic. Any necessary modifications for specific boards should be made in the corresponding `DTS overlay` or a special `fixup` file, using appropriate guards to maintain stability.
83+
To ensure flexibility, the `loader` project is designed to be generic. Any necessary modifications for specific boards should be made in the corresponding "DTS overlay" or a special "fixup" file, using appropriate guards to maintain compatibility.
8484

85-
The behavior of the `loader` can be adjusted through the `Mode` menu:
85+
The behavior of the `loader` can be adjusted through the `Mode` menu of the IDE:
8686
- `Standard`: The sketch is loaded automatically.
8787
- `Debug`: The user must type `sketch` in Zephyr's shell, which is accessible via the default Serial.
8888

8989
The most important components of this project are:
9090

9191
* [Zephyr based loader](/loader)
9292
* [LLEXT](https://docs.zephyrproject.org/latest/services/llext/index.html)
93-
* [Actual core](/cores/arduino) with [variants](/variants) and the usual `{platform,boards}.txt`
93+
* [Actual core](/cores/arduino) with [variants](/variants) and the usual [platform](/platform.txt) and [boards](/boards) files
9494
* [ArduinoCore-API](https://github.com/arduino/ArduinoCore-API)
95-
* [post_build_tool](/extra/post_build_tool)
95+
* [zephyr-sketch-tool](/extra/zephyr-sketch-tool)
9696

97-
## 🛠️ Setup the environment
97+
## 🏃 Shortcut: using the Core in Arduino IDE/CLI without installing Zephyr
9898

99-
In this section, we’ll guide you through setting up your environment to work with the core.
99+
> [!TIP]
100+
>
101+
> If you are only interested in developing features in the [core](/cores/arduino)
102+
> or [libraries](/libraries), and do not want to set up a full Zephyr build
103+
> environment, you can use the [`sync-zephyr-artifacts`](/extra/sync-zephyr-artifacts)
104+
> utility to download a pre-built version of the files needed to compile
105+
> sketches and flash the loader.
106+
>
107+
> To do so, after cloning this repo, compile the `sync-zephyr-artifacts`
108+
> utility via `go build` and run it as `sync-zephyr-artifacts .` to retrieve
109+
> the precompiled files for the current revision of the core.
110+
>
111+
> Next, follow the instructions in [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli).
112+
> Remember to [update the loader on your board](#flash-the-loader) as well.
113+
114+
## 🛠️ Setup a Zephyr build environment
115+
116+
In this section, we’ll guide you through setting up your environment to work on and update the Zephyr core.
100117

101118
Shell scripts are available to simplify the installation process (Windows is not supported at the moment 😔).
102119

@@ -124,7 +141,9 @@ download all packages required for a Zephyr build in addition to the toolchains
124141
in the Zephyr SDK.
125142

126143
> [!NOTE]
127-
> This core is validated with version v0.17.0. Compatibility with later versions has not been tested yet.
144+
> This core is validated with version v0.17.0 of the SDK. Compatibility with later versions has not been tested yet.
145+
146+
## 🛠️ Regenerate the compiled core files
128147

129148
### Build the Loader
130149

@@ -145,7 +164,7 @@ or the Zephyr board target:
145164
./extra/build.sh arduino_portenta_h7//m7
146165
```
147166

148-
The firmwares will be copied to [firmwares](/firmwares) folder, and the
167+
The firmwares will be copied to the [firmware](/firmware) folder, and the
149168
associated variant will be updated.
150169

151170
### Flash the Loader
@@ -154,29 +173,30 @@ If the board is fully supported by Zephyr, you can flash the firmware directly o
154173
```bash
155174
west flash
156175
```
176+
This can also be performed via the "Burn bootloader" action in the IDE if the core is properly installed, as detailed below.
157177

158178
### Using the Core in Arduino IDE/CLI
159179

160-
After running the `bootstrap` script, you can symlink the core to `$sketchbook/hardware/arduino-git/zephyr`. Once linked, it will appear in the IDE/CLI, and the board's Fully Qualified Board Name (FQBN) will be formatted as `arduino-git:zephyr:name_from_boards_txt`.
161-
162-
### Using the Core in Arduino IDE/CLI (without installing Zephyr toolchain)
163-
164-
To help core developers (who might not be interested at all in setting up a full Zephyr build system) we are providing [sync-zephyr-artifacts](/extra/sync-zephyr-artifacts) utility. After compiling it via `go build`, run as `sync-zephyr-artifacts .` to retrieve the files needed to compile sketches and flash the loader.
180+
After running the `bootstrap.sh` script, you can symlink the core to `$sketchbook/hardware/arduino-git/zephyr`. Once linked, it will appear in the IDE/CLI, and the board's Fully Qualified Board Name (FQBN) will be formatted as `arduino-git:zephyr:name_from_boards_txt`.
165181

166182
## 🚀 Adding a new target
167183

168-
To add a new board that is already supported by mainline Zephyr, follow these steps:
184+
To add a new board that is already supported by mainline Zephyr with the target `$your_board`, follow these steps:
185+
186+
* Get the variant name from your board by running `extra/get_variant_name.sh $your_board`.
187+
* Create a folder in the [`variants/`](/variants) directory with the same name as the variant for your new board.
188+
* Create the DTS `<variant>.overlay` and Kconfig `<variant>.conf` files in that directory.
169189

170-
* Create the `DTS overlay` and `.conf` files in the [loader](/loader/boards) directory.
171190
The overlay must include:
172-
* A flash partition called `user_sketch`, tipically located near the end of the flash.
191+
* A flash partition called `user_sketch`, typically located near the end of the flash.
173192
* A `zephyr,user` section containing the description for GPIOs, Analog, UART, SPI and I2C devices. Feel free to leave some fields empty in case Zephyr support is missing. This will result in some APIs not being available at runtime (eg. `analogWrite` if PWM section is empty).
174-
* Build the Loader: run `./extra.build.sh $your_board $your_board` and start debugging the errors. :grin:
193+
194+
The Kconfig file must include any board-specific options required by this target.
195+
* Build the Loader: run `./extra/build.sh $your_board` (with any additional arguments as required) and start debugging the errors. :grin:
175196
* Update the `boards.txt`: add an entry for your board, manually filling the required fields.
176-
* Implement touch support: if your board supports the `1200bps touch` method, implement `_on_1200_bps` in a file located inside the `variant/your_board` folder.
177-
* ⏳ Temporary steps
178-
* Create `includes.txt` based on `llext-edk/Makefile.cflags`, taking inspiration for other variants.
179-
* Amend `your_board.compiler.zephyr.*` with information from `llext-edk/Makefile.cflags`.
197+
198+
In particular, set `build.zephyr_target` and `build.zephyr_args` to the arguments used in the `build.sh` call, and `build.variant` to the variant name identified above.
199+
* Implement touch support: if your board supports the "1200bps touch" method, implement `_on_1200_bps` in a file located inside the variant folder of your board.
180200

181201
## 🐛 Bug Reporting
182202

@@ -191,14 +211,12 @@ Contributions are always welcome. The preferred way to receive code contribution
191211
192212
## 📌 Upcoming features
193213

194-
- [x] Unify overlay in [loader](/loader/boards) with the one provided in [variant](/variant) for interoperability with GSoC project
195-
- [x] Autogenerate `defines.txt`, `includes.txt`, `cflags.txt` from `llext-edk` output
214+
- [ ] Remove binaries from this repo history (arduino/ArduinoCore-zephyr#102, :warning: will require a clean clone)
196215
- [x] Network: support UDP and TLS
197-
- [ ] USB: switch to USB_DEVICE_STACK_NEXT to support PluggableUSB
198-
- [ ] Relocate RODATA in flash to accomodate sketches with large assets
216+
- [ ] USB: switch to `USB_DEVICE_STACK_NEXT` to support PluggableUSB
217+
- [ ] Relocate RODATA in flash to accommodate sketches with large assets
199218
- [ ] Provide better error reporting for failed llext operations
200-
- [ ] Replace [llext_exports.c](/loader/llext_exports.c) with proper symbols generation (via includes)
201-
- [x] Provide better usability for `Debug` builds (eg. shell over USB)
219+
- [ ] Replace [`llext_exports.c`](/loader/llext_exports.c) with proper symbols generation (via includes)
202220
- [ ] Fix corner cases with `std::` includes (like `<iterator>`)
203221
- [ ] Get rid of all warnings
204222

0 commit comments

Comments
 (0)