projects
/
my-code
/
arm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added initial linker script and tartup asm code
[my-code/arm.git]
/
betty
/
lpcload.c
diff --git
a/betty/lpcload.c
b/betty/lpcload.c
index
bd69fbe
..
30a808e
100644
(file)
--- a/
betty/lpcload.c
+++ b/
betty/lpcload.c
@@
-60,6
+60,7
@@
typedef struct s_lpc {
u8 info; /* info/mode */
char freq[8]; /* frequency */
u32 roff; /* ram offset of uc */
u8 info; /* info/mode */
char freq[8]; /* frequency */
u32 roff; /* ram offset of uc */
+ u32 jaddr; /* addr for the jump */
} t_lpc;
void usage(void) {
} t_lpc;
void usage(void) {
@@
-311,7
+312,7
@@
int go(t_lpc *lpc) {
char buf[BUFSIZE];
int ret,len;
char buf[BUFSIZE];
int ret,len;
- snprintf(buf,BUFSIZE,"G %d A\r\n",lpc->
roff
);
+ snprintf(buf,BUFSIZE,"G %d A\r\n",lpc->
jaddr
);
len=strlen(buf);
ret=txrx(lpc,buf,len,TXRX_TYPE_GO);
len=strlen(buf);
ret=txrx(lpc,buf,len,TXRX_TYPE_GO);
@@
-442,10
+443,6
@@
int firmware_to_ram(t_lpc *lpc) {
/* read len */
ret=read(lpc->fwfd,buf,2);
sscanf(buf,"%02x",&len);
/* read len */
ret=read(lpc->fwfd,buf,2);
sscanf(buf,"%02x",&len);
- if(len%4) {
- printf("fw to ram: len not a multiple of 4\n");
- return -1;
- }
/* read addr */
ret=read(lpc->fwfd,buf,4);
sscanf(buf,"%04x",&addr);
/* read addr */
ret=read(lpc->fwfd,buf,4);
sscanf(buf,"%04x",&addr);
@@
-478,8
+475,11
@@
int firmware_to_ram(t_lpc *lpc) {
write_to_ram(lpc,buf,addr,len);
break;
case 0x04:
write_to_ram(lpc,buf,addr,len);
break;
case 0x04:
- lpc->roff=((buf[0]<<28)|(buf[1]<<24));
- lpc->roff|=((buf[2]<<20)|(buf[3]<<16));
+ lpc->roff=((buf[0]<<24)|(buf[1]<<16));
+ break;
+ case 0x05:
+ lpc->jaddr=((buf[0]<<24)|(buf[1]<<16));
+ lpc->jaddr|=((buf[2]<<8)|buf[3]);
break;
default:
printf("fw to ram: unknown type %02x\n",type);
break;
default:
printf("fw to ram: unknown type %02x\n",type);
@@
-503,6
+503,7
@@
int main(int argc,char **argv) {
memset(&lpc,0,sizeof(t_lpc));
strncpy(lpc.freq,CRYSTFREQ,7);
lpc.roff=RAMOFFSET;
memset(&lpc,0,sizeof(t_lpc));
strncpy(lpc.freq,CRYSTFREQ,7);
lpc.roff=RAMOFFSET;
+ lpc.jaddr=RAMOFFSET;
/* parse argv */
/* parse argv */