Hi i`ve a kernell (in flash) using RCM3700 that load a file (bin) from fs in XMEM then copy to RAM and execute. This work fine with
files until 128K then it fail, i try making bigger segment XMEM (but i`m not sure how to do that). I need almost 220K to run my
application. I post the code
sorry my english
Thanks
root nodebug void run_RAM(void)
{
root unsigned long fileTo;
root char buffer_stack[128];
root int tmp_i;
fileTo=0xC0000L;
while (TRUE)
{
tmp_i=fread(&FD,&buffer_stack,128);
if (tmp_i==0) break;
root2xmem(fileTo,&buffer_stack,128);
fileTo+=128L;
}
#asm
ipset 3
ld D,0x0C
ld E,0x08
ld IX,0x0000
Copy_Byte:
; Copia dos bytes desde D:IX -> E:IX
ld A,D
ldp HL,(IX)
ld A,E
ldp (IX),HL
inc IX
inc IX
ld HL,IX
ld A,H
or L
jr nz,Copy_Byte
; if IX==0 D=D+1 y E=E+1
inc D
inc E
; if D!=0x0F continue
ld A,D
cp 0x0E
jr nz,Copy_Byte
ld B,200 // i m not sure what it
s for
ld E,0x0E // i m not sure what it
s for
ld IX,0x0000 // i m not sure what it
s for
ld D,0x00 // i m not sure what it
s for
ld IY,changecs // i m not sure what it
s for
copy_exec:
ld A,D
ldp HL,(IY)
ld A,E
ldp (IX),HL
inc IX
inc IX
inc IY
inc IY
djnz copy_exec
; Jump to 0xE0000
db 0xC7,0x00,0xE0,0xD2 // i m not sure what it
s for
ipres
#endasm
}
root void changecs(void);
root void endChangecs(void);
#asm
changecs:
ld A,0x10
ioi ld (MMIDR),A
ld A,0x85
ioi ld (MB0CR),A
ld A,0x85
ioi ld (MB1CR),A
ld A,0x08
ioi ld (MB2CR),A
; ld A,0x08
; ioi ld (MB3CR),A
jp 0x0000
endChangecs:
#endasm