Intel: Nios® II SBT for Eclipse build error related to insufficient On-Chip Memory, is there a way around this without changing the FPGA design?

Nios II

Category: Nios® II
Tools: Nios® II EDS
device:-

<Error message>
'onchip_memory' overflowed

If you want to avoid it only by setting the software without changing the FPGA design, if you write the code only in C language (not using the C++ language), turn off the check of hal.enable_c_pluse_pluse of enable_c_pluse_pluse and Generate - > It is possible to reduce the code size by executing a build.

Alternatively, if you don't plan to use printf, using hello_world_small in New Project in your project template will use limited libraries and reduce code size.
The option name for the BSP in this template is enable_small_library.
If you use printf you need about 64K of RAM. If you don't use it, 32KB or less will work well.
Even with this setting, simple character string output and hexadecimal display can be performed as shown below. There is a prototype in BSP/HAL/sys/alt_stdio.h.

int alt_getchar(); int alt_putchar(int c); int alt_putstr(const char* str); void alt_printf(const char *fmt, …); // 16進のみ、10進は不可

For simple test programs, small_library is recommended because the printf family has a large code size, especially when using float.

As for how to calculate the code size, after building, the following message will be displayed at the end of the Console screen, so please refer to these.

<Message example>

Info: (test.elf) 119 KBytes program size (code + initialized data).
Info: 8824 Bytes free for stack + heap.
Info: Creating test.objdump
nios2-elf-objdump --disassemble --syms --all-header --source test.elf >test.objdump
[test build complete]

Experienced FAE
Free consultation is available.

From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.