cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Partner: TySOM on AWS IoT Greengrass

xtech-blogs
Xilinx Employee
Xilinx Employee
0 0 798

Editor’s Note: This content is contributed by Farhad Fallahlalehzari, Application Engineer at Aldec

 

Every day there are new devices appearing in homes, offices, hospitals, factories, and thousands of other places that are part of the Internet-of-Things (IoT). They need to be connected to the Internet, and there is a need for a huge amount of raw data to be collected, stored, and processed on the cloud.

Many data centers are available to store the data. However, only some provide features specifically for IoT applications. One of the most complete cloud-based IoT services available is Amazon Web Services (AWS) IoT Greengrass. It enables edge devices to act locally on the data networked devices and provides secure bi-directional communication between the IoT devices and the AWS cloud for management, analytics, and storage.

By using AWS Greengrass IoT, devices can keep the data in synch even when not connected to the Internet. Also, they can run AWS Lambda functions and make predictions based on machine learning models provided by AWS.

FPGA-based system-on-chip (SoC) devices are getting more popularity among IoT devices as an edge processing unit. Their high performance and low power, along with their reconfigurability, create an ideal setup for IoT devices.

Among all SoCs, Xilinx Zynq® devices have become very popular thanks to the flexibility of providing hardened multicore Arm® processors along with FPGA logic, all integrated into a single chip. As an old and trusted partner of Xilinx, Aldec has produced a range of embedded development boards (our TySOM Product Line) featuring Zynq-7000 SoC and Zynq UltraScale+™ MPSoC devices along with a wide range of on-board peripherals. Recently, TySOM embedded development boards were qualified by AWS to run AWS IoT Greengrass core. Figure 1 shows the setup with a TySOM board and AWS IoT Greengrass.

In this blog, I shall run through the process of enabling TySOM boards for AWS IoT Greengrass.

TySOM Embedded Development BoardTySOM Embedded Development Board

 The main concepts to be covered are:

  • Building a new Linux kernel image for a TySOM board that meets the requirements for AWS IoT Greengrass.
  • Preparing a bootable SD card with a proper kernel image, bootloader, device tree, and Linux filesystem.
  • Running IoT Greengrass qualification tests, which include MQTT communication, dependency checking, and many more.

For the purpose of this blog, we chose our TySOM-3-ZU7EV board. By the way, Aldec provides a complete reference design that includes ready-to-use hardware and software to enable all the peripherals on the board. There are also BSP files, which include device tree, kernel image, bootloader, and the bitstream file.

AWS IoT Greengrass requires that the target device supports specific kernel features, which requires the kernel be recompiled. PetaLinux is a set of software tools that uses Yocto, which allows for embedded Linux development. To recompile the kernel, we can use either the HDF file generated by SDK or the BSP file provided by Aldec.

By typing the following command “petalinux-config -c kernel,” we get access to the environment where we need to add the new configuration. To find where each configuration is located, you can use “/” like Figure below.

Kernel Configuration - Search Configuration ParameterKernel Configuration - Search Configuration Parameter

 

Here are some of the kernel features and where they are located:

Kernel configs for namespace-

    CONFIG_IPC_NS

        General setup -> Namespaces support -> IPC namespace

    CONFIG_UTS_NS

        General setup -> Namespaces support -> UTS namespace

    CONFIG_USER_NS

        General setup -> Namespaces support -> User namespace

    CONFIG_PID_NS

        General setup -> Namespaces support -> PID namespace

Kernel configs for cgroups:

    CONFIG_CGROUP_DEVICE

        General setup -> Control Group support -> Device controller

    CONFIG_CGROUPS

        General setup -> Control Group support  

    CONFIG_MEMCG

        General setup -> Control Group support -> Memory controller

Other required kernel configs:

    CONFIG_POSIX_MQUEUE

        General setup -> POSIX Message Queues

    CONFIG_OVERLAY_FS

        Files systems -> Overlay filesystem support

    CONFIG_SECCOMP

        Kernel Features -> Enable seccomp to safely compute untrusted         bytecode

    CONFIG_KEYS

        Security options -> Enable access key retention support

    CONFIG_SHMEM

        General setup -> Use full shmem filesystem

Kernel Configuration - General SetupKernel Configuration - General Setup

Some additional packages, such as Python 2.7 and 3.7 plus Java, are also needed. They can be installed later as well.

After configuring the kernel, it’s time to build the project. If we are using a Zynq-7000 SoC, zImage will be provided by default. In TySOM, we use uImage, which can be generated by the following command “petalinux-package --image -c kernel --format uImage.”

It’s possible to run the Linux without any GUI. However, Aldec provides a Linaro embedded Linux distribution for TySOM users. To use it, the SD card requires boot and root partitions.

  • The new uImage file
  • pre-built device tree provided by Aldec (if it hasn’t been updated in case of using additional hardware)
  • BOOT.bin
  • uEnv.txt files

If the design hasn’t been changed, the pre-built BOOT.bin can be used. In case of any change, the following commands can be used:
petalinux-package --boot --force --fsbl --pmufw –fpga –atf –u-boot

BOOT.bin basically includes the bitstreem, fsbl, and uboot. The uEnv.txt file includes the information (addresses) for the boatloader to find out where the kernel, device tree, and the main filesystem are located.

So, boot partition will include Boot.bin, Image, device tree, and uEnv.txt. The root partition, as mentioned, needs the Linaro embedded Linux distribution files, which are provided by Aldec and ready-to-use for TySOM boards.

After preparing the boot SD card, we power on the board and connect it through UART to the host system. On windows, using a terminal like putty / tera term helps to communicate with the board and access the booting logs.

AWS IoT Greengrass requires the target board to enable SSH communication. A selected user for SSH communication should be added to the “sudoer” group; AWS IoT Greengrass needs to run some commands that require root access, and the selected user should have that permission. Lastly, the AWS IoT Greengrass core compatible with the current architecture needs to be installed on the device, and by using the AWS device tester, all the different functionality of AWS IoT Greengrass will be assessed.

TySOM boards can be used either as the main edge processing device or as a gateway to AWS cloud.

The AWS IoT Greengrass core extends cloud capabilities to a TySOM board. It enables the TySOM board to connect with devices in an IoT system, run Lambda functions, synch, and secure the communications among devices even if it’s not connected to the Internet / Cloud.

 

Aldec is here to help you with your IoT applications. All the required hardware and software are pre-built and will be provided to TySOM IoT developers. For more information, visit Aldec’s IoT solution page