Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12409 Discussions

Optimize a single file in a project

Altera_Forum
Honored Contributor II
1,740 Views

What is the easiest way with NIOS II EDS 10.1sp1 to setup the auto-generated Makefile to optimize a single file? By default the project has optimization turned off, but I'd like to enable it on a single file to check the performance. 

 

I've tried using the optimize attribute directive, but that is getting ignored. Same with a gcc# pragma. Is there a way to do this without having to roll the file into a library? 

 

Thanks.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
74 Views

Personally I'd use -O2 (or -O3) all the time, unless I really suspect a compiler bug.

Altera_Forum
Honored Contributor II
74 Views

I'm doing a lot of debugging, so I don't want to optimize the entire project yet. I just want to optimize one file so I can determine how the optimization level affects the performance of one of the functions. Is there a way to do that?

Altera_Forum
Honored Contributor II
74 Views

Assuming you don't want to be writing your own makefiles I'm guessing this would work: 

 

1) Compile the code you want optimized as a library with -O2/3 and other flags 

2) Associate the compiled library to your project 

3) Compile the entire project using -O0 

 

There might be other ways to do this..... this seemed like the simplest way to me.
Altera_Forum
Honored Contributor II
74 Views

I'm trying to do that right now, but the SBT doesn't give me the option to set the optimization flags with the library. Either I'm doing something wrong, or the "New Library" path does not following the documentation at all.

Altera_Forum
Honored Contributor II
74 Views

Well that was weird. Now the library is showing up like I would have expected all along. Now I can see if the optimization of this file will help.

Altera_Forum
Honored Contributor II
74 Views

I have never created a library in the GUI but if that doesn't work you can always do that from the command line.

Reply