When using FAST and locking the F28069M MCU using the CSM, all _IQ() macros produce the value 0. By stepping through the disassembly I found the cause.
This happens because the _IQ() macro uses the constant 16777216.0L which is located into Flash, but tries to use it from the FD$$MPY function which is FAST ROM. Since FAST-ROM does not have access to the user protected Flash, the value 0 is used and the _IQ() macro returns value 0.
Edited to add solution:
{
The project was missing the Link Order settings, causing the linker to use FD$$MPY in FAST-ROM instead of linking in the version from rts2800_ml.lib.
}
One solution mentioned in the relevant documentation is to move .econst to unprotected RAM, like RAML7. This moves *all* constants to RAM, which is a waste of RAM. There must be a better solution.
I see two possible solutions;
- Make the linker include an FD$$MPY function in Flash, and ignore the one in FAST ROM for user code
- Selectively move only part of the constants to RAM, instead of all of them
The first solution seems preferable. More general, I would like to tell the linker that it should not use the math functions in FAST-ROM provided by 2806xRevB_FastSpinROMSymbols.lib for code running from protected user Flash. I don't know enough deep linker configuration wizardry to correctly tell the linker what I want it to do. Please help :)
Cheers,
Rob