<?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 Microcontrollers中的主题 Re: K65 RESET Line Weirdness with Optimizations Disabled</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471447#M28501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When changing optimization levels breaks something this is frequently a sign that the keyword volatile is missing from someplace that it is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the function shown NVIC is not passed as a parameter, it is a global.&amp;nbsp; Is something with it changing with the optimization level?&amp;nbsp; Perhaps passed in a register in one level and on the stack in an other.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Dec 2015 14:48:20 GMT</pubDate>
    <dc:creator>bobpaddock</dc:creator>
    <dc:date>2015-12-28T14:48:20Z</dc:date>
    <item>
      <title>K65 RESET Line Weirdness with Optimizations Disabled</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471443#M28497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having a very weird problem with a K65. The behavior I'm seeing is different based on wether optimizations are enabled and/or JTAG is connected. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #c6c6c6; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;P&gt;&lt;SPAN style="color: #505050;"&gt;&lt;STRONG&gt;Code Compiled with Any Optimization Level Enabled&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TH&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Code Compiled with Optimizations Disabled&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;JTAG Connected&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;K65 boots fine. Voltage on RESET pin is equal to our system voltage of 2.1V (read on multimeter).&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;K65 boots fine. Voltage on RESET pin is equal to our system voltage of 2.1V (read on multimeter).&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;JTAG Disconnected&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;K65 boots fine. Voltage on RESET pin is equal to our system voltage of 2.1V (read on multimeter).&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;K65 does not boot. Voltage on RESET pin is read on multimeter to be at 1.2V. Proving the RESET line on oscilloscope shows that the reset line is behaving like a square wave that keeps toggling between high and low. So the K65 keeps resetting.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to track down a small part of the code that if I optimized individually, I no longer see the issue. That part of the code is the 2 functions NVIC_SetPriority() and NVIC_EnableIRQ() which are only used in an enable_interrupt() function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;void enable_interrupt(uint8_t irqNum, uint8_t prio)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp; NVIC_SetPriority(irqNum, prio);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp; NVIC_ClearPendingIRQ(irqNum);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp; NVIC_EnableIRQ(irqNum);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVIC_SetPriority() and NVIC_EnableIRQ() are from the Freescale KSDK 1.3 and I haven't modified them:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if((int32_t)IRQn &amp;lt; 0) {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCB-&amp;gt;SHP[(((uint32_t)(int32_t)IRQn) &amp;amp; 0xFUL)-4UL] = (uint8_t)((priority &amp;lt;&amp;lt; (8 - __NVIC_PRIO_BITS)) &amp;amp; (uint32_t)0xFFUL);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; else {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC-&amp;gt;IP[((uint32_t)(int32_t)IRQn)]&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; = (uint8_t)((priority &amp;lt;&amp;lt; (8 - __NVIC_PRIO_BITS)) &amp;amp; (uint32_t)0xFFUL);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; NVIC-&amp;gt;ISER[(((uint32_t)(int32_t)IRQn) &amp;gt;&amp;gt; 5UL)] = (uint32_t)(1UL &amp;lt;&amp;lt; (((uint32_t)(int32_t)IRQn) &amp;amp; 0x1FUL));&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if I optimize these 2 functions only with the reset of my code unoptimized and JTAG disconnected, the K65 boots fine and the RESET line voltage goes to 2.1V. I do that by adding &lt;SPAN style="color: #000000; font-family: HelveticaNeue; font-size: 12px;"&gt;__attribute__((optimize("O1"))) to both function definitions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: HelveticaNeue;"&gt;__attribute__((optimize("O1"))) &lt;/STRONG&gt;__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if((int32_t)IRQn &amp;lt; 0) {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCB-&amp;gt;SHP[(((uint32_t)(int32_t)IRQn) &amp;amp; 0xFUL)-4UL] = (uint8_t)((priority &amp;lt;&amp;lt; (8 - __NVIC_PRIO_BITS)) &amp;amp; (uint32_t)0xFFUL);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; else {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC-&amp;gt;IP[((uint32_t)(int32_t)IRQn)]&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; = (uint8_t)((priority &amp;lt;&amp;lt; (8 - __NVIC_PRIO_BITS)) &amp;amp; (uint32_t)0xFFUL);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG style="color: #000000; font-size: 12px; font-family: HelveticaNeue;"&gt;__attribute__((optimize("O1"))) &lt;/STRONG&gt;__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;{&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; NVIC-&amp;gt;ISER[(((uint32_t)(int32_t)IRQn) &amp;gt;&amp;gt; 5UL)] = (uint32_t)(1UL &amp;lt;&amp;lt; (((uint32_t)(int32_t)IRQn) &amp;amp; 0x1FUL));&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 08:46:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471443#M28497</guid>
      <dc:creator>willx</dc:creator>
      <dc:date>2015-12-09T08:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: K65 RESET Line Weirdness with Optimizations Disabled</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471444#M28498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you let us know which IDE software you are using?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 06:38:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471444#M28498</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2015-12-11T06:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: K65 RESET Line Weirdness with Optimizations Disabled</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471445#M28499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using Rowley Crossworks (Release 3.5.1.2015071000.25017).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Dec 2015 22:37:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471445#M28499</guid>
      <dc:creator>willx</dc:creator>
      <dc:date>2015-12-13T22:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: K65 RESET Line Weirdness with Optimizations Disabled</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471446#M28500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Will,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the Rowley Crossworks is not&amp;nbsp; our supported compiler tool, we couldn't provide related support.&lt;/P&gt;&lt;P&gt;There with below IDE software customer could select to use:&lt;/P&gt;&lt;P&gt;KDS: &lt;A href="http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE" title="http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE"&gt;Kinetis Design Studio Integrated Development |NXP&lt;/A&gt; &lt;/P&gt;&lt;P&gt;IAR:&amp;nbsp; &lt;A href="https://www.iar.com/iar-embedded-workbench/" title="https://www.iar.com/iar-embedded-workbench/"&gt;IAR Embedded Workbench&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Keil:&amp;nbsp; &lt;A href="http://www.keil.com/" title="http://www.keil.com/"&gt;Keil Embedded Development Tools for ARM, Cortex-M, Cortex-R4, 8051, C166, and 251 processor families.&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you could find support from Rowley Crossworks. Thank you for the understanding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Ma Hui&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 05:43:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471446#M28500</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2015-12-22T05:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: K65 RESET Line Weirdness with Optimizations Disabled</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471447#M28501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When changing optimization levels breaks something this is frequently a sign that the keyword volatile is missing from someplace that it is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the function shown NVIC is not passed as a parameter, it is a global.&amp;nbsp; Is something with it changing with the optimization level?&amp;nbsp; Perhaps passed in a register in one level and on the stack in an other.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Dec 2015 14:48:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65-RESET-Line-Weirdness-with-Optimizations-Disabled/m-p/471447#M28501</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2015-12-28T14:48:20Z</dc:date>
    </item>
  </channel>
</rss>

