📄 out.h
字号:
#ifndef _OUT_H_
#define _OUT_H_
#define F_RELFLG 0x0001 /* 重定位信息已成文件中删除 */
#define F_EXEC 0x0002 /* 文件可执行 */
#define F_LSYMS 0x0008 /* 本地符号已成文件中删除 */
#define F_LITTLE 0x0100 /* 目标主机字节序为 LITTLE_ENDIAN */
#define F_BIG 0x0200 /* 目标主机字节序为 BIG_ENDIAN*/
/* out文件头 */
struct out_head
{
unsigned short vension_id;
unsigned short num_sections;
int time_stamp;
unsigned int symtable_addr; /* 符号表起始地址 */
int num_entries; /* 符号表中有多少个entry */
unsigned short sizes_optheader;
unsigned short flags;
unsigned short target_id;
};
#define SIZE_OF_OUTHEAD 22 /* OUT 头部长度 */
/* 可选文件头 */
struct opt_head
{
unsigned short magic;
unsigned short version_stamp;
unsigned int sizes_execode;
unsigned int sizes_initsec;
unsigned int sizes_uninisec;
unsigned int entry_point;
unsigned int begin_exe_addr;
unsigned int begin_init_addr;
};
#define SIZE_OF_OPTHEAD 28 /* 可选段长度 */
/* 节点标志定义 */
#define STYP_REG 0x00000000 /* regular section */
#define STYP_DSECT 0x00000001 /* dummy section */
#define STYP_NOLOAD 0x00000002 /* Noload section */
#define STYP_COPY 0x00000010 /* copy section */
#define STYP_TEXT 0x00000020 /* text */
#define STYP_DATA 0x00000040 /* data */
#define STYP_BSS 0x00000080 /* bss */
#define STYP_BLOCK 0x00001000 /* alignment used as a blocking factor */
#define STYP_PASS 0x00002000 /* section should pass through unchanged */
#define STYP_CLINK 0x00004000 /* section requires conditional linking */
#define STYP_VECTOR 0x00008000 /* section contains vector table */
#define STYP_PADDED 0x00010000 /* section has been padded */
/* 节点头部 */
struct section_head
{
unsigned char name[8]; /* 节点名 */
unsigned int physcial_addr;
unsigned int virtual_addr;
unsigned int sizes;
unsigned int pointer_rawdata;
unsigned int pointer_relentries;
int res1;
unsigned int nums_relentries;
unsigned int res2;
unsigned int flag;
unsigned short res3;
unsigned short page_num;
};
#define SIZE_OF_SECTIONHEAD 48 /* 节点头长度 */
struct section_info
{
struct section_head sectionhead;
unsigned char * prawdata; /* 原始数据 */
unsigned int head_bytes_recved; /* 该section头部已经收到多少个字节 */
unsigned int raw_bytes_recved; /* 属于该section的原始数据已经收到多少个字节 */
unsigned int flag; /* 该段是否需要烧写到flash中 */
};
/* sym entry struct */
struct symbol_entry
{
unsigned char name[8]; /* 节点名 */
int symbol_value;
short num_symbol_section; /* 该符号属于哪一个节 */
short res;
char symbol_class;
char num_aux_entries;
};
struct out_info
{
struct out_head OutHead;
struct opt_head OptHead;
struct section_info * psection; /* 节信息 */
unsigned int section_recved; /* 已经接收到多少个section */
unsigned int already_used; /* 表示是否已经下载成功过 */
};
#define SIZE_OF_SYMENTRY 18 /* 一个符号ENTRY所占用字节数 */
/* 状态机 */
#define STAT_BEGIN 0 /* 接收开始 */
#define STAT_RECV_SECTION 1 /* 接收section段内容 */
#define STAT_SEARCH_RAWPOINTER 2 /* 查找原始数据起始位置 */
#define STAT_RECV_RAWDATA 3 /* 接收原始数据 */
#define STAT_SEARCH_SYMPOINTER 4 /* 查找原始数据起始位置 */
#define STAT_RECV_SYMBLO 5 /* 接收符号表 */
#define STAT_SEARCH_STRING 6 /* 查找符号表开始位置 */
#define STAT_GET_STRING_LEN 7 /* 获得字符串表长度 */
#define STAT_RECV_STRING 8 /* 接收字符串表 */
#define STAT_END 9 /* out信息接收完毕 */
/* FLASH存放位置相关定义 */
#define DEBUG_ABBR_UNZIPLEN (0x378) /* abbre节压缩前长度 */
#define DEBUG_INFO_UNZIPLEN (0x37c) /* info 节压缩前长度 */
#define DEBUG_INFO_ADDR (0x380) /* DIE表的存放地址 */
#define DEBUG_INFO_LEN (0x384) /* DIE长度 */
#define DEBUG_ABBR_ADDR (0x388) /* debug abbrev表的存放地址 */
#define DEBUG_ABBR_LEN (0x38c) /* debug abbrev table len */
#define TEXT_LOAD_ADDR (0x390) /* 正文段装载地址 */
#define TEXT_LOAD_LEN (0x394) /* 正文段装载长度 */
#define TEXT_RUN_ADDR (0x398) /* 正文段运行地址 */
#define TEXT_RUN_LEN (0x39c) /* 正文段运行长度 */
#define FAR_RUN_ADDR (0x3a0) /* far */
#define FAR_RUN_LEN (0x3a4) /* far len */
#define BSS_RUN_ADDR (0x3a8) /* bss */
#define BSS_RUN_LEN (0x3ac) /* bss len */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -