Skip to content

Commit 600fdcd

Browse files
committed
Update build documentation for nif or port inclusion
Updates "Build Instructions" documentation for including custom nifs and ports into esp32 builds. Closes #1599 Signed-off-by: Winford <winford@object.stream>
1 parent 4a6e5a9 commit 600fdcd

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

doc/src/build-instructions.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ documentation.
569569

570570
The instructions for adding custom Nifs and ports differ in slight detail, but are otherwise quite similar. In general, they involve:
571571

572-
1. Adding the custom Nif or Port to the `components` directory of the AtomVM source tree;
573-
1. Adding the component to the corresponding `main/component_nifs.txt` or `main/component_ports.txt` files;
572+
1. Adding the custom Nif or Port to the `components` directory of the AtomVM source tree.
573+
1. Run `idf.py reconfigure` to pick up any menuconfig options, many extra drivers have an option to disable them (they are enabled by default). Optionally use `idf.py menuconfig` and confirm the driver is enabled and save when quitting.
574574
1. Building the AtomVM binary.
575575

576576
```{attention}
@@ -604,10 +604,12 @@ To add support for a new peripheral or protocol using custom AtomVM Nif, you nee
604604
Instructions for implementing Nifs is outside of the scope of this document.
605605
```
606606

607-
* Add your `<moniker>` to the `main/component_nifs.txt` file in the `src/platforms/esp32` directory.
608-
```{attention}
609-
The `main/component_nifs.txt` file will not exist until after the first clean build.
610-
```
607+
* Add the `REGISTER_NIF_COLLECTION` using the parameters `NAME`, `INIT_CB`, `DESTROY_CB`, `RESOLVE_NIF_CB` macro to the end of your nif code. Example:
608+
609+
```c
610+
REGISTER_NIF_COLLECTION(my_nif, NULL, NULL, my_nif_get_nif);
611+
```
612+
611613

612614
#### Adding a custom AtomVM Port
613615

@@ -630,10 +632,12 @@ To add support for a new peripheral or protocol using an AtomVM port, you need t
630632
Instructions for implementing Ports is outside of the scope of this document.
631633
```
632634

633-
* Add your `<moniker>` to the `main/component_ports.txt` file in the `src/platforms/esp32` directory.
634-
```{attention}
635-
The `main/component_ports.txt` file will not exist until after the first clean build.
636-
```
635+
* Add the `REGISTER_PORT_COLLECTION` using the parameters `NAME`, `INIT_CB`, `DESTROY_CB`, `RESOLVE_NIF_CB` macro to the end of your nif code. Example:
636+
637+
```c
638+
REGISTER_PORT_COLLECTION(my_port, my_port_init, NULL, my_port_create_port);
639+
```
640+
637641

638642
## Building for STM32
639643

0 commit comments

Comments
 (0)