Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
devicetree_regions.h File Reference
#include <zephyr/devicetree.h>
#include <zephyr/sys/util.h>
#include <zephyr/toolchain.h>

Go to the source code of this file.

Macros

#define LINKER_DT_NODE_REGION_NAME_TOKEN(node_id)
 Get the linker memory-region name in a token form.
 
#define LINKER_DT_NODE_REGION_NAME(node_id)
 Get the linker memory-region name.
 
#define LINKER_DT_NODE_REGION_FLAGS(node_id)
 Get the linker memory-region flags with parentheses.
 
#define LINKER_DT_REGIONS()
 Generate linker memory regions from the device tree nodes with compatible 'zephyr,memory-region'.
 
#define LINKER_DT_SECTIONS()
 Generate linker memory sections from the device tree nodes with compatible 'zephyr,memory-region'.
 

Macro Definition Documentation

◆ LINKER_DT_NODE_REGION_FLAGS

#define LINKER_DT_NODE_REGION_FLAGS ( node_id)
Value:
COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_region_flags), \
(COND_CODE_1(_LINKER_IS_EMPTY_TOKEN(_DT_MEMORY_REGION_FLAGS_TOKEN(node_id)), \
(), \
(_LINKER_ENCLOSE_PAREN( \
_DT_MEMORY_REGION_FLAGS_UNQUOTED(node_id)) \
))), \
(_LINKER_ENCLOSE_PAREN(rw)))
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3744
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:195

Get the linker memory-region flags with parentheses.

This attempts to return the zephyr,memory-region-flags property with parentheses. Return empty string if not set the property.

Example devicetree fragment:

/ {
soc {
rx: memory@2000000 {
zephyr,memory-region = "READ_EXEC";
zephyr,memory-region-flags = "rx";
};
rx_not_w: memory@2001000 {
zephyr,memory-region = "READ_EXEC_NOT_WRITE";
zephyr,memory-region-flags = "rx!w";
};
no_flags: memory@2001000 {
zephyr,memory-region = "NO_FLAGS";
};
};
};

Example usage:

LINKER_DT_NODE_REGION_FLAGS(DT_NODELABEL(no_flags)) // [flags will not be specified]
#define LINKER_DT_NODE_REGION_FLAGS(node_id)
Get the linker memory-region flags with parentheses.
Definition devicetree_regions.h:136
#define DT_NODELABEL(label)
Get a node identifier for a node label.
Definition devicetree.h:196
Parameters
node_idnode identifier
Returns
the value of the memory region flag specified in the device tree enclosed in parentheses.

◆ LINKER_DT_NODE_REGION_NAME

#define LINKER_DT_NODE_REGION_NAME ( node_id)
Value:
#define LINKER_DT_NODE_REGION_NAME_TOKEN(node_id)
Get the linker memory-region name in a token form.
Definition devicetree_regions.h:48
#define STRINGIFY(s)
Definition common.h:134

Get the linker memory-region name.

This attempts to use the zephyr,memory-region property (with non-alphanumeric characters replaced with underscores).

Example devicetree fragment:

/ {
soc {
sram1: memory@2000000 {
zephyr,memory-region = "MY_NAME";
};
sram2: memory@2001000 {
zephyr,memory-region = "MY@OTHER@NAME";
};
};
};

Example usage:

LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram2)) // "MY_OTHER_NAME"
#define LINKER_DT_NODE_REGION_NAME(node_id)
Get the linker memory-region name.
Definition devicetree_regions.h:82
Parameters
node_idnode identifier
Returns
the name of the memory memory region the node will generate

◆ LINKER_DT_NODE_REGION_NAME_TOKEN

#define LINKER_DT_NODE_REGION_NAME_TOKEN ( node_id)
Value:
DT_STRING_TOKEN(node_id, zephyr_memory_region)
#define DT_STRING_TOKEN(node_id, prop)
Get a string property's value as a token.
Definition devicetree.h:1106

Get the linker memory-region name in a token form.

This attempts to use the zephyr,memory-region property (with non-alphanumeric characters replaced with underscores) returning a token.

Example devicetree fragment:

/ {
soc {
sram1: memory@2000000 {
zephyr,memory-region = "MY_NAME";
};
sram2: memory@2001000 {
zephyr,memory-region = "MY@OTHER@NAME";
};
};
};

Example usage:

Parameters
node_idnode identifier
Returns
the name of the memory memory region the node will generate

◆ LINKER_DT_REGIONS

#define LINKER_DT_REGIONS ( )
Value:
DT_FOREACH_STATUS_OKAY(_DT_COMPATIBLE, _REGION_DECLARE)
#define DT_FOREACH_STATUS_OKAY(compat, fn)
Invokes fn for each status okay node of a compatible.
Definition devicetree.h:3426

Generate linker memory regions from the device tree nodes with compatible 'zephyr,memory-region'.

Note: for now we do not deal with MEMORY attributes since those are optional, not actually used by Zephyr and they will likely conflict with the MPU configuration.

◆ LINKER_DT_SECTIONS

#define LINKER_DT_SECTIONS ( )
Value:
DT_FOREACH_STATUS_OKAY(_DT_COMPATIBLE, _SECTION_DECLARE)

Generate linker memory sections from the device tree nodes with compatible 'zephyr,memory-region'.