主要实现CMD命令专门分布在一个段内
代码如下:
typedef struct __init_cmd {
char *name; /* Command Name */
void (*cmd)(void);
}init_cmd_t;
#define Struct_Section __attribute__ ((used,section("INIT_CMD")))
#define INIT_CMD(name,cmd) const init_cmd_t __init_cmd_##name Struct_Section = {#name, cmd }
INIT_CMD(test1,Test_parm);
INIT_CMD(test2,Test_parm2);
INIT_CMD(test3,Test_parm2);
extern unsigned char Load$$INIT_SECTION$$Base[];
extern unsigned char Load$$INIT_SECTION$$Leng