Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20641 Discussions

custom SOPC component, component_sw.tcl

Altera_Forum
Honored Contributor II
1,131 Views

I have written a custom sopc builder component in VHDL. 

I built the component_hw.tcl file and am able to instantiate the component in sopc builder. 

 

I have also built component.hpp and component.cpp, which define a c++ class which facilitates control of the component from the NIOS II processor. 

 

Right now I have to manually copy the the c++ files into my software project 

and also# include the .hpp file in my main.cpp. 

 

I would like to have my software files included into my NIOS II project automatically, as is done when you instantiate an Altera SOPC builder component. 

 

I was under the impression that this could be done using a custom _sw.tcl file. I have copied one of these _sw.tcl from the ones included in the altera  

install directory on my hdd and modified it to reflect the name of my custom component and the pointed it to the paths of associated .cpp and .hpp files. 

 

Unfortunately, these files are not being automatically included into my NIOS II projected as I was hoping.  

 

Does anyone have any advice on how to automatically include the software files associated with a given custom sopc builder component in your NIOS II project? 

 

 

thanks.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
407 Views

I have the same problem but only with the Eclipse Platform. If I generate a new Nios application using the legacy Nios IDE, the source files from my custom component get included automatically into the SysLib. However, generating a BSP in the Eclipse platform does not bring in my source files. Looking under the drivers page of the BSP editor I can see that the driver name for my component = none?? 

 

I'm not too keen on using legacy tools as you never know how long they will be around for. 

 

Any help on this issue that gwall and I are having would be greatly appreciated. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
407 Views

I have solved my issue! I have seen in a previous forum post that the version numbers in the _hw.tcl and the _sw.tcl files must match. This is not the tools version number but the component version number.  

 

My version number in both the hardware and software tcl files did match. However they were three digits long (3.3.0). I have since changed this to 9.1 as all the examples use this and my source code is now included in my BSP. I'm not sure if this is because they were 3 digits long or because the version needs to equal the tools in use..... either way I don't care, its working! 

 

I hope this helps others.
0 Kudos
Altera_Forum
Honored Contributor II
407 Views

Here is the version# declaration in my component_hw.tcl: 

 

set_module_property VERSION 1.0 

 

Here is the corresponding version# declaration in my my component_sw.tcl: 

 

set_sw_property version 1.0 

 

I regenerated my sopc system, then opened the NIOS II Eclipse Platform 

and regenerated the BSP for my project. 

 

Then when I click on the BSP editor and then go to the drivers tab, 

I can see the component listed, but the driver name is still "none" 

and the version number is still "none". 

 

Is there something further I might be missing? 

Perhaps I need to make a .ipx file for my component, or maybe I 

need to make my own class.ptf file for this component? 

 

Also, I have seen something on the Altera website the suggests I may have to run some kind of bsp shell script?? 

 

 

thanks!
0 Kudos
Altera_Forum
Honored Contributor II
407 Views

Where did you locate all the .c and .h software files for the driver? Its recommended that you keep these files in a folder located inside your main project folder.

0 Kudos
Reply