This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Run IQmath library from RAM

Hi all,

My application requires FLASH set to low power state and I need to run some calculation (IQmpy, IQdiv mainly) without waking FLASH up i.e. calling functions from RAM.

Normal division '/' operator results in calling u_tofs28.inc which wake the FLASH up. IQmath are allocated in FLASH hence I am thinking is there anyway to load it to RAM?

Thanks.

  • Soon,
    you can try to place the needed functions in RAMFUNCS user section and let the main() routine copy the functions from Flash to RAM on start up.

    Hope this helps.

    Best Regards
    Santosh Athuru
  • Hi Santosh,

    period = _IQ16div(period, _IQ16(div));

    The above line alone calls to u_tofd28.inc, fd_mpy28.inc, fd_tol28.inc and _IQ16div lib.

    Doing this has no effect #pragma CODE_SECTION(_IQ16div, "ramfuncs");

    I guess what I need to do is put some of the below functions in RAM, but I don't know a way to do so or if that is even possible?

    C$$EXIT
    FD$$MPY
    FD$$TOL
    FS$$ADD
    FS$$CMP
    FS$$DIV
    FS$$MPY
    FS$$NEG
    FS$$SUB
    FS$$TOFD
    FS$$TOI
    FS$$TOL
    FS$$TOU
    FS$$TOUL
    I$$DIV
    I$$MOD
    I$$TOFS
    L$$DIV
    L$$MOD
    L$$TOFS
    U$$TOFD
    U$$TOFS
    UL$$DIV
    UL$$MOD
    UL$$TOFS

  • Temporarily written my own fixed point calculation as solution. Any suggestion on above questions is highly appreciated.
  • Soon,

    see if you can use something like below. The text inside {} below should let you extract the needed functions from IQMATH to the LOAD to Flash and RUN from RAM segments. Rest of the IQMATH can be in flash if needed.

    IQMATHFLASHRAM : load =

    {

    -l IQmath.lib<IQ24sinPU.obj>(IQmath)
    -l IQmath.lib<IQ24cosPU.obj>(IQmath)
    -l IQmath.lib<IQ29rsmpy.obj>(IQmath)

    LOAD = FLASHML,
    RUN = RAMLS0LS1,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    Hope this helps.

    Best Regards

    Santosh Athuru

  • Hi Santosh,

    I am getting error during compilation

    error #10008-D: cannot find file "IQmath.lib"

    How can I fix this?