<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to include math CMSIS DSP library in NRF9160?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51656/how-to-include-math-cmsis-dsp-library-in-nrf9160</link><description>Hello! 1-st question - how can i set preprocessor defines using SES and NRF connect options? When i set define like: ARM_MATH_CM3 in proj.conf file, i get an error &amp;quot;malformed line&amp;quot;. 2-nd question: Ok, i set ARM_MATH_CM3 define in arm_math.h file. Include</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Sep 2019 09:30:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51656/how-to-include-math-cmsis-dsp-library-in-nrf9160" /><item><title>RE: How to include math CMSIS DSP library in NRF9160?</title><link>https://devzone.nordicsemi.com/thread/207332?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:30:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2addce5-1328-4fbf-9589-f00b42bb17f5</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="72754" url="~/f/nordic-q-a/51656/how-to-include-math-cmsis-dsp-library-in-nrf9160"]1-st question - how can i set preprocessor defines using SES and NRF connect options?[/quote]
&lt;p&gt;You can set it in the CMakeLists.txt with &lt;a href="https://cmake.org/cmake/help/v3.1/command/add_definitions.html"&gt;add_definitions()&lt;/a&gt;&lt;/p&gt;
[quote userid="72754" url="~/f/nordic-q-a/51656/how-to-include-math-cmsis-dsp-library-in-nrf9160"]ARM_MATH_CM3 define in arm_math.h file.&amp;nbsp;Include lines with sources in CMakeLuists.txt[/quote]
&lt;p&gt;The nRF9160 uses a &lt;span&gt;ARM Cortex-M33 CPU. The &lt;a href="https://github.com/ARM-software/CMSIS/blob/master/CMSIS/Include/arm_math.h"&gt;CMSIS DSP Library&lt;/a&gt;&amp;nbsp;is only for&amp;nbsp;Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0.&lt;/span&gt;&lt;/p&gt;
[quote userid="72754" url="~/f/nordic-q-a/51656/how-to-include-math-cmsis-dsp-library-in-nrf9160"]How should i correctly include and use math functions in NRF9160?[/quote]
&lt;p&gt;&lt;span&gt;In order to use&amp;nbsp;math.h , set&amp;nbsp;CONFIG_NEWLIB_LIBC=y in your prj.conf&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;EDIT 26.05.2020:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Starting from nRF Connect SDK v1.3.0, there is support for CMSIS Version v5.&amp;nbsp;A arm_math.h library with support for&amp;nbsp;ARM Cortex-M33 / Armv8-M is included there.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Set these config&amp;#39;s in you project to use it:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_CMSIS_DSP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_FPU=y
//Set CONFIG_NEWLIB_LIBC_FLOAT_PRINTF if  printf should be able to print float
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And&amp;nbsp;use&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;#include&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;lt;arm_math.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;in the application code to start using CMSIS DSP functions.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>