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.

Cortex-R4 CMSIS DSP Library

Hello,


I installed the CMSIS DSP Library, and I am trying to select it in (code replacement library) pane in (configuration paramters) of simulink but I can not find it!!

Is it possible to know how can I solve this problem?

Many thanks in advance.

  • Hi Ah El,

    It's not preconfigured in Simulink for the Cortex R.. You would need to map each block to it's replacement function individually.
  • Thanks for your reply.

    But here in this Video from Mathworks, it exists (minute: 22:55)

    au.mathworks.com/.../ti-hercules-mcu-optimized-code-from-simulink-for-iec-61508-and-iso-26262-92003.html
  • Yes that was done by selecting the block being used and mapping it to the simulink function - rather than by applying a 'global' selection.
  • Looking back at my notes - I think we used 'crtool' command from the prompt to map the relevant block to the CMSIS DSP lib.
    Will need to research this more. It wasn't hard to do for a given model.. building a table that covers all the possible blocks though is a bigger effort and we haven't done that yet.
  • So my PC happens to not be setup to build the example at the moment - have updated MATLAB to the latest version and haven't gotten the PIL package setup. Will probably take a few days to get to where I can give you a recipe to do this optimization. Wasn't hard at all - and basically it's 90% the same as Cortex M CMSIS DSP.. There were a few exceptions when we went through the list but they were all cases where the M needed a math 'function' for something that the R supported natively --- like the 32-bit integer divide where the R has a special pipeline and opcode..
  • Hello Seely,

    I am waiting for you to give me a recipe to do this optimization, actually I downloaded a "R4 CMSIS DSP Library" but don't know exactly how to use it with "crtool"

    www.ti.com/.../hercules-dsplib

    Best Regards,

    Ah El

  • Hi Ah El,

    Yes thanks for the reminder. I need to refresh my memory on this as well.

    BTW what version ML are you using? I don't want to use one that is too much older or too much newer...
  • Thanks for answering, I am using MATLAB Version: 8.6.0.267246 (R2015b)
  • Hello Seely,

    I am just reminding you of the optimization for the code replacement library.

    Kind Regards
  • Hi,

    I thought I should mention, you may not need to write your own code replacement library. 

    The Mathworks already has created a CMSIS DAP Code Replacement Library (CRL) for the ARM Cortex-M series of processors. Since, TI's CMSIS CRL is functionally the same as the ARM Cortex-M CMSIS DAP library, I believe you should be able to use this code replacement library with your Hercules processor. (I should mention that I haven't tested this out on a hercules processor yet)

    Here is how you can get the CRL, and subsequently use this in your PIL Simulation:

    1) Download and install the ARM Cortex-M CMSIS DSP Library Support Package. This particular support package requires both an Embedded Coder License, as well as a DSP Systems Toolbox License. If you do not have a DSP Systems Toolbox license, you we do ship a code replacement library for only Math and Fixed Point operations with the ARM Cortex-M Support Package.

    2) Once you have installed the support package, in your Simulink model, you should see an entry that looks like this:

    Now, if you generate code from your Simulink model, Math and DSP operations should be replaced with calls to the CMSIS's math and dsp functions.

    3)I am assuming you want to run your model on your Hercules processor.

    To do this you have two options: 

    • Download Anthony's File Exchange entry : TI Hercuels PIL Target for RM48. Anthony's target will allow you to run a PIL simulation (for verification of numerical accuracy) on an RM48 processor with a  XDS100v2 debug probe (this is on-board with the RM48 development kit). The target has the following features:
      • PIL,
      • PIL Profiler,
    • Download the Mathworks Support Package for ARM Cortex-R processors. This support package includes a Target for the Hercules RM57 processor (you could use the $29 RM57 launchpad that includes an on-board XDA110 emulator). The target will have the following features:
    • PIL,
    • PIL Profiler,
    • External mode,
    • Real-Time scheduling (with FreeRTOS),
    • Real Time Execution Profiling
    • GIO blocks (LED and Push buttons)

    Unfortunately, the official support package is only going to be available in the R2016b release which will be out on September 14th 2016. If you would like to evaluate this support package, I could give you an evaluation version of the support package that will work the R2016b Pre-release.

    If you are using Anthony's PIL Target, after the math and DSP operations have been replaced, in order to make the generated executable link successfully, you will need to link in the relevant TI CMSIS Library.

    Here's how you do it. Type:

    >>edit TI_HERCULES_RM48Pil.TargetApplicationFramework

     and in constructor, add these lines:

    buildInfo = this.getBuildInfo;

    buildInfo.addLinkObjects(‘ti_math_Cortex_R4_lspf.lib’, ‘C:\ti\Hercules\Cortex-R4 CMSIS DSP Library\1.0.0\Lib’, 1000, true, true); 

    %replace the path and library accordingly. LSPF should be for the RM48 but BSPF should be for the TMS570

    Now, when you run a PIL Simulation, the TI CMSIS Libarary will get Linked into the generated executable. 

    I hope this helps. 

  • In addition to adding the library to build, you need to add 1 include path as well as 1 define.

    So in constructor, add these lines:

    buildInfo = this.getBuildInfo;

    lpath = 'C:\ti\Hercules\Cortex-R4 CMSIS DSP Library\1.0.0';

    buildInfo.addLinkObjects(‘ti_math_Cortex_R4_lspf.lib’, fullfile(lpath, ‘Lib’), 1000, true, true); 
    %replace the path and library accordingly. LSPF should be for the RM48 but BSPF should be for the TMS570

    buildInfo.addIncludePaths(fullfile(lpath, 'Include'));

    buildInfo.addDefines({'CCS', 'UART_SUPPORT'});

    I've verified that this makes the appropriate replacements.