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.

Code size / Due to STL?

Altera_Forum
Honored Contributor II
849 Views

Hello, 

 

 

I recently started with the NIOS II. I started from the 'small C hello world' example and simply added C++ support. Now, when I want to use a vector<int> for instance, the code instantly grows from 1kB to 5kB at declaration time: 

 

int main() 

{  

vector<int> tmp; 

 

return 0; 

 

when i push something on it, it shoots up to about 45kB!!!! 

 

int main() 

{  

vector<int> tmp; 

tmp.push_back( 20 ); 

 

return 0; 

 

I use Os as optimization setting, I noticed that debug info doesn't affect the size ( which is strange, no? ). I personally find it hard to believe that a push_back costs me 40kB of code, so I hope someone can point me in the right direction? 

 

Kind regards, 

Xabre
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
101 Views

Doesn't surprise me, push_back() isn't trivial. 

If you want small code avoid ALL library calls, you really need to write assembler in C.
Reply