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++
12589 Discussions

Best Practice for Editing Ipport.h options

NRugg
New Contributor I
741 Views

I'm curious what the accepted best practice is for editing options in ipport.h

 

My understanding is that all files in the BSP (including ipport.h) are auto generated when you generate a BSP. It's also my understanding that you should never manually edit these auto-generated files because all changes will be overwritten anytime you re-generate the BSP.

 

In NIOS documentation, it states several times that we can edit options in Ipport.h by adding or removing #defines and changing values.

 

These two things seem to compete with each other. So my question is what is the accepted best practice for editing options in Ipport.h?

0 Kudos
1 Solution
NRugg
New Contributor I
705 Views

I have found the solution to this issue! 

 

It turns out the file I needed to edit was a located at C:\intelFPGA_pro\19.4\nios2eds\components\altera_iniche\UCOSII\src\h\nios2\ipport.h

 

Note that the file is not called "ipport.h_h" like the documentation suggests.

 

So for anyone else looking for this same solution, the process goes as follows:

  1. Find the ipport.h file specific to your target system. For me this was located at the above path
    1. Note that this ipport.h will not be part of your project or BSP. Rather it will be part of the quartus install
  2. Make desired changes to ipport.h located in your target system directory
  3. Save and close the file
  4. Open up NIOS II Eclipse
  5. Right click bsp >> Nios II >> Generate BSP
  6. Clean and build project
  7. Your desired ipport.h changes will now be reflected in the ipport.h file included in your BSP.

View solution in original post

0 Kudos
2 Replies
NRugg
New Contributor I
716 Views

I've found a couple more breadcrumbs but no direct instructions for how to accomplish this. In case this sheds some light on the situation, here is what I've found. This documentation comes from the NicheStackRef 

 

2.2 The IP Port File: ipport.h_h

Before you compile the portable TCP/IP stack files you should create a version of the file ipport.h_h that is appropriate for your target system. An inspection of the NicheStack source code will show that many of the C language source files include a file named ipport.h. ipport.h is intended to contain not only the IP layer's port dependent definitions, but all the architectural definitions for all the IP related code. CPU architectures (big vs. little endian), compiler idiosyncrasies and optional features (DHCP, multiple interfaces, IP routing support) are controlled in this file. ipport.h is one of the target system include files that are copied to the h directory and thus should not be edited directly. See the section titled Target System Include Directory /h for instructions on how to deal with files of this type.

This section outlines the basic contents of ipport.h. Remember, the modifications described in this section should be made to the file named ipport.h_h that exists in your target system dependent directory, not to any file named ipport.h.

Changes that you make directly to ipport.h WILL BE LOST the next time you execute make because they WILL BE OVERWRITTEN with the contents of ipport.h_h.

 

 

Then the following from the same documentation

 

1.4.5 Target System Include Directory /h

Some aspects of a particular target system cannot be easily localized into a single source code directory. These are represented in include files that are included by source files contained in both target system independent and target system dependent directories. ipport.h_h, which is discussed in greater detail later, is the most widely included example of files of this type but there are others.

Different versions of these target system include files are appropriate for different target systems. Therefore each target system dependent directory contains a set of these files that is appropriate for that specific target system. For example, the dosmain directory contains a version of ipport.h_h that is appropriate for 16 bit real mode DOS targets and the net186 directory contains a different version of ipport.h_h that is appropriate for Net186 board targets. In order to avoid compilation problems that could be introduced by the presence of multiple include files with the same name in the same source tree, these target system include files, as they exist in the target system directories, are named using the file name suffix .h_h instead of the conventional .h.

For development environments using "make" or a similar utility, the makefile in each of these target system directories should copies the .h_h versions of these files from that target directory to a directory named h, changing the extension from .h_h to .h in the process. Thus when the C compiler encounters a directive to include, for example, ipport.h in a source file, there is only one instance of ipport.h in the source tree and therefore the same ipport.h will be included by each source file that includes it, independent of the include search path that has been specified to the compiler.

This scheme has some ramifications for porting engineers. The principal one being that if, during the course of a port, it is found to be necessary to modify one of these target system include files, the place to make the modification is NOT in the .h version of the file that resides in the h directory, but in the .h_h version of the file that resides in the target system dependent directory. All files that end up in the /h directory should be considered to be transient files like object files. No modifications should be made to them directly.

Modifications made to the .h include files that reside in the h directory WILL BE LOST.

For example, if you were porting the stack to an AMD Net186 target system and found it necessary to modify a defined constant in ipport.h, the file in which to make the change would be /net186/ipport.h_h, not /h/ipport.h.

 

 

 

This documentation suggests that I edit the ipport.h_h in my target system dependent directory. However the only other version of ipport.h_h I've found on my computer lives in the quartus install path. Editing this file has no effect on the ipport.h that gets included in my project.

 

So my question becomes. Where can I find this ipport.h_h file?

 

 

0 Kudos
NRugg
New Contributor I
706 Views

I have found the solution to this issue! 

 

It turns out the file I needed to edit was a located at C:\intelFPGA_pro\19.4\nios2eds\components\altera_iniche\UCOSII\src\h\nios2\ipport.h

 

Note that the file is not called "ipport.h_h" like the documentation suggests.

 

So for anyone else looking for this same solution, the process goes as follows:

  1. Find the ipport.h file specific to your target system. For me this was located at the above path
    1. Note that this ipport.h will not be part of your project or BSP. Rather it will be part of the quartus install
  2. Make desired changes to ipport.h located in your target system directory
  3. Save and close the file
  4. Open up NIOS II Eclipse
  5. Right click bsp >> Nios II >> Generate BSP
  6. Clean and build project
  7. Your desired ipport.h changes will now be reflected in the ipport.h file included in your BSP.
0 Kudos
Reply