Quantcast
Channel: Altera Forums
Viewing all articles
Browse latest Browse all 19390

SoC: Example C-code for accessing Avalon Slave peripherals?

$
0
0
Hi - I recently obtained an Arria V SoC card and I'm having a couple of problems...

1) All my existing designs present an external interface that looks like an Avalon Slave. In the past, I hooked this to the Avalon JTAG master via QSYS, wrote all my control SW in TCL, and ran it on System Console. Now I have an Arria V SOC board. I'm going to use the Golden System Reference Design as is and just add my design as a FPGA Avalon Slave peripheral. I know that Qsys will generate a .h file with the base address of my peripheral, but I have two questions

a) What does the C code that accesses my peripheral actually look like? All the .h file contains is a base address (call it "foo"). I know that conceptually my code will look like

int main ()
{
dumvar0 = contents(address (foo+4)); // reading the peripheral
contents(address(foo+8) = dumvar1; // writing the peripheral
}

But I'm not sure what the valid C syntax would look like for this example above - can anyone point me to an example?

b) once I write my C. I believe I compile it on the host. I found a hello world example for this on Rocketboards referring to the "linaro ARM compiler"). Is that what I want to do, or, how do I want to compile this? (is there a cookbook example how-to somewhere?)

After it's compiled, I assume I can FTP it to the linux on the dev. board (which should boot right up using the GSRD since I won't have tweaked anything) and just execute it. yes?

Thanks!
/j

Viewing all articles
Browse latest Browse all 19390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>