From 8bfb08fbda478fae9040b9ed6155784c365b1f61 Mon Sep 17 00:00:00 2001 From: Youssef Zini Date: Mon, 19 May 2025 17:18:46 +0200 Subject: [PATCH] boards: add gpio, button and led support 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 --- .../stm32mp257f_ev1_stm32mp257fxx_m33.dts | 34 +++++++++++++++++++ ...tm32mp257f_ev1_stm32mp257fxx_m33_defconfig | 3 ++ 2 files changed, 37 insertions(+) diff --git a/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33.dts b/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33.dts index 35225a95a92..61f83448a95 100644 --- a/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33.dts +++ b/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include +#include / { model = "STMicroelectronics STM32MP257F-EV1 board"; @@ -15,8 +17,40 @@ zephyr,flash = &ddr_code; zephyr,sram = &ddr_sys; }; + + leds { + compatible = "gpio-leds"; + + orange_led_3: led_3 { + gpios = <&gpioj 6 GPIO_ACTIVE_HIGH>; + label = "LD3"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + + button_user2: button2 { + label = "User 2"; + gpios = <&gpiog 8 GPIO_ACTIVE_LOW>; + zephyr,code = ; + }; + }; + + aliases { + led0 = &orange_led_3; + sw0 = &button_user2; + }; }; &rcc { clock-frequency = ; }; + +&gpiog { + status = "okay"; +}; + +&gpioj { + status = "okay"; +}; diff --git a/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33_defconfig b/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33_defconfig index 0fdf892fff3..ba770561fbe 100644 --- a/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33_defconfig +++ b/boards/st/stm32mp257f_ev1/stm32mp257f_ev1_stm32mp257fxx_m33_defconfig @@ -4,5 +4,8 @@ # Enable MPU CONFIG_ARM_MPU=y +# Enable GPIO +CONFIG_GPIO=y + # Enable HW stack protection CONFIG_HW_STACK_PROTECTION=y