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

Merged
merged 12 commits into from
Jul 25, 2025
Merged

Conversation

KozhinovAlexander
Copy link
Contributor

@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:

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source $script_dir/../.zephyr_venv/bin/activate

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

# 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"
)

# This array shall have same size as app_list
sleep_time_sec_list=(
	1
	20
	60
)

# Iterate over apps:
for i in "${!app_list[@]}"; do
	echo "--> running test: ${app_list[$i]}"
	west twister -T "${app_list[$i]}" --vendor st
done
# exit $?;

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"
		safe_board_name="${board//\//_}"
		build_dir="$app_abs_path/build/$safe_board_name"
		echo "--> use build directory: $build_dir"

		rm -rf $build_dir
		west twister -p $board -T $app_abs_path --vendor st \
			--device-testing --device-serial-baud 115200 --device-serial "/dev/ttyACM0" -v
		# west build -p auto -d $build_dir -b $board $app_abs_path
		[ $? -ne 0 ] && exit $?;

		# west flash -d $build_dir
		# [ $? -ne 0 ] && exit $?;
		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

NOTE: For the nucleo_g071rb/stm32g071xx board only tests/drivers/rtc/rtc_api in the above script will work. The other tests are missing necessary .overlay files.

Running twister for EXTI STM32 test case:

west twister -T "tests/drivers/interrupt_controller/intc_exti_stm32" --vendor st

@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
Contributor 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
Contributor 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 and others added 8 commits July 24, 2025 12:52
…nding

integrate intc_exti_stm32 to intc_gpio_stm32

Co-authored-by: Mathieu CHOPLAIN <mathieu.choplain@st.com>
Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
integrate EXTI driver

Co-authored-by: Mathieu CHOPLAIN <mathieu.choplain@st.com>
Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
add nucleo_h745zi_q_stm32h745xx_m7 overlay and config
add nucleo_h745zi_q_stm32h745xx_m4 overlay and config

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
add nucleo_h745zi_q_stm32h745xx_m7 overlay
add stm32mp257f_ev1_stm32mp257fxx_m33 overlay

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
add exti driver tests for stm32 platform

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
update exti num-lines to depict total number of lines
add clocks entry to exti nodes of certain series

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
add APB0 bus

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
add APB3_S bus

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
@KozhinovAlexander
Copy link
Contributor Author

Following changes were done:

  1. Rebase on top of newest main
  2. Apply meaningful change-requests from @JarmouniA, thnx for it
  3. Rework release note drivers section - @erwango it is mostly due to your change request - thus please take a look.

@mathieuchopstm I think, if @erwango agrees with release notes change - you can start HW-farm run again and hopefully last time 😄

@KozhinovAlexander
Copy link
Contributor Author

UPD: Fix spell-check

@mathieuchopstm
Copy link
Contributor

OK for test bench with 63afc88

@erwango
Copy link
Member

erwango commented Jul 24, 2025

Approved as long as the latest PR are squashed ;-)

@KozhinovAlexander
Copy link
Contributor Author

KozhinovAlexander commented Jul 24, 2025

Approved as long as the latest PR are squashed ;-)

@erwango squashed

@mathieuchopstm Your approve is also mandatory - please take action.

Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

Please remove me as co-author from the last commit.

add release note for STM32 EXTI driver

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
@KozhinovAlexander
Copy link
Contributor Author

Please remove me as co-author from the last commit.

removed

Copy link

Copy link
Contributor

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

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

OK on test bench

@cfriedt cfriedt merged commit 42babf7 into zephyrproject-rtos:main Jul 25, 2025
26 checks passed
@KozhinovAlexander KozhinovAlexander deleted the exti_stm32 branch July 25, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Software interrupts support for STM32 EXTI
10 participants