<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: M0 inline assembly: subs r0, #32 not supported in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564360#M17538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Wed Apr 28 07:32:12 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;When you compile for LPC11xx (cortex-m0), the compiler will automatically set the following define:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define __ARM_ARCH_6M__ 1&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;When you compile for LPC13xx/LCP17xx (cortex-m3), the compiler will automatically set&amp;nbsp; the following define:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define __ARM_ARCH_7M__ 1&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;You should be able to use these defines to conditionally include the appropriate code for your target.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To see all the defines generated by the compiler, Ctrl-click on the project name in the bottom right of the status bar of the LPCXpresso IDE to open a command prompt with the compiler tools set up on the path. Then enter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -E -dD -&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;After pressing Enter, press Ctrl-Z and Enter again. The list of defines will be displayed on screen. [Note - change the processor to cortex-m0 if you are interested in LPC11 rather than LPC13/17.]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:16:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:16:49Z</dc:date>
    <item>
      <title>M0 inline assembly: subs r0, #32 not supported</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564357#M17535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rkiryanov on Tue Apr 27 09:02:12 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Building file: ../src/OS/os_kernel.cpp&lt;BR /&gt;Invoking: MCU C++ Compiler&lt;BR /&gt;arm-none-eabi-c++ -DNDEBUG -D__CODE_RED -O3 -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -Wa,-ahlnds=os_kernel.asm -mcpu=cortex-m0 -mthumb -D__NEWLIB__ -MMD -MP -MF"src/OS/os_kernel.d" -MT"src/OS/os_kernel.d" -o"src/OS/os_kernel.o" "../src/OS/os_kernel.cpp"&lt;BR /&gt;C:\DOCUME~1\user\LOCALS~1\Temp\ccs4Wgyb.s: Assembler messages:&lt;BR /&gt;C:\DOCUME~1\user\LOCALS~1\Temp\ccs4Wgyb.s:3676: Error: instruction not supported in Thumb16 mode -- `subs r0,#32'&lt;BR /&gt;C:\DOCUME~1\user\LOCALS~1\Temp\ccs4Wgyb.s:3683: Error: instruction not supported in Thumb16 mode -- `subs r0,#32'&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DDI0419B_arm_architecture_v6m_reference_manual_errata_markup_2_0.pdf&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;A6.7.65 SUB (immediate)&lt;BR /&gt;This instruction subtracts an immediate value from a register value, and writes the result to the destination register. The condition flags are updated based on the result.&lt;BR /&gt;&lt;BR /&gt;Encoding T2 All versions of the Thumb ISA.&lt;BR /&gt;SUBS &amp;lt;Rdn&amp;gt;,#&amp;lt;imm8&amp;gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:16:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564357#M17535</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: M0 inline assembly: subs r0, #32 not supported</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564358#M17536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Tue Apr 27 09:32:44 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This works for me....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void test(unsigned int a, unsigned int b)
{
asm(".syntax unified");
asm("subs r0, #32;");
asm(".syntax divided");
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect you might be missing the .syntax directives.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:16:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564358#M17536</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: M0 inline assembly: subs r0, #32 not supported</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564359#M17537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rkiryanov on Wed Apr 28 06:43:34 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I determine, what is core selected? I want to use Cortex-M3 instructions if possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#if (__CORE__ == __ARM7M__) // IAR
// code for ARMv7-M: it, stmdb, ldmia, clz
#else
// code for ARMv6-M: beq, mov, mov, mov, stm, mov, subs
#endif&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:16:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564359#M17537</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: M0 inline assembly: subs r0, #32 not supported</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564360#M17538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Wed Apr 28 07:32:12 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;When you compile for LPC11xx (cortex-m0), the compiler will automatically set the following define:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define __ARM_ARCH_6M__ 1&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;When you compile for LPC13xx/LCP17xx (cortex-m3), the compiler will automatically set&amp;nbsp; the following define:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define __ARM_ARCH_7M__ 1&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;You should be able to use these defines to conditionally include the appropriate code for your target.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To see all the defines generated by the compiler, Ctrl-click on the project name in the bottom right of the status bar of the LPCXpresso IDE to open a command prompt with the compiler tools set up on the path. Then enter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -E -dD -&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;After pressing Enter, press Ctrl-Z and Enter again. The list of defines will be displayed on screen. [Note - change the processor to cortex-m0 if you are interested in LPC11 rather than LPC13/17.]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:16:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/M0-inline-assembly-subs-r0-32-not-supported/m-p/564360#M17538</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:16:49Z</dc:date>
    </item>
  </channel>
</rss>

