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.
12435 Discussions

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

Altera_Forum
Honored Contributor II
1,468 Views

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 II
310 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 II
310 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 II
310 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 II
310 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 II
310 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