Forum Discussion
NIOS : INTERNICHE stack without ucOSII
Hello
I'd like to use the interniche stack and the TSE ethernet mac, but without ucOSII.. I've heard, it exist a superloop example but it seems a lot of files patching is mandatory. Do you have experience about it ? it works ? Do you have an example of project which already working as standalone ? What about niche task, the free "OS" provided by Interniche. Thanks a lot dvb_man Etienne19 Replies
- Altera_Forum
Honored Contributor
Yes, it works fine. We are using superloop since Altera Version 7.2. As far as I can gather patches exists for Version 7.1 and 9.0. I made some minor changes for using the patch for Altera 9.0 from rfrazer also in Altera 9.1.
(I'm unable to post the link :confused:, you have to search the forum) I have prepared a project for the Altera Nios2 StratixII Devkit which is based on Simple Socket Server example. Additional you need the GigE Santa Cruz board from MoreThanIP with the Marvell phy. The patch is based on build tools therefore no changes are necessary in the original sources of the Interniche lib and TSE driver. The patch is just applied to the copy in the application directory. There is not much effort because the patch is based on scripts. I will attch a Quartus archive with the example. After unpacking you will find the patches and the build tools scripts in the directory \software_examples. Jens - Altera_Forum
Honored Contributor
Hello,
thanks for posting the patches! Unfortunately I can not apply the patches. create-this-bsp works, but patching the libraries always results in the error-code bellow (e.g. when trying to patch the interniche library. same problem with TSE lib ). Any ideas about the reasons? thanks a lot, Frank --- Quote Start --- [NiosII EDS]$ ./create-this-lib Copying library sources from installation tree... ................................................................................ ................................................................................ ................................................... create-this-lib: Running "nios2-lib-generate-makefile --bsp-dir ../bsp --lib-dir . --lib-name superloop_iniche --src-rdir ./iniche/ --public-inc-dir ./iniche/i nc --public-inc-dir ./iniche/src/h --public-inc-dir ./iniche/src/h/nios2 --publi c-inc-dir ./iniche/src/nios2 --set LIB_CFLAGS_DEFINED_SYMBOLS -DSUPERLOOP -DALT_ INICHE -DALTERA_TRIPLE_SPEED_MAC --set LIB_CFLAGS_OPTIMIZATION -O0 " INFO: nios2-lib-generate-makefile --bsp-dir ../bsp --lib-dir . --lib-name superl oop_iniche --src-rdir ./iniche/ --public-inc-dir ./iniche/inc --public-inc-dir . /iniche/src/h --public-inc-dir ./iniche/src/h/nios2 --public-inc-dir ./iniche/sr c/nios2 --set LIB_CFLAGS_DEFINED_SYMBOLS -DSUPERLOOP -DALT_INICHE -DALTERA_TRIPL E_SPEED_MAC --set LIB_CFLAGS_OPTIMIZATION -O0 INFO: Generating library makefile FINE: Generated file ".\Makefile" FINE: Generated file ".\public.mk" INFO: Library makefile generated patching file ../iniche/src/h/nios2/ipport.h Hunk# 1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file ../iniche/src/h/nios2/ipport.h. rej patching file ../iniche/src/h/sockvar.h patching file ../iniche/src/nios2/targnios.c Hunk# 1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file ../iniche/src/nios2/targnios.c. rej patching file ../iniche/src/tftp/tftpcli.c Hunk# 1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file ../iniche/src/tftp/tftpcli.c.re j patching file ../iniche/src/tftp/tftpsrv.c patching file ../iniche/src/tftp/tftputil.c patching file ../iniche/src/allports/timeouts.c create-this-lib: Running make Info: Building ../bsp/ make --no-print-directory -C ../bsp/ [BSP build complete] Info: Compiling iniche/src/allports/allports.c to obj/iniche/src/allports/allpor ts.o nios2-elf-gcc -xc -MP -MMD -c -Iiniche/inc/ -Iiniche/src/h/ -Iiniche/src/h/nios2 / -Iiniche/src/nios2/ -I../bsp/ -I../bsp//drivers/inc -I../bsp//HAL/inc -DSYSTE M_BUS_WIDTH=32 -D__hal__ -pipe -DALT_NO_INSTRUCTION_EMULATION -DALT_SINGLE_THREA DED -DSUPERLOOP -DALT_INICHE -DALTERA_TRIPLE_SPEED_MAC -O0 -g -Wall -mno-hw- div -mhw-mul -mhw-mulx -o obj/iniche/src/allports/allports.o iniche/src/allport s/allports.c In file included from iniche/src/allports/allports.c:26: iniche/src/h/nios2/ipport.h:506:22: includes.h: No such file or directory In file included from iniche/src/h/nios2/ipport.h:507, from iniche/src/allports/allports.c:26: iniche/src/h/tk_crnos.h:115: error: syntax error before '*' token iniche/src/h/tk_crnos.h:115: warning: type defaults to `int' in declaration of ` rcvdq_sem_ptr' iniche/src/h/tk_crnos.h:115: warning: data definition has no type or storage cla ss In file included from iniche/src/allports/allports.c:77: iniche/src/allports/../nios2/osport.h:25:22: includes.h: No such file or directo ry make: *** [obj/iniche/src/allports/allports.o] Error 1 --- Quote End --- - Altera_Forum
Honored Contributor
Hi Frank, which Altera version you have installed? The patch is tested for 9.1 with service pack 1.
Jens - Altera_Forum
Honored Contributor
Hi Jens,
thanks a lot for your quick response! I have installed Version 9.1 without a service pack. Maybe this is the reason? Shure I can install the SP1-Version and give it a shot... Are those 2 libraries media-dependent? Or is it possible to upload ready-built libraries and just include them in into a NiosII-project? Then I could try only to modify the BSP and the application files...? Thanks once more, Frank - Altera_Forum
Honored Contributor
wow... it worked. Thanks a lot for the hint! After all the time I wasted using an old version... :)
But there is still the second question... Are those 2 libraries media-dependent (FPGA - in my case Stratix III, SOPC,RAM-constellation,...; of course the are media-dependendet concerning the ethernet-MAC ;) )? Can I include them in into a SimpleSocketServer-NiosII-project? Then I could try only to modify the BSP and the application files...? - Altera_Forum
Honored Contributor
I'm really pleased.
Belonging dependencies I'm not sure. In some sources, e.g. in C:\altera\91\nios2eds\components\altera_iniche\HAL\src\alt_iniche_read.c is a# include "system.h". Thats a broad hint to system-dependency. But I don't know what they do in detail. When using TSE and Iniche you need a few components in each SOPC (SGDMA_TX, SGDMA_RX, DESCRIPTOR_MEMORY) which will referenced by the libraries. My solution is actually to have 2 virtual machines. One with 9.1 SP1 for building firmware and another with SP2 for synthesis (needed for C4E). I didn't test if the Simple Socket Server in superloop works in 9.1 without SP or with SP2. You should try it out! Jens - Altera_Forum
Honored Contributor
you are right. There are dependencies through system.h.
Meanwhile I can compile your example, but using my own .sopcinfo, .sopc ... files still won't work, resulting in some errors concerning: C:\altera\91\nios2eds\components\altera_iniche\HAL \src\alt_iniche_read.c C:\altera\91\nios2eds\components\altera_iniche\HAL \src\alt_iniche_write.c C:\altera\91\nios2eds\components\altera_iniche\HAL \src\alt_iniche_close.c ... and so on Making the libraries (create-this-lib) and BSP one by one through the Nios-shell works. But create-this-app (or build-all in the Eclipse Platform) results in the errors mentioned above. e.g. in the shell the error looks like: --- Quote Start --- ../superloop_iniche_lib/libsuperloop_iniche.a(cksum.o)(.text+0xec): In function `cksum': iniche/src/misclib/cksum.c:105: undefined reference to `asm_cksum' collect2: ld returned 1 exit status --- Quote End --- => slightly I'm going mad with this :mad: - Altera_Forum
Honored Contributor
I'd guess that is an asm function that calculates the IP checksum.
Doing that on the nios will be a PITA - since it is normally done using a 32bit 'add with carry' and the nios doesn't have a carry flag! The quickest way would be a custom instruction that adds the high and low 16bits (of a 32bit value) together, and then adds that to a running total. That might work with a C control loop. - Altera_Forum
Honored Contributor
Frank, did you had a look at the creat-this-app script in my sss example? There are some changes in the NIOS2_APP_GEN_ARGS compared to the sss example provided by Altera.
They should be: NIOS2_APP_GEN_ARGS=" --elf-name sss_niosII_2s60_RoHS.elf --set ALT_LDFLAGS \"-u write -u read\" --set APP_CFLAGS_OPTIMIZATION -O0 --set OBJDUMP_INCLUDE_SOURCE 1 --set CREATE_OBJDUMP 0 --set APP_CFLAGS_DEFINED_SYMBOLS -DSUPERLOOP -DALT_INICHE -DALTERA_TRIPLE_SPEED_MAC -DALT_DEBUG --use-lib-dir ${SUPERLOOP_INICHE_LIB_DIR} --use-lib-dir ${SUPERLOOP_TSE_LIB_DIR} --src-files network_utilities.c simple_socket_server.c led.c nios_init_nortos.c --log create_app.log " Jens - Altera_Forum
Honored Contributor
dsl you are right, if you want a bandwith that is significant over fast ethernet you need hardware acceleration. To achieve about 640 MBit/s data rate I had to offload the whole UDP protocol, but for controlling the user application the TCP/IP stack is fast enough.
There is an app note (AN440) for accelerating ethernet applications. Checksum offload through custom instructions is also described. Jens