Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1175 Discussions

Altera Monitor Program nios2-elf-gcc compiler flags

Altera_Forum
Honored Contributor II
1,178 Views

It seems when I try to compile a C program using nios2-elf-gcc in the Altera Monitor Program (v. 11) several compiler flags are added by default. Where are these flags specified and can they be modified? The flags appear on the command line with the call to nios2-elf-gcc as "-g -mno-cache-volatile -mno-hw-mulx -mno-hw-mul -mno-hw-div". 

 

The reason I'm asking is because it appears GCC4 no longer supports the "-mno-cache-volatile" compiler flag, and this is causing the compilation to fail. 

 

If it matters, I'm using Quartus Web v. 11 on Windows XP Pro SP3. Thanks in advance for any assistance. 

 

Rick
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
418 Views

I'm not sure what the "Altera Monitor Program" is but to answer the question yes those flags can edited. 

 

If the software is compiled from the command line chances are it is done through a shell script. Open the script and look for those flags and remove the ones you don't need. 

 

If the software is compiled from the Nios II software build tools for Eclipse then right click the project and go into the options/properties and you should be able to find those flags being set (just remove them). 

 

Ok now that being said if the mno-cache-volatile flag was being set then the application code might have been written to rely on that flag being present. What this means is that if you remove that flag you might need to modify the application so that instead of relying on volatile pointers accessing peripherals that those locations either be mapped to non-cacheable pointers or accessed via IOWR/IORD macros. You could also install the legacy Nios II tools (installed by default if you use the unified installer in 11.0) which comes with the gcc3 toolchain.
0 Kudos
Altera_Forum
Honored Contributor II
418 Views

Thank you for the suggestions. 

 

 

--- Quote Start ---  

I'm not sure what the "Altera Monitor Program" is but to answer the question yes those flags can edited. 

--- Quote End ---  

 

 

The Altera Monitor Program is a GUI program that is used to debug and compile C and assembly programs for the Nios II processor. It is intended for use by students. This is the environment in which I am testing this software for suitability. 

 

The Altera Monitor Program can be downloaded for free from here: 

http://www.altera.com/education/univ/software/monitor/unv-monitor.html 

 

 

--- Quote Start ---  

 

If the software is compiled from the command line chances are it is done through a shell script. Open the script and look for those flags and remove the ones you don't need. 

--- Quote End ---  

I assume the Monitor Program is utilizing the command line since the status window in the program displays command line instructions when I try to compile a C program. However, I have not been able to find any script or configuration file that references the "-mno-cache-volatile" flag. Perhaps it's being called directly from the Altera Monitor Program executable... 

 

 

--- Quote Start ---  

 

Ok now that being said if the mno-cache-volatile flag was being set then the application code might have been written to rely on that flag being present. What this means is that if you remove that flag you might need to modify the application so that instead of relying on volatile pointers accessing peripherals that those locations either be mapped to non-cacheable pointers or accessed via IOWR/IORD macros. You could also install the legacy Nios II tools (installed by default if you use the unified installer in 11.0) which comes with the gcc3 toolchain. 

--- Quote End ---  

At best I'm a beginner so feel free to correct me; it appears that the "-mbypass-cache" performs the same function as the "-mno-volatile-cache" flag. Since the "-mbypass-cache" flag is supported by GCC4, I assume a simple substitution on the command line will yield the same result. 

 

I considered installing the legacy Nios II tools, but am trying to avoid doing so. Version 11 of the Altera Monitor Program is a new release. In none of the documentation is it referenced that this version is dependent upon the legacy tools. I believe the use of a deprecated flag is just an oversight leftover from a previous software iteration.
0 Kudos
Altera_Forum
Honored Contributor II
418 Views

It appears to me that the compiler flag causing the issue, "-mno-cache-volatile", is indeed being passed directly to nios2-elf-gcc by the Altera Monitor Program software. 

 

The only solution I could find was to install the Nios II legacy tool located here: 

 

https://www.altera.com/download/software/nios-ii 

 

The Nios II legacy tool installs GCC3 as well as some other "legacy" software. This eliminates the problem of the "-mno-cache-volatile" parameter by using a version of GCC that still supports it.
0 Kudos
Altera_Forum
Honored Contributor II
418 Views

If you use the new gcc v4 based tools and just eliminate/rewrite any code that is relying on that flag being set that would be the better approach. The newer gcc compilers removed that flag for a reason so if you have the opportunity to remove that code that will make your life easier down the road.

0 Kudos
Altera_Forum
Honored Contributor II
418 Views

It would be nice if Altera updated their Altera Monitor Program, University Program IP Cores, and University Program Design Examples so that an install of the Nios II legacy tools was not required for functionality. However, I cannot complain too much as they distribute these educational materials free of charge.

0 Kudos
Altera_Forum
Honored Contributor II
418 Views

I will pass this on once I find out who created the program you were using. For the record Altera does not develop the IDE that you were using so this was probably as case of crossed wires. Since Altera offers free tools through the open core model I would recommend using that since I have worked for Altera for almost 7 years and this application was news to me..... so in other words Altera is not testing that IDE so I don't know how much it lags in terms of updates.

0 Kudos
Reply