<?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>Kinetis Design Studio中的主题 Re: KDS: variable optimized out when compile with O2 and LTO option</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732991#M9451</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have documented how I have been fixing that warning message caused by -flto in &lt;A class="link-titled" href="https://mcuoneclipse.com/2018/05/31/gnu-link-time-optimization-finds-non-matching-declarations/" title="https://mcuoneclipse.com/2018/05/31/gnu-link-time-optimization-finds-non-matching-declarations/"&gt;GNU Link Time Optimization finds non-matching Declarations | MCU on Eclipse&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is useful,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2018 10:17:55 GMT</pubDate>
    <dc:creator>BlackNight</dc:creator>
    <dc:date>2018-05-31T10:17:55Z</dc:date>
    <item>
      <title>KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732986#M9446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all. I have two questions.&lt;/P&gt;&lt;P&gt;In the startup.c file, the stack pointer declaration _SP_INIT as char[], when I add LTO option with linker, there's a warning: "warning: type of '__SP_INIT' does not match original declaration", I want to disable it, and not know how?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2018-05-30_012414.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/24002i4C6E077993CB73C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-05-30_012414.png" alt="2018-05-30_012414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the second one is that, when compiled with O2, I found a locale variable is optimized out which used in asm instructions. So, my question is that, &lt;STRONG&gt;how to avoid this in ALL of source files generated by Processor Export?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2018-05-30_012837.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/30442i1CA74AA625804A71/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-05-30_012837.png" alt="2018-05-30_012837.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 17:31:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732986#M9446</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-29T17:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732987#M9447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could anybody give some suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 01:44:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732987#M9447</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-31T01:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732988#M9448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been running into this for myself in the past too. I'll put together a more detailed response to you (should be able to provide that today).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I don't see your second problem about that local variable optimized? Can you provide more details about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 03:36:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732988#M9448</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-05-31T03:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732989#M9449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich.&lt;/P&gt;&lt;P&gt;The local variable optimized away when I removed the __attribute__(optimze("O0"))&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="local variable optimzed away.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61349i1A95B84DAEB5D44F/image-size/large?v=v2&amp;amp;px=999" role="button" title="local variable optimzed away.png" alt="local variable optimzed away.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As compare, I remove the comment, and it display as following&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="local variable kept with attribute O0 set.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61350iBA032C6D03A97299/image-size/large?v=v2&amp;amp;px=999" role="button" title="local variable kept with attribute O0 set.png" alt="local variable kept with attribute O0 set.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 06:23:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732989#M9449</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-31T06:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732990#M9450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's normal and expected with higher optimization settings. If you want to keep it, the usual way is to define the variable with 'volatile'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 09:00:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732990#M9450</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-05-31T09:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732991#M9451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have documented how I have been fixing that warning message caused by -flto in &lt;A class="link-titled" href="https://mcuoneclipse.com/2018/05/31/gnu-link-time-optimization-finds-non-matching-declarations/" title="https://mcuoneclipse.com/2018/05/31/gnu-link-time-optimization-finds-non-matching-declarations/"&gt;GNU Link Time Optimization finds non-matching Declarations | MCU on Eclipse&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is useful,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 10:17:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732991#M9451</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-05-31T10:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732992#M9452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Erich, that doc helpful, thanks.&lt;/P&gt;&lt;P&gt;And the second question is that, are there bugs similar with optimized away within other modules generated by PE, e.g. UART, MSCAN, SPI. For I found another problem using UART, which runing ok with O0 compile option, and run to UnhandledInterrupt when UART transmit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 13:26:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732992#M9452</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-31T13:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732993#M9453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when compiled with O2 and LTO, when run to UART_PDD_EnableInterrupt and continue, it run to UnhandledInterrupt, but i can not location the problem accuratly.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61409i783456B71C9B5CEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/61410iC1214E90DC3BF46E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the UART source files attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 13:38:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732993#M9453</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-31T13:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732994#M9454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To know which interrupt is causing this, turn on 'one for every', see &lt;A class="link-titled" href="https://mcuoneclipse.com/2012/02/20/oh-my-an-interrupt/" title="https://mcuoneclipse.com/2012/02/20/oh-my-an-interrupt/"&gt;Oh my! An Interrupt… | MCU on Eclipse&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 13:59:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732994#M9454</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-05-31T13:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732995#M9455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich, that's great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2018 18:41:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732995#M9455</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-05-31T18:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732996#M9456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Erich, I found local variable will optimized away even if volatile added, and GCC's version is arm-none-eabi-gcc 4.9.3.&lt;/P&gt;&lt;P&gt;an usage as follow:&lt;/P&gt;&lt;P&gt;#define CpuCriticalVar()&amp;nbsp;&amp;nbsp; &amp;nbsp;uint8_t cpuSR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define CpuEnterCritical()&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp; do {&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __asm volatile (&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "MRS&amp;nbsp;&amp;nbsp; R0, PRIMASK\n\t"&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "CPSID I\n\t"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "STRB R0, %[output]"&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; : [output] "=m" (cpuSR) :: "r0");&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp; } while(0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define CpuExitCritical()&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp; do{&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __asm volatile (&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "ldrb r0, %[input]\n\t"&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "msr PRIMASK,r0;\n\t"&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ::[input] "m" (cpuSR) : "r0");&amp;nbsp;&amp;nbsp; &amp;nbsp;\&lt;BR /&gt;&amp;nbsp; } while(0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2018 08:18:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732996#M9456</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-06-02T08:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732997#M9457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you would have to mark the cpuSR as volatile.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 15:17:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732997#M9457</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2018-06-04T15:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: KDS: variable optimized out when compile with O2 and LTO option</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732998#M9458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Erich, no effect &lt;STRONG&gt;even if volatile added&lt;/STRONG&gt;, so you can try it with compile option -O2 and linked with LTO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="optimized away even if volatile added.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/23961i200A525C6E2ECEF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="optimized away even if volatile added.png" alt="optimized away even if volatile added.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2018 03:56:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-variable-optimized-out-when-compile-with-O2-and-LTO-option/m-p/732998#M9458</guid>
      <dc:creator>vaughn</dc:creator>
      <dc:date>2018-06-07T03:56:09Z</dc:date>
    </item>
  </channel>
</rss>

