<?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 find and set library dependencies and configuration?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55294/how-to-find-and-set-library-dependencies-and-configuration</link><description>Hello, 
 I&amp;#39;ve just recently started learning to develop on the nrf52 platform after 2 years of frustration trying to learn of how to develop on the Nordic platform I finally decided to purchase one of the only courses I could find that teach the &amp;quot;foundations</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Dec 2019 10:07:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55294/how-to-find-and-set-library-dependencies-and-configuration" /><item><title>RE: How to find and set library dependencies and configuration?</title><link>https://devzone.nordicsemi.com/thread/225569?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 10:07:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cac8ded2-d784-4496-aa60-20c24eeaaf19</guid><dc:creator>Simon</dc:creator><description>[quote user="MikeLemon"]But this doesn&amp;#39;t answer my educational part of the question which was how do you figure out which other libraries you need to use for say &amp;quot;nrf_serial.h&amp;quot; and similar libraries like that how do you approach it?[/quote]
&lt;p&gt;If you want to use the functions in &amp;quot;nrf_serial.h&amp;quot; you first have to add the associated source file nrf_serial.c. Then you should look in these files to see what libraries/drivers you need to add to your project. E.g. in nrf_serial.h these header files are listed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;

#include &amp;quot;nrf_drv_uart.h&amp;quot;
#include &amp;quot;nrf_queue.h&amp;quot;
#include &amp;quot;nrf_mtx.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You need to add the paths to these files, in addition, you have to implement the associated source files.&lt;/p&gt;
&lt;p&gt;In&amp;nbsp;&lt;span&gt;nrf_serial.c the following file is listed:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;sdk_common.h&amp;quot;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You don&amp;#39;t have to worry about this file if you start with an existing project, e.g. ble_app_template.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You repeat this process with the files nrf_drv_uart.h, nrf_queue.h, nrf_mtx.h and app_timer.h.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to find and set library dependencies and configuration?</title><link>https://devzone.nordicsemi.com/thread/224289?ContentTypeID=1</link><pubDate>Sun, 08 Dec 2019 22:09:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:960302cc-0416-452f-85f9-7e2254c105c5</guid><dc:creator>MikeLemon</dc:creator><description>&lt;p&gt;Hi Thanks for the detailed explanation about how to add the libraries ended up taking one example that contains most everything I needed and go from there,&lt;/p&gt;
&lt;p&gt;But this doesn&amp;#39;t answer my educational part of the question which was how do you figure out which other libraries you need to use for say &amp;quot;nrf_serial.h&amp;quot; and similar libraries like that how do you approach it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to find and set library dependencies and configuration?</title><link>https://devzone.nordicsemi.com/thread/224192?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2019 13:26:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99452341-103d-42af-87aa-bcc2099ec398</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;My approach:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I always start with an existing project, most similar to the end goal and build on that&lt;/li&gt;
&lt;li&gt;I always use a BLE example (if your solution uses BLE, which I assume) as the base project and merge functionality from other projects into that. From my experience that is the easiest approach, not the other way around.
&lt;ul&gt;
&lt;li&gt;E.g. if I want to develop a solution with SPI and BLE, then I start with a BLE project (e.g. examples\ble_app_uart) and use an SPI example (e.g.&lt;em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;examples\peripheral\spi&lt;/em&gt;) as a guideline of what to add into it&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Then I add the specific functions into the BLE example, for example, the function&amp;nbsp;&lt;em&gt;nrf_drv_spi_init(..)&amp;nbsp;&lt;/em&gt;from&amp;nbsp;&lt;em&gt;examples\peripheral\spi.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Then I go through these steps:
&lt;ul&gt;
&lt;li&gt;Put the function into&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;main()&lt;/em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and build the example&lt;/li&gt;
&lt;li&gt;Get error messages&lt;/li&gt;
&lt;li&gt;Go into main.c of&amp;nbsp;&lt;em&gt;examples\peripheral\spi&amp;nbsp;&lt;/em&gt;right click on the function&amp;nbsp;&lt;em&gt;nrf_drv_spi_init(..)&amp;nbsp;&lt;/em&gt;and&amp;nbsp;go to the definition (source file) and declaration (header file) of the function&lt;/li&gt;
&lt;li&gt;include the header file at the top of main.c of&amp;nbsp;&lt;span&gt;examples\ble_app_uart&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Add the path of the header file as explained&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/31247/linker-error---segger-embedded-studio/123471#123471"&gt;here&lt;/a&gt;&amp;nbsp;and the source file as explained&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://www.youtube.com/watch?v=t-kh1EbesvI&amp;amp;list=PLx_tBuQ_KSqGHmzdEL2GWEOeix-S5rgTV&amp;amp;index=6"&gt;here&lt;/a&gt;&amp;nbsp;into&amp;nbsp;&lt;span&gt;examples\ble_app_uart&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Build the example (examples\ble_app_uart)&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;If&amp;nbsp;no errors appear, you have successfully implemented the function&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;If an error appears, follow the steps below&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Look into drivers/sub drivers, and check if the called function is grayed out,&amp;nbsp;and check for the specific config that causes this (in examples\ble_app_uart)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Search for the config in the sdk_config.h of the SPI example (e.g. inside&amp;nbsp;&lt;em&gt;examples\peripheral\spi\pca10040\blank\config&lt;/em&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Copy this config, and the associated configs into the sdk_config.h file of the ble_app_uart project&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;E.g. if SPI_ENABLED is the config you are looking for, then include all the configs that are &amp;quot;caught&amp;quot; between&amp;nbsp;&lt;em&gt;&amp;lt;e&amp;gt;&lt;/em&gt;&amp;nbsp;and&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;lt;/e&amp;gt;&amp;nbsp;&lt;/em&gt;&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;// &amp;lt;e&amp;gt; SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver - legacy layer&lt;br /&gt;//==========================================================&lt;br /&gt;#ifndef SPI_ENABLED&lt;br /&gt;#define SPI_ENABLED 1&lt;br /&gt;#endif&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Repeat these steps for all the functions you wish to implement&lt;/span&gt;&lt;span&gt;&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Be aware that most of the other SPI functions will work fine after completing this once, and you don&amp;#39;t need to do it again&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Following this approach has worked fine for me, and I have never really had any problems&amp;nbsp;merging two projects. If you encounter any specific problems, please create a Devzone ticket and explain it in detail, and someone will help you. I also recommend you to read&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38149/iar-error-pe020-identifier-nrfx_timer1_inst_idx-is-undefined"&gt;this&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/41707/fails-to-use-nrfx-modules"&gt;this&lt;/a&gt;&amp;nbsp;thread regarding NRFX vs. legacy configurations.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Some links&amp;nbsp;you may find helpful:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/30862/create-a-new-project-in-segger-embedded-stuido/129639#129639"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/30862/create-a-new-project-in-segger-embedded-stuido/129639#129639&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/28196/graduating-from-example-to-production-project-file-structure"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/28196/graduating-from-example-to-production-project-file-structure&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/39240/starting-a-new-project-from-scratch"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/39240/starting-a-new-project-from-scratch&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/20093/what-is-the-best-way-to-merge-two-existing-examples-with-segger-embedded-studio"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/20093/what-is-the-best-way-to-merge-two-existing-examples-with-segger-embedded-studio&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/merging-two-ble-examples-together"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/merging-two-ble-examples-together&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38054/how-to-combine-two-sdk_config-h-file"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/38054/how-to-combine-two-sdk_config-h-file&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.youtube.com/watch?v=YZouRE_Ol8g&amp;amp;list=PLx_tBuQ_KSqGHmzdEL2GWEOeix-S5rgTV&amp;amp;index=1"&gt;https://www.youtube.com/watch?v=YZouRE_Ol8g&amp;amp;list=PLx_tBuQ_KSqGHmzdEL2GWEOeix-S5rgTV&amp;amp;index=1&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>