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++
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
12583 Discussions

Optimize a single file in a project

Altera_Forum
Honored Contributor II
1,930 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
264 Views

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

0 Kudos
Altera_Forum
Honored Contributor II
264 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?

0 Kudos
Altera_Forum
Honored Contributor II
264 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.
0 Kudos
Altera_Forum
Honored Contributor II
264 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.

0 Kudos
Altera_Forum
Honored Contributor II
264 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.

0 Kudos
Altera_Forum
Honored Contributor II
264 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.

0 Kudos
Reply