Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

Using Nichestack (superloop mode) with custom board.

Altera_Forum
Honored Contributor II
1,363 Views

I'm looking for some help conceptually understanding what is required to convert a project that uses Nichestack with uC/OSII RTOS to a project that uses Nichestack in superloop mode.  

 

Background: 

I have successully created a working version of the embedded web server demo that is modified to run on my custom board that uses minimal resources (EPCS Flash, SRAM only, no LCD). As required by Altera, I used the Nichestack with uC/OSII RTOS in the Nios IDE. Now we have a potential order from a customer for a small quantity job that will utilize a similar ethernet interface. Now I'm looking into the costs associated with designing this system: 

 

FPGA and peripherals = $100: No problem 

PCB = $100: No problem 

Nichestack + NIOSII bundle = $1000 (one time cost): No problem 

uC/OSII = $6,000 per end product license: Problem! 

 

Words cannot express how disappointed I am that Altera integrates and forces you to use uC/OSII if you intend on using the Nichestack in your design. This is especially troubling since it appears that Nichestack was designed to work without an RTOS. Anyway, sorry for the rant. 

 

I am also struggling with the fact that Altera is obsoleting the NIOS IDE in favor of the software build tools approach. So I am trying to learn the software build tools as well as trying to convert my web server demo to use the superloop approach. 

 

I am very aware of the superloop_simple_socket_server_plus example which is a nicely documented example for use with one on the evaluation boards. What I'm trying to figure out is what the difficulty level is of porting a stripped down version of this example to run on my custom board.  

It appears that, in the example, a bsp is built without using the uC/OSII and without automatically including the nichestack library. Instead two custom libraries are included in the software directory (superloop_iniche_lib and superloop_tse_lib). The create-this-app script located in the app folder links to these libraries and runs the create-this-lib script for each of the libraries. 

 

Now if I want to use the superloop mode in my custom board, is it a correct approach to do the following steps: 

 

1.) Create design hardware design using SOPC builder. 

2.) Create a new software design using the Software Build Tools. 

3.) Copy the superloop_iniche_lib and superloop_tse_lib folders from the superlooop example and store them in my software project folder. 

4.) Copy the linking commands from the create-this-app script that refer to these custom library folders. 

5.) Add hardware timer interrupt as in the superloop example to replace the functionality of the Nichestack tick task. 

6.) Remove hardware specific code that is not included on my custom boards (LCD screen, etc.).  

7.) Compile and run the project. 

 

Thanks in advance for any help or insight that you can give me. 

 

Mike C.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
483 Views

did you get a solution for this? could you please share it? 

thx
0 Kudos
Altera_Forum
Honored Contributor II
483 Views

Yes, I got the stack running and the simple socket server portion of the example running. I left out some of the code from the superloop_simple_socket server_plus example since I don't have a display device and I'm not sure if I can use the ROZIPFS with my EPCS Flash device. My approach was as follows: 

 

1.) Downloaded and unziped the source file directories from 20090611_superloop_sss_plus_neek_90sp1.tgz. The source files contain the hardware image for the neek eval board and scripts for generating the project from the hardware image. 

 

2.) Replaced the hardware image (files with .sof, .ptf, and .sopcinfo extensions) with the ones from my custom board. 

 

3.) Modified the create-this-bsp script in the bsp folder to configure my custom board's hardware configuration. I had to change the memory mapping since I'm using SRAM, not DDRAM. I also removed references to the ROZIPFS because I'm not sure if my hardware can support it. 

 

4.) I commented out the line "tar -kxf sources.tar 2> /dev/null" in the create-this-app script in the app directory so that I could include only the source files that I wanted. I manually extracted the source files in the "sources.tar" file and included only the following source files: 

iniche_init.c 

network_utilities.c 

network_utilities.h 

simple_socket_server.c 

simple_socket_server.h 

 

I will go back later and try to get the complete example running by including all the source files, but for now, I like to keep things simple. 

 

Note: I had to make a slight change to the create-this-lib script in the superloop_tse_lib folder. The example was made for nios version 9.0 and makes reference to C:/altera/90/ip... directory. Since I'm running nios 9.0 sp2, I had to change it to C:/alter/90sp2/ip.... in order for the script to find the driver. 

 

5.) I modified the code in the network_utlilities.c file to change the get_mac_addr() function to manually set the MAC address since I don't have eeprom memory. My function is as follows: 

 

int get_mac_addr(NET net, unsigned char mac_addr[6]) 

int ret_code = -1; 

 

mac_addr[0] = MAC_ADDR0; 

mac_addr[1] = MAC_ADDR1; 

mac_addr[2] = MAC_ADDR2; 

mac_addr[3] = MAC_ADDR3; 

mac_addr[4] = MAC_ADDR4; 

mac_addr[5] = MAC_ADDR5; 

ret_code = 1; 

 

return ret_code; 

 

6.) I commented out all the references to the graphics display and the demo_init() function call in the iniche_init.c source file. I removed all references to the demo.c source file. 

 

7.) Opened the nios command shell and changed the directory to the app directory. Typed ./create-this-app. The script automatically builds and links the necessary bsp files and libraries. The project compiles after generating the bsp and libraries. 

 

With this partial implementation of the superloop_simple_socket_server_plus example I was able to get the IP stack running and was able interact with the simple socket server menu through a telnet client. I just wanted to get enough done to prove that I could get the stack running without using uC/OSII. I would like to continue to get the all the network features of this example running on my custom board. 

 

Hope this helps someone.
0 Kudos
Altera_Forum
Honored Contributor II
483 Views

Hello, thx for the reply! 

did you use the macro SUPERLOOP while compiling the libraries?
0 Kudos
Altera_Forum
Honored Contributor II
483 Views

I'm not sure what you mean by "SUPERLOOP macro". The defines for SUPERLOOP were already setup by the setup scripts.

0 Kudos
Altera_Forum
Honored Contributor II
483 Views

OK, thank you!

0 Kudos
Reply