Code: Select all
_start:
ldc r0,0
ldc r1,0
ldc r2,0
ldc r3,0
ldc r4,0
ldc r5,0
ldc r6,0
ldc r7,0
ldc r8,0
ldc r9,0
ldc r10,0
ldc r11,0
ldc r11,0x00B
get r10,ps[r11] # get ram base
ldc r11,0x10B
set ps[r11],r10 # set vector base (to match ram base)
ldc r11, 0x6 # the I/O ports need a clock
setc res[r11], 0x8 # setci
setc res[r11], 0xf # setci
ldap r11,kep_handler
set kep,r11
# define XS1_PORT_32A 0x200000
ldc r8,0x2000
shl r8,r8,8
setc res[r8],0x8 # turn the port on
ldc r1,0x6 # give it a clock
setclk res[r8],r1
setup_resources:
getr r3,1 # define XS1_RES_TYPE_TIMER 0x1
ldap r11,tmr_vec
setv res[r3],r11
ldc r10,256
setd res[r3],r10
setc res[r3],0x9 # define XS1_SETC_COND_AFTER 0x9
setc res[r3],0x2 # define XS1_SETC_IE_MODE_EVENT 0x2
ldc r0,0x1234
clre
eeu res[r3]
waiteu
tmr_vec:
ldc r10,0xABCD
out res[r8],r10
freer res[r3]
ldc r0,0
clre
waiteu
.align 0x20
kep_handler:
clre
waiteu
I used freer, clre, waiteu at the end of my event handler to simply stop simulator output, let it run into max cycles.
The reason why I keep asking about this operating system call thing is because it keeps coming out of the simulator at the time of the event. with r0 set to 0x1234 as above then you get unimplemented OS call '4660'
Code: Select all
tile[0]@0- -A-.----00010000 (_start + 0) : ldc r0(0x0), 0x0 @5
tile[0]@0- -A-.----00010002 (_start + 2) : ldc r1(0x0), 0x0 @9
tile[0]@0- -A-.----00010004 (_start + 4) : ldc r2(0x0), 0x0 @13
tile[0]@0- -A-.----00010006 (_start + 6) : ldc r3(0x0), 0x0 @17
tile[0]@0- -A-.----00010008 (_start + 8) : ldc r4(0x0), 0x0 @21
tile[0]@0- -A-.----0001000a (_start + a) : ldc r5(0x0), 0x0 @25
tile[0]@0- -A-.----0001000c (_start + c) : ldc r6(0x0), 0x0 @29
tile[0]@0- -A-.----0001000e (_start + e) : ldc r7(0x0), 0x0 @33
tile[0]@0- -A-.----00010010 (_start + 10) : ldc r8(0x0), 0x0 @37
tile[0]@0- -A-.----00010012 (_start + 12) : ldc r9(0x0), 0x0 @41
tile[0]@0- -A-.----00010014 (_start + 14) : ldc r10(0x0), 0x0 @45
tile[0]@0- -A-.----00010016 (_start + 16) : ldc r11(0x0), 0x0 @49
tile[0]@0- -A-.----00010018 (_start + 18) : ldc r11(0xb), 0xb @53
tile[0]@0- -A-.----0001001a (_start + 1a) : get r10(0x10000), ps[r11(0xb)] @57
tile[0]@0- -A-.----0001001e (_start + 1e) : ldc r11(0x10b), 0x10b @65
tile[0]@0- -A-.----00010022 (_start + 22) : set ps[r11(0x10b)], r10(0x10000) @73
tile[0]@0- -A-.----00010026 (_start + 26) : ldc r11(0x6), 0x6 @77
tile[0]@0- -A-.----00010028 (_start + 28) : setc res[r11(0x6)], 0x8 @81
tile[0]@0- -A-.----0001002a (_start + 2a) : setc res[r11(0x6)], 0xf @85
tile[0]@0- -A-.----0001002c (_start + 2c) : ldap r11(0x10080), 0x29 @89
tile[0]@0- -A-.----0001002e (_start + 2e) : set kep(0x10080), r11(0x10080) @93
tile[0]@0- -A-.----00010030 (_start + 30) : ldc r8(0x2000), 0x2000 @97
tile[0]@0- -A-.----00010034 (_start + 34) : shl r8(0x200000), r8(0x2000), 0x8 @101
tile[0]@0- -A-.----00010036 (_start + 36) : setc res[r8(0x200000)], 0x8 @105
tile[0]@0- -A-.----00010038 (_start + 38) : ldc r1(0x6), 0x6 @109
tile[0]@0- -A-.----0001003a (_start + 3a) : setclk res[r8(0x200000)], r1(0x6) @113
tile[0]@0- -A-.----0001003e (setup_resources + 0) : getr r3(0x1), 0x1 @117
tile[0]@0- -A-.----00010040 (setup_resources + 2) : ldap r11(0x10058), 0xb @121
tile[0]@0- -A-.----00010042 (setup_resources + 4) : setv res[r3(0x1)], r11(0x10058) @125
tile[0]@0- -A-.----00010044 (setup_resources + 6) : ldc r10(0x100), 0x100 @129
tile[0]@0- -A-.----00010048 (setup_resources + a) : setd res[r3(0x1)], r10(0x100) @133
tile[0]@0- -A-.----0001004a (setup_resources + c) : setc res[r3(0x1)], 0x9 @137
tile[0]@0- -A-.----0001004c (setup_resources + e) : setc res[r3(0x1)], 0x2 @141
tile[0]@0- -A-.----0001004e (setup_resources + 10) : ldc r0(0x1234), 0x1234 @145
tile[0]@0- -A-.----00010052 (setup_resources + 14) : clre @149
tile[0]@0- -A-.----00010054 (setup_resources + 16) : eeu res[r3(0x1)] @153
tile[0]@0-P-A-.----00010056 (setup_resources + 18) : waiteu @157
tile[0]@0Event caused by res 0x00000001, V=0x00010058, EV=0x00000001 @1285
xsim: error: C31182: unimplemented OS call '4660'
The two loads makes sense, do both loads live in flash and there is some mechanism (in hardware) that loads and runs the first one then stops, loads the second one and resets the pc to run it? Or is the second load something done with code from the first or something along those lines?
Thanks,
David