devicetree: LINKER_DT_NODE_REGION_NAME
added
Adds a macro to convert a devicetree node to the name of a linker memory region. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
9c98d4f2b7
commit
024ecdd672
1 changed files with 28 additions and 0 deletions
|
@ -7,6 +7,34 @@
|
|||
* Generate memory regions from devicetree nodes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the linker memory-region name
|
||||
*
|
||||
* This attempts to use the zephyr,memory-region property, falling back
|
||||
* to the node path if it doesn't exist.
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* / {
|
||||
* soc {
|
||||
* sram1: memory@2000000 {
|
||||
* zephyr,memory-region = "MY_NAME";
|
||||
* };
|
||||
* sram2: memory@2001000 { ... };
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram1)) // "MY_NAME"
|
||||
* LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram2)) // "/soc/memory@2001000"
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @return the name of the memory memory region the node will generate
|
||||
*/
|
||||
#define LINKER_DT_NODE_REGION_NAME(node_id) \
|
||||
DT_PROP_OR(node_id, zephyr_memory_region, DT_NODE_PATH(node_id))
|
||||
|
||||
/* Declare a memory region */
|
||||
#define _REGION_DECLARE(name, attr, node) name(attr) : \
|
||||
ORIGIN = DT_REG_ADDR(node), \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue