-
Notifications
You must be signed in to change notification settings - Fork 30
/
head.c
40 lines (35 loc) · 1.49 KB
/
head.c
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
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
typedef struct boot_file_head {
uint32_t jump_instruction; /* one intruction jumping to real code */
uint8_t magic[8]; /* ="eGON.BT0" */
uint32_t check_sum; /* generated by PC */
uint32_t *length; /* generated by LD */
uint32_t pub_head_size; /* the size of boot_file_head_t */
uint8_t pub_head_vsn[4]; /* the version of boot_file_head_t */
uint32_t *ret_addr; /* the return value */
uint32_t *run_addr; /* run addr */
uint32_t boot_cpu; /* eGON version */
uint8_t platform[8]; /* platform information */
} boot_file_head_t;
#define BROM_FILE_HEAD_SIZE_OFFSET (((sizeof(boot_file_head_t) + sizeof(int)) / sizeof(int) + 1))
#define JUMP_INSTRUCTION (BROM_FILE_HEAD_SIZE_OFFSET | 0xEA000000)
#define BOOT0_MAGIC "eGON.BT0"
#define STAMP_VALUE (0x12345678)
#define BOOT_PUB_HEAD_VERSION "3000"
extern uint32_t __spl_size[];
extern uint32_t __code_start_address[];
const __attribute__((section(".boot0_head"))) boot_file_head_t boot_head = {
.jump_instruction = JUMP_INSTRUCTION,
.magic = BOOT0_MAGIC,
.check_sum = STAMP_VALUE,
.length = __spl_size,
.pub_head_size = sizeof(boot_file_head_t),
.pub_head_vsn = BOOT_PUB_HEAD_VERSION,
.ret_addr = __code_start_address,
.run_addr = __code_start_address,
.boot_cpu = 0,
.platform = {0, 0, '3', '.', '0', '.', '0', 0},
};