Some questions about SPIN - C interaction
heapdump
Posts: 13
Hi all,
there are still some issues left I did not understand with that topic:
1. Is the compiled SPIN code (via btsc -c ...), which will be add to the binary via objcopy, bytecode or native?
2. How exactly are parameters passed from C to the start routine in the SPIN code? (I did not get it from some examples...)
I just wanted to interface some VGA spin driver from C ...
Thank you in advance!
Patrick
there are still some issues left I did not understand with that topic:
1. Is the compiled SPIN code (via btsc -c ...), which will be add to the binary via objcopy, bytecode or native?
2. How exactly are parameters passed from C to the start routine in the SPIN code? (I did not get it from some examples...)
I just wanted to interface some VGA spin driver from C ...
Thank you in advance!
Patrick
Comments
Passing the parameters is usually done through the second argument of coginit (or whatever they call it in C). It's also sometimes done by poking values into the PASM image. Read the Spin code to see how your object does it, and port that Spin code to C.
I think I now understood; currently I am using a header section with unfilled longs in PASM head and pass the content of a filled C structure via memcopy to this absolute address. This worked for me quite good.