Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12434 Discussions

How to write software independent of module instance name in Qsys or SOPC Builder?

Altera_Forum
Honored Contributor II
1,020 Views

Hi All, 

 

I am not sure that this is the correct place to post this question. 

 

I have designed an IP Core and I have written low level driver to verify it. I am able to verify it. My question is that I have used macro in my c file which indicates my ip core instance name in Qsys/SOPC.For example, when I select my IP Core in Qsys/SOPC,it creates instance name ip_core_0 and in system.h file macro is created with name ip_core_0_BASE.This macro I am using in my c file.Now suppose I rename instance name from ip_core_0 to ip_core.Now macro in system.h file is also updated from ip_core_0_BASE to ip_core_BASE and due to that I am getting an error in c file.I want to add automation i.e whatever instance name I used for my IP Core,my software should not generate any error. 

 

I hope it should be done using tcl. 

 

Would some one please provide my any link or suggestion to implement it? 

 

Thanks, 

 

Krupesh
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
126 Views

If you create an INIT() macro, then it will be invoked from alt_sys_init() before main() executes. The HAL will supply your macro with the correct# define'd value. Your initialization function can then locally store the base address and use that local value in all of your subsequent functions. 

 

http://www.altera.com/literature/hb/nios2/n2sw_nii52005.pdf 

 

You can't really do this if you intend to have multiple instances of your hardware block in your FPGA.
Altera_Forum
Honored Contributor II
126 Views

Hi Ted, 

 

Thanks for the document and suggestion.As I am a hardware engineer,it will take some time for me to accomplish the goal.I will try to update the procedure so other can also use it in near future. 

 

Thanks, 

 

Krupesh
Reply