Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
linker-devnull.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/*
8
* DESCRIPTION
9
* Platform independent set of macros for creating a memory segment for
10
* aggregating data that shall be kept in the elf file but not in the binary.
11
*/
12
13
#ifndef ZEPHYR_INCLUDE_LINKER_LINKER_DEVNULL_H_
14
15
#if defined(CONFIG_LINKER_DEVNULL_MEMORY)
16
17
#if defined(CONFIG_XIP)
18
#if (!defined(ROM_ADDR) && !defined(ROM_BASE)) || !defined(ROM_SIZE)
19
#error "ROM_SIZE, ROM_ADDR or ROM_BASE not defined"
20
#endif
21
#endif
/* CONFIG_XIP */
22
23
#if (!defined(RAM_ADDR) && !defined(RAM_BASE)) || !defined(RAM_SIZE)
24
#error "RAM_SIZE, RAM_ADDR or RAM_BASE not defined"
25
#endif
26
27
#if defined(CONFIG_XIP) && !defined(ROM_ADDR)
28
#define ROM_ADDR ROM_BASE
29
#endif
30
31
#if !defined(RAM_ADDR)
32
#define RAM_ADDR RAM_BASE
33
#endif
34
35
#define ROM_END_ADDR (ROM_ADDR + ROM_SIZE)
36
#define DEVNULL_SIZE CONFIG_LINKER_DEVNULL_MEMORY_SIZE
37
#define ROM_DEVNULL_END_ADDR (ROM_END_ADDR + DEVNULL_SIZE)
38
#define MAX_ADDR UINT32_MAX
39
40
/* Determine where to put the devnull region. It should be adjacent to the ROM
41
* region. If ROM starts after RAM or the distance between ROM and RAM is big
42
* enough to fit the devnull region then devnull region is placed just after
43
* the ROM region. If it cannot be done then the devnull region is placed before
44
* the ROM region. It is possible that the devnull region cannot be placed
45
* adjacent to the ROM (e.g. ROM starts at 0 and RAM follows ROM). In that
46
* case compilation fails and the devnull region is not supported in that
47
* configuration.
48
*/
49
#if !defined(CONFIG_XIP)
50
51
#if RAM_ADDR >= DEVNULL_SIZE
52
#define DEVNULL_ADDR (RAM_ADDR - DEVNULL_SIZE)
53
#else
54
#define DEVNULL_ADDR (RAM_ADDR + RAM_SIZE)
55
#endif
56
57
#else
/* CONFIG_XIP */
58
59
#if ((ROM_ADDR > RAM_ADDR) && ((MAX_ADDR - ROM_END_ADDR) >= DEVNULL_SIZE)) || \
60
((ROM_END_ADDR + DEVNULL_SIZE) <= RAM_ADDR)
61
#define DEVNULL_ADDR ROM_END_ADDR
62
#elif ROM_ADDR > DEVNULL_SIZE
63
#define DEVNULL_ADDR (ROM_ADDR - DEVNULL_SIZE)
64
#else
65
#error "Cannot place devnull segment adjacent to ROM region."
66
#endif
67
68
#endif
/* CONFIG_XIP */
69
70
#define DEVNULL_REGION DEVNULL_ROM
71
72
#endif
/* CONFIG_LINKER_DEVNULL_MEMORY */
73
74
#endif
/* ZEPHYR_INCLUDE_LINKER_LINKER_DEVNULL_H_ */
zephyr
linker
linker-devnull.h
Generated on Fri Jul 26 2024 14:01:57 for Zephyr API Documentation by
1.9.6