When linking a custom HAL driver in the Quartus® II software version 13.1, a undefined reference linker error maybe seen to math.h functions such as ceilf() or floorf() although the project has linking with "-lm”.
This issue is caused by the nios2-elf-g "-msys-lib=hal_bsp" flag.
The "--start-group -lsmallc -lgcc -lhal_bsp --end-group" is added to the end of the "collect2" linking call and it doesn't see the "-lm" flag.
To workaround this issue , manually add "m" to ALT_BSP_DEP_LIBRARY_NAMES in the application’s Makefile which is located in “<project>\software\test_project\Makefile”
- Before: ALT_BSP_DEP_LIBRARY_NAMES :=
- After: ALT_BSP_DEP_LIBRARY_NAMES := m
This problem is scheduled to be fixed in a future release of the Quartus® II software.