linker: rename DT_REGION_FROM_NODE_STATUS_OKAY

The main motivation is to avoid polluting the all-caps "DT_"
namespace, which within zephyr belongs to devicetree.h.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-08-05 16:22:17 -07:00 committed by Christopher Friedt
commit d1eee6a966
2 changed files with 21 additions and 16 deletions

View file

@ -88,21 +88,21 @@ MEMORY
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
/* TI CCFG Registers */ /* TI CCFG Registers */
DT_REGION_FROM_NODE_STATUS_OKAY(FLASH_CCFG, rwx, DT_NODELABEL(ti_ccfg_partition)) LINKER_DT_REGION_FROM_NODE(FLASH_CCFG, rwx, DT_NODELABEL(ti_ccfg_partition))
/* Data & Instruction Tightly Coupled Memory */ /* Data & Instruction Tightly Coupled Memory */
DT_REGION_FROM_NODE_STATUS_OKAY(ITCM, rw, DT_CHOSEN(zephyr_itcm)) LINKER_DT_REGION_FROM_NODE(ITCM, rw, DT_CHOSEN(zephyr_itcm))
DT_REGION_FROM_NODE_STATUS_OKAY(DTCM, rw, DT_CHOSEN(zephyr_dtcm)) LINKER_DT_REGION_FROM_NODE(DTCM, rw, DT_CHOSEN(zephyr_dtcm))
/* STM32 Core Coupled Memory */ /* STM32 Core Coupled Memory */
DT_REGION_FROM_NODE_STATUS_OKAY(CCM, rw, DT_CHOSEN(zephyr_ccm)) LINKER_DT_REGION_FROM_NODE(CCM, rw, DT_CHOSEN(zephyr_ccm))
/* STM32WB IPC RAM */ /* STM32WB IPC RAM */
DT_REGION_FROM_NODE_STATUS_OKAY(SRAM1, rw, DT_NODELABEL(sram1)) LINKER_DT_REGION_FROM_NODE(SRAM1, rw, DT_NODELABEL(sram1))
DT_REGION_FROM_NODE_STATUS_OKAY(SRAM2, rw, DT_NODELABEL(sram2)) LINKER_DT_REGION_FROM_NODE(SRAM2, rw, DT_NODELABEL(sram2))
/* STM32 alternate RAM configurations */ /* STM32 alternate RAM configurations */
DT_REGION_FROM_NODE_STATUS_OKAY(SRAM3, rw, DT_NODELABEL(sram3)) LINKER_DT_REGION_FROM_NODE(SRAM3, rw, DT_NODELABEL(sram3))
DT_REGION_FROM_NODE_STATUS_OKAY(SRAM4, rw, DT_NODELABEL(sram4)) LINKER_DT_REGION_FROM_NODE(SRAM4, rw, DT_NODELABEL(sram4))
DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM1, rw, DT_NODELABEL(sdram1)) LINKER_DT_REGION_FROM_NODE(SDRAM1, rw, DT_NODELABEL(sdram1))
DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM2, rw, DT_NODELABEL(sdram2)) LINKER_DT_REGION_FROM_NODE(SDRAM2, rw, DT_NODELABEL(sdram2))
DT_REGION_FROM_NODE_STATUS_OKAY(BACKUP_SRAM, rw, DT_NODELABEL(backup_sram)) LINKER_DT_REGION_FROM_NODE(BACKUP_SRAM, rw, DT_NODELABEL(backup_sram))
/* Used by and documented in include/linker/intlist.ld */ /* Used by and documented in include/linker/intlist.ld */
IDT_LIST (wx) : ORIGIN = (RAM_ADDR + RAM_SIZE), LENGTH = 2K IDT_LIST (wx) : ORIGIN = (RAM_ADDR + RAM_SIZE), LENGTH = 2K
} }

View file

@ -15,12 +15,17 @@
/** /**
* @brief Generate a linker memory region from a devicetree node * @brief Generate a linker memory region from a devicetree node
* *
* If @p node_id refers to a node with status "okay", then this declares
* a linker memory region named @p name with attributes from @p attr.
*
* Otherwise, it doesn't expand to anything.
*
* @param name name of the generated memory region * @param name name of the generated memory region
* @param attr region attributes to use (rx, rw, ...) * @param attr region attributes to use (rx, rw, ...)
* @param node devicetree node with a \<reg\> property defining region location * @param node_id devicetree node identifier with a \<reg\> property
* and size. * defining region location and size.
*/ */
#define DT_REGION_FROM_NODE_STATUS_OKAY(name, attr, node) \ #define LINKER_DT_REGION_FROM_NODE(name, attr, node_id) \
COND_CODE_1(DT_NODE_HAS_STATUS(node, okay), \ COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \
(_REGION_DECLARE(name, attr, node)), \ (_REGION_DECLARE(name, attr, node_id)), \
()) ())