{"id":1773,"date":"2014-05-28T18:24:24","date_gmt":"2014-05-28T12:54:24","guid":{"rendered":"http:\/\/www.e-consystems.com\/blog\/windowsce\/?p=1154"},"modified":"2024-03-19T13:45:52","modified_gmt":"2024-03-19T08:15:52","slug":"wec2013-thumb2-arm-pre-ual-syntax-and-its-equivalent-ual-syntax-part-2","status":"publish","type":"post","link":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wec2013-thumb2-arm-pre-ual-syntax-and-its-equivalent-ual-syntax-part-2\/","title":{"rendered":"Resolving compilation issues in WEC2013 porting \u2013 Part2"},"content":{"rendered":"<p>This blog is the continuation of <a href=\"https:\/\/www.e-consystems.com\/blog\/windowsce\/wec-2013-thumb2-arm-pre-ual-syntax-and-its-equivalent-ual-syntax\/\">Windows Embedded Compact 2013 THUMB2 ARM  pre UAL syntax and its equivalent UAL syntax<\/a> blog post to cover the missing  items.<\/p>\n<table width=\"540\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td width=\"180\" valign=\"top\"><strong>Pre UAL syntax mnemonic<\/strong><\/td>\n<td width=\"180\" valign=\"top\"><strong>UAL syntax mnemonic<\/strong><\/td>\n<td width=\"172\" valign=\"top\"><strong>Remarks<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">stmia&nbsp;&nbsp; r0!, {r7, r13,    r14}<\/td>\n<td valign=\"top\">stmia&nbsp;&nbsp;  r0!, {r7-r12}<br \/>\nstr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sp,    [r0], #4<br \/>\nstr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  lr,    [r0], #4<\/td>\n<td valign=\"top\">You can&rsquo;t access sp,lr and pc registers directly through stmia instruction.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">ldmia&nbsp;&nbsp; r0!, {r7,    r13, r14}<\/td>\n<td valign=\"top\">ldmia&nbsp;&nbsp; r0!,    {r7-r12}<br \/>\nldr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp, [r0], #4<br \/>\nldr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    lr, [r0], #4<\/td>\n<td valign=\"top\">You    can&rsquo;t access sp,lr and pc registers directly through ldmia instruction.<\/td>\n<\/tr>\n<tr>\n<td  valign=\"top\">mcr &nbsp; p15, 0, r15, c7, c14,    0<\/td>\n<td  valign=\"top\">mov&nbsp;&nbsp;&nbsp; r1, r15<br \/>\nmcr&nbsp;&nbsp;&nbsp;&nbsp; p15, 0, r1, c7, c14, 0<\/td>\n<td  valign=\"top\">R15 or PC can&rsquo;t be directly used in mcr instruction<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">msr&nbsp;&nbsp; cpsr_c, #SYS_MODE<\/td>\n<td valign=\"top\">mov&nbsp;&nbsp; r1,    #SYS_MODE<br \/>\nmsr&nbsp;&nbsp; cpsr_c, r1<\/td>\n<td valign=\"top\">Expected register operant<\/td>\n<\/tr>\n<\/table>\n<p><\/br>Whenever you are trying to use co processor  15 you may get the warning as to use ISB, DSB&nbsp;  or DMB instruction. These instructions are called memory barrier  instructions.<br \/>\n<\/br>In some circumstances, processor  optimizations such as&nbsp;speculative reads or&nbsp;out-of-order execution (as  in the example above), are undesirable and can lead to unintended program  behaviour. &nbsp;In such situations it is necessary to insert barrier  instructions into code where there is a requirement for stricter, &#8216;Classic ARM  processor-like&#8217; behaviour. &nbsp;There are three types of barrier instructions.  &nbsp;For simplicity, note that the descriptions below are for a uni-processor  environment:<\/p>\n<ul type=\"disc\">\n<li>A <strong>Data Synchronization       Barrier (DSB)<\/strong>&nbsp;completes when all instructions before this       instruction complete.<\/li>\n<li>A <strong>Data Memory Barrier       (DMB)<\/strong>&nbsp;ensures that all explicit memory accesses before the DMB       instruction complete before any explicit memory accesses after the DMB       instruction start.<\/li>\n<li>An <strong>Instruction&nbsp;Synchronization Barrier (ISB)<\/strong>&nbsp;flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the ISB has been completed.<\/li>\n<\/ul>\n<p>Note that  the CP15 equivalent barrier instructions available in ARMv6 are deprecated in  ARMv7. Therefore, if possible, it is recommended that any code that uses these  instructions is migrated to use the new barrier instructions described above  instead.<\/p>\n<p>For example,<\/p>\n<a href=\"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-content\/uploads\/2014\/05\/WEC2013-THUMB2-ARM-UAL-syntax.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-content\/uploads\/2014\/05\/WEC2013-THUMB2-ARM-UAL-syntax.jpg\" alt=\"WEC 2013 THUMB2 ARM pre UAL syntax and its equivalent UAL syntax\" title=\"WEC2013-THUMB2-ARM-UAL-syntax\" width=\"602\" height=\"136\" class=\"size-full wp-image-1157\" \/><\/a>\n<p>Hope this will help you to resolve the pre  UAL and UAL changes in Windows Embedded Compact 2013.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog is the continuation of Windows Embedded Compact 2013 THUMB2 ARM pre UAL syntax&#8230;<\/p>\n","protected":false},"author":12,"featured_media":1271,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[213,216],"tags":[263,273,287,300,320],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1773"}],"collection":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/comments?post=1773"}],"version-history":[{"count":2,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1773\/revisions"}],"predecessor-version":[{"id":3014,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1773\/revisions\/3014"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media\/1271"}],"wp:attachment":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media?parent=1773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/categories?post=1773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/tags?post=1773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}