2

I am currently working with the quartus prime (16.1) and NIOS II eclipse tool chain. I tried to compile a simple C++ Hello World application, but I get an error like this:

"onchip_memory2_nios2' overflowed by 609088 bytes"

My question now is: Is this behavior normal for the NIOS II target? Does the string (also all STL container) implementation for this target really needs this much memory (I have about 128KB memory)? Has anybody experience with developing software for the NIOS II target in C++ and knows that this is the case or not?

I am happy for any help. Thanks!

application looks like this:

#include <string>
int main()
{ 
  std::string s = "Hello World!";
}
Litschi
  • 21
  • 3
  • What about using array of characters (e.g `unsigned char s[15]`) instead? I had used `printf` for character code devices before I left NIOS II ... about 5 years ago. Perhaps, and are supported now - try to find something about this in references – VolAnd Dec 08 '16 at 18:56
  • which libraries did you link? statically? linker options? sure about whether this is a compile-time or runtime error? – Cee McSharpface Dec 08 '16 at 18:57
  • if the memory footprint of the STL is your problem, there still is the ETL as an alternative, and various other considerations about memory allocation alternatives here: http://stackoverflow.com/questions/2226252/embedded-c-to-use-stl-or-not – Cee McSharpface Dec 08 '16 at 19:13
  • to 1) The char array would solve the problem, but I have already code which I want to use on the NIOS II target, which does use strings (I want to avoid to re-code this software, if possible), and there should be support for this (it says so on the altera website) to 2) yes its a compiler/linker error, I only use statically linked libraries (standard linker option, can give it to you in an update of this post) to 3) will look into it, but the STL containers should be useable with much less memory than I have – Litschi Dec 08 '16 at 19:34
  • I tried now several compiler options and it shows very interesting behavior in general. If I use the BSP with full optimization ( -O3 ) and the normal application project with ( -O2, -O3 ) the memory footprint is about 11KByte (kind of okay for me) and for all other cases - also the optimizing for size option - does generate something completely different (with about 600KByte of size). I have absolutely no clue why this is the case, but kind of solves the problem for me (But I asked the Altera support about this behavior, but no answer yet) – Litschi Dec 09 '16 at 08:44

1 Answers1

0

I contacted the ALTERA support team and in the end they said to me due to limitations in their C++ support for this target it is not possible to use most of C++ features with less than about 750KByte of memory (They would recommend to use external memory).

I will now use some mix up between C and C++ and hope this will do it.

Litschi
  • 21
  • 3