<?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>Questions on calling external function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48376/questions-on-calling-external-function</link><description>Excuse me, I have a question on calling external function. 
 
 board using: nrf52832 
 softdevice using : s132(6.1.1) 
 
 The situation: There are two applications which is named as app1.c and app2.c . In app1.c, there is the main application which will</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jun 2019 09:08:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48376/questions-on-calling-external-function" /><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/193343?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 09:08:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d25e6bac-5dd1-4902-b871-b738ab478a57</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You&amp;#39;re welcome.&lt;/p&gt;
&lt;p&gt;Be sure to come back and verify the answer once you&amp;#39;ve got it working.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5226._5F00_Verify_2D00_answer_2D00_nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/193277?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 01:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05bdaae9-8cbc-4817-9866-d118a2a407ac</guid><dc:creator>hang</dc:creator><description>&lt;p&gt;Thank you all for being helpful. I would try using library and see what the result is. I truely thank you for all your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/193121?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 09:53:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5495ee76-7857-4318-a328-dab80f117901</guid><dc:creator>awneil</dc:creator><description>[quote userid="2867" url="~/f/nordic-q-a/48376/questions-on-calling-external-function/193050"]a library, which Keil is completely capable of doing, is what you want to do here[/quote]
&lt;p&gt;Absolutely!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="80473" url="~/f/nordic-q-a/48376/questions-on-calling-external-function/193046"]Although library is one the key but it will be inconvenient to implent[/quote]
&lt;p&gt;Go on!&lt;/p&gt;
&lt;p&gt;It is the standard, tried &amp;amp; tested way of doing it!&lt;/p&gt;
&lt;p&gt;It is an order of magnitude &lt;em&gt;&lt;strong&gt;less&lt;/strong&gt; &lt;/em&gt;&amp;quot;inconvenient&amp;quot; than all the messing about with hexfiles you suggest!!&lt;/p&gt;
&lt;p&gt;Seriously: &lt;strong&gt;Just Use A Library!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is exactly what libraries are for.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/193050?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 04:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdf24230-19bb-4b97-afc3-da22d5cd6c2e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Sorry what&amp;#39;s all this &amp;#39;hex file&amp;#39; rubbish. Hex files are generated as the final step of making a complete application, they are just the bits which get dumped on the chip at the end.&amp;nbsp;Trying to do this by having different hex files loaded at explicit memory addresses which functions with fixed addresses is going to be a nightmare to try and sort out even if you were brilliant with Keil and frankly the way you mix up terms in your mail doesn&amp;#39;t give me the feeling you are.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Making a library, which Keil is completely capable of doing, is what you want to do here. You compile the one function you are writing into a library and you send him&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) the library&lt;/p&gt;
&lt;p&gt;2) a header file&lt;/p&gt;
&lt;p&gt;then he adds the library to his keil project and includes the header file and builds the application. That&amp;#39;s it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you change the function you send him a new library, a process which should take you about 10 seconds.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/193046?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 01:54:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f14db18d-66e0-4a71-b4bf-817cddf532b8</guid><dc:creator>hang</dc:creator><description>&lt;p&gt;Thank you for all your help. Library definitely is one of the key to the problem.&amp;nbsp; Refer to tesc, other people&amp;nbsp; making the application is true provided that I am responsible for writting a function for him to call only. The plan is that he will provide me the hex file of the application and I need to link his hex file with my hex file which contains the code of my function written. Searching the internet, it seems that function cannot be independently exists in a hex file given that I am using Keil as the ide. Therefore, may I ask whether I can store my function at another block of memory and link it to the application hex file. Although library is one the key but it will be inconvenient to implent as I have to give the writter couple of files when amendment is required. Again, I am grateful for all the help from you guys :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/192716?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 13:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfee28e4-8774-4e37-95f3-0f9482e194ce</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I also thought it was the other way around at first, but then I read the posts more carefully and it looks like the other people is making the application. Some clarification from &lt;a href="https://devzone.nordicsemi.com/members/hang"&gt;hang&lt;/a&gt; would be good here.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/192706?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 12:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b3124c9-f66e-44ce-8a51-1418c7af6c25</guid><dc:creator>awneil</dc:creator><description>[quote userid="8164" url="~/f/nordic-q-a/48376/questions-on-calling-external-function/192699"]you should use a library[/quote]
&lt;p&gt;Absolutely!&lt;/p&gt;
[quote userid="8164" url="~/f/nordic-q-a/48376/questions-on-calling-external-function/192699"]you provide that library to the person making the application[/quote]
&lt;p&gt;I think it&amp;#39;s actually the other way around - &lt;a href="https://devzone.nordicsemi.com/members/hang"&gt;hang&lt;/a&gt; is the one who is making the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/192699?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 12:50:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e89a4fd-df61-4025-8f9c-3212b1503574</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, &lt;a href="https://devzone.nordicsemi.com/members/hang"&gt;hang&lt;/a&gt; use a library.&lt;/p&gt;
&lt;p&gt;If you do not want the users of the library to see the source code then you can compile the .c files and provide the library as .h files plus compiled object files. Then anyone using your library (e.g. using your function, or set of functions,) can link it into their own project without access to the source. Some of the libraries in the nRF5 SDK is (or was previously) provided this way.&lt;/p&gt;
&lt;p&gt;In the extreme cases where making a library will not work then yes, &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Flib_svc.html"&gt;supervisor calls&lt;/a&gt; may be an option, as it is with our buttonless DFU solution. Please note however that this is a very complex solution that should only be considered in rare cases, and if you know exactly what you are doing.&lt;/p&gt;
&lt;p&gt;From what you have written, you should use a library. Then you provide that library to the person making the application.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/191809?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2019 10:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20749ef4-caf8-4f62-858a-9ee1b6a0ac10</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;That&amp;#39;s a bizarre situation!&lt;/p&gt;
&lt;p&gt;Anyhow, in that case, use a &lt;em&gt;&lt;strong&gt;library&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/191808?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2019 10:32:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78394dae-4797-43f8-9ed4-aa97e189408e</guid><dc:creator>hang</dc:creator><description>&lt;p&gt;Thank you for reply. The method you mentioned cannot work in my case provided that the source code of app1 is written by others and the content of the source code cannot not be accessed by me. He will only provide the hex file of the source code so the job for me is to see whether i can write my own function and save it at other place of the memory. Then, the function can be called by the hex file.&amp;nbsp; Again, thank for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions on calling external function</title><link>https://devzone.nordicsemi.com/thread/191803?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2019 10:02:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aac53b68-1e6d-491f-ad1d-439d12d60a7e</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I think you are waaaay over-complicating the issue!&lt;/p&gt;
&lt;p&gt;What you&amp;#39;re describing doesn&amp;#39;t sound like two &lt;em&gt;applications&lt;/em&gt; at all.&lt;/p&gt;
&lt;p&gt;What you&amp;#39;re describing sounds like just standard programming practice of writing your code in a so-called &amp;quot;modular&amp;quot; fashion,&amp;nbsp; with different functions in different &amp;quot;modules - which usually means separate source &lt;em&gt;files&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://c-faq.com/decl/decldef.html"&gt;http://c-faq.com/decl/decldef.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>