Skip to content

STM32 EXTI Rework #85508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

KozhinovAlexander
Copy link
Collaborator

@KozhinovAlexander KozhinovAlexander commented Feb 10, 2025

Rework STM32 Zephyr EXTI driver to be independent from GPIO and compatible with most of the STM32 SoC's.

Addresses the issue #85366

This change introduces updated EXTI interrupt controller supporting interrupt/event lines handling also from peripherals.

The simplest way to test this PR under Linux is to run tests by utilizing following script:

Create a script file:

touch <zephyr_root_path>/exti_build_test.sh 
chmod +x exti_build_test.sh  <zephyr_root_path>/exti_build_test.sh 

Copy following content to the script:

# Put your board under test to this list
board_list=(
	"nucleo_h745zi_q/stm32h745xx/m7"
)

# The apps are defined for this application
app_list=(
	"tests/drivers/interrupt_controller/intc_exti_stm32"
	"tests/drivers/gpio/gpio_basic_api"
	"tests/drivers/rtc/rtc_api"
)

sleep_time_sec_list=(
	1
	20
	60
)

script_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Iterate over boards:
for board in "${board_list[@]}"; do
	# Iterate over apps:
	for i in "${!app_list[@]}"; do
		app="${app_list[$i]}"
		app_abs_path="$script_path/$app"
		build_dir="$app_abs_path/build/$board"
		echo "--> use build directory: $build_dir"

		west build -p auto -d $build_dir -b $board $app_abs_path
		[ $? -ne 0 ] && exit 1;

		west flash -d $build_dir
		[ $? -ne 0 ] && exit 1;

		echo "--> wait ${sleep_time_sec_list[$i]} sec. for $board $app to finish..."
		sleep ${sleep_time_sec_list[$i]}
		done
done

exit 0;

NOTE: You may need to change the board name in board_list.

Run the script: <zephyr_root_path>/exti_build_test.sh

@KozhinovAlexander KozhinovAlexander force-pushed the exti_stm32 branch 8 times, most recently from 48d57d5 to 4540804 Compare February 16, 2025 23:42
@KozhinovAlexander KozhinovAlexander force-pushed the exti_stm32 branch 3 times, most recently from 41c6fe7 to 49f0acc Compare February 17, 2025 22:49
@KozhinovAlexander
Copy link
Collaborator Author

@erwango Do you have ability to run all the EXTI/GPIO twister tests for different stm32 SoC on HW for this PR?

@erwango
Copy link
Member

erwango commented Feb 18, 2025

First, a big thanks for addressing this point.

@erwango Do you have ability to run all the EXTI/GPIO twister tests for different stm32 SoC on HW for this PR?

Yes, but we're currently busy with v4.1, so this topic will be addressed in low prio.

Then, one observation regarding the whole change.
I know this is WIP, but I've seen similar things already which can end up with lot of work achieved but never integrated, resulting in lot of frustration in both sides.
So here is my advice:
Even in WIP, please split your changes in multiple commits to explain the changes you're doing.
This may not be possible for some parts, and there will be fixup commits, which is ok on a WIP branch.
But it will help readers to understand where you're going, the big directions, and early prevent misalignments that would prevent eventual merge.
Otherwise, if you're not abl to do so, then maybe this is a bit early to share your work

For instance: here is an example of good draft PR: https://github.com/zephyrproject-rtos/zephyr/pull/85135/commits
(You'll see it's quite clean, I don't ask so much, but at least reader can understand the direction and is able to comment)

@KozhinovAlexander
Copy link
Collaborator Author

KozhinovAlexander commented Feb 18, 2025

@erwango Thanks for the advice. I have a commit-split definitely on my to-do list. I didn't do so, cause I have somehow cyclic dependency:

  1. I need a CI with all the tests to proceed faster - thus I've created a WIP
  2. I myself was not sure how the end work will look like until I've approached to some good shape of this work. But to approach to good shape I needed tests from CI (see 1.) :)

I hope you see my point. Sure I will split commits - thanks for the reminder ;)

@KozhinovAlexander KozhinovAlexander force-pushed the exti_stm32 branch 16 times, most recently from aa5fc04 to 2e045aa Compare March 3, 2025 21:02
@KozhinovAlexander KozhinovAlexander force-pushed the exti_stm32 branch 4 times, most recently from c42bb71 to e6208a6 Compare April 23, 2025 21:26
KozhinovAlexander and others added 4 commits April 23, 2025 23:38
add nucleo_h745zi_q_stm32h745xx_m7 overlay

Signed-off-by: Alexander Kozhinov <[email protected]>
add nucleo_h745zi_q_stm32h745xx_m7 overlay

Signed-off-by: Alexander Kozhinov <[email protected]>
rename intc_exti_stm32.c to intc_gpio_stm32.c
add renamed file to CMakeLists.txt
define GPIO_INTC_STM32 KConfig entry

Signed-off-by: Alexander Kozhinov <[email protected]>
integrate EXTI driver

Co-authored-by: Mathieu CHOPLAIN <[email protected]>
Signed-off-by: Alexander Kozhinov <[email protected]>
KozhinovAlexander and others added 4 commits April 23, 2025 23:49
add peripheral lines support
add EXTI interface

Co-authored-by: Mathieu CHOPLAIN <[email protected]>
Signed-off-by: Alexander Kozhinov <[email protected]>
add exti driver tests for stm32 platform

Signed-off-by: Alexander Kozhinov <[email protected]>
integrate intc_exti_stm32 to intc_gpio_stm32

Co-authored-by: Mathieu CHOPLAIN <[email protected]>
Signed-off-by: Alexander Kozhinov <[email protected]>
set num-lines to total number of lines

Signed-off-by: Alexander Kozhinov <[email protected]>
@KozhinovAlexander
Copy link
Collaborator Author

@mathieuchopstm Thanks for the review - I've applied changes so far. Please take a look.

@KozhinovAlexander
Copy link
Collaborator Author

@henrikbrixandersen @bjarki-andreasen please ignore last review request - the git-hub app on the smartphone didn't worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants