Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
733 Views

Overriding static variables from Eclipse

Hi, 

 

I want to override a few variables (NUMBIGBUFS, MAXBIGPKTS, etc) contained in the ipport.h file of the NicheStack-enabled bsp without actually modifying the file itself. 

Does SBT give me any tools for doing this? 

 

Thanks!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
38 Views

Not that I'm a software person but are those variables or C macros (all caps and their location in an include file makes them look like macros)? C macros look something like this "#define <some macro name> <optionally some macro value>". If those are macros you should be able to overwrite them using the -D flag in the project settings. You can learn more by searching the gcc documentation about the -D flag.

Altera_Forum
Honored Contributor I
38 Views

Hi, 

 

if that's the definition of C Macros, they are then macros. 

 

I tried with -D already but it doesn't seem to work. But perhaps my tcl line was wrong... I did something like: 

 

set_setting hal.make.bsp_cflags_defined_symbols -DTSE_MY_SYSTEM,-DMAXBIGPKTS=1000,-DNUMBIGBUFS=250 

 

When doing a printf from main() I still get the old values. 

 

Not that I'm a software person too, but should't I first undefine those Macros first? In the description of cflags_defined_symbols it says that the effect is the same with# define... 

I tried using 

hal.make.bsp_cflags_undefined_symbols "-u DMAXBIGPKTS", "-u DNUMBIGBUFS" but still not working...
Altera_Forum
Honored Contributor I
38 Views

I found a slightly different syntax here: http://www.altera.com/support/kdb/solutions/rd11122009_293.html

Altera_Forum
Honored Contributor I
38 Views

If by "slightly different" you refer to those the "--set " directive, that would be actually the same but called from a .sh script. When the list of settings is included in a .tcl script the set is not required. 

 

NIOS2_BSP_ARGS="--script settings.tcl hal my_bsp" 

 

Anyways, I figgured out that the syntax for multiple defined symbols is  

 

set_setting hal.make.bsp_cflags_defined_symbols "-DTSE_MY_SYSTEM -DNUMBIGBUFS=250 -DMAXBIGPKTS=500" 

 

so parameters between quotes and separated by space not comma.
Altera_Forum
Honored Contributor I
38 Views

Oops ya, I didn't notice those commas. That's the same syntax that compilers like gcc uses for overwriting C macros.

Reply