⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkcygelfsyms.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
字号:
/************************************************************* * File: tools/mkcygelfsyms.c * Purpose: Make S4 symbol records from a Cygnus-elf .map file. *	This program is intended for users who are invoking *	the cygnus tools directly, rather than using pmcc.  * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970826	Created */#include <stdio.h>int vflag;/**************************************************************/main(argc,argv)int argc;char *argv[];{if (argc != 3) {	fprintf(stderr,"Make S4 symbol records from a Cygnus-elf .map file\n");	fprintf(stderr,"usage: mkcygelfsyms <infile> <outfile>\n");	fprintf(stderr,"eg. mkcygelfsyms hello.map hello.sym\n");	exit(1);	}mksyms(argv[1],argv[2]);}/**************************************************************  mksyms(char *ifn,char *ofn)*/mksyms(ifn,ofn)char *ifn,*ofn;{FILE *ifp,*ofp;char buf[100],*field[10];int nf,flag,csum,len;if (vflag) fprintf(stderr,"mksyms %s > %s\n",ifn,ofn);flag = 0;ifp = fopen(ifn,"r");if (ifp == 0) {	fprintf(stderr,"Can't open %s\n",ifn);	exit(1);	}ofp = fopen(ofn,"w");if (ofp == 0) {	fprintf(stderr,"Can't open %s\n",ofn);	exit(1);	}for (;;) {	if (!fgets(buf,100,ifp)) break;	buf[strlen(buf)-1] = 0;	if (strlen(buf)==0) continue;	if (buf[0] != ' ') continue;	nf = argvize(field,buf);	if (nf != 2) continue;	if (strlen(field[0]) != 18) continue;	if (strncmp(field[0],"0x00000000",10)) continue;	if (strchr(field[1],'=')) continue;	csum = 0;	len = strlen(field[1])+8+2;	fprintf(ofp,"S4%02X%s%s,%02x\n",len,&field[0][10],field[1],csum);	}fclose(ifp);fclose(ofp);}/**************************************************************  int argvize(av,s) *	place address of each word in s into the array av*/int argvize(av,s)char *av[];char *s;{char **pav = av, c;int ac;for (ac=0;;ac++) {	/* step over cntrls and spaces */	while(*s && *s <= ' ') ++s;	/* if eos quit */	if(!*s) break;	c = *s;	/* find end of word */	if (pav) *pav++ = s;	while(' ' < *s) ++s;	/* not eos inc ptr */	if(*s) *s++ = 0;	}return(ac);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -