RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
arm
imxrt
mcux-sdk
devices
MIMXRT1166
xip
fsl_flexspi_nor_boot.h
1
/*
2
* Copyright 2019-2021 NXP
3
* All rights reserved.
4
*
5
* SPDX-License-Identifier: BSD-3-Clause
6
*/
7
8
#ifndef __FLEXSPI_NOR_BOOT_H__
9
#define __FLEXSPI_NOR_BOOT_H__
10
11
#include <stdint.h>
12
#include "fsl_common.h"
13
#ifndef __rtems__
14
#ifndef BOARD_FLASH_SIZE
15
#include "
board.h
"
16
#endif
17
#endif
/* __rtems__ */
18
22
#define FSL_XIP_DEVICE_DRIVER_VERSION (MAKE_VERSION(2, 0, 5))
24
25
/*************************************
26
* IVT Data
27
*************************************/
28
typedef
struct
_ivt_
29
{
33
uint32_t
hdr
;
37
uint32_t
entry
;
39
uint32_t
reserved1
;
41
uint32_t
dcd
;
45
uint32_t
boot_data
;
47
uint32_t
self
;
49
uint32_t
csf
;
51
uint32_t
reserved2
;
52
} ivt;
53
54
#define IVT_MAJOR_VERSION 0x4
55
#define IVT_MAJOR_VERSION_SHIFT 0x4
56
#define IVT_MAJOR_VERSION_MASK 0xF
57
#define IVT_MINOR_VERSION 0x1
58
#define IVT_MINOR_VERSION_SHIFT 0x0
59
#define IVT_MINOR_VERSION_MASK 0xF
60
61
#define IVT_VERSION(major, minor) \
62
((((major)&IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \
63
(((minor)&IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT))
64
65
/* IVT header */
66
#define IVT_TAG_HEADER 0xD1
67
#define IVT_SIZE 0x2000
68
#define IVT_PAR IVT_VERSION(IVT_MAJOR_VERSION, IVT_MINOR_VERSION)
69
#define IVT_HEADER (IVT_TAG_HEADER | (IVT_SIZE << 8) | (IVT_PAR << 24))
70
71
/* Set resume entry */
72
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
73
extern
uint32_t Reset_Handler[];
74
#define IMAGE_ENTRY_ADDRESS ((uint32_t)Reset_Handler)
75
#define BOOT_IMAGE_BASE ((uint32_t)FLASH_BASE)
76
#define BOOT_IMAGE_SIZE ((uint32_t)FLASH_SIZE)
77
#define BOOT_DATA_ADDRESS &g_boot_data
78
#define IVT_ADDRESS &image_vector_table
79
#define DCD_DATA_ADDRESS dcd_data
80
#elif defined(__MCUXPRESSO)
81
extern
uint32_t ResetISR[];
82
extern
uint32_t __boot_hdr_start__[];
83
extern
uint32_t __boot_hdr_ivt_loadaddr__[];
84
extern
uint32_t __boot_hdr_boot_data_loadaddr__[];
85
extern
uint32_t __boot_hdr_dcd_loadaddr__[];
86
extern
uint32_t _boot_loadaddr[];
87
extern
uint32_t _boot_size[];
88
#define IMAGE_ENTRY_ADDRESS ((uint32_t)ResetISR)
89
#define BOOT_IMAGE_BASE ((uint32_t)_boot_loadaddr)
90
#define BOOT_IMAGE_SIZE ((uint32_t)_boot_size)
91
#define BOOT_DATA_ADDRESS ((uint32_t)__boot_hdr_boot_data_loadaddr__)
92
#define IVT_ADDRESS ((uint32_t)__boot_hdr_ivt_loadaddr__)
93
#define DCD_DATA_ADDRESS ((uint32_t)__boot_hdr_dcd_loadaddr__)
94
#elif defined(__ICCARM__)
95
extern
uint32_t Reset_Handler[];
96
#define IMAGE_ENTRY_ADDRESS ((uint32_t)Reset_Handler)
97
#define BOOT_IMAGE_BASE ((uint32_t)FLASH_BASE)
98
#define BOOT_IMAGE_SIZE ((uint32_t)FLASH_SIZE)
99
#define BOOT_DATA_ADDRESS &g_boot_data
100
#define IVT_ADDRESS &image_vector_table
101
#define DCD_DATA_ADDRESS dcd_data
102
#elif defined(__GNUC__)
103
extern
uint32_t Reset_Handler[];
104
#define IMAGE_ENTRY_ADDRESS ((uint32_t)Reset_Handler)
105
#define BOOT_IMAGE_BASE ((uint32_t)FLASH_BASE)
106
#define BOOT_IMAGE_SIZE ((uint32_t)FLASH_SIZE)
107
#define BOOT_DATA_ADDRESS &g_boot_data
108
#define IVT_ADDRESS &image_vector_table
109
#define DCD_DATA_ADDRESS dcd_data
110
#endif
111
#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
112
#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
113
#define DCD_ADDRESS DCD_DATA_ADDRESS
114
#else
115
#define DCD_ADDRESS 0
116
#endif
117
#endif
118
#define CSF_ADDRESS 0
119
#define IVT_RSVD (uint32_t)(0x00000000)
120
121
/*************************************
122
* Boot Data
123
*************************************/
124
typedef
struct
_boot_data_
125
{
126
uint32_t start;
/* boot start location */
127
uint32_t size;
/* size */
128
uint32_t plugin;
/* plugin flag - 1 if downloaded application is plugin */
129
uint32_t placeholder;
/* placehoder to make even 0x10 size */
130
} BOOT_DATA_T;
131
132
#if __CORTEX_M == 7
133
#define FLASH_BASE FlexSPI1_AMBA_BASE
134
#elif __CORTEX_M == 4
135
#define FLASH_BASE FlexSPI1_ALIAS_BASE
136
#endif
137
138
#ifndef __rtems__
139
#if defined(BOARD_FLASH_SIZE)
140
#define FLASH_SIZE BOARD_FLASH_SIZE
141
#else
142
#error "Please define macro BOARD_FLASH_SIZE"
143
#endif
144
#endif
/* __rtems__ */
145
#define PLUGIN_FLAG (uint32_t)0
146
147
/* External Variables */
148
extern
const
BOOT_DATA_T g_boot_data;
149
#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
150
extern
const
uint8_t dcd_data[];
151
#endif
152
153
#endif
/* __FLEXSPI_NOR_BOOT_H__ */
board.h
_boot_data_
Definition
fsl_flexspi_nor_boot.h:100
_ivt_
Definition
fsl_flexspi_nor_boot.h:29
_ivt_::reserved2
uint32_t reserved2
Definition
fsl_flexspi_nor_boot.h:51
_ivt_::csf
uint32_t csf
Definition
fsl_flexspi_nor_boot.h:49
_ivt_::entry
uint32_t entry
Definition
fsl_flexspi_nor_boot.h:37
_ivt_::dcd
uint32_t dcd
Definition
fsl_flexspi_nor_boot.h:41
_ivt_::self
uint32_t self
Definition
fsl_flexspi_nor_boot.h:47
_ivt_::reserved1
uint32_t reserved1
Definition
fsl_flexspi_nor_boot.h:39
_ivt_::boot_data
uint32_t boot_data
Definition
fsl_flexspi_nor_boot.h:45
_ivt_::hdr
uint32_t hdr
Definition
fsl_flexspi_nor_boot.h:33
Generated by
1.18.0