sput.c
Go to the documentation of this file.00001
00002
00003
00004
00005 int cmd_sput(int argc,char **argv)
00006 {
00007 unsigned long download_addr;
00008 struct stat statbuf;
00009 char *buf;
00010 int fd;
00011 if(stat(argv[1],&statbuf)!=0)
00012 {
00013 printf("error read file %s\n",argv[1]);
00014 exit(-1);
00015 }
00016 printf("open file %s,size %d\n",argv[1],statbuf.st_size);
00017 buf=malloc(statbuf.st_size);
00018 if(!buf)printf("error allocate memory\n");
00019 fd=open(argv[1],O_RDONLY);
00020 read(fd,(buf),statbuf.st_size);
00021 close(fd);
00022 download_addr=strtoul(argv[2],0,0);
00023
00024 jtag_putmem(buf,download_addr,statbuf.st_size);
00025
00026
00027 free(buf);
00028
00029 return 0;
00030 }
00031
00032 mycmd_init(sput,cmd_sput,"sput","sput filename address");