Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,265 Views

How to use "i2c_opencores_sw.tcl" in I2C (OpenCores)?

Altera wiki provides i2c core from opencores: 

 

http://www.alterawiki.com/wiki/i2c_%28opencores%29 

 

The core supports the qsys. There is an "i2c_opencores_sw.tcl" inside the folder. I believe I can use this to update the bsp (to add the i2c HAL to bsp) in nios II eclipse when I develop software. But how can I run this tcl in Nios II eclipse?  

 

I try to run it through Nios II command shell: 

 

nios2-bsp --script i2c_opencores_sw.tcl 

 

But it gives me errors as screenshot, why? 

 

Thanks.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
107 Views

_sw.tcl files are used by nios2-bsp-editor 

 

Open nios2-bsp-editor 

 

Look at the "Driver" tab of the GUI. 

 

The "Driver Name" for the I2C component should be something other than "none". This means that the BSP editor found the _sw.tcl and assigned that driver to the hardware block for you.  

 

When you generate the BSP, the driver .h and .c files will be included in your build and you can invoke the functions from your application.
Altera_Forum
Honored Contributor I
107 Views

 

--- Quote Start ---  

_sw.tcl files are used by nios2-bsp-editor 

 

Open nios2-bsp-editor 

 

Look at the "Driver" tab of the GUI. 

 

The "Driver Name" for the I2C component should be something other than "none". This means that the BSP editor found the _sw.tcl and assigned that driver to the hardware block for you.  

 

When you generate the BSP, the driver .h and .c files will be included in your build and you can invoke the functions from your application. 

--- Quote End ---  

 

 

 

Thanks, ted. I checked the Nios II BSP Editor and I can see the driver of the i2c is "none". I think this means the _sw.tcl has not been excuted properly. How can I fix this problem? 

 

Thanks.
Altera_Forum
Honored Contributor I
107 Views

Where should I put "_sw.tcl" file? When I open the bsp editor, in the software packages tab, I can't see this tcl file. 

 

Thanks.
Altera_Forum
Honored Contributor I
107 Views

The _sw.tcl belongs in the same search path as the _hw.tcl you used to create your Qsys system. So if you just unzip the .zip and have added the I2C to your Qsys, then the _sw.tcl is probably in the right place. 

 

It looks like the problem is that for whatever reason, in the files in the .zip, the _hw.tcl and _sw.tcl don't agree on the name of the hardware block. 

 

In the _hw.tcl, the name is "i2c_opencores" [like it says on the wiki page]. 

 

In the _sw.tcl, the expected name is "opencores_i2c". 

 

Try changing the _sw.tcl so that: 

set_sw_property hw_class_name i2c_opencores  

 

And then restart the bsp-editor
Altera_Forum
Honored Contributor I
107 Views

 

--- Quote Start ---  

The _sw.tcl belongs in the same search path as the _hw.tcl you used to create your Qsys system. So if you just unzip the .zip and have added the I2C to your Qsys, then the _sw.tcl is probably in the right place. 

 

It looks like the problem is that for whatever reason, in the files in the .zip, the _hw.tcl and _sw.tcl don't agree on the name of the hardware block. 

 

In the _hw.tcl, the name is "i2c_opencores" [like it says on the wiki page]. 

 

In the _sw.tcl, the expected name is "opencores_i2c". 

 

Try changing the _sw.tcl so that: 

set_sw_property hw_class_name i2c_opencores  

 

And then restart the bsp-editor 

--- Quote End ---  

 

 

You are right. in _sw.tcl, all "i2c_opencores" was mistaken to "opencores_i2c", even the source codes names. After I changed all of them, it works and the drivers are generated in bsp.  

 

Thanks so much for help.
Reply