Skip to content

Commit 65ecc42

Browse files
Alain Volmatcfriedt
authored andcommitted
display: stm32_ltdc: use LINKER_DT_NODE_REGION_NAME for ext-sdram
Use the LINKER_DT_NODE_REGION_NAME macro in order to get the memory-region into which to put the framebuffer for the LTDC. This is made possible since all memory areas have the zephyr,memory-region compatible, allowing to have each region referenced within the linker script generated by Zephyr. Signed-off-by: Alain Volmat <[email protected]>
1 parent 76b6f6e commit 65ecc42

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/display/display_stm32_ltdc.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
1919
#include <zephyr/drivers/clock_control.h>
2020
#include <zephyr/drivers/reset.h>
21+
#include <zephyr/linker/devicetree_regions.h>
2122
#include <zephyr/pm/device.h>
2223
#include <zephyr/sys/barrier.h>
2324
#include <zephyr/cache.h>
@@ -529,19 +530,8 @@ static DEVICE_API(display, stm32_ltdc_display_api) = {
529530
};
530531

531532
#if DT_INST_NODE_HAS_PROP(0, ext_sdram)
532-
533-
#if DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram1))
534-
#define FRAME_BUFFER_SECTION __stm32_sdram1_section
535-
#elif DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram2))
536-
#define FRAME_BUFFER_SECTION __stm32_sdram2_section
537-
#elif DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(psram))
538-
#define FRAME_BUFFER_SECTION __stm32_psram_section
539-
#else
540-
#error "LTDC ext-sdram property in device tree does not reference SDRAM1 or SDRAM2 node or PSRAM "\
541-
"node"
542-
#define FRAME_BUFFER_SECTION
543-
#endif /* DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram1)) */
544-
533+
#define FRAME_BUFFER_SECTION \
534+
Z_GENERIC_SECTION(LINKER_DT_NODE_REGION_NAME(DT_INST_PHANDLE(0, ext_sdram)))
545535
#else
546536
#define FRAME_BUFFER_SECTION
547537
#endif /* DT_INST_NODE_HAS_PROP(0, ext_sdram) */

0 commit comments

Comments
 (0)