Description
This error happens when functions are located in a memory location more than 256MB apart from the main memory because the Nios II compiler uses the call instruction which has 256MB boundary limitation.
Solution
1) In ACDS version 13.1, the -relax-all option is implemented to use the callr instruction instead of call instruction. In Software Build Tools for Eclipse, add the -Wa,-relax-all option in the Application and/or BSP properties as user flags.
This workaround may impact the software performance as callr instruction uses more assembly instructions compared to the call instruction.
For BSP, gemrtos uses:
nios2-bsp hal $1 qsysgrtos.sopcinfo --cpu-name GeMRTOS_Multiprocessor_0_gemrtos_proc_1 --cmd "set_setting hal.enable_reduced_device_drivers true" --cmd "set_setting hal.stderr GeMRTOS_Multiprocessor_0_jtag_uart_1" --cmd "set_setting hal.stdin GeMRTOS_Multiprocessor_0_jtag_uart_0" --cmd "set_setting hal.stdout GeMRTOS_Multiprocessor_0_jtag_uart_0" --cmd "add_section_mapping rstaux GeMRTOS_Multiprocessor_0_rstaux_memory" --cmd "delete_memory_region GeMRTOS_Multiprocessor_0_onchip_memory2_2" --cmd "add_memory_region onchipdata GeMRTOS_Multiprocessor_0_onchip_memory2_2 0 512" --cmd "add_memory_region onchipcode GeMRTOS_Multiprocessor_0_onchip_memory2_2 512 15872" --cmd "add_section_mapping onchipdata onchipdata" --cmd "add_section_mapping onchipmem onchipcode" --cmd "set_setting hal.make.bsp_cflags_user_flags -Wa,-relax-all"
and for the application
nios2-app-generate-makefile.exe --bsp-dir ./${SOFTWARE_DIR_NAME}/${BSP_NAME} --app-dir ./${SOFTWARE_DIR_NAME}/${APP_NAME} --elf-name ${APP_NAME}.elf --set APP_CFLAGS_USER_FLAGS "-Wa,-relax-all" --inc-rdir ./${SOFTWARE_DIR_NAME}/${APP_NAME} --src-rdir ./${SOFTWARE_DIR_NAME}/${APP_NAME}