<?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 Local variable declared over global variable in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019929#M39866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an LPC1756 microcontroller with the latest MCUXpresso.&lt;/P&gt;&lt;P&gt;I did encounter a problem that my global variables are overwritten by local variables.&lt;/P&gt;&lt;P&gt;How can this happen?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/100052iCB58FEEB359AFF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.jpg" alt="pastedImage_1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jan 2020 07:44:17 GMT</pubDate>
    <dc:creator>szempy</dc:creator>
    <dc:date>2020-01-30T07:44:17Z</dc:date>
    <item>
      <title>Local variable declared over global variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019929#M39866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using an LPC1756 microcontroller with the latest MCUXpresso.&lt;/P&gt;&lt;P&gt;I did encounter a problem that my global variables are overwritten by local variables.&lt;/P&gt;&lt;P&gt;How can this happen?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/100052iCB58FEEB359AFF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.jpg" alt="pastedImage_1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 07:44:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019929#M39866</guid>
      <dc:creator>szempy</dc:creator>
      <dc:date>2020-01-30T07:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Local variable declared over global variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019930#M39867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose i am using to much memory and that's why this is happening:&lt;/P&gt;&lt;P&gt;text&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data bss&amp;nbsp; &amp;nbsp; &amp;nbsp;dec&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hex&lt;BR /&gt; 129736&amp;nbsp; 916 13880 144532 23494&lt;/P&gt;&lt;P&gt;So a total of data + bss = 916 + 13880 = 14796 so that means there is only&amp;nbsp;1588 bytes left in the RAM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 08:09:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019930#M39867</guid>
      <dc:creator>szempy</dc:creator>
      <dc:date>2020-01-30T08:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Local variable declared over global variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019931#M39868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Isvan,&lt;/P&gt;&lt;P&gt;Frankly speaking, I have not seen which global variable is overwritten by local variable from the screenshot you gave, can you clarify which global variable is overwritten by which local variable?&lt;/P&gt;&lt;P&gt;Generally, the local variables are saved in stack, the global variables are saved in a specific location, if the global variables are overwritten by stack unexpectedly, it means that the stack size is too small, you can redefine the stack size in the linker file, for example &amp;nbsp;_StackSize = 0x2000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jan 2020 05:11:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019931#M39868</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2020-01-31T05:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Local variable declared over global variable</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019932#M39869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you check the left side of the screenshot in the expression i have put in the global variables from the upper file and the local variables are in the bottom file.&lt;/P&gt;&lt;P&gt;The global variable&amp;nbsp;rfile is at address 0x10003974 has size of 40 and the local variable fs is placed at the address&amp;nbsp;0x1000398c so it is declared over the global variable.&lt;/P&gt;&lt;P&gt;I have checked in the Settings -&amp;gt; MCU Linker -&amp;gt; Managed Linker Script -&amp;gt; Heap and Stack placement&amp;nbsp;was set to LPCXpresso Style because this project is an old one and i have started to develop it in LPCXpresso, so i have changed it to MCUXpresso Style i hope that one helps.&lt;/P&gt;&lt;P&gt;But i have reduced some&amp;nbsp;buffers and the problem was gone.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jan 2020 07:08:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Local-variable-declared-over-global-variable/m-p/1019932#M39869</guid>
      <dc:creator>szempy</dc:creator>
      <dc:date>2020-01-31T07:08:21Z</dc:date>
    </item>
  </channel>
</rss>

