Forum Discussion
Altera_Forum
Honored Contributor
16 years agoThere is a known problem with the nichestack being utilized from multiple UCOSII tasks. I was unable to get a specific problem ID from Altera, but they say the problem was supposed to be fixed in 9.0, but the fix didn't work, and they hoped that it would be fixed in 9.1, although at first glance of 9.1 I don't see any release notes describing a fix. The nichestack version in 9.1 remains at 3.1, the same as 9.0.
If you use the jtag uart for stdout and stdio, you will probably see "dtrap - breakpoint needed" messages generated by nichestack. My solution was to refactor my code so that all tcp/ip calls are done from a single task which gives time slices to the individual network-related functions I need. nioswiki.com has an example of a "superloop" version of nichestack usage, where all network calls are handled in a single task. This is a good starting point for you. The catch with the superloop model is that it is all or nothing - either superloop or UCOSII. I needed the networking to function properly in the presence of UCOSII handling other functions so I ended up with "superloop in a task" with all of my network code in a superloop inside a single UCOSII task. In order to do this I had to reverse-engineer the ipport.h file found in your syslib, in order to set the appropriate DEFINES that weren't documented, and I had to modify netmain.c located in misclib under the Altera components syslib/Nios II Software Packages/altera_iniche/UCOSII/src/misclib. Not the answer you wanted to hear, but an alternative if you aren't able to resolve your specific problem. Mike