Skip to content

Conversation

@youssefz24
Copy link
Contributor

@youssefz24 youssefz24 commented May 21, 2025

Add basic support of the Cortex-M33 core for the STM32MP2 series.
Provide support for the STM32MP257F-EV1 evaluation board.

It depends on the following PR from the STM32-HAL:zephyrproject-rtos/hal_stm32#282

This first step allows to run and debug the samples:

  • Hello_world
  • Blinky
  • Button

Signed-off-by: Youssef Zini [email protected]

@github-actions
Copy link

Hello @youssefz24, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @youssefz24 for this work!

Some initial comments, but looks globally fine!

@erwango erwango requested a review from arnopo May 22, 2025 09:22
@arnopo

This comment was marked as resolved.

@youssefz24 youssefz24 force-pushed the topic/stm32mp2_support branch from dc679f5 to 8a8a74f Compare May 23, 2025 16:58
@github-actions
Copy link

github-actions bot commented May 23, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_stm32 zephyrproject-rtos/hal_stm32@90f5642 zephyrproject-rtos/hal_stm32@468e5ad (main) zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_stm32 DNM (manifest) This PR should not be merged (controlled by action-manifest) labels May 23, 2025
@youssefz24 youssefz24 requested review from arnopo, erwango and nordicjm May 23, 2025 17:02
Copy link
Contributor

@arnopo arnopo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only review until commit 2ff8bc2

@erwango erwango assigned erwango and unassigned nordic-krch Jun 16, 2025
Update west.yml to add the STM32MP2x SoC support in the STM32 HAL.
This is done after the merge of the PRs:
zephyrproject-rtos/hal_stm32#282
zephyrproject-rtos/hal_stm32#286

Signed-off-by: Youssef Zini <[email protected]>
Add the initial device tree source include (dtsi) files for the
stm32mp25 series boards, covering non-secure configuration for zephyr on
the Cortex-M33 core.
These files provide the basic hardware description, including CPU
(Cortex-M33), memory, RCC clock controller and NVIC interrupt
controller.

Key features:
- Set flash and RAM addresses to DDR memory.
- Adjust RCC peripheral address for non-secure context.

Signed-off-by: Youssef Zini <[email protected]>
Add initial soc support for the stm32mp2x series, including
initial Kconfig entries and default configuration files.
This enables Zephyr to recognize and build for the stm32mp2x series,
taking the stm32mp257f_ev1 as a baseline.

Includes:
- Kconfig and defconfig files for SoC selection and defaults
- soc.h for hal headers
- CMakeLists.txt for build system integration
- soc.yml update to register the new SoC

System Clock is configured statically from DTS. So no initialization
hook or soc.c needed.

Signed-off-by: Youssef Zini <[email protected]>
Add a linker script for the stm32mp2x soc series. It includes the
standard arm cortex-m linker and adds standard zephyr relocation
sections.
Replace the rom_start section name with .isr_vectors in the linker
script. This is necessary for the zephyr firmware to be started by the
remote proc driver which expects the section containing the vector table
to be named .isr_vectors.

Signed-off-by: Youssef Zini <[email protected]>
Introduce initial board support for the STM32MP257F-EV1. This includes:
- Board metadata (board.yml, stm32mp257f_ev1.yaml)
- Base software configuration (Kconfig.stm32mp257f_ev1)
- CMake build integration (board.cmake)
- Default configuration (stm32mp257f_ev1_stm32mp257fxx_m33_defconfig)
- Minimal device tree (stm32mp257f_ev1_stm32mp257fxx_m33.dts)
- Initial documentation and image for the stm32mp257f_ev1 board.
- OpenOCD configuration files for debugging support.

This enables the STM32MP257F-EV1 board to build and debug a hello world
sample.

Note that other necessary openocd configuration files are added to the
zephyr sdk directory and can be found in the stm-openocd repository[1].
[1]:https://github.com/STMicroelectronics/device-stm-openocd/tree/main

Signed-off-by: Youssef Zini <[email protected]>
Replace the use of `DT_NODELABEL(exti)` which depends on the node label
with the defined EXTI_NODE macro using the instance with the
`st_stm32_exti` compatible.
Since both macros point to the same node, this change doesn't affect
the code logic, but makes it independent of the node label, in
preparation for the addition of the STM32MP2 exti nodes.

Signed-off-by: Youssef Zini <[email protected]>
Add the mp2 exti2 dts to the dtsi file.
Add mp2 exti hal and ll function calls with EXTI2 instance. We use the
EXTI2 instance because it contains the GPIO interrupts in the non-secure
context. (We are trying to build the blinky sample as a first milestone)

Signed-off-by: Youssef Zini <[email protected]>
Add support for STM32MP2 series in the hwinfo driver.
The STM32MP2 series uses the HAL functions since it doesn't have a
ll_utils.

Signed-off-by: Youssef Zini <[email protected]>
Introduce DeviceTree binding for the STM32MP2 RCC clock controller,
enabling support for STM32MP2-specific clock configuration in Zephyr.
Update Kconfig.stm32 to add a dependency on STM32MP2 configuration,
allowing the use of STM32 LL RCC features when targeting STM32MP2
devices.
Add header for STM32MP2 per peripheral clock definitions.

Signed-off-by: Youssef Zini <[email protected]>
Add the stm32mp2 clock driver to the clock_control subsystem. The driver
is a reduced version of the generic stm32 clock driver.

Signed-off-by: Youssef Zini <[email protected]>
Remove gpio clock management from the GPIO driver when running on the
cortex-m33 on the mp2 and gpio clocks are managed by the cortex-A, being
the resource manager, allowed by the Resource Isolation Framework (RIF).
Also add a specific binding for the mp2 gpio to make clock property
optional.

Signed-off-by: Youssef Zini <[email protected]>
Add GPIO A-K nodes to the device tree for STM32MP2 SoC.
Note that GPIOs are disabled by default in the STM32MP2 SoC.

Signed-off-by: Youssef Zini <[email protected]>
Add gpio support for STM32MP257F-EV1 board.
Add the orange (&led0) LED to the device tree and enable GPIOJ.
Add the user button USER2 to the device tree and enable GPIOG.
This step allows building and debugging the blinky and button sample
applications.

Signed-off-by: Youssef Zini <[email protected]>
@youssefz24 youssefz24 force-pushed the topic/stm32mp2_support branch from a6a71ea to 982382b Compare June 16, 2025 15:48
@youssefz24
Copy link
Contributor Author

Rebased (again) to stay up to date with the main branch :/

@sonarqubecloud
Copy link

@JarmouniA JarmouniA added this to the v4.2.0 milestone Jun 16, 2025
@kartben kartben merged commit 8bfb08f into zephyrproject-rtos:main Jun 17, 2025
32 checks passed
@github-actions
Copy link

Hi @youssefz24!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@youssefz24
Copy link
Contributor Author

Hello there,

Thank you all for the reviews and the merge. 🎩

Youssef Zini

@youssefz24 youssefz24 deleted the topic/stm32mp2_support branch June 17, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment