forked from wolfSSL/wolfBoot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtarget.h.in
More file actions
161 lines (142 loc) · 6.74 KB
/
target.h.in
File metadata and controls
161 lines (142 loc) · 6.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* target.h
*
* User configurable build-time options for bootloader and application offsets
*
* target.h is automatically generated using the template in target.h.in by running
* "make config".
*
* Copyright (C) 2025 wolfSSL Inc.
*
* This file is part of wolfBoot.
*
* wolfBoot is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef H_TARGETS_TARGET_
#define H_TARGETS_TARGET_
#ifndef WOLFBOOT_NO_PARTITIONS
# define WOLFBOOT_FIXED_PARTITIONS
#endif
#define WOLFBOOT_SECTOR_SIZE @WOLFBOOT_SECTOR_SIZE@
#ifdef WOLFBOOT_FIXED_PARTITIONS
#if defined(ARCH_SIM) && !defined(WOLFBOOT_PARTITION_FILENAME)
#include <stdint.h>
/* use runtime ram base for simulator */
extern uint8_t *sim_ram_base;
#undef ARCH_FLASH_OFFSET
#define ARCH_FLASH_OFFSET ((size_t)sim_ram_base)
#define WOLFBOOT_PART_USE_ARCH_OFFSET
#endif
#ifdef PULL_LINKER_DEFINES
#include <stdint.h>
/* linker script variables */
extern const uint32_t _wolfboot_nsc_address[];
extern const uint32_t _wolfboot_nsc_size[];
extern const uint32_t _wolfboot_partition_boot_address[];
extern const uint32_t _wolfboot_partition_size[];
extern const uint32_t _wolfboot_partition_update_address[];
extern const uint32_t _wolfboot_partition_swap_address[];
/* create plain integers from linker script variables */
static const uint32_t WOLFBOOT_NSC_ADDRESS = (uint32_t)_wolfboot_nsc_address;
static const uint32_t WOLFBOOT_NSC_SIZE = (uint32_t)_wolfboot_nsc_size;
static const uint32_t WOLFBOOT_PARTITION_BOOT_ADDRESS = (uint32_t)_wolfboot_partition_boot_address;
static const uint32_t WOLFBOOT_PARTITION_SIZE = (uint32_t)_wolfboot_partition_size;
static const uint32_t WOLFBOOT_PARTITION_UPDATE_ADDRESS = (uint32_t)_wolfboot_partition_update_address;
static const uint32_t WOLFBOOT_PARTITION_SWAP_ADDRESS = (uint32_t)_wolfboot_partition_swap_address;
#else
#if defined(WOLFBOOT_PART_USE_ARCH_OFFSET)
#if !defined(EXT_FLASH) || (defined(EXT_FLASH) && !defined(PART_BOOT_EXT))
#define WOLFBOOT_PARTITION_BOOT_ADDRESS (ARCH_FLASH_OFFSET + @WOLFBOOT_PARTITION_BOOT_ADDRESS@)
#endif
#if !defined(EXT_FLASH) || (defined(EXT_FLASH) && !defined(PART_UPDATE_EXT))
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS (ARCH_FLASH_OFFSET + @WOLFBOOT_PARTITION_UPDATE_ADDRESS@)
#endif
#if !defined(EXT_FLASH) || (defined(EXT_FLASH) && !defined(PART_SWAP_EXT))
#define WOLFBOOT_PARTITION_SWAP_ADDRESS (ARCH_FLASH_OFFSET + @WOLFBOOT_PARTITION_SWAP_ADDRESS@)
#endif
#endif
/* use values provided on input template parsing */
#ifndef WOLFBOOT_NSC_ADDRESS
#define WOLFBOOT_NSC_ADDRESS @WOLFBOOT_NSC_ADDRESS@
#endif
#ifndef WOLFBOOT_NSC_SIZE
#define WOLFBOOT_NSC_SIZE @WOLFBOOT_NSC_SIZE@
#endif
#ifndef WOLFBOOT_PARTITION_BOOT_ADDRESS
#define WOLFBOOT_PARTITION_BOOT_ADDRESS @WOLFBOOT_PARTITION_BOOT_ADDRESS@
#endif
#ifndef WOLFBOOT_PARTITION_UPDATE_ADDRESS
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS @WOLFBOOT_PARTITION_UPDATE_ADDRESS@
#endif
#ifndef WOLFBOOT_PARTITION_SWAP_ADDRESS
#define WOLFBOOT_PARTITION_SWAP_ADDRESS @WOLFBOOT_PARTITION_SWAP_ADDRESS@
#endif
#ifndef WOLFBOOT_PARTITION_SIZE
#define WOLFBOOT_PARTITION_SIZE @WOLFBOOT_PARTITION_SIZE@
#endif
#ifdef WOLFBOOT_SELF_HEADER
#if defined(WOLFBOOT_PART_USE_ARCH_OFFSET)
#if !defined(EXT_FLASH) || (defined(EXT_FLASH) && !defined(WOLFBOOT_SELF_HEADER_EXT))
#define WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS (ARCH_FLASH_OFFSET + @WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS@)
#endif
#endif
#ifndef WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS
#define WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS @WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS@
#endif
#endif /* WOLFBOOT_SELF_HEADER */
#endif
#define WOLFBOOT_DTS_BOOT_ADDRESS @WOLFBOOT_DTS_BOOT_ADDRESS@
#define WOLFBOOT_DTS_UPDATE_ADDRESS @WOLFBOOT_DTS_UPDATE_ADDRESS@
#if defined(WOLFBOOT_FIXED_PARTITIONS) && \
!defined(WOLFBOOT_PART_USE_ARCH_OFFSET) && !defined(PULL_LINKER_DEFINES)
/*
* Only compare partitions that share the same internal flash address
* space. External partitions and runtime/linker-provided addresses are
* validated elsewhere.
*/
#if !defined(PART_BOOT_EXT) && !defined(PART_UPDATE_EXT) && \
((WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0) != 0) && \
((WOLFBOOT_PARTITION_BOOT_ADDRESS + 0 + WOLFBOOT_PARTITION_SIZE + 0) > \
(WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0)) && \
((WOLFBOOT_PARTITION_BOOT_ADDRESS + 0) < \
(WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0 + WOLFBOOT_PARTITION_SIZE + 0))
#error "Boot and update partitions overlap"
#endif
#if !defined(PART_BOOT_EXT) && !defined(PART_SWAP_EXT) && \
((WOLFBOOT_PARTITION_SWAP_ADDRESS + 0) != 0) && \
((WOLFBOOT_PARTITION_BOOT_ADDRESS + 0 + WOLFBOOT_PARTITION_SIZE + 0) > \
(WOLFBOOT_PARTITION_SWAP_ADDRESS + 0)) && \
((WOLFBOOT_PARTITION_BOOT_ADDRESS + 0) < \
(WOLFBOOT_PARTITION_SWAP_ADDRESS + 0 + WOLFBOOT_SECTOR_SIZE))
#error "Boot and swap partitions overlap"
#endif
#if !defined(PART_UPDATE_EXT) && !defined(PART_SWAP_EXT) && \
((WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0) != 0) && \
((WOLFBOOT_PARTITION_SWAP_ADDRESS + 0) != 0) && \
((WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0 + WOLFBOOT_PARTITION_SIZE + 0) > \
(WOLFBOOT_PARTITION_SWAP_ADDRESS + 0)) && \
((WOLFBOOT_PARTITION_UPDATE_ADDRESS + 0) < \
(WOLFBOOT_PARTITION_SWAP_ADDRESS + 0 + WOLFBOOT_SECTOR_SIZE))
#error "Update and swap partitions overlap"
#endif
#endif
#endif /* WOLFBOOT_FIXED_PARTITIONS */
#if !defined(WOLFBOOT_NO_LOAD_ADDRESS)
/* Load address in RAM for staged OS (update_ram only) */
#define WOLFBOOT_LOAD_ADDRESS @WOLFBOOT_LOAD_ADDRESS@
#endif
/* Optional RAM-boot image size cap for targets without partitions */
@WOLFBOOT_RAMBOOT_MAX_SIZE_DEFINE@
#define WOLFBOOT_LOAD_DTS_ADDRESS @WOLFBOOT_LOAD_DTS_ADDRESS@
#endif /* !H_TARGETS_TARGET_ */