How to import DSP into mbed-os?

Hello, I am trying to import DSP in my project to use arm_math features but I am stuck with no idea how to continue.

  1. Git clone CMSIS_5-develop
  2. Edit cmsis_importer.json, I have added DSP in the last two folders to include
{
  "files" : [
    {
      "src_file" : "CMSIS/Core/Template/ARMv8-M/tz_context.c",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/Source/mbed_tz_context.c"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Config/handlers.c",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config/TARGET_CORTEX_A/handlers.c"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Config/RTX_Config.h",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config/RTX_Config.h"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Config/RTX_Config.c",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config/RTX_Config.c"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv6m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M0/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv6m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M0P/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv8mbl.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M23/irq_armv8mbl.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv7m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M3/irq_cm3.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv8mml.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv7m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/irq_cm4f.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/ARM/irq_armv7a.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_CORTEX_A/irq_ca.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv6m.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_M0/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv6m.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_M0P/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv8mbl.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_M23/irq_armv8mbl.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv7m.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_M3/irq_cm3.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv8mml.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_M33/irq_armv8mml.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv7m.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/irq_cm4f.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/GCC/irq_armv7a.S",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_CORTEX_A/irq_ca.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv6m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_M0/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv6m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_M0P/irq_cm0.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv8mbl.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_M23/irq_armv8mbl_common.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv7m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_M3/irq_cm3.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv8mml.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_M33/irq_armv8mml_common.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv7m.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/irq_cm4f.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/Source/os_systick.c",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/Source/os_systick.c"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Source/IAR/irq_armv7a.s",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_IAR/TARGET_CORTEX_A/irq_ca.S"
    },
    {
      "src_file" : "CMSIS/RTOS2/RTX/Library/cmsis_os1.c",
      "dest_file" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Library/cmsis_os1.c"
    }
  ],
  "folders" : [
    {
      "src_folder" : "CMSIS/Core/Include/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/Include"
    },
    {
      "src_folder" : "CMSIS/RTOS2/Include/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/RTOS2/Include/"
    },
    {
      "src_folder" : "CMSIS/RTOS2/RTX/Include1/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Include1/"
    },
    {
      "src_folder" : "CMSIS/RTOS2/RTX/Include/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Include/"
    },
    {
      "src_folder" : "CMSIS/RTOS2/RTX/Source/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/"
    },
    {
      "src_folder" : "CMSIS/RTOS2/RTX/Source/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/"
    },
    {
      "src_folder" : "CMSIS/Core_A/Include/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/Include/"
    },
    {
      "src_folder" : "CMSIS/Core_A/Source/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/Source/"
    },
    {
      "src_folder" : "CMSIS/DSP/Include/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/DSP/Include/"
    },
    {
      "src_folder" : "CMSIS/DSP/Source/",
      "dest_folder" : "cmsis/CMSIS_5/CMSIS/DSP/Source/"
    }
  ],
   "commit_sha" : [
      "4360b7bbf815c4d812005938c9c27af199803a97",
      "fb354752eb69403ad503c8e53da67da6483776d6",
      "08ab8cc47d8722bf0c767990cd615cf1c427d006",
      "00580ce3f5d64b76342b7f26deed55e842056ea0",
      "c122158d496d59fbd723bdb17bbc7bd5cc95245e"
    ]
}


  1. Remove commit _sha 43a86f30450f8e9cec366434f6f752430847b4cf because
    Response : The command git cherry-pick -x 43a86f30450f8e9cec366434f6f752430847b4cf failed with return code: 128

  2. run python tools\importer\importer.py -c tools\importer\cmsis_importer.json -r ..\CMSIS_5-develop\

    Response : Already on 'feature_CMSIS_5-develop_fd9c719

Nothing has changed in the mbed-os/cmsis directory. Is there any problem with my steps?

I checked your file against Mbed master branch (should be equivalent to 6.15). I was able to get it to work, though I had to remove 08ab8cc47d8722bf0c767990cd615cf1c427d006 instead of the commit hash you mentioned – it looks like that commit hash refers to the previous location of the RTX RTOS before it was moved. Basically, it seems like this importer script is a bit dependent on which mbed version you’re using, so you might have to mess around with it a bit.

One thing that’s useful is, it looks like you can pass the -l DEBUG argument to the script to make it print more information about what it’s doing. That might be helpful in diagnosing what’s going on. Another thing I noticed is, this script doesn’t do a good job cleaning up if the cherry-pick operation fails. You might need to do something like:

git cherry-pick --abort
git checkout YOUR_ORIGINAL_BRANCH
git branch -D feature_CMSIS_5-develop_fd9c719 # delete the branch created by the script

in order to get back to a clean slate in your working directory. Note that this will delete any local uncommitted changes in your repo and any changes that you have committed to feature_CMSIS_5-develop_fd9c719!

After running those commands, removing the offending commit hash, and then running the script again, I was able to get a DSP directory under cmsis/CMSIS_5/CMSIS.

This way you can link a static CMSIS DSP library with your GCC program.