QNX support for using Freescale E500 SPE
This technote provides details about the QNX support for using Freescale E500 SPE.
The IDE includes support for the Freescale MPC8548 (e500v2 core) PowerQUICC III Processor with on-chip Signal-Processing Engine (SPE) APU (Auxiliary Processing Unit) and the Freescale MPC8572 PowerQUICC III Processor with on-chip SPE APU. Support for using Freescale E500 SPE is available by:
If full IEEE 754 support is required by an application (to support the full IEEE 754 standard), the PPC SPE embedded floating point (EFP) fpassist.so library must be on the dynamic loader search path. The PPC floating point library, fpemu.so, shouldn't be installed (it's not used by an SPE libc even if it's installed). By default, the EFP hardware is reasonable for handling floating point. In addition, as with all software implementations, you'll need to be aware of the significant performance decrease when you use full IEEE 754 compliance.
You'll need to review the E500 documentation to determine if the default hardware behaviour is adequate for your needs. The features that aren't available from the hardware include, but are not limited to the following:
- gradual underflow (i.e. subnorm/denorm numbers)
- IEEE NaN/Inf handling
- rounding towards +Inf/-Inf
Every thread that requires full IEEE 754 behaviour must call any of the various QNX Neutrino math library functions that control the floating point exception environment.
If the PPC SPE embedded floating point (EFP) fpassist.so library isn't part of the image, you won't have full IEEE compliance. However, you should use this library only when you require full compliance because using this library is slower, and there are also other performance tradeoffs to consider.
For SPE floating Point instructions, fpemu.so supports the classic instructions only. This means that fpemu.so is present for non-SPE configurations (builds), and that fpassist.so is present for SPE configurations. So, fpemu.so and fpassist.so are mutually exclusive; you can only use one at a time. However, if you use SPE libc, fpemu.so will be completely ignored.
If fpassist.so is installed and you call any of the functions below, the first call will place the thread into full IEEE 754 mode; however at present, there is no way to turn off this mode; once placed into full IEEE 754 mode, it remains set.
The most basic functions that set the floating point environment to trigger IEEE behaviour are:
- Dinkum C99 library interface functions:
- QNX-specific functions:
The fe*() functions are from the Dinkum C99 interface; they are also supported by QNX Neutrino in C90. However, the Dinkum C99 FENV_ACCESS() pragma isn't supported.
The fp*() functions are QNX Neutrino specific, and are all implemented in terms of the Dinkum C99 interface.
In full IEEE 754 mode, SIGFPE will still be delivered to the faulting thread for operations that result in IEEE 754 exceptions that are unmasked.
The IDE includes support for the Freescale e500 SPE. To use Freescale E500 SPE, you'll need to add the -me500v2 option to your compiler, linker, and assembler. However, once set, you won't be able to include regular PPC binaries with the ones for which you specified the -me500v2 option. In addition, for your older legacy binaries, you won't be able to take advantage of SPE.
The e500 PPC core contains an SPE unit, that has a FPU that is different from the classic PPC FPU. The QNX kernel supports the SPE registers, and the Command Line tools are able to generate SPE code by supporting the compiler, assembler, and linker. In addition, the libraries — in particular the libm library — were rebuilt because of the change in the ABI (because e500 doesn't have fp registers, so it needs a new ABI; no compiler with the classic PowerPC ABI will work for e500.)
From the command line, to build for SPE, you'll need to specify the following command:
qcc -Vgcc_ntoppcbe -me500v2
After adding new conf files, you'll need to specify the following command:
By default, the qcc -Vgcc_ntoppcbespe has the -me500v2 option enabled.
If either you, or the IDE, creates a o-be-spe or o.be.spe variant directory, the Makefiles will add the -me500v2 option to CCOPTS, ASOPTS, and LDOPTS, which will then be passed to the compiler, assembler, and linker, thereby enabling support for Freescale E500 SPE.
For debug, nothing is required; SPE information is retrieved from the binary.
In the IDE, to create a new target with Freescale e500 SPE support, do the following:
- Create a new target.
- Select the SPE option to automatically enable Freescale E500 SPE.
- Run the application.
The compiler, assembler, and linker will automatically be enabled for Freescale E500 SPE.