This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

no FPU in memset

How can I tell the linker/compiler not to use memset/memcpy function which use FPU registers?

For example: SCIOPTA allows to limit the use of the FPU for certain tasks (to improve task-switching). Tasks without FPU may not use FPU registers. But the compiler/linker uses optimized versions of memset() which results in an exception.

I tried to compile C files with --fpu none, but this produces link-timer errors.

Parents
  • Hi,

    I'm afraid there's no easy way to avoid this with the ARM Compilation tools.  At link time, if any of the user code was built for VFP then by default armlink will choose a library that is allowed to use the VFP.  It is possible to override the linker's default choice, and force it to use a non-VFP library (see later), but that choice applies to the entire image, so that both your non-VFP and VFP-using functions will end up calling an inefficient non-VFP library.

    When compiling with "--cpu=Cortex-A8", the compiler assumes VFP and NEON are allowed.  To have better control over this, one solution is to compile your non-VFP using functions with "--fpu=SoftVFP", and the VFP-using functions with "--fpu=SoftVFP+VFPv3".  These are link-time compatible.  The linker will select the library functions that use floating point instructions but pass floating point parameters in core registers.  As floating point instructions are still used by the library, that might not be sufficient to achieve the your goal of running some tasks entirely in soft-floating point and some in hard-floating point.

    If all your code is compiled with either "--fpu=SoftVFP" or "--fpu=SoftVFP+VFPv3", the linker’s default choice of an "--fpu=SoftVFP+VFPv3" library can be overridden by adding the name of the soft floating point only library on the linker command line.  In this case no library functions will use hardware floating point, so this is context switch safe, although will not be high performance if your VFP-using code makes heavy use of library functions.  To find the software floating point library location, compile all files with "--fpu=SoftVFP" and use the linker option "--info=libraries" to list the libraries that the linker actually selected.

    The only other solution would be to build _two_ executables, one containing the VFP-using functions and VFP libraries, and the other containing the non-VFP-using functions and non-VFP libraries, then join the two executables together somehow.

Reply
  • Hi,

    I'm afraid there's no easy way to avoid this with the ARM Compilation tools.  At link time, if any of the user code was built for VFP then by default armlink will choose a library that is allowed to use the VFP.  It is possible to override the linker's default choice, and force it to use a non-VFP library (see later), but that choice applies to the entire image, so that both your non-VFP and VFP-using functions will end up calling an inefficient non-VFP library.

    When compiling with "--cpu=Cortex-A8", the compiler assumes VFP and NEON are allowed.  To have better control over this, one solution is to compile your non-VFP using functions with "--fpu=SoftVFP", and the VFP-using functions with "--fpu=SoftVFP+VFPv3".  These are link-time compatible.  The linker will select the library functions that use floating point instructions but pass floating point parameters in core registers.  As floating point instructions are still used by the library, that might not be sufficient to achieve the your goal of running some tasks entirely in soft-floating point and some in hard-floating point.

    If all your code is compiled with either "--fpu=SoftVFP" or "--fpu=SoftVFP+VFPv3", the linker’s default choice of an "--fpu=SoftVFP+VFPv3" library can be overridden by adding the name of the soft floating point only library on the linker command line.  In this case no library functions will use hardware floating point, so this is context switch safe, although will not be high performance if your VFP-using code makes heavy use of library functions.  To find the software floating point library location, compile all files with "--fpu=SoftVFP" and use the linker option "--info=libraries" to list the libraries that the linker actually selected.

    The only other solution would be to build _two_ executables, one containing the VFP-using functions and VFP libraries, and the other containing the non-VFP-using functions and non-VFP libraries, then join the two executables together somehow.

Children