blob: 85071b4ed371b9af6698abee858a10f11475c0b6 (
plain)
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
|
#define HEADER_LEN 0x1000 /* length of the blank area + IVT + DCD */
/*
* ============================================================================
* i.MX flash header v1 handling. Found on i.MX35 and i.MX51
* ============================================================================
*/
#define DCD_BARKER 0xb17219e9
struct imx_flash_header {
uint32_t app_code_jump_vector;
uint32_t app_code_barker;
uint32_t app_code_csf;
uint32_t dcd_ptr_ptr;
uint32_t super_root_key;
uint32_t dcd;
uint32_t app_dest;
uint32_t dcd_barker;
uint32_t dcd_block_len;
} __attribute__((packed));
struct imx_boot_data {
uint32_t start;
uint32_t size;
uint32_t plugin;
} __attribute__((packed));
#define TAG_IVT_HEADER 0xd1
#define IVT_VERSION 0x40
#define TAG_DCD_HEADER 0xd2
#define DCD_VERSION 0x40
#define TAG_WRITE 0xcc
#define TAG_CHECK 0xcf
struct imx_ivt_header {
uint8_t tag;
uint16_t length;
uint8_t version;
} __attribute__((packed));
struct imx_flash_header_v2 {
struct imx_ivt_header header;
uint32_t entry;
uint32_t reserved1;
uint32_t dcd_ptr;
uint32_t boot_data_ptr;
uint32_t self;
uint32_t csf;
uint32_t reserved2;
struct imx_boot_data boot_data;
struct imx_ivt_header dcd_header;
} __attribute__((packed));
struct config_data {
uint32_t image_load_addr;
uint32_t image_dcd_offset;
uint32_t image_size;
uint32_t load_size;
char *outfile;
char *srkfile;
int header_version;
int cpu_type;
int (*check)(struct config_data *data, uint32_t cmd, uint32_t addr, uint32_t mask);
int (*write_mem)(struct config_data *data, uint32_t addr, uint32_t val, int width);
int csf_space;
char *csf;
};
int parse_config(struct config_data *data, const char *filename);
|