boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst
.. zephyr:board:: stm32mp157c_dk2
Overview
The STM32MP157-DK2 Discovery board leverages the capacities of the STM32MP157 multi-core processor,composed of a dual Cortex®-A7 and a single Cortex®-M4 core. Zephyr OS is ported to run on the Cortex®-M4 core.
Common features:
STM32MP157:
ST PMIC STPMIC1A
4-Gbit DDR3L, 16 bits, 533 MHz
1-Gbps Ethernet (RGMII) compliant with IEEE-802.3ab
USB OTG HS
Audio CODEC, with a stereo headset jack, including analog microphone input
4 user LEDs
2 user and reset push-buttons, 1 wake-up button
5 V / 3 A USB Type-CTM power supply input (not provided)
Board connectors:
Board-specific features:
More information about the board can be found at the
STM32P157C Discovery website_.
Hardware
The STM32MP157 SoC provides the following hardware capabilities:
Core:
32-bit dual-core Arm® Cortex®-A7
32-bit Arm® Cortex®-M4 with FPU/MPU
Memories:
Security/safety:
Clock management:
General-purpose input/outputs:
Interconnect matrix
3 DMA controllers
Communication peripherals:
Graphics:
Timers:
Hardware acceleration:
Debug mode:
More information about STM32P157C can be found here:
STM32MP157C on www.st.com_STM32MP157C reference manual_.. zephyr:board-supported-hw::
STM32MP157C-DK2 Discovery Board schematic is available here:
STM32MP157C Discovery board schematics_.
The Cortex®-M4 Core is configured to run at a 209 MHz clock speed. This value must match the configured mlhclk_ck frequency.
The STM32MP157C-DK2 Discovery board has 8 U(S)ARTs. The Zephyr console output is assigned by default to the RAM console to be dumped by the Linux Remoteproc Framework on Cortex®-A7 core. In order to keep the UART7 free for future serial interactions with Arduino shield, the Zephyr UART console output is USART3 and is disabled by default. UART console can be enable through board's devicetree and stm32mp157c_dk2_defconfig board file (or prj.conf project files), and will disable existing RAM console output. Default UART console settings are 115200 8N1.
Programming and Debugging
.. zephyr:board-supported-runners::
The STM32MP157C doesn't have QSPI flash for the Cortex®-M4 and it needs to be started by the Cortex®-A7 core. The Cortex®-A7 core is responsible to load the Cortex®-M4 binary application into the RAM, and get the Cortex®-M4 out of reset. The Cortex®-A7 can perform these steps at bootloader level or after the Linux system has booted.
The Cortex®-M4 can use up to 2 different RAMs. The program pointer starts at address 0x00000000 (RETRAM), the vector table should be loaded at this address These are the memory mappings for Cortex®-A7 and Cortex®-M4:
+------------+-----------------------+------------------------+----------------+ | Region | Cortex®-A7 | Cortex®-M4 | Size | +============+=======================+========================+================+ | RETRAM | 0x38000000-0x3800FFFF | 0x00000000-0x0000FFFF | 64KB | +------------+-----------------------+------------------------+----------------+ | MCUSRAM | 0x10000000-0x1005FFFF | 0x10000000-0x1005FFFF | 384KB | +------------+-----------------------+------------------------+----------------+ | DDR | 0xC0000000-0xFFFFFFFF | | up to 1 GB | +------------+-----------------------+------------------------+----------------+
Refer to stm32mp157c boot Cortex-M4 firmware_ wiki page for instruction
to load and start the Cortex-M4 firmware.
You can debug an application using OpenOCD and GDB. The Solution proposed below is based on the attach to a preloaded firmware, available only for a Linux environment. The firmware must first be loaded by the Cortex®-A7. Developer then attaches the debugger to the running Zephyr using OpenOCD.
Principle is to attach to the firmware already loaded by the Linux.
.. code-block:: console
west build -b stm32mp157c_dk2 samples/hello_world
stm32mp157c boot Cortex-M4 firmware_)... code-block:: console
west attach
.. _STM32P157C Discovery website: https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32mp157c-dk2.html
.. _STM32MP157C Discovery board User Manual: https://www.st.com/resource/en/user_manual/dm00591354.pdf
.. _STM32MP157C Discovery board schematics: https://www.st.com/resource/en/schematic_pack/mb1272-dk2-c01_schematic.pdf
.. _STM32MP157C on www.st.com: https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-arm-cortex-mpus/stm32mp1-series/stm32mp157/stm32mp157c.html
.. _STM32MP157C reference manual: https://www.st.com/resource/en/reference_manual/DM00327659.pdf
.. _stm32mp1 developer package: https://wiki.st.com/stm32mpu/index.php/STM32MP1_Developer_Package#Installing_the_SDK
.. _stm32mp157c boot Cortex-M4 firmware: https://wiki.st.com/stm32mpu/index.php/Linux_remoteproc_framework_overview#How_to_use_the_framework