Why and how to get started with multicore microcontrollers for IoT devices at the Edge
Figure 6: The STM32Cube_FW_H7 provides several examples that demonstrate how to configure an operating system with multicore processors. Image source: Beningo Embedded Group board and then follow these ‘tips and tricks’ will find that they save quite a bit of time and grief
How to start that first multicore application
For developers of IoT systems at the network Edge, multicore microcontrollers provide the ability to better match and balance functionality, performance, and power consumption.
No matter which of the two STM32H7 development boards is selected, there are two main tools that are needed to get started. The first is STMicroelectronics’ STM32CubeIDE , a free integrated development environment (IDE) that lets developers compile their application code and deploy it to the development board. STM32CubeIDE also provides the resources necessary to step through and debug an application, and is available for major operating systems including Windows, Linux and MacOS. The second tool is STMicroelectronics’ STM32H7 firmware package. This includes examples for the STM32H7
how those capabilities can be leveraged by the application
Tips and tricks for working with multicore microcontrollers
■ Download the application examples for the STM32H7 processors and run the multicore application examples for the selected development board. The H747 includes two: one for FreeRTOS and one for OpenAMP ■ When debugging an application, don’t forget that there are now two cores running! Make sure to select the correct thread within the debug environment to examine its call history ■ Leverage internal hardware resources, such as a hardware semaphore, to synchronize application execution on the cores ■ Developers that start with a well-supported development
Getting started with multicore microcontrollers is not difficult, but it does require that developers start to think about their application’s design a bit differently. Here are a few ‘tips and tricks’ for getting started with multicore microcontrollers: ■ Carefully evaluate the application to determine which application domain separation makes the most sense. It is possible to mix domains on a single processor, but performance can be affected if not done carefully ■ Take the time to explore the capabilities that are built into the OpenAMP framework and
when working with multicore microcontrollers for the first time.
Specifically, there are two folders that developers will want to pay attention to. The first is the applications folder which has two examples that show how to use OpenAMP (Figure 5). These examples show how to transmit data back and forth between the microcontroller cores where one core sends data to the other core, which then retransmits it back to the first core. Both examples perform this in a different way. One is baremetal, without an operating system, while the other is with FreeRTOS. The second set of examples demonstrates how to configure both cores with and without an RTOS (Figure 6). One example shows how to run FreeRTOS on each core, while the other shows how to use an RTOS on one core and run the second core baremetal. There are several other examples
throughout the firmware package that demonstrate other capabilities, but these are good choices to get started. Loading an example project will result in a developer seeing a project layout similar to that shown in Figure 7. As illustrated, the project is broken up into application code for each core. The build configuration can also be setup such that a developer is working with only one core at a time. This can be seen in Figure 7, through the grayed-out files. A full description of the example code is beyond the scope of this article, but the reader can examine the readme.txt file that is associated with any of the examples to get a detailed description of how it works, and then examine the source code to see how the inter-processor communication (IPC) is actually performed.
Conclusion For developers of IoT systems at the network Edge, multicore microcontrollers provide the ability to better match and balance functionality, performance, and power consumption per the application’s requirements. Such microcontrollers allow a developer to partition their application into domains such as feature rich/ real-time or real-time/secure processing. This ability to separate an application into different domains allows a developer to disable a core to conserve energy when the processing domain is no longer needed or turn it on in order to enhance application performance. As shown, there are several different development boards that can be used to start exploring multicore microcontroller application design and take full control over its performance and energy profile.
development boards for: ■ Multicore processing ■ Using FreeRTOS ■ Peripheral drivers ■ FatFS (file system)
Developers will want to download the firmware application package and become familiar with the examples that are supported by the chosen development board.
Figure 7: An example OpenAMP Ping-Pong project demonstrates to developers how to create a communication channel between the two CPU cores. Image source: Beningo Embedded Group
Figure 5: The STM32Cube_FW_H7 provides several examples that demonstrate how to get started with multicore processing using OpenAMP. Image source: Beningo Embedded Group
we get technical
16
17
Powered by FlippingBook