Browse Source

parse argv in emifwriter

Signed-off-by: surenyi <surenyi82@qq.com>
master
surenyi 6 years ago
parent
commit
47133a5edd
  1. 10
      progs/emifwriter/.cproject
  2. 24
      progs/emifwriter/writer.c

10
progs/emifwriter/.cproject

@ -59,6 +59,7 @@
<option id="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.LIBRARY.452516125" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.LIBRARY" valueType="libs">
<listOptionValue builtIn="false" value="&quot;libc.a&quot;"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.ARG_SIZE.702008922" name="Set C argc/argv memory size (--arg_size, --args)" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.ARG_SIZE" value="4096" valueType="string"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD_SRCS.1840987821" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD2_SRCS.1764102017" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD2_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__GEN_CMDS.416701883" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__GEN_CMDS"/>
@ -86,8 +87,8 @@
<listOptionValue builtIn="false" value="&quot;${XDAIS_CG_ROOT}/examples&quot;"/>
<listOptionValue builtIn="false" value="&quot;${TARGET_CONTENT_BASE}&quot;"/>
</option>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.25742040" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.279449454" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.25742040" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.279449454" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="vsky.platforms.simple" valueType="string"/>
</tool>
</toolChain>
</folderInfo>
@ -150,6 +151,7 @@
<option id="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.LIBRARY.955368127" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.LIBRARY" valueType="libs">
<listOptionValue builtIn="false" value="&quot;libc.a&quot;"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.ARG_SIZE.110266809" name="Set C argc/argv memory size (--arg_size, --args)" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.linkerID.ARG_SIZE" value="512" valueType="string"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD_SRCS.105823691" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD2_SRCS.1245533345" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__CMD2_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__GEN_CMDS.87680588" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_7.4.exeLinker.inputType__GEN_CMDS"/>
@ -177,8 +179,8 @@
<listOptionValue builtIn="false" value="&quot;${XDAIS_CG_ROOT}/examples&quot;"/>
<listOptionValue builtIn="false" value="&quot;${TARGET_CONTENT_BASE}&quot;"/>
</option>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.24273991" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.1848042801" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.24273991" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="vsky.platforms.simple" valueType="string"/>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.1848042801" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="vsky.platforms.simple" valueType="string"/>
</tool>
</toolChain>
</folderInfo>

24
progs/emifwriter/writer.c

@ -1,9 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <vsky/libdsp/inc/nor.h>
#include <vsky/libdsp/GPIO.h>
/*
* Use CCS's script console to specify args:
*
* eg:
*
* loadProg('e:/dsp/libdsp/progs/emifwriter/Debug/emifwriter.out', new Array('emifwriter.out', '0x20000', 'e:/ether.out'))
*/
//#define BINARY_FILE "e:\\dsp\\libdsp\\progs\\spl\\spl.bin"
#define BINARY_FILE "e:\\dsp\\simple\\sbl\\sbl.bin"
#define BINARY_OFFSET 0
@ -24,12 +33,23 @@ static void erasing(nor_flash_t nf, Int start, Int size)
nor_flash_erase(nf, b, e);
}
Void main()
Void main(int argc, char *argv[])
{
FILE *sfp;
Int n, size, tot = 0;
nor_flash_t flash;
Int offset = BINARY_OFFSET;
const char *fname = BINARY_FILE;
if (argc >= 2) {
offset = strtoul(argv[1], NULL, 0);
}
if (argc >= 3) {
fname = argv[2];
}
System_printf("%s : %u\n", fname, offset);
GPIO_setOutput(7);
GPIO_setOutput(8);
@ -45,7 +65,7 @@ Void main()
System_printf("flash size 0x%x, sectors: %d\n", nor_flash_size(flash), nor_flash_sectors(flash));
sfp = fopen(BINARY_FILE, "rb");
sfp = fopen(fname, "rb");
if (sfp == NULL) {
System_printf("open file failed\n");

Loading…
Cancel
Save