Introduction
This article describes how to reduce the software size used by the Nios® V processor (hereafter referred to as Nios® V), which is based on RISC-V architecture.
The Nios® II processor (hereafter referred to as Nios® II) will be released in winter 2023 (Quartus® Prime Pro v23.4, Quartus® Prime Standard v23.1) and will be the last soft-core processor to be released, so if you are using a newer version, you should consider using the Nios® V processor. If you wish to use a newer version, you will need to migrate to Nios® V.
If software size is an issue when migrating from Nios® II to Nios® V, please review the information presented in this article.
1. how to reduce software in the application project
The following article describes how to reduce software in an application project.
Reference : Nios® V Debug Methodology: Changing the Optimization Level
2. how to reduce software in BSP project
2-1. check box option settings in BSP-Editor
The options introduced in this section are options that can be enabled/disabled by checkboxes in BSP-Editor.
Common Setting | |
| Option Name | Option name Summary Description |
enable_reduced_device_drivers |
This option is effective for IPs that have drivers in reduced size mode. It reduces the code size. |
enable_sim_optimize |
Enables optimizations to speed up HDL simulation, such as initializing the cache, clearing .bss sections, omitting long delay loops, etc. |
use_picolibc |
Enabling this option changes the library used from Newlibc to the smaller Picolibc. |
Advanced Settings | |
| Option Name | Summary |
enable_lightweight_device_driver_api |
The function to assign device names to file descriptors (e.g. /dev/uart0) is removed, reducing the driver code and data size. open(), close(), and lseek() routines will no longer function, so use with caution. |
2-2. setting the Cflags option of BSP-Editor
The options introduced in this section are options that can be freely set by the user as compiler flags.
Common Settings | |
| Option Name | Overview |
cflags_debug |
Specifies compiler flags. |
cflags_optimaization |
Specifies the level of compiler optimization when Build Type is Release. |
Advanced Settings | |
| Option Name | Summary |
cflags_user_flags |
S files, you can set flags that are passed to the compiler when compiling C, C++, and . |
cflags_cxx_flags |
You can set flags that are valid when compiling C++. |
cflags_link_flags |
You can set flags that are effective when the linker is executed. |
Conclusion
This article has shown how to reduce software size in Nios® V. We hope you will find it useful when porting software from Nios® II.
For more information on the Nios® V processor, please refer to the manufacturer's page below.
Reference: Nios® V Processor Developer Center
We have also compiled information on Nios® V in the "Nios® V Processor Developer Center". Nios ® V V Summary Page which contains information on Nios® V. Please check this page as well, as it contains useful information in addition to this article.