Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

SOPC Component API

Hi all,

So, I've created my first-ever component (it's an adaptation of the VGA driver in AppNote333), and I'm trying to figure out how I integrate it so the Nios processor can actually address the DMA registers.

The appnote was written a while ago, and talks about 'publishing' the component which seems to be how the headers etc. get exported out to a file the Nios can read, but I can't see where that option actually is in the Quartus2/SOPC application I have today. Indeed, I can see there is a cpu_sdk/inc directory that contains files that were automatically generated, and those files seem to be what I want. I just don't know how to make them.

I also have a DMA controller in my project, but I'm not seeing any directory being made automatically that contains the 'altera_avalon_dma_regs.h' file, for example. So ideally I'd like to know

1) How do I get SOPC Builder or Quartus to create the cpu_sdk (or equivalent) directory ?

2) Where ought I put my own headers (or do they get generated automatically) for my vga component ?

Cheers

Simon

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ok, so I think I've found the answer to (1) above. From within SOPC Builder, the 'Tools' menu allows me to launch Eclipse, and from there I can select 'File => New Application and BSP from Template', which results in a 'software' directory containing (amongst a lot of other things) the aforementioned 'altera_avalon_dma_regs.h' file.

    So far, so great. Still not sure what I have to do to get my own component to show up there, though. If someone could point me at the correct documentation, I'd be very grateful :) To a complete newbie such as myself, there's a lot to take in and learn...

    Cheers

    Simon
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi SpaceCowboy,

    for No 2) I can tell you that you can put your own headers wherever you want (maybe it would be best to put them in your Nios II IDE project directory) as long as you inlcude them correctly into your *.c file.

    You also can use the automatically generated header files out of the bsp project. There, you can find headers for accessing the SOPC components with Macros like IORD and IOWR in io.h for avalon memory slaves. So, depending on the avalon component you created (memory slave, master or streaming, etc.) you can find basic header files in the automatically generated bsp project.

    Everything that goes beyond this has to be written by yourself, because you are the only person who knows the internals of your component (such as control registers, addresses and general functionality).

    I hope this helped a bit to show you the right direction.

    As you mentioned the "cpu_sdk", I guess you come from NIOS I development. That is exactly the way i went through, too. I would suggest to read this document http://www.altera.com/literature/an/an350.pdf, as it gives youm a good overview about the differences between Nios and Nios II development.

    Regards,

    Maik