You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ESP32 SoC (with IDF/FreeRTOS, see [esp32](https://doc.atomvm.org/main/getting-started-guide.html#getting-started-on-the-esp32-platform))
20
-
* STM32 MCUs (with LibOpenCM3, see [stm32](https://doc.atomvm.org/main/getting-started-guide.html#getting-started-on-the-stm32-platform))
20
+
* STM32 MCUs (with official ST HAL/LL SDK, see [stm32](https://doc.atomvm.org/main/getting-started-guide.html#getting-started-on-the-stm32-platform))
21
21
* Raspberry Pi Pico and Pico 2 (see [rp2](https://doc.atomvm.org/main/getting-started-guide.html#getting-started-on-the-raspberry-pi-pico-platform))
22
22
* Browsers and NodeJS with WebAssembly (see [emscripten](https://doc.atomvm.org/main/getting-started-guide.html#getting-started-with-atomvm-webassembly))
Copy file name to clipboardExpand all lines: doc/src/build-instructions.md
+66-49Lines changed: 66 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -707,39 +707,21 @@ To add support for a new peripheral or protocol using an AtomVM port, you need t
707
707
708
708
## Building for STM32
709
709
710
+
This section describes building AtomVM using the official ST HAL/LL SDK, which is downloaded automatically via CMake FetchContent. This platform supports STM32F2, STM32F4, STM32F7, STM32G0, STM32G4, STM32H5, STM32H7, STM32L4, STM32L5, STM32U3, STM32U5, and STM32WB families.
711
+
710
712
### STM32 Prerequisites
711
713
712
714
The following software is required to build AtomVM for the STM32 platform:
713
715
714
-
*[11.3 ARM toolchain](https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz) (or compatible with your system)
715
-
*[libopencm3](https://github.com/libopencm3/libopencm3.git) version 0.8.0
716
-
*`cmake`
717
-
*`make`
716
+
* ARM toolchain (`arm-none-eabi-gcc`, e.g. 11.3 or later)
717
+
*`cmake` (3.13 or later)
718
+
*`meson`
719
+
*`ninja`
718
720
*`git`
719
-
*`python`
720
721
* Erlang/OTP `escript`
721
722
722
723
```{note}
723
-
AtomVM tests this build on the latest Ubuntu github runner.
724
-
```
725
-
726
-
### Setup libopencm3
727
-
728
-
Before building for the first time you need to have a compiled clone of the libopencm3 libraries, from inside the AtomVM/src/platforms/stm32 directory:
No external SDK download is required. The STM32 HAL/LL drivers and CMSIS headers are fetched automatically by CMake during the build. AtomVM is built with `picolibc` which is also downloaded as part of the build and requires `meson` and `ninja`.
743
725
```
744
726
745
727
### Build AtomVM with cmake toolchain file
@@ -749,14 +731,32 @@ $ cd <atomvm-source-tree-root>
The default build is based on the STM32F4Discovery board chip (`stm32f407vgt6`). If you want to target a different
759
-
chip, pass the `-DDEVICE` flag when invoking cmake. For example, to use the BlackPill V2.0, pass `-DDEVICE=stm32f411ceu6`. At this time any `STM32F4` or `STM32F7` device with 512KB or more of on package flash should work with AtomVM. If an unsupported device is passed with the `DEVICE` parameter the configuration will fail. For devices with either 512KB or 768KB of flash the available application flash space will be limited to 128KB. Devices with only 512KB of flash may also suffer from slightly reduced performance because the compiler must optimize for size rather than performance.
740
+
The default build targets the BlackPill (`stm32f411ceu6`). Pass the `-DDEVICE` flag to select a different device. Supported families and example devices:
If an unsupported device is passed with the `DEVICE` parameter the configuration will fail.
758
+
759
+
For devices with 512KB or less of flash, application flash space will be limited and the compiler optimizes for size rather than performance.
760
760
761
761
```{attention}
762
762
For devices with only 512KB of flash the application address is different and must be adjusted when flashing your
@@ -766,7 +766,9 @@ devices is `0x8060000`.
766
766
767
767
### Configuring the Console
768
768
769
-
The default build for any `DEVICE` will use `USART2` and output will be on `PA2`. This default will work well for most `Discovery` and generic boards that do not have an on-board TTL to USB-COM support (including the `stm32f411ceu6` A.K.A. `BlackPill V2.0`). For `Nucleo` boards that do have on board UART to USB-COM support you may pass the `cmake` parameter `-DBOARD=nucleo` to have the correct USART and TX pins configured automatically. The `Nucleo-144` series use `USART3` and `PD8`, while the supported `Nucleo-64` boards use `USART2`, but passing the `BOARD` parameter along with `DEVICE` will configure the correct `USART` for your model. If any other boards are discovered to have on board USB UART support pull requests, or opening issues with the details, are more than welcome.
769
+
By default, stdout and stderr are printed on the configured console USART. Baudrate is 115200 and serial transmission is 8N1 with no flow control.
770
+
771
+
The default console is `USART1` on `PA9`. For `Nucleo` boards, pass `-DBOARD=nucleo` to automatically select the correct USART for your board.
The AtomVM system console `USART` may also be configured to a specific uart peripheral. Pass one of the parameters from the chart below with the `cmake` option `-DAVM_CFG_CONSOLE=CONSOLE_#`, using the desired console parameter in place of `CONSOLE_#`. Not all UARTs are available on every supported board, but most will have several options that are not already used by other on board peripherals. Consult your data sheets for your device to select an appropriate console.
| STM32WB | 32 MHz | Nucleo-WB55, WeAct Studio WB55 (required for BLE radio) |
816
+
817
+
```{note}
818
+
Not all STM32 families have been tested on hardware. The F4, H5, H7, U5, and WB families have been tested on actual boards. The F2, F7, G0, G4, L4, L5, and U3 families are supported in the build system but have not yet been validated on hardware. If you encounter issues with an untested family, please open an [issue on GitHub](https://github.com/atomvm/AtomVM/issues).
819
+
```
790
820
791
821
### Configure STM32 logging with `cmake`
792
822
@@ -803,19 +833,6 @@ For log entries colorized by log level pass `-DAVM_ENABLE_LOG_COLOR=on` to cmake
803
833
804
834
By default only `ERROR` messages contain file and line number information. This can be included with all log entries by passing `-DAVM_ENABLE_LOG_LINES=on` to cmake, but it does incur a significant performance penalty and is only suggested for debugging during development.
805
835
806
-
### Console Printing on STM32
807
-
808
-
AtomVM is built with standard `newlib` to support `long long` integers (`signed` and `unsigned`). If you are building for a device with extremely limited flash space the `nano` version of `newlib` can be used instead. This may be done by passing `-DAVM_NEWLIB_NANO=on`. If the `nano newlib` is used logs will be automatically disabled, this is because many of the VM low level log messages will include `%ull` formatting and will cause buffer overflows and crash the VM if logging is not disabled for `nano newlib` builds. The total flash savings of using `nano newlib` and disabling logs is just under 40kB.
809
-
810
-
By default, stdout and stderr are printed on USART2. On the STM32F4Discovery board, you can see them
811
-
using a TTL-USB with the TX pin connected to board's pin PA2 (USART2 RX). Baudrate is 115200 and serial transmission
812
-
is 8N1 with no flow control.
813
-
814
-
```{seealso}
815
-
If building for a different target USART may be configure as explained above in
816
-
[Configuring the Console](#configuring-the-console).
817
-
```
818
-
819
836
### Configuring deployment builds for STM32
820
837
821
838
After your application has been tested (_and debugged_) and is ready to put into active use you may want to tune the build of AtomVM. For instance disabling logging with `-DAVM_LOG_DISABLE=on` as a `cmake` configuration option may result in slightly better performance. This will have no affect on the console output of your application, just disable low level log messages from the AtomVM system. You may also want to enabling automatic reboot in the case that your application ever exits with a return other than `ok`. This can be enabled with the `cmake` option `-DAVM_CONFIG_REBOOT_ON_NOT_OK=on`.
0 commit comments