<?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>add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114023/add-large-assembly-code-to-a-zephyr-project</link><description>Hi, I have a nRF5340 Development Kit. I want to add a large amount of assembly code from a previous Cortex M4 project (from PSoC Creator 4.2). Project has *.s files and *.h files. 
 How can I adapt the assembly code into the Zephyr project? Where I can</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Aug 2024 20:29:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114023/add-large-assembly-code-to-a-zephyr-project" /><item><title>RE: add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/thread/500636?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2024 20:29:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c017b04a-b621-4928-984e-f1e0c016983a</guid><dc:creator>Johnny Nguyen</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/droidecahedron/hello_world_asm/tree/main"&gt;droidecahedron/hello_world_asm (github.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is a bare minimum sample showing both inline and externally called asm. I don&amp;#39;t protect my registers, sp, etc. It is just showing how to call an asm fn in an NCS C application inline and externally.&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll have to add the assembly files&amp;nbsp;to cmakelists similar to C source files and have C-callable assembly functions.&lt;/p&gt;
&lt;p&gt;If it just runs on the app core, it mostly just has to play nice with the RTOS wherever and however you&amp;#39;re calling the asm functions.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve not tested this kind of use case extensively, and as&amp;nbsp;&lt;span&gt;&amp;Oslash;yvind mentioned you&amp;#39;ll have to make sure your *.s assembler source code will be compliant with M33 if your intention is to use the 5340 and it was written for M4.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;There is not a lot of documentation around this, as&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp;mentioned I referenced the Zephyr .s files to write this basic arithmetic. Depending on what the end goal of the application is, how much work has to be done, and what the asm libraries do, I would heavily consider a port to C.&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: add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/thread/499097?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2024 15:42:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3522464c-0bf1-4ca0-b5ad-3d78a42a75df</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Perhaps look at some of the Zephyr .s files for example usage, eg reset.s although they tend to use a lot of macros which is unfortunate&lt;/p&gt;
&lt;p&gt;&lt;em&gt;C:\ncs\v2.7.0\zephyr\arch\arm\core\header.s&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;C:\ncs\v2.7.0\zephyr\arch\arm\core\cortex_m\reset.s&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/thread/498979?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2024 08:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5059e9e-f79c-44e7-b8a9-30eb0a9471f5</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;There isn&amp;#39;t much documentation on writing assembly in our nRF Connect SDK (based on Zephyr RTOS). Most of the code is based on C and some C++. I&amp;#39;m not able to provide more information for assembly I&amp;#39;m afraid.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You could &lt;a href="https://discord.com/invite/Ck7jw53nU2"&gt;try reaching out to the Zephyr community on Discord&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/thread/498924?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 22:28:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d837548e-d816-4ec6-90e3-751e6a5e3eec</guid><dc:creator>A Lin</dc:creator><description>&lt;p&gt;Hello, Thank you for your answer.&lt;/p&gt;
&lt;p&gt;I forgot the highlight that my code has to reside on the Application processor.&lt;/p&gt;
&lt;p&gt;BTW: how do I know what source code is compiled for one Code and what code is compiled for the other?&lt;/p&gt;
&lt;p&gt;I read that sentence ... but is not clear for me how?&lt;/p&gt;
&lt;p&gt;I create a new *.s file and what should I write in order to define a function?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have any link to documentation related to: how to write ASM code (not in line ... because I have a large amount of ASM code).?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: add large assembly code to a Zephyr project</title><link>https://devzone.nordicsemi.com/thread/498832?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 12:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae369e78-0f65-4a99-b310-d744cc168d63</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note that the nRF5340 SoC&amp;nbsp;has&amp;nbsp;&lt;span&gt;two Arm&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Cortex&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt;-M33 processors:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;128/64 MHz Arm Cortex-M33 application processor with 1 MB Flash &amp;amp; 512 KB RAM&lt;/li&gt;
&lt;li&gt;64 MHz Arm Cortex-M33 network processor with 256 KB Flash &amp;amp; 64 KB RAM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You will need to make sure that the assembly code is compliant with the M33 processors.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding assembly in the Zephyr project, it should be fully compatible with the os.&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/develop/application/index.html#overview"&gt;Please see&amp;nbsp;Application Development in the Zephyr OS&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&lt;strong&gt;main.c&lt;/strong&gt;: A source code file. Applications typically contain source files written in C, C++, or assembly language. The Zephyr convention is to place them in a subdirectory of&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;app&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;named&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;src&lt;/span&gt;&lt;/code&gt;.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>