This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 CMSIS DSP code bloat

Using SES v1.6.1 with the nRF9160 module, I added the necessary CMSIS DSP defines for my project. Each define compiles a lot of files and it does not look like the linker includes only files used.

My code size has went over 466Kb. After adding more unrelated features, the code went over the 512Kb mark after which I remark part of the added code since I do not want to get into adjusting boot loader defines yet (a learning curve also there).

 We need the CMSIS libraries and the calculations seems to work but it looks like the linker adds a ton of functions that are not even called.
 Is there a way that the linker will remove them or should I just select all of the files I need in a new directory (bad I know).  How can I determine which files are used or not?


  CONFIG_CMSIS_DSP=y
  CONFIG_CMSIS_DSP_SUPPORT=y
  CONFIG_CMSIS_DSP_FASTMATH=y
  CONFIG_CMSIS_DSP_COMPLEXMATH=y
  CONFIG_CMSIS_DSP_STATISTICS=y
  CONFIG_CMSIS_DSP_TRANSFORM=y

Thanks David

Parents Reply Children
  • I made a post to the ARM forum and got this reply:

    This forum is about the core/cpu not compilers/tools. Esp. not Zephyr. Anyway, since you did not tell which compiler/linker one can only guess. But the manual for your linker might tell you.

     So I have a couple of more questions.

     1) If I try some of the gcc ccompiler|linker flags such as "arm-strip --strip-unneeded" will it not remove any vital Nordic code? Are dead code removal flags already used by the Nordic defaults?

    2) Would it help if I created somehow a CMSIS DSP library and added it to my code?

    How can I create a library from the CMSIS DSP code? It does not look like the SES New Connect project would make a library with the proj.conf and CMakeLists.txt.

    Thanks David

  • You can create a static library for all the dsp code.  You need to create a new static library project not using ncs or create a makefile to compile the library.  After that you can add the library to ncs project.  The linker then takes only what is used from the library.  Contrary to adding code into the project, the linker will link everything.  That is why they have to add thousands of defines to select what to compile which is a very bad programming practice.   

  • I created a library using SES without the CONNECT infrastructure but since the CONNECT project does not have the normal SES options settings, I do not know how to add the library to try in in my project.

    Thanks David

  • I have not used SES much but I think you might be able manually add the library via the SES project settings.  However you may lose it if ncs is used again to modify the project.  Unfortunately, there are currently no other options without zephyr. I hope there will be a bare metal aka nRF5_SDK version in the future.     

Related