I want to get to the point where I have simple C programs running in the MD and slave CPU. I just don't really have a good sense of how that is done.
Ignoring MD for now...
If I just want to have the slave SH2 start in it's own main() how should I structure my C code? How to have the initialization point to the C function that it should start in?
I am using Chilly Willy's tool chain and here is the code that starts the "slave()" but I don't know where exactly that is being defined nor if I can change it to my own C code.
Code: Select all
scont:
! clear interrupt flags
mov.l _slave_int_clr,r1
mov.w r0,@-r1 /* PWM INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* CMD INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* H INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* V INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* VRES INT clear */
mov.w r0,@r1
mov.l _slave_stk,r15
! wait for Master SH2 and 68000 to finish init
mov.l _slave_sts,r0
mov.l _slave_ok,r1
1:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bt 1b
mov.l _slave_adapter,r1
mov #0x00,r0
mov.b r0,@(1,r1) /* set int enables (different from master despite same address!) */
mov #0x20,r0
ldc r0,sr /* allow ints */
! purge cache, turn it on, and run slave()
mov.l _slave_cctl,r0
mov #0x11,r1
mov.b r1,@r0
mov.l _slave_go,r0
jmp @r0
nop
.align 2
_slave_int_clr:
.long 0x2000401E /* one word passed last int clr reg */
_slave_stk:
.long 0x06040000 /* Cold Start SP */
_slave_sts:
.long 0x20004024
_slave_ok:
.ascii "S_OK"
_slave_adapter:
.long 0x20004000
_slave_cctl:
.long 0xFFFFFE92
_slave_go:
.long _slave