-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Renesas R-Car Setup documents (#20)
* add Renesas R-Car setup document * Feature/add renesas rcar s4 (#1) Update steps and add S4 Spider board image * update link * add link for detail manuals * Fixed confusing expressions and fix shell script sample * Fix the script * Make script executable * Fix paths, make script executable, install deps Co-authored-by: Jun Ichikawa <juichika@amazon.co.jp> Co-authored-by: Yuya Hamamachi <94039217+yhamamachi@users.noreply.github.com> Co-authored-by: Geoff Phillips <phigeoff@amazon.de>
- Loading branch information
1 parent
e2056ae
commit d7c415e
Showing
6 changed files
with
553 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Getting started with AWS IoT FleetWise Edge Agent on NXP S32G | ||
|
||
This section describes how to deploy AWS IoT FleetWise Edge Agent onto an NXP S32G-VNP-RDB2 board. | ||
|
||
## Prerequisites | ||
|
||
- **NXP Semiconductors S32G Reference Design 2** — Part number: S32G-VNP-RDB2 | ||
- **AWS IoT FleetWise Edge Agent Compiled for ARM64** — If you are using an EC2 Graviton instance as your development machine, you will have completed this already in [previous step](./edge-agent-dev-guide.md#compile-aws-iot-fleetwise-edge-agent-software). | ||
|
||
- _If you are using a local Intel x86_64 (amd64) development machine_, you will need to run the following to cross-compile AWS IoT FleetWise Edge Agent: | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge \ | ||
&& sudo -H ./tools/install-deps-cross.sh \ | ||
&& rm -rf build \ | ||
&& ./tools/build-fwe-cross.sh | ||
``` | ||
|
||
- **Internet Router with Ethernet** — The S32G-VNP-RDB2 must be connected to an internet router via an Ethernet cable for internet connectivity. It is beyond the scope of this document to describe how this is achieved, but one possibility is to use a WiFi to Ethernet bridge and a smartphone acting as an internet hotspot. | ||
|
||
## Build an SD-Card Image | ||
|
||
The following instructions use the development machine to build an SD-card image based on the Ubuntu variant of the NXP Linux BSP version 28.0, with the addition of the `can-isotp` kernel module required by AWS IoT FleetWise Edge Agent, an updated version of the `canutils` package and a `systemd` service called `setup-socketcan` for bringing up the CAN interfaces at startup. | ||
|
||
1. Run the following _on the development machine_ to install the dependencies of the `bitbake` tool of the Yocto / OpenEmbedded project. | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge \ | ||
&& sudo ./tools/install-deps-yocto.sh | ||
``` | ||
|
||
1. Run the following to create a build folder and setup the Yocto project: | ||
|
||
```bash | ||
mkdir -p ~/yocto-build && cd ~/yocto-build \ | ||
&& ~/aws-iot-fleetwise-edge/tools/setup-yocto-s32g.sh | ||
``` | ||
|
||
1. Run the following to run `bitbake` to create the SD-card image and compress it. This can take several hours to complete depending on the performance of the development machine and the speed of the internet connection. | ||
|
||
```bash | ||
source sources/poky/oe-init-build-env build_s32g274ardb2ubuntu \ | ||
&& bitbake fsl-image-ubuntu \ | ||
&& gzip -fk tmp/deploy/images/s32g274ardb2/fsl-image-ubuntu-s32g274ardb2.sdcard | ||
``` | ||
|
||
1. Run the following _on your local machine_ to download the compressed SD-card image: | ||
|
||
```bash | ||
scp -i <PATH_TO_PEM> ubuntu@<EC2_IP_ADDRESS>:yocto-build/build_s32g274ardb2ubuntu/tmp/deploy/images/s32g274ardb2/fsl-image-ubuntu-s32g274ardb2.sdcard.gz . | ||
``` | ||
|
||
## Flash the SD-Card Image | ||
|
||
1. Download and install Balena Etcher _on your local machine_: https://www.balena.io/etcher/ | ||
1. Run Balena Etcher, choose ‘Select image’ and select the compressed SD-card image | ||
`fsl-image-ubuntu-s32g274ardb2.sdcard.gz` | ||
1. Insert the SD-card supplied with the S32G-VNP-RDB2 into your local machine’s SD-card reader | ||
1. Choose ‘Select target’ and select the SD-card | ||
1. Choose ‘Flash!’ | ||
|
||
## Specify Initial Board Configuration | ||
|
||
1. Insert the SD-card into the S32G-VNP-RDB2’s SD-card slot. | ||
1. Connect the S32G-VNP-RDB2’s power supply. | ||
1. Connect an Ethernet cable from port P3A of the S32G-VNP-RDB2 to the internet router. | ||
|
||
![](./images/s32g_golden_box.png) | ||
|
||
1. Connect your local machine to the internet router, for example via WiFi or via Ethernet. | ||
1. Connect to the S32G-VNP-RDB2 via SSH, entering password `bluebox`: | ||
`ssh bluebox@ubuntu-s32g274ardb2` | ||
1. If you can’t connect using the hostname `ubuntu-s32g274ardb2`, you will need to connect to the administration webpage of the internet router to obtain the IP address assigned to the S32G-VNP-RDB2. Use this IP address in place of `ubuntu-s32g274ardb2` used throughout this guide. | ||
1. Once connected via SSH, check the board’s internet connection by running: `ping amazon.com`. There should be 0% packet loss. | ||
|
||
## Provision AWS IoT Credentials | ||
|
||
Run the following commands _on the development machine_ (after compiling AWS IoT FleetWise Edge Agent for ARM64 as explained above), to create an IoT Thing and provision credentials for it. The AWS IoT FleetWise Edge Agent binary and its configuration files will be packaged into a ZIP file ready to be deployed to the board. | ||
|
||
```bash | ||
mkdir -p ~/aws-iot-fleetwise-deploy && cd ~/aws-iot-fleetwise-deploy \ | ||
&& cp -r ~/aws-iot-fleetwise-edge/tools . \ | ||
&& mkdir -p build/src/executionmanagement \ | ||
&& cp ~/aws-iot-fleetwise-edge/build/src/executionmanagement/aws-iot-fleetwise-edge \ | ||
build/src/executionmanagement/ \ | ||
&& mkdir -p config && cd config \ | ||
&& ../tools/provision.sh \ | ||
--vehicle-name fwdemo-s32g \ | ||
--certificate-pem-outfile certificate.pem \ | ||
--private-key-outfile private-key.key \ | ||
--endpoint-url-outfile endpoint.txt \ | ||
--vehicle-name-outfile vehicle-name.txt \ | ||
&& ../tools/configure-fwe.sh \ | ||
--input-config-file ~/aws-iot-fleetwise-edge/configuration/static-config.json \ | ||
--output-config-file config-0.json \ | ||
--vehicle-name `cat vehicle-name.txt` \ | ||
--endpoint-url `cat endpoint.txt` \ | ||
--can-bus0 can0 \ | ||
&& cd .. && zip -r aws-iot-fleetwise-deploy.zip . | ||
``` | ||
|
||
## Deploy AWS IoT FleetWise Edge Agent on NXP S32G | ||
|
||
1. Run the following _on your local machine_ to copy the deployment ZIP file from the EC2 machine to your local machine: | ||
|
||
```bash | ||
scp -i <PATH_TO_PEM> ubuntu@<EC2_IP_ADDRESS>:aws-iot-fleetwise-deploy/aws-iot-fleetwise-deploy.zip . | ||
``` | ||
|
||
1. Run the following _on your local machine_ to copy the deployment ZIP file from your local machine to the S32G (replacing `ubuntu-s32g274ardb2` with the IP address of the S32G if using the hostname is not supported): | ||
|
||
```bash | ||
scp aws-iot-fleetwise-deploy.zip bluebox@ubuntu-s32g274ardb2: | ||
``` | ||
|
||
1. SSH to the S32G board, as described above, then run the following **_on the S32G_** to install AWS IoT FleetWise Edge Agent as a service: | ||
|
||
```bash | ||
mkdir -p ~/aws-iot-fleetwise-deploy && cd ~/aws-iot-fleetwise-deploy \ | ||
&& unzip -o ~/aws-iot-fleetwise-deploy.zip \ | ||
&& sudo mkdir -p /etc/aws-iot-fleetwise \ | ||
&& sudo cp config/* /etc/aws-iot-fleetwise \ | ||
&& sudo ./tools/install-fwe.sh | ||
``` | ||
|
||
1. Run the following **_on the S32G_** to view and follow the AWS IoT FleetWise Edge Agent log (press CTRL+C to exit): | ||
|
||
```bash | ||
sudo journalctl -fu fwe@0 | ||
``` | ||
|
||
## Collect OBD Data | ||
|
||
1. Run the following _on the development machine_ to deploy a ‘heartbeat’ campaign that periodically collects OBD data: | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge/tools/cloud \ | ||
&& ./demo.sh --vehicle-name fwdemo-s32g --campaign-file campaign-obd-heartbeat.json | ||
``` | ||
|
||
**Note:** | ||
If you unable to collect OBD data from a real vehicle, it is possible that the vehicle uses extended CAN identifiers for diagnostic communication. In this case, SSH to the S32G board and edit the file `/etc/aws-iot-fleetwise/config-0.json`, changing the key `useExtendedIds` to `true.` Restart AWS IoT FleetWise Edge Agent by running | ||
`sudo systemctl restart fwe@0` and try running the demo script again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# Getting started with AWS IoT FleetWise Edge Agent on Renesas R-Car S4 | ||
|
||
This section describes how to deploy AWS IoT FleetWise Edge Agent onto an Renesas [R-Car S4 Reference Board/Spider](https://www.renesas.com/jp/en/products/automotive-products/automotive-system-chips-socs/rtp8a779f0askb0sp2s-r-car-s4-reference-boardspider). | ||
|
||
## Prerequisites | ||
|
||
- **Renesas Electronics Corporation R-Car S4 Reference Board/Spider** | ||
- Spider board has eMMC and micro SD-card slot but the can't use simalutaneously. | ||
- For using sdcard, please execute following two steps. The detail files can find in [R-Car S4 SDK Start Up Guide PKG](https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/r-car-s4-automotive-system-chip-soc-car-servercommunication-gateway#design_development). | ||
1. Please flash IPL which support booting from sdcard. | ||
- It requires to build IPL with CA_LOAD_TYPE=1 option. | ||
- For more details about building IPL, please refer to section 6.2.3 "How to build" in "RENESAS_ICUMX_IPL_for_R-Car_Gen4_Users_Manual_E.pdf" | ||
1. Please change SW3 and SW6 on the CPU board. | ||
- For more details, please refer to section 3.7.8.1 "Enable SD Card" in "R-Car S4_StartupGuide_x_x_x.pdf" | ||
- **AWS IoT FleetWise Edge Agent Compiled for ARM64** | ||
— If you are using an EC2 Graviton instance as your development machine, you will have completed this already above. | ||
|
||
- _If you are using a local Intel x86_64 development machine running ubuntu 20.04_, you will need to run the following to cross-compile AWS IoT FleetWise Edge Agent: | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge | ||
CODENAME=$(grep UBUNTU_CODENAME /etc/os-release | cut -d'=' -f2 ) | ||
# update the ubuntu version to your host | ||
sed -i "s/bionic/${CODENAME}/g" ./tools/arm64.list | ||
sudo -H ./tools/install-deps-cross.sh \ | ||
&& rm -rf build \ | ||
&& ./tools/build-fwe-cross.sh | ||
``` | ||
|
||
- **Internet Router with Ethernet** — The R-Car S4 Spider board must be connected to an internet router via an Ethernet cable for internet connectivity. It is beyond the scope of this document to describe how this is achieved, but one possibility is to use a WiFi to Ethernet bridge and a smartphone acting as an internet hotspot. | ||
|
||
## Build an SD-Card Image | ||
|
||
The following instructions use the development machine(Ubuntu 20.04) to build an SD-card image based on the Ubuntu variant of the Renesas Linux BSP version 5.10.41. | ||
|
||
1. Run the following _on the development machine_ to install the dependencies: | ||
|
||
```bash | ||
sudo apt install qemu-user-static flex bison build-essential crossbuild-essential-arm64 libssl-dev | ||
``` | ||
|
||
1. Run the following to build SD-card image: | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge \ | ||
&& sudo ./tools/renesas-rcar-s4/make-rootfs.sh 20.04.5 spider -sd | ||
``` | ||
|
||
## Flash the SD-Card Image | ||
|
||
1. Run the following to write the image to micro SD-card: | ||
|
||
```bash | ||
sudo dd if=./Ubuntu-20.04.5-rootfs-image-rcar-spider-sdcard.ext4 of=/dev/sdc bs=1M status=progress | ||
``` | ||
|
||
## Specify Initial Board Configuration | ||
|
||
1. Insert the micro SD-card into the R-Car S4 Spider board’s micro SD-card slot. | ||
1. Connect an Ethernet cable. | ||
1. Connect develop machine to R-Car S4 Spider board USB port. | ||
|
||
- USB port is depending on board revision(until B0-1st or since B0-2nd). | ||
- For more detail, please refer to the section 2.1 "Linux BSP" in "R-Car S4_StartupGuide_x_x_x.pdf". | ||
|
||
![](./images/rcar-s4-spider.jpg) | ||
|
||
1. Use screen command on your develop machine terminal to veiw serial output.(Modify the device path `/dev/xxxxx` to the correct path) | ||
|
||
``` | ||
screen /dev/xxxxx 1843200 | ||
``` | ||
1. Power on S4 Spider board. You can see the count down during U-Boot. Hit enter key to stop U-Boot. | ||
1. Enter following settings to flash the micro SD-card data to board | ||
```bash | ||
setenv _booti 'booti 0x48080000 - 0x48000000' | ||
setenv sd1 'setenv bootargs rw root=/dev/mmcblk0p1 rootwait ip=dhcp maxcpus=1' | ||
setenv sd2 ext4load mmc 0:1 0x48080000 /boot/Image | ||
setenv sd3 ext4load mmc 0:1 0x48000000 /boot/r8a779f0-spider.dtb | ||
setenv sd 'run sd1; run sd2; run sd3; run _booti' | ||
setenv bootcmd 'run sd' | ||
saveenv | ||
boot | ||
``` | ||
|
||
1. Connect to the R-Car S4 Spider board via SSH, entering password `rcar`: | ||
`ssh rcar@<R-Car Ip address>` | ||
1. Once connected via SSH, check the board’s internet connection by running: `ping amazon.com`. There should be 0% packet loss. | ||
|
||
## Provision AWS IoT Credentials | ||
|
||
Run the following commands _on the development machine_ (after compiling AWS IoT FleetWise Edge Agent for ARM64 as explained above), to create an IoT Thing and provision credentials for it. The AWS IoT FleetWise Edge Agent binary and its configuration files will be packaged into a ZIP file ready to be deployed to the board. | ||
|
||
```bash | ||
mkdir -p ~/aws-iot-fleetwise-deploy && cd ~/aws-iot-fleetwise-deploy \ | ||
&& cp -r ~/aws-iot-fleetwise-edge/tools . \ | ||
&& mkdir -p build/src/executionmanagement \ | ||
&& cp ~/aws-iot-fleetwise-edge/build/src/executionmanagement/aws-iot-fleetwise-edge \ | ||
build/src/executionmanagement/ \ | ||
&& mkdir -p config && cd config \ | ||
&& ../tools/provision.sh \ | ||
--vehicle-name fwdemo-rcars4 \ | ||
--certificate-pem-outfile certificate.pem \ | ||
--private-key-outfile private-key.key \ | ||
--endpoint-url-outfile endpoint.txt \ | ||
--vehicle-name-outfile vehicle-name.txt \ | ||
&& ../tools/configure-fwe.sh \ | ||
--input-config-file ~/aws-iot-fleetwise-edge/configuration/static-config.json \ | ||
--output-config-file config-0.json \ | ||
--vehicle-name `cat vehicle-name.txt` \ | ||
--endpoint-url `cat endpoint.txt` \ | ||
--can-bus0 vcan0 \ | ||
&& cd .. && zip -r aws-iot-fleetwise-deploy.zip . | ||
``` | ||
|
||
## Deploy AWS IoT FleetWise Edge Agent software on R-Car S4 Spider board | ||
|
||
1. Run the following _on your local machine_ to copy the deployment ZIP file from the EC2 machine to your local machine: | ||
|
||
```bash | ||
scp -i <PATH_TO_PEM> ubuntu@<EC2_IP_ADDRESS>:aws-iot-fleetwise-deploy/aws-iot-fleetwise-deploy.zip . | ||
``` | ||
|
||
1. Run the following _on your local machine_ to copy the deployment ZIP file from your local machine to the R-Car S4 Spider board (replace `<R-Car Ip address>` with the IP address of the R-Car S4 Spider board): | ||
|
||
```bash | ||
scp aws-iot-fleetwise-deploy.zip rcar@<R-Car Ip address>: | ||
``` | ||
|
||
1. SSH to the R-Car S4 Spider board, as described above, then run the following **_on the R-Car S4 Spider board_** to install AWS IoT FleetWise Edge Agent as a service: | ||
|
||
```bash | ||
mkdir -p ~/aws-iot-fleetwise-deploy && cd ~/aws-iot-fleetwise-deploy \ | ||
&& unzip -o ~/aws-iot-fleetwise-deploy.zip \ | ||
&& sudo mkdir -p /etc/aws-iot-fleetwise \ | ||
&& sudo cp config/* /etc/aws-iot-fleetwise | ||
|
||
cp ./tools/install-socketcan.sh ./tools/setup-vcan.sh | ||
sed -i '17,68d' ./tools/setup-vcan.sh | ||
./tools/setup-vcan.sh | ||
sudo ./tools/install-fwe.sh | ||
sed -i 's/python3.7/python3/g' ./tools/cansim/run-cansim.sh | ||
sed -i 's/python3.7/python3/g' ./tools/install-cansim.sh | ||
sed -i -e 's/^After/# After/' -e 's/^Wants/#Wants/' ./tools/cansim/cansim@.service | ||
sudo -H ./tools/install-cansim.sh | ||
``` | ||
|
||
1. Run the following **_on the R-Car S4 Spider board_** to view and follow the AWS IoT FleetWise Edge Agent log (press CTRL+C to exit): | ||
|
||
```bash | ||
sudo journalctl -fu fwe@0 | ||
``` | ||
|
||
## Collect OBD Data | ||
|
||
1. Run the following _on the development machine_ to deploy a ‘heartbeat’ campaign that periodically collects OBD data: | ||
|
||
```bash | ||
cd ~/aws-iot-fleetwise-edge/tools/cloud | ||
sed -i 's/python3.7/python3/g' ./install-deps.sh | ||
sudo -H ./install-deps.sh | ||
sed -i 's/python3.7/python3/g' ./demo.sh | ||
./demo.sh --vehicle-name fwdemo-rcars4 --campaign-file campaign-obd-heartbeat.json | ||
``` |
Oops, something went wrong.