How does C code load/run in memory?
Fernand
Posts: 83
I'm still unclear on how the Prop uses memory. Can someone point me to some explanation(s)? E.g. is C code completely compiled to PASM? If there's no Spin interpreter, where is this compiled code executed? If without using external RAM we can have programs that total up to 32kb, clearly bigger than Cog memory, how does one control which cog is being used for a given "thread"? Can a Cog execute directly out of Main Memory, and is there a latency price compared to Spin ? How does one mix in Spin code? Thank you!
Comments
Any function that is small enough can run entirely in the COG fcache area. Fcache is an overlay where PASM code is fetched from HUB RAM and run in the COG without interpretation, but it needs a kernel to manage code residency. Code is swapped when necessary.
There are other topics, but that sums most of it up.
The wiki has several other pages also: https://code.google.com/p/propgcc/wiki
Another Propeller-GCC that is mentioned in the SimpleIDE Help Menu is here: https://sites.google.com/site/propellergcc/
So even Assembly code is never just running loose, it's usually being fetched from Hub or external RAM in appropriate chunks and executed in the cog under control of a kernel?
These issues seem essential. Where is there a clear description that defines the terms? [edit] I'll look over the reference you provided, but it always seems these explanations assume the reader is familiar with the chip's specific jargon. Fcache is barely mentioned. How big is it? Does each cog have one?
Other modes can use asm(...) inline code that will be fetched from HUB RAM.
Fcache is an area that is at least 64 longs in the kernel COG. This means a second COG is not required in C to do useful things. There are some serial in/out driver functions for example that will run in any mode and fit entirely inside that area. Even the slowest mode can do bit-banged serial IO at 115200bps. By comparison, the fastest SPIN function can do 19200bps.