Description
In ACDS version 13.1, the Nios® II GNU toolchain is upgraded from GCC 4.1.2 to GCC 4.7.3. Users upgrading to the new toolchain need to take note of the following changes listed below.
Nios II specific changes:
- Use __buildin_custom_* instead of -mcustom-* or #pragma to reliably generate Nios II Floating Point Custom Instructions (FPCI), independent of compiler optimization level and command line flags.
- To use -mcustom-* or #pragma for Nios II Floating Point Custom Instructions (FPCI):
- the -ffinite-math-only flag must be used to generate fmins and fmax FPCI
- the optimization (non -O0 flag) must be used to generate fsqrts FPCI
- Users implementing transcendental functions in hardware must use the -funsafe-math-optimizations flag to generate the FPCI for the transcendental functions fsins(), fcoss(), ftans(), fatans(), fexps(), flogs() and corresponding double-precision functions
- The Pragma format has changed from eg. #pragma custom_fadds 253 to #pragma GCC target("custom-fadds=253") and function attributes provide an alternative format __attribute__((target("custom-fadds=253"))).
- Use the -mel/-meb flags instead of -EL/-EB for endian settings. Software Build Tool for Eclipse (SBTE) users must regenerate the BSP for this setting to take effect.
- The -mreverse-bitfields flag and reverse_bitfields pragma are no longer supported.
- The -fstack-check flag must be used instead of -mstack-check to enable stack checking.
GCC changes and enhancements:
- The -Wa,-relax-all flag in nios2-elf-gcc GCC 4.7.3 supports function calls and programs exceeding the 256MB limit.
- When used with optimization, inline assembly code with the asm operator needs to declare values imported from C and exported back to C, using the mechanisms described in http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Extended-Asm.
- Pre-standard C headers are not supported in GCC 4.7.3. Replace pre-standard C with standard C eg. #include <iostream.h>, cout, endl with #include <iostream>, std::cout and std::endl respectively.
- The compile flag -Wl,--defsym foo=bar where bar is an undefined symbol, will generate error at the linker level in GCC 4.7.3. GCC 4.1.2 does not include this check.
GNU also provides a porting guide to GCC4.7 to document common issues : http://gcc.gnu.org/gcc-4.7/porting_to.html
Full GCC release notes are available at http://gcc.gnu.org/releases.html.