1 /* Copyright 2023 Cypress Semiconductor Corporation (an Infineon company) or
2  * an affiliate of Cypress Semiconductor Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/devicetree.h>
8 #include <zephyr/toolchain.h>
9 #include <stdint.h>
10 
11 struct toc2_data {
12 	uint32_t toc2_size;
13 	uint32_t l1_app_descr_addr;
14 	uint32_t service_app_descr_addr;
15 	uint32_t debug_cert_addr;
16 } __packed;
17 
18 struct l1_desc {
19 	uint32_t l1_app_descr_size;
20 	uint32_t boot_strap_addr;
21 	uint32_t boot_strap_dst_addr;
22 	uint32_t boot_strap_size;
23 	uint32_t reserved[3];
24 } __packed;
25 
26 struct l1_usr_app_hdr {
27 	uint8_t reserved[32];
28 } __packed;
29 
30 struct app_header {
31 	struct toc2_data toc2_data;
32 	struct l1_desc l1_desc;
33 	uint8_t padding[4];
34 	struct l1_usr_app_hdr l1_usr_app_hdr;
35 } __packed;
36 
37 const struct app_header app_header Z_GENERIC_SECTION(.app_header) = {
38 	.toc2_data = {.toc2_size = sizeof(struct toc2_data),
39 		      .l1_app_descr_addr = offsetof(struct app_header, l1_desc)},
40 	.l1_desc = {.l1_app_descr_size = sizeof(struct l1_desc),
41 		    .boot_strap_addr = DT_REG_ADDR(DT_NODELABEL(bootstrap_region)) -
42 				       DT_REG_ADDR(DT_NODELABEL(flash0)),
43 		    .boot_strap_dst_addr = DT_REG_ADDR(DT_NODELABEL(sram_bootstrap)),
44 		    .boot_strap_size = DT_REG_SIZE(DT_NODELABEL(sram_bootstrap))},
45 };
46