<?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: Re: Question of debug in KDS IDE in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342790#M1024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed all the callbacks (functions included in the events.c file) are called just before the processor services the Interrupt Routine (ISR); in those ISR the Processor Expert code handles the interrupt flags and perform some actions before calling the callback, this means that when the code reaches the callback function the interrupt was already serviced, and this means that there are not hardware issues and the interrupt is being serviced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the next link to see what are the differences between optimizations. &lt;A href="https://gcc.gnu.org/onlinedocs/gnat_ugn/Optimization-Levels.html" rel="nofollow noopener noreferrer" title="https://gcc.gnu.org/onlinedocs/gnat_ugn/Optimization-Levels.html" target="_blank"&gt;Optimization Levels - GNAT User's Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will include here part of the text for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;Without any optimization option&lt;/STRONG&gt;, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: &lt;STRONG&gt;if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter&lt;/STRONG&gt; to any other statement in the subprogram and get exactly the results you would expect from the source code. &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;Turning on optimization&lt;/STRONG&gt; makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and &lt;STRONG&gt;possibly the ability to debug the program. &lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;This implies that the optimization will reduce the ability to debug the program.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I am not quite sure about this behavior but maybe this could be reason. You can try using a volatile variable for the callback flags.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;In events.c declare:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14169489968294818" jivemacro_uid="_14169489968294818"&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;volatile uint8_t spi_tx_fin = 0;
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;In main.c declare it as external:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_14169489968072614 jive_macro_code" jivemacro_uid="_14169489968072614"&gt;
&lt;P&gt;extern volatile uint8_t &lt;STRONG&gt;&lt;EM&gt;spi_tx_fin;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Adrian Sanchez Cano&lt;BR /&gt;Technical Support Engineer&lt;BR /&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>Tue, 25 Nov 2014 20:56:07 GMT</pubDate>
    <dc:creator>adriancano</dc:creator>
    <dc:date>2014-11-25T20:56:07Z</dc:date>
    <item>
      <title>Question of debug in KDS IDE</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342787#M1021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I create a project in KDS, and it use MK10DX256VLH7. Now, I have a question to ask for your help.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I use PE to initial a SPI component, which involve Input interrupt and Output interrupt,and at the initial progress, PE auto enable SPI component also.Then, I define two variables, &lt;SPAN style="font-family: inherit;"&gt;&lt;EM&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;spi_tx_fin&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/EM&gt;&lt;/SPAN&gt;and &lt;SPAN style="font-family: inherit;"&gt;&lt;EM&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;&lt;/SPAN&gt;. &lt;/EM&gt;&lt;/SPAN&gt;In the project, PE create two event functions, &lt;SPAN style="font-family: inherit;"&gt;&lt;EM&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;void SPI_OnBlockReceived(LDD_TUserData *UserDataPtr)&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/EM&gt;&lt;/SPAN&gt;and &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr). &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;For the convenience of polling SPI transmit and/or receive progress success or not, I write the code: &lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;EM&gt;&lt;STRONG&gt;spi_tx&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit;"&gt;&lt;EM&gt;_fin&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit;"&gt;&lt;EM&gt; = Yes&lt;/EM&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;and&lt;SPAN style="font-family: inherit;"&gt;&lt;EM&gt; &lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;EM&gt;&lt;STRONG&gt;spi_rx_fin&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt; = Yes&amp;nbsp; (Macro: Yes=1, No=0) &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/SPAN&gt;in the two event functions respectively. Afterward, I define another function &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;MotorInit()&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;, which call function&amp;nbsp; &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;LDD_TError SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;generated by PE to transmit data on the SPI module. The code as follows:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&lt;EM&gt;motor.c :&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;union TAG_IF_CONFIGURATION_429{&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; struct IF_CONFIGURATION_429{&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 INV_REF : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 SDO_INT : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 STEP_HALF : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 INV_STP : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 INV_DIR : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 EN_SD : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 POS_COMP_SEL_0 : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 POS_COMP_SEL_1 : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 EN_REFR : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 RESERVE : 15;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 RW : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 JDX : 4;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 smda : 2;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint32 RRS : 1;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; }if_configuration_429;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; uint8 buffer[4];&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;}if_configuration_429;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;&lt;STRONG&gt;MotorInit()&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;if_configuration_429.if_configuration_429.INV_REF = 0;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; .....&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;spi_tx_fin = No;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; SPI_SendBlock(pSPI,if_configuration_429.buffer,4);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; .....&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;}&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min- padding: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&lt;EM&gt;Event.c :&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; /* Write your code here ... */&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; spi_tx_fin = Yes;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min- padding: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Unfortunately, when debug program, the progress was blocked here &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; I checked the debug progress and was sure in the event function &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr) &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;the variable &lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;spi_tx_fin&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; was set &lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;EM&gt;&lt;STRONG&gt;Yes&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;By the way, I offer my project to you. Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="16634_16634.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120027i85069F56CFCBEB9D/image-size/large?v=v2&amp;amp;px=999" role="button" title="16634_16634.bmp" alt="16634_16634.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="os.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/47260i931C09BCF711147D/image-size/large?v=v2&amp;amp;px=999" role="button" title="os.bmp" alt="os.bmp" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Above picture is about the build optimization level &lt;STRONG&gt;&lt;EM&gt;-Os&lt;/EM&gt;&lt;/STRONG&gt;, it is that debug progress was blocked here&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;&lt;EM&gt;while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the below picture is about the build optimization level &lt;STRONG&gt;&lt;EM&gt;None(-O0), &lt;/EM&gt;&lt;/STRONG&gt;it is that debug progress was ok sometime.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="16633_16633.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120028i263ABBA3013C56F1/image-size/large?v=v2&amp;amp;px=999" role="button" title="16633_16633.bmp" alt="16633_16633.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="debug picture.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/47261i4ACE1562882E7D13/image-size/large?v=v2&amp;amp;px=999" role="button" title="debug picture.bmp" alt="debug picture.bmp" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;消息编辑者为：guo huoping One picture added&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;消息编辑者为：guo huoping Edit my question again! Wait your answer sincerely! Thank you!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338622"&gt;workspace.kds.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Nov 2014 00:20:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342787#M1021</guid>
      <dc:creator>guohuoping</dc:creator>
      <dc:date>2014-11-15T00:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question of debug in KDS IDE</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342788#M1022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest you enable the interrupt even if you don't use .&lt;/P&gt;&lt;P&gt;or&amp;nbsp; before read receive data , use the function of "SS1_Main(slaveDevData);" about this function , you can find on file of "SS1.C".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Nov 2014 10:22:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342788#M1022</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2014-11-16T10:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question of debug in KDS IDE</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342789#M1023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;In my project, I have enabled the interrupt. Also, I have saw the debug progress run in the interrupt function &lt;EM&gt;&lt;STRONG&gt;PE_ISR(SPI_Interrupt)&lt;/STRONG&gt;&lt;/EM&gt;, and sure the function &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;void SPI_OnBlockSent(LDD_TUserData *UserDataPtr)&lt;/EM&gt;&lt;/STRONG&gt; was called from the interrupt function. &lt;SPAN style="text-decoration: underline;"&gt;I was confused that the debug progress blocked in the interrupt when the project &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-decoration: underline;"&gt;build optimization level was set &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; text-decoration: underline;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;-Os&lt;/EM&gt;&lt;/STRONG&gt; and it seemed the program thread not return and blocked on the line: &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; text-decoration: underline;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;while(spi_tx_fin == No);&lt;/EM&gt;&lt;/STRONG&gt;.&lt;/SPAN&gt; How ever, &lt;SPAN style="text-decoration: underline;"&gt;the program thread could return from the interrupt when the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-decoration: underline;"&gt;build optimization level was set &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; text-decoration: underline;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;-None(-O&lt;/EM&gt;&lt;/STRONG&gt;0) and not blocked on the line:&lt;/SPAN&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-family: inherit; text-decoration: underline; font-weight: inherit;"&gt;while(spi_tx_fin == No)&lt;/EM&gt;&lt;/STRONG&gt;. I hope you can download the project I provided and test it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for response! I sincerely wait for your success answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guo Huoping&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Nov 2014 11:08:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342789#M1023</guid>
      <dc:creator>guohuoping</dc:creator>
      <dc:date>2014-11-16T11:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Question of debug in KDS IDE</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342790#M1024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed all the callbacks (functions included in the events.c file) are called just before the processor services the Interrupt Routine (ISR); in those ISR the Processor Expert code handles the interrupt flags and perform some actions before calling the callback, this means that when the code reaches the callback function the interrupt was already serviced, and this means that there are not hardware issues and the interrupt is being serviced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the next link to see what are the differences between optimizations. &lt;A href="https://gcc.gnu.org/onlinedocs/gnat_ugn/Optimization-Levels.html" rel="nofollow noopener noreferrer" title="https://gcc.gnu.org/onlinedocs/gnat_ugn/Optimization-Levels.html" target="_blank"&gt;Optimization Levels - GNAT User's Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will include here part of the text for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;Without any optimization option&lt;/STRONG&gt;, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: &lt;STRONG&gt;if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter&lt;/STRONG&gt; to any other statement in the subprogram and get exactly the results you would expect from the source code. &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;Turning on optimization&lt;/STRONG&gt; makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and &lt;STRONG&gt;possibly the ability to debug the program. &lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;This implies that the optimization will reduce the ability to debug the program.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I am not quite sure about this behavior but maybe this could be reason. You can try using a volatile variable for the callback flags.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;In events.c declare:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14169489968294818" jivemacro_uid="_14169489968294818"&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;volatile uint8_t spi_tx_fin = 0;
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="; color: #3366ff;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;In main.c declare it as external:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_14169489968072614 jive_macro_code" jivemacro_uid="_14169489968072614"&gt;
&lt;P&gt;extern volatile uint8_t &lt;STRONG&gt;&lt;EM&gt;spi_tx_fin;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Adrian Sanchez Cano&lt;BR /&gt;Technical Support Engineer&lt;BR /&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>Tue, 25 Nov 2014 20:56:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342790#M1024</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2014-11-25T20:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Question of debug in KDS IDE</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342791#M1025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I got your advice, and the answer is correct!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 06:58:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/Question-of-debug-in-KDS-IDE/m-p/342791#M1025</guid>
      <dc:creator>guohuoping</dc:creator>
      <dc:date>2014-11-26T06:58:44Z</dc:date>
    </item>
  </channel>
</rss>

