Skip to content

Commit ffdda37

Browse files
author
Alain Volmat
committed
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 e96e9ba commit ffdda37

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>
@@ -555,19 +556,8 @@ static DEVICE_API(display, stm32_ltdc_display_api) = {
555556
};
556557

557558
#if DT_INST_NODE_HAS_PROP(0, ext_sdram)
558-
559-
#if DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram1))
560-
#define FRAME_BUFFER_SECTION __stm32_sdram1_section
561-
#elif DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram2))
562-
#define FRAME_BUFFER_SECTION __stm32_sdram2_section
563-
#elif DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(psram))
564-
#define FRAME_BUFFER_SECTION __stm32_psram_section
565-
#else
566-
#error "LTDC ext-sdram property in device tree does not reference SDRAM1 or SDRAM2 node or PSRAM "\
567-
"node"
568-
#define FRAME_BUFFER_SECTION
569-
#endif /* DT_SAME_NODE(DT_INST_PHANDLE(0, ext_sdram), DT_NODELABEL(sdram1)) */
570-
559+
#define FRAME_BUFFER_SECTION \
560+
Z_GENERIC_SECTION(LINKER_DT_NODE_REGION_NAME(DT_INST_PHANDLE(0, ext_sdram)))
571561
#else
572562
#define FRAME_BUFFER_SECTION
573563
#endif /* DT_INST_NODE_HAS_PROP(0, ext_sdram) */

0 commit comments

Comments
 (0)