RTEMS 6.1-rc7
Loading...
Searching...
No Matches
fsl_flexspi_nor_boot.h
1/*
2 * Copyright 2017-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, 3))
25/*************************************
26 * IVT Data
27 *************************************/
28typedef 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)
73extern uint32_t __Vectors[];
74#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors)
75#elif defined(__MCUXPRESSO)
76extern uint32_t __Vectors[];
77#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors)
78#elif defined(__ICCARM__)
79extern uint32_t __VECTOR_TABLE[];
80#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE)
81#elif defined(__GNUC__)
82extern uint32_t __VECTOR_TABLE[];
83#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE)
84#endif
85
86#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
87#define DCD_ADDRESS dcd_data
88#else
89#define DCD_ADDRESS 0
90#endif
91
92#define BOOT_DATA_ADDRESS &g_boot_data
93#define CSF_ADDRESS 0
94#define IVT_RSVD (uint32_t)(0x00000000)
95
96/*************************************
97 * Boot Data
98 *************************************/
99typedef struct _boot_data_
100{
101 uint32_t start; /* boot start location */
102 uint32_t size; /* size */
103 uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */
104 uint32_t placeholder; /* placehoder to make even 0x10 size */
106
107#ifdef FlexSPI1_AMBA_BASE
108#define FLASH_BASE FlexSPI1_AMBA_BASE
109#else
110#define FLASH_BASE FlexSPI_AMBA_BASE
111#endif
112
113#ifndef __rtems__
114#if defined(BOARD_FLASH_SIZE)
115#define FLASH_SIZE BOARD_FLASH_SIZE
116#else
117#error "Please define macro BOARD_FLASH_SIZE"
118#endif
119#endif /* __rtems__ */
120#define PLUGIN_FLAG (uint32_t)0
121
122/* External Variables */
123extern const BOOT_DATA_T g_boot_data;
124#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
125extern const uint8_t dcd_data[];
126#endif
127
128#endif /* __FLEXSPI_NOR_BOOT_H__ */
Definition: fsl_flexspi_nor_boot.h:100
Definition: fsl_flexspi_nor_boot.h:29
uint32_t reserved2
Definition: fsl_flexspi_nor_boot.h:51
uint32_t csf
Definition: fsl_flexspi_nor_boot.h:49
uint32_t entry
Definition: fsl_flexspi_nor_boot.h:37
uint32_t dcd
Definition: fsl_flexspi_nor_boot.h:41
uint32_t self
Definition: fsl_flexspi_nor_boot.h:47
uint32_t reserved1
Definition: fsl_flexspi_nor_boot.h:39
uint32_t boot_data
Definition: fsl_flexspi_nor_boot.h:45
uint32_t hdr
Definition: fsl_flexspi_nor_boot.h:33