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

📄 iaddcmd.htm

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 HTM
字号:
		<title>Adding SerialICE Monitor Commands</title>		<h1 align=center>Adding SerialICE Monitor Commands</h1><!--INDEX "Adding SerialICE Monitor Commands" mycmd -->Adding commands to the SerialICE Monitor is very simple. You have twochoices:  Add the command to the SerialICE Monitor ROMs, or add the command to theSerialICE Driver.  Adding the command to the SerialICE Driver avoids the need torebuild the SerialICE Monitor ROM and is described below. To add the commandto the SerialICE Monitor ROM follow the procedure for <ahref="paddcmd.htm">adding commands to PMON</a>, except that you use thefiles in the imon directory instead of the pmon directory.<p>In this example, we wish toadd a command called mycmd to the SerialICE Driver. This command simply identifiesitself and prints out a list of its arguments. The function is placedin a file called mycmd.c in the bsps subdirectory. Notice that it iscalled with an argc/argv argument list in exactly the same way asa normal C program is called. As with UNIX, the name of the command is located in argv[0].<p><pre><b>bsps/mycmd.c</b>	Optdesc mycmd_opts[] = {		{"","My Command"},		{0}};	mycmd(argc,argv)	int argc;	char *argv[];	{	int i;	printf("This is my command. Arguments were: ");	for (i=1;i&lt;argc;i++) printf("%s ",argv[i]);	printf("\n");	}</pre>Note that you can also list any options that your new command accepts, tothe mycmd_opts array. The first field can contain the list of options. Additional lines would explain those options. For example,<p><pre>	Optdesc mycmd_opts[] = {		{"[-fl]","My Command"},		{"-f","Find bug"},		{"-l","Lose bug"},		{0}};</pre>The name of this function must now be installed in the table ofcommands. The new command can be added to all drivers (iceif.c/icecmds),or just for a specific driver (eg. d4001.c/cmdlist).<p>The new command can beplaced anywhere in the list. Its position determines where itsname will appear in the list generated by the 'h' command.<p><pre><b>bsps/d4001.c</b>	int mycmd();	extern Optdesc mycmd_opts[];	CmdRec cmdlist[] = {		{"mycmd",mycmd_opts,mycmd},</pre>Finally, the new module must be added to the list in the Makefile.For example,<p><pre><b>bsps/Makefile</b># a driver for a board that has a 4001d4001 : $(DVROBJS) d4001.o 400x.o mycmd.o	pmcc $(DVRFLAGS) -o $@ $(DVROBJS) d4001.o 400x.o mycmd.o</pre>To support arguments that can be complex expressions, convert theargument from ascii to binary using the function get_rsa(). Thisfunction has the prototype:<pre>	int get_rsa(unsigned long *value, char *source);</pre>Where:<p>	<dl><dd><table><tr><td>	<var>source</var> </td><td>is the input ascii string.	</td></tr><tr><td>	<var>value</var> </td><td>is the place where the binary value is	to be written.	</td></tr><tr><td colspan=2>	The return value is 1 if the conversion was successful, otherwise	it is zero. get_rsa() prints its own messages if the conversion	was unsuccessful.	</td></tr></table></dl><p>Example:<p><pre>	if(!get_rsa(&adr,av[i])) return;</pre>Once the files havebeen modified, you need to rebuild the driver and <ahref="idinst.htm">download</a> it to the SerialICE Controller. Or if you choseto add the command to the ROM, you need to rebuild IMON and <ahref="mkroms.htm">make</a> new <a href="romdef.htm">ROMs</a>.<p></dl><p><hr><b>Navigation:</b> <a href="index.htm">Document Home</a> | <a href="doctoc.htm">Document Contents</a> | <a href="docindex.htm">Document Index</a> <p>

⌨️ 快捷键说明

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