Skip to content

[PXCT-101][PC-1676] Update Portenta X8 User Manual #2249

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 59 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a131ff2
Update content.md
martab1994 May 22, 2024
d4f2ef8
Update content.md
martab1994 May 22, 2024
9b64ec2
Add files via upload
martab1994 May 22, 2024
4c6888b
Update content.md
martab1994 May 22, 2024
70a10ea
User Manual X8 update
martab1994 Jun 3, 2024
110636d
Rename configurator with Wizard
martab1994 Jun 6, 2024
645beb6
User manual content major update (revamp support)
TaddyHC Sep 1, 2024
40eb413
Merge branch 'main' into martab1994-portenta-x8-revamp
TaddyHC Sep 1, 2024
f744488
User manual content update/patch
TaddyHC Sep 1, 2024
511f000
Image flashing tutorial update (revamp w/ User manual update)
TaddyHC Sep 1, 2024
1b9192a
User manual QoL update
TaddyHC Sep 12, 2024
8b4f0ca
Merge branch 'main' into martab1994-portenta-x8-revamp
TaddyHC Sep 12, 2024
bae0181
User manual update - OS image section update compact, x8 fundamentals…
TaddyHC Sep 18, 2024
a3df5f5
Content linter patch
TaddyHC Sep 18, 2024
af90797
User manual content theory optimization and fundamentals tutorial update
TaddyHC Sep 18, 2024
312de27
User manual and fundamental documentation resource update
TaddyHC Sep 19, 2024
82a4d3e
Fundamentals tutorial content update
TaddyHC Sep 19, 2024
f7c8a3f
Main diagram layout wip update w/ password reference removed & update…
TaddyHC Sep 29, 2024
e6d1697
User manual content update new diagram layout & tenta config integration
TaddyHC Sep 29, 2024
2032d7d
Skopeo concept & fundamental documentation update
TaddyHC Oct 10, 2024
9b3d4c2
Documentation content update
TaddyHC Oct 12, 2024
f77dec5
Documentation update lmp-partner-arduino-image to lmp-factory-image
TaddyHC Oct 15, 2024
3e2d1af
Documentation content update
TaddyHC Oct 15, 2024
e0ee2d4
Documentation content update
TaddyHC Oct 16, 2024
b12d8f1
Documentation content minor update
TaddyHC Oct 16, 2024
1b109ea
Documentation content update (Flashing details)
TaddyHC Oct 16, 2024
0558c01
Documentation content update
TaddyHC Oct 17, 2024
ef7badf
Documentation image build update & validation test
TaddyHC Oct 22, 2024
eff87c4
User manual documentation front image update
TaddyHC Oct 22, 2024
e18c9dd
Documentation content minor update
TaddyHC Oct 23, 2024
5559bfc
Update content/hardware/04.pro/boards/portenta-x8/tutorials/08.image-…
TaddyHC Oct 25, 2024
86024a3
Update content/hardware/04.pro/boards/portenta-x8/tutorials/01.user-m…
TaddyHC Oct 25, 2024
41f4066
Documentation content update post checklist review
TaddyHC Oct 25, 2024
aa11d80
Linter patch
TaddyHC Oct 25, 2024
b0dffd7
Documentation content minor update post checklist review
TaddyHC Oct 25, 2024
6972edb
Documentation content update RPC
TaddyHC Oct 25, 2024
6422de7
Documentation content update RPC post pre review
TaddyHC Oct 29, 2024
5557918
Documentation content post pre review update section restructured
TaddyHC Oct 29, 2024
4b4632d
Documentation content posr pre review update
TaddyHC Oct 29, 2024
fab6e4e
Documentation content post pre review update
TaddyHC Oct 29, 2024
e5ebd0a
Update content/hardware/04.pro/boards/portenta-x8/tutorials/01.user-m…
TaddyHC Nov 8, 2024
f5d4383
Update content/hardware/04.pro/boards/portenta-x8/tutorials/01.user-m…
TaddyHC Nov 8, 2024
9827ecb
Update content/hardware/04.pro/boards/portenta-x8/tutorials/02.x8-fun…
TaddyHC Nov 8, 2024
49c9c27
Documentation content update ALW & Docker Fundamentals
TaddyHC Nov 8, 2024
e68f503
Documentation content post review update
TaddyHC Nov 12, 2024
48d1860
Documentation content post review update
TaddyHC Nov 12, 2024
e8b047b
Preview element retrigger
TaddyHC Nov 21, 2024
e22f88e
Update content/hardware/04.pro/boards/portenta-x8/tutorials/09.image-…
TaddyHC Nov 22, 2024
6828f42
Update content/hardware/04.pro/boards/portenta-x8/tutorials/09.image-…
TaddyHC Nov 22, 2024
8d5ec2a
Update content/hardware/04.pro/boards/portenta-x8/tutorials/09.image-…
TaddyHC Nov 22, 2024
81d1227
Update content/hardware/04.pro/boards/portenta-x8/tutorials/02.x8-fun…
TaddyHC Nov 22, 2024
197d7fe
Update content/hardware/04.pro/boards/portenta-x8/tutorials/02.x8-fun…
TaddyHC Nov 22, 2024
9680b07
Update content/hardware/04.pro/boards/portenta-x8/tutorials/09.image-…
TaddyHC Nov 22, 2024
73d888a
Update content/hardware/04.pro/boards/portenta-x8/tutorials/01.user-m…
TaddyHC Nov 22, 2024
1a0ed40
Documentation content post review update
TaddyHC Nov 22, 2024
1da2433
User manual documentation content post review update
TaddyHC Nov 27, 2024
25c9965
User manual documentation update (For Docker)
TaddyHC Nov 28, 2024
538526c
Documentation content descriptive openining graphics update
TaddyHC Nov 29, 2024
4169c96
Documentation content update RPC related
TaddyHC Nov 29, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
2,808 changes: 1,368 additions & 1,440 deletions content/hardware/04.pro/boards/portenta-x8/tutorials/01.user-manual/content.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ hardware:

## Overview

![Portenta X8 RPC](assets/x8-rpc-c.gif)

The container infrastructure provided by Arduino contains a pre-built Python® image that you can use to run Python® applications on the Portenta X8. In this tutorial, we are going to build a container based on a provided one.

While all the peripherals are accessible from the iMX8 processor running the Linux environment, it can be useful to let the onboard microcontroller take care of certain peripheral handling and exchange only the required data between the microcontroller and the Python® application.

You will be guided on how to achieve this setup. It is recommendable to familiarize yourself with the foundational elements of the Portenta X8 and its infrastructure by reading the [user manual](https://docs.arduino.cc/tutorials/portenta-x8/user-manual) if you have not already done so.
You will be guided on how to achieve this setup. It is recommendable to familiarize yourself with the foundational elements of the Portenta X8 and its infrastructure by reading [fundamentals of the Portenta X8](https://docs.arduino.cc/tutorials/portenta-x8/x8-fundamentals) if you have not already done so.

## Goals

Expand All @@ -32,6 +34,39 @@ You will be guided on how to achieve this setup. It is recommendable to familiar
- Any sensor (in this example, we will use an [BME680](https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/) I<sup>2</sup>C module)
- [Arduino IDE 1.8.10+](https://www.arduino.cc/en/software), [Arduino IDE 2](https://www.arduino.cc/en/software), or [Arduino Cloud Editor](https://create.arduino.cc/editor)

## Remote Procedure Call - RPC

The two processors within the Portenta X8 require a communication mechanism to exchange data, known as an **RPC (Remote Procedure Call)**.

**RPC** allows a program to trigger a **`procedure`** or **`function`** on another computer over a network rather than locally. It lets a program execute procedures **remotely**, with the details of network communication hidden to maintain transparency, making the remote call appear similar to a local one.

It is particularly useful for distributed computing in a client-server model. The **`procedure call`** behaves as a **`request`** from the client, and the **`return value`** serves as the server's **`response`**. This model uses multiple computers connected over a network (often the Internet) to solve large computational tasks.

While RPC aims to closely replicate local procedure calls, complete equivalence is not possible due to network communication challenges, which can introduce communication failures. To manage these issues, different RPC mechanisms adopt distinct semantics:

- **`At most once` semantics** ensures that a remote call may fail but will not be run multiple times.
- **`At least once` semantics** guarantees that the call is made at least once, even if it results in multiple activations.

The Portenta X8 uses **MessagePack-RPC** for its communication (see the [library repository](https://github.com/msgpack-rpc/msgpack-rpc) for details). *MessagePack-RPC* relies on *MessagePack* as the serialization protocol, encoding data in *MsgPack* format, and is supported over:

- OpenAMP via Shared Memory
- SPI
- Linux Char Device
- TCP/IP

![Linux Arduino RPC](assets/linux_arduino_RPC.png "Linux Arduino RPC")

In the image above, the **M7 core** of the **STM32H7** manages communication between the Linux and Arduino environments. If an Arduino sketch runs on the **M4 core**, the **M7 core** acts as an intermediary, handling data requests between the M4 core and the Linux environment. Due to this setup, traditional dual-core processing is not supported on the Portenta X8.

On the Linux side, a service called `m4-proxy` handles data transfer between Linux and Arduino.

The communication process works as follows:

- A program registers as the RPC server on port X, listing the procedures available for the M4 to call.
- `m4-proxy` then forwards the calls from the M4 to the appropriate program/port.

![RPC M4 proxy](assets/m4-proxy.png "RPC M4 proxy")

## Python® on the X8

Python® is a modern and powerful scripting language used for a wide range of applications. In this tutorial, we only read sensor data from an Arduino sketch, but you could extend the example and process the data further.
Expand Down Expand Up @@ -102,33 +137,33 @@ adb push <local directory path>/py-serialrpc /home/fio
Log into the X8 shell with `adb shell` and navigate into the `serialrpc` folder. Build the container using

```bash
sudo docker build . -t py-serialrpc`
docker build . -t py-serialrpc
```

The `-t` flag assigns a tag to the container. Then run the container by executing `cd..` and then:

```bash
sudo docker compose up -d
docker compose up -d
```

The `-d` flag detaches the container so it runs in the background. Note that this will run the docker compose app and have the container built persistently across reboots by registering it as a systemd service.

To stop the container, run:

```bash
sudo docker compose stop
docker compose stop
```

Check if the container is running by executing:

```bash
sudo docker ps
docker ps
```

You can then access the log of its service at any time by using following command from the **same directory**:

```bash
sudo docker compose logs -f --tail 20
docker compose logs -f --tail 20
```

If you do not wish to run the container in the background, skip the `-d` flag, you will get the console output directly in the executing shell. Once the container is running, you will see the messages being sent from the M4.
Expand All @@ -154,13 +189,13 @@ adb push <local directory path>/python-sensor-rpc /home/fio
Log into the X8 via `adb shell`. Then navigate into the `python-sensor-rpc` folder and execute:

```bash
sudo docker build . -t python-sensor-rpc
docker build . -t python-sensor-rpc
```

When it has finished, you can run the container with:

```bash
sudo docker compose up
docker compose up
```

After a few seconds, you should see the output from the Python application featuring the sensor readings on the M4 that exchanges through the RPC mechanism. The output should look similar to the following:
Expand All @@ -186,25 +221,25 @@ adb push python-sensor-rpc /home/fio

```bash
# On the Portenta X8
sudo docker compose down
docker compose down
```

```bash
# On the Portenta X8
sudo docker build . -t python-sensor-rpc
docker build . -t python-sensor-rpc
```

```bash
# On the Portenta X8
sudo docker compose up
docker compose up
```

Alternatively, you could modify the files directly on the X8 using an editor such as **VIM**, so you do not need to upload the files every time. Rebuilding the container will be necessary in any case though.

If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT` command that takes multiple arguments. In our example:

```python
ENTRYPOINT [ "python3", "m4_to_python.py"]`
ENTRYPOINT ["python3", "m4_to_python.py"]
```

## Conclusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repo init -u https://github.com/arduino/lmp-manifest.git -m arduino.xml -b relea
echo Pulling git-repo files
repo sync

# Build 'lmp-partner-arduino-image' image
# Build 'lmp-factory-image' image. lmp-partner-arduino-image is now known as lmp-factory-image
echo Building Portenta-X8 image
DISTRO=lmp-xwayland MACHINE=portenta-x8 . setup-environment
echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf
Expand All @@ -36,7 +36,7 @@ cd ..
echo Building tools
DISTRO=lmp-mfgtool MACHINE=portenta-x8 . setup-environment
echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf
echo "MFGTOOL_FLASH_IMAGE = \"lmp-partner-arduino-image\"" >> conf/local.conf
echo "MFGTOOL_FLASH_IMAGE = \"lmp-factory-image\"" >> conf/local.conf
bitbake mfgtool-files

echo Exit tools folder
Expand All @@ -52,7 +52,7 @@ cp -L build-lmp-mfgtool/deploy/images/portenta-x8/mfgtool-files-portenta-x8.tar.
cp -L build-lmp-xwayland/deploy/images/portenta-x8/imx-boot-portenta-x8 $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/u-boot-portenta-x8.itb $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/sit-portenta-x8.bin $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/lmp-partner-arduino-image-portenta-x8.wic $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/lmp-factory-image-portenta-x8.wic $DEPLOY_FOLDER

cd $DEPLOY_FOLDER
tar xvf mfgtool-files-portenta-x8.tar.gz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ hardware:

## Overview

![Portenta X8 Custom Image Build](assets/x8-image-build-c.gif)

In this tutorial, you will learn how to build an image for the Portenta X8 with the source code provided at our [GitHub repository for lmp-manifest](https://github.com/arduino/lmp-manifest/). It is an ideal approach for debugging system elements like the bootloader or kernel support by building images locally.

***Images built locally cannot register with FoundriesFactory and will not be OTA compatible, but this is a good alternative for those who do not have a FoundriesFactory subscription.***
Expand Down Expand Up @@ -59,11 +61,19 @@ cd lmp-manifest
Build the Docker image with the following command:

```bash
docker build -t yocto-build ./lmp-manifest
docker build -t yocto-build .
```

***If you encounter issues running Docker commands, you may need to install the necessary Docker components. You can install the Docker CLI by running: __`winget install --id=Docker.DockerCLI -e`__ or install [__Docker Desktop__](https://docs.docker.com/desktop/install/windows-install/), which includes all needed components.***

![Building a Docker Image](assets/docker_build.png)

If you are building the Docker image one directory up, please use the following command:

```bash
docker build -t yocto-build ./lmp-manifest
```

You will see a confirmation message indicating the image's readiness if the build completes successfully.

#### Run The Docker Image (Builder)
Expand All @@ -78,6 +88,12 @@ To run the *`yocto-build`* image and begin an interactive session, use the follo
docker run -v <source>:/dockerVolume -it yocto-build bash
```

If it encounters errors that may relate to entrypoint, you can use the following command instead of the previous command:

```bash
docker run --entrypoint /bin/bash -v <source>:/dockerVolume -it yocto-build
```

Once inside the container, switch to the *`builder`* user to proceed with the build process. The password for the builder user is **builder**:

```bash
Expand Down Expand Up @@ -152,7 +168,7 @@ Choose the appropriate distribution with the command below:
DISTRO=lmp-xwayland MACHINE=portenta-x8 . setup-environment
```

***Support for `lmp-partner-arduino-image` is anticipated to improve continuously.***
***Support for `lmp-factory-image` is anticipated to improve continuously. Starting from image __version 888__, _`lmp-partner-arduino-image`_ is now known as __`lmp-factory-image`__.***

Following the environment setup, the process will navigate to a new directory. Here, accept the EULA with:

Expand All @@ -169,7 +185,7 @@ The setup completion should resemble the output shown here:
Start the image build with Bitbake using:

```bash
bitbake lmp-partner-arduino-image
bitbake lmp-factory-image
```

***This process may take ~7 hours depending on the build host***
Expand All @@ -193,7 +209,7 @@ To flash your board, you will need to compile **lmp-mfgtool distro** to get addi
cd ..
DISTRO=lmp-mfgtool MACHINE=portenta-x8 . setup-environment
echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf
echo "MFGTOOL_FLASH_IMAGE = \"lmp-partner-arduino-image\"" >> conf/local.conf
echo "MFGTOOL_FLASH_IMAGE = \"lmp-factory-image\"" >> conf/local.conf
```

You should be able to see similar results as the following image when successful:
Expand Down Expand Up @@ -229,7 +245,7 @@ cp -L build-lmp-mfgtool/deploy/images/portenta-x8/mfgtool-files-portenta-x8.tar.
cp -L build-lmp-xwayland/deploy/images/portenta-x8/imx-boot-portenta-x8 $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/u-boot-portenta-x8.itb $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/sit-portenta-x8.bin $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/lmp-partner-arduino-image-portenta-x8.wic $DEPLOY_FOLDER
cp -L build-lmp-xwayland/deploy/images/portenta-x8/lmp-factory-image-portenta-x8.wic $DEPLOY_FOLDER

cd $DEPLOY_FOLDER
tar xvf mfgtool-files-portenta-x8.tar.gz
Expand Down
Loading
Loading