Skip to contentSkip to conversation

Add 96Boards Avenger96 support

PATCH New Wojciech Zmuda 1 participant 4 messages Dec 14, 2020 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Add 96Boards Avenger96 support

From: Wojciech Zmuda <[email protected]>

This patch set adds support of Avenger96 boards based on STMicro STM32MP157AAC 2xCortex-A7+2xCortex-M4 SoC. The support consists of:
- cloning dependencies i.e. STM32 HAL and OpenAMP framework,
- adding STM32MP1 and Avenger96 $MACHINE config files.

Verification:

1. Build an example app for Avenger96:

   $ DISTRO=zephyr MACHINE=96b-avenger96 bitbake zephyr-philosophers

2. Please be aware that Avenger96's Cortex-M4 core can be programmed and got out of reset only by software running on the Cortex-A7 core, e.g. by U-Boot or Linux. Therefore, despite the SoC can enter DFU mode, it cannot be used for programming the M4 firmware. This example uses Linux.

3. Linux has to be built with remoteproc support. This can be verified with simple dmesg inspection:

   root@stm32mp1-av96:~# dmesg | grep remoteproc
   [    2.336231] remoteproc remoteproc0: m4 is available

4. Transfer the example app to the board, e.g. using scp.
The elf is located as usual in build/tmp-newlib/deploy/images/96b-avenger96/.

5. On the board, check the expected location of the fimrware image. Empty path defaults to /lib/firmware. You can leave them as they are and copy the Zephyr ELF file to the location pointed by them or you can echo the new path and image name.

   root@stm32mp1-av96:~# cat /sys/module/firmware_class/parameters/path
   <empty>
   root@stm32mp1-av96:~# cat /sys/class/remoteproc/remoteproc0/firmware
   rproc-m4-fw

6. After the image path and name are configured, start the M4 core:

   root@stm32mp1-av96:~# echo start > /sys/class/remoteproc/remoteproc0/state
   remoteproc remoteproc0: powering up m4
   remoteprocroc remoteproc0: Booting fw image rproc-m4-fw, size 591544
   rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:m4_led (ops 0xc0be1210)
   remoteproc remoteproc0: remote processor m4 is now

7. Firmware output can be inspected with:

   root@stm32mp1-av96:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
   Philosopher 5 [C:-2]        STARVING
   Philosopher 3 [P: 0]    DROPPED ONE FORK
   Philosopher 3 [P: 0]  THINKING [  25 ms ]
   Philosopher 2 [P: 1]   EATING  [  425 ms ]
   Philosopher 3 [P: 0]        STARVING
   Philosopher 4 [C:-1]        STARVING
   Philosopher 4 [C:-1]    HOLDING ONE FORK
   Philosopher 4 [C:-1]   EATING  [  800 ms ]
   Philosopher 3 [P: 0]    HOLDING ONE FORK
   Philosopher 2 [P: 1]    DROPPED ONE FORK
   Philosopher 2 [P: 1]  THINKING [  725 ms ]
   Philosopher 1 [P: 2]   EATING  [  225 ms ]

Wojciech Zmuda (3):
zephyr-kernel: clone STM32 HAL
zephyr-kernel: clone OpenAMP
conf: machine: add 96boards Avenger96 support

 classes/zephyr-kernel-src.bbclass                     |  6 ++++++
 conf/machine/96b-avenger96.conf                       |  8 ++++++++
 conf/machine/include/stm32mp1-cortex-m4.inc           | 11 +++++++++++
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc |  2 ++
 4 files changed, 27 insertions(+)
 create mode 100644 conf/machine/96b-avenger96.conf
 create mode 100644 conf/machine/include/stm32mp1-cortex-m4.inc
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 zephyr-kernel: clone STM32 HAL

From: Wojciech Zmuda <[email protected]>

HAL for STM32 chipsets is one of Zephyr subprojects. It is downloaded by default by west. Clone the HAL repository so it can be used for building images for boards with STM32 chips.

---
 classes/zephyr-kernel-src.bbclass                     | 2 ++
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 1 +
 2 files changed, 3 insertions(+)
classes/zephyr-kernel-src.bbclass +2 -0
index ea9b30b..4e05182 100644
@@ -6,10 +6,12 @@ SRCREV_FORMAT = "default_cmsis"
 SRCREV_default = "7a3b253ced7333f5c0269387a7f3ed1dee69739d"
 SRCREV_cmsis = "542b2296e6d515b265e25c6b7208e8fea3014f90"
 SRCREV_nordic = "d8a6ea9695ddf792bb18bb6035c13b1daac5d79c"
+SRCREV_stm32 = "f0e11398128ac9abdff713da5d3035e6c96e9b86"
 
 SRC_URI = "git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=v2.4-branch;name=default \
            git://github.com/zephyrproject-rtos/cmsis.git;protocol=https;destsuffix=git/modules/cmsis;name=cmsis \
            git://github.com/zephyrproject-rtos/hal_nordic.git;protocol=https;destsuffix=git/modules/hal/nordic;name=nordic \
+           git://github.com/zephyrproject-rtos/hal_stm32.git;protocol=https;destsuffix=git/modules/hal/stm32;name=stm32 \
            file://0001-cmake-add-yocto-toolchain.patch \
           "
 
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +1 -0
index a1f640d..c7c894e 100644
@@ -17,6 +17,7 @@ ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
 EXTRA_OECMAKE = " -DZEPHYR_BASE=${S} -DZEPHYR_GCC_VARIANT=yocto -DBOARD=${BOARD} -DARCH=${ARCH} -DCROSS_COMPILE=${CROSS_COMPILE} -DZEPHYR_SYSROOT=${ZEPHYR_SYSROOT} -DZEPHYR_TOOLCHAIN_VARIANT=yocto"
 EXTRA_OECMAKE_append_arm = " -DZEPHYR_MODULES=${S}/modules/cmsis"
 EXTRA_OECMAKE_append_nordic = "\;${S}/modules/hal/nordic"
+EXTRA_OECMAKE_append_stm32 = "\;${S}/modules/hal/stm32"
 export ZEPHYR_BASE="${S}"
 
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 zephyr-kernel: clone OpenAMP

In reply to Wojciech Zmuda

From: Wojciech Zmuda <[email protected]>

OpenAMP is a framework providing software components enabling development of software applications for AMP systems. It is downloaded by default by west from two Zephyr Project repositories based on original OpenAMP repositories:

- open-amp - IPC layer that implements rpmsg communication between cores,
- libmetal - HAL abstraction layer used by open-amp.

Clone the repositories so they can be used for building images for boards with multicore chips.

---
 classes/zephyr-kernel-src.bbclass                     | 4 ++++
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 1 +
 2 files changed, 5 insertions(+)
classes/zephyr-kernel-src.bbclass +4 -0
index 4e05182..b7fb81d 100644
@@ -7,11 +7,15 @@ SRCREV_default = "7a3b253ced7333f5c0269387a7f3ed1dee69739d"
 SRCREV_cmsis = "542b2296e6d515b265e25c6b7208e8fea3014f90"
 SRCREV_nordic = "d8a6ea9695ddf792bb18bb6035c13b1daac5d79c"
 SRCREV_stm32 = "f0e11398128ac9abdff713da5d3035e6c96e9b86"
+SRCREV_open-amp = "de1b85a13032a2de1d8b6695ae5f800b613e739d"
+SRCREV_libmetal = "9d4ee2c3cfd5f49861939447990f3b7d7bf9bf94"
 
 SRC_URI = "git://github.com/zephyrproject-rtos/zephyr.git;protocol=https;branch=v2.4-branch;name=default \
            git://github.com/zephyrproject-rtos/cmsis.git;protocol=https;destsuffix=git/modules/cmsis;name=cmsis \
            git://github.com/zephyrproject-rtos/hal_nordic.git;protocol=https;destsuffix=git/modules/hal/nordic;name=nordic \
            git://github.com/zephyrproject-rtos/hal_stm32.git;protocol=https;destsuffix=git/modules/hal/stm32;name=stm32 \
+           git://github.com/zephyrproject-rtos/open-amp.git;protocol=https;destsuffix=git/modules/lib/open-amp;name=open-amp \
+           git://github.com/zephyrproject-rtos/libmetal.git;protocol=https;destsuffix=git/modules/hal/libmetal;name=libmetal \
            file://0001-cmake-add-yocto-toolchain.patch \
           "
 
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +1 -0
index c7c894e..1357c8f 100644
@@ -18,6 +18,7 @@ EXTRA_OECMAKE = " -DZEPHYR_BASE=${S} -DZEPHYR_GCC_VARIANT=yocto -DBOARD=${BOARD}
 EXTRA_OECMAKE_append_arm = " -DZEPHYR_MODULES=${S}/modules/cmsis"
 EXTRA_OECMAKE_append_nordic = "\;${S}/modules/hal/nordic"
 EXTRA_OECMAKE_append_stm32 = "\;${S}/modules/hal/stm32"
+EXTRA_OECMAKE_append_openamp = "\;${S}/modules/lib/open-amp\;${S}/modules/hal/libmetal"
 export ZEPHYR_BASE="${S}"
 
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 conf: machine: add 96boards Avenger96 support

In reply to Wojciech Zmuda

From: Wojciech Zmuda <[email protected]>

The board is based on STMicro STM32MP157AAC 2xCortex-A7+2xCortex-M4 system-on-chip.

Add STM32MP1 family machine config. STM32MP1 support depends on STM32 HAL and OpenAMP for inter-core communication.

This change has been verified with zephyr-philosophers and zephyr-shell sample applications on by loading Zephyr image to Cortex-M4 core from Linux using remoteproc framework.

---
 conf/machine/96b-avenger96.conf             |  8 ++++++++
 conf/machine/include/stm32mp1-cortex-m4.inc | 11 +++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 conf/machine/96b-avenger96.conf
 create mode 100644 conf/machine/include/stm32mp1-cortex-m4.inc
conf/machine/96b-avenger96.conf new file +8 -0
new file mode 100644
index 0000000..7bcfb4a
@@ -0,0 +1,8 @@
+#@TYPE: Machine
+#@NAME: 96b_avenger96
+
+#@DESCRIPTION: Machine configuration for 96Boards Avenger96 Board.
+
+require conf/machine/include/stm32mp1-cortex-m4.inc
+
+ARCH_96b-avenger96 = "arm"
conf/machine/include/stm32mp1-cortex-m4.inc new file +11 -0
new file mode 100644
index 0000000..b82b02d
@@ -0,0 +1,11 @@
+#@TYPE: Machine
+#@NAME: stm32mp1-cortex-m4
+
+#@DESCRIPTION: Machine configuration for Cortex-M4 core of STMicroelectronics STM32MP1 SoC.
+
+require conf/machine/include/tune-cortexm4.inc
+
+# Include OpenAMP for communication with Cortex-A7 core of the SoC
+MACHINEOVERRIDES =. "stm32:openamp:"
+
+TUNE_FEATURES = "armv7m cortexm4"
Signature · 1 line
2.25.1