Allowing IoT devices to keep data in sync even when not connected to the Internet.
Everyday there are new devices appearing in homes, offices, hospitals, factories and thousands of other places that are part of the Internet-of-Things (IoT). Clearly, 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.
There are many data centers 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 generate 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 sync 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 devices are getting more popularity among IoT devices as an edge processing unit. Their high performance and low power, along with their reconfigurability, creates an ideal set up 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 space, 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 and 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 TySOM board and AWS IoT Greengrass.
In this blog, I shall run through the process of enabling TySOM boards for AWS IoT Greengrass.
The main concepts to be covered are:
For the purpose of this blog we chose our TySOM-3-ZU7EV board. By the way, Aldec provides a complete reference design which includes ready-to-use HW and SW to enable all the peripherals on the board. There is also BSP files which include devicetree, 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 which uses Yocto to allows for embedded linux development. To recompile the kernel, we can use either the HDF file generated by SDK or by using the BSP file provided for the board 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 2.
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
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 Zynq 7000, 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. In order to use it, the SD card requires boot and root partitions. The new uImage file, pre-built devicetree provided by Aldec (if it hasn’t been updated in case of using additional hardware), BOOT.bin and uEnv.txt files. If the deisgn hasn’t been change, the prebuilt 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, devicetree and the main filesystem are located.
So, boot partition will include Boot.bin, Image, devicetree 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 on communicating with the board and accessing 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. This is because 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 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 HW and SW are pre-built and will be provided to TySOM IoT developers. For more information, visit Aldec’s IoT solution page.
Leave a Reply