AN 978: Nios® V Processor Migration Guidelines

ID 773196
Date 5/15/2024
Document Table of Contents

2.3. Software Optimization

The following information represents a Hello World application's program size with various software optimizations. You can evaluate your application ELF file using the nios2-stack-report and niosv-stack-report commands.

Both Nios® II and Nios® V processor software support the default Newlib C library and the option for Reduced Device Drivers. The difference lies in the optimized C library, which is the Small-C library in the Nios® II processor, and the Picolibc library in the Nios® V processor.

Hello World Application

#include <stdio.h>
int main()
  printf("Hello from Nios II!\n");
  return 0;
Table 4.  ELF Footprint Optimization Comparison
Board Support Package Settings hal.make.cflags_optimization Program Size (KB)
Nios® II Processor Nios® V Processor
Default (Newlib) O0 28 33
O2 24 28
Os 23 27
Reduced Device Drivers O0 20 26
O2 17 22
Os 17 22
Small-C O0 14
O2 10
Os 10
Picolibc O0 16
O2 12
Os 11
  • Small-C
  • Reduced Device Drivers
O0 6
O2 5
Os 4
  • Picolibc
  • Reduced Device Drivers
O0 9
O2 6
Os 6