<?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: MK60F120M External RAM Cause Debugger to fail resetting target in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/MK60F120M-External-RAM-Cause-Debugger-to-fail-resetting-target/m-p/679040#M8982</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;Finally, i think i figured out what happened after reading on the GNU GCC linker description. &amp;nbsp;I post my answer here for someone who got stuck like me. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to declared the external RAM similar to the internal lower RAM including the loading option. &amp;nbsp;it seems to work ok. &amp;nbsp;But once i put a large structure in the external RAM, the linker choked because it checked the size of total data larger than .text size.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading further, i concluded that the external RAM with large data structure can not be part of the .text that got loaded at initialization. &amp;nbsp;I need (NOLOAD) as part of the external memory declaration. &amp;nbsp;if i don't put it there, the CPU will try to load it and it seems that it can not find it and somehow messed up. &amp;nbsp;The NOLOAD solve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_ROMStart = ___ROM_AT + SIZEOF(.data) + SIZEOF(.m_data_20000000); */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; .m_data_60000000 (NOLOAD) : /* AT(___m_data_60000000_ROMStart) */&amp;nbsp;&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; /* ___m_data_60000000_RAMStart = .; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; KEEP (*(.ExtRam)) /* This is an User defined section */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_RAMEnd = .; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; } &amp;gt; m_data_60000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_ROMSize = ___m_data_60000000_RAMEnd - ___m_data_60000000_RAMStart; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Henry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jun 2017 23:15:15 GMT</pubDate>
    <dc:creator>henrynguyen</dc:creator>
    <dc:date>2017-06-08T23:15:15Z</dc:date>
    <item>
      <title>MK60F120M External RAM Cause Debugger to fail resetting target</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/MK60F120M-External-RAM-Cause-Debugger-to-fail-resetting-target/m-p/679039#M8981</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 am using KDS 3.0 with SDK 1.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have an external SRAM connect to MK60F120M device.&lt;/P&gt;&lt;P&gt;I follow the notes in the following link:&amp;nbsp;&lt;A href="https://community.nxp.com/thread/309185"&gt;External Ram and Nand flash&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A href="https://community.nxp.com/docs/DOC-104433"&gt;Relocating Code and Data Using the KDS GCC Linker File for Kinetis&lt;/A&gt;,&amp;nbsp;&lt;A _jive_internal="true" class="link-titled" href="https://community.nxp.com/message/546255?commentID=546255#comment-546255" title="https://community.nxp.com/message/546255?commentID=546255#comment-546255"&gt;https://community.nxp.com/message/546255?commentID=546255#comment-546255&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i declared the pointer to 0x60000000 to read / write raw data, the entire SRAM memory works fine. &amp;nbsp;No issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, i decide to put a data structure on the external RAM.&lt;/P&gt;&lt;P&gt;I follow this example to relocate data to external RAM&amp;nbsp;&lt;A href="https://community.nxp.com/docs/DOC-104433"&gt;Relocating Code and Data Using the KDS GCC Linker File for Kinetis&lt;/A&gt;&amp;nbsp;. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is what i have on my linker file .ld:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MEMORY {&lt;BR /&gt; m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E8&lt;BR /&gt; m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0&lt;BR /&gt; m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000&lt;BR /&gt; m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000&lt;BR /&gt; m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010&lt;BR /&gt; m_data_60000000 (RW) : ORIGIN = 0x60000000, LENGTH = 0x0200000&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.mysection : &lt;BR /&gt; {&lt;BR /&gt; KEEP (*(.ExtRam))&lt;BR /&gt; } &amp;gt; m_data_60000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what i did in my example codes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;union TYPE {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint8_t bArray[SRAMTESTBYTE];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint64_t dWord[SRAMTESTBYTE &amp;gt;&amp;gt; 3];&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;__attribute__ ((section(".ExtRam"))) union TYPE TestSram;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After compiling it, i see the TestSram got assigned to external RAM space in the .map file as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.m_data_20000000&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x20000000 0x0 load address 0x000021b8&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x20000000 &amp;nbsp; &amp;nbsp; . = ALIGN (0x4)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x20000000 &amp;nbsp; &amp;nbsp; ___m_data_20000000_RAMStart = .&lt;BR /&gt; *(.m_data_20000000)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x20000000 &amp;nbsp; &amp;nbsp; ___m_data_20000000_RAMEnd = .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x20000000 &amp;nbsp; &amp;nbsp;. = ALIGN (0x4)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x00000000 &amp;nbsp; ___m_data_20000000_ROMSize = (___m_data_20000000_RAMEnd - ___m_data_20000000_RAMStart)&lt;/P&gt;&lt;P&gt;.mysection 0x60000000 0x960&lt;BR /&gt; *(.ExtRam)&lt;BR /&gt; .ExtRam 0x60000000 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x960 ./Sources/main.o&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x60000000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TestSram&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x60000960 &amp;nbsp; &amp;nbsp; &amp;nbsp; . = ALIGN (0x4)&lt;/P&gt;&lt;P&gt;.bss &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x1fff0068 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x130c load address 0x000021c0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x1fff0068 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;__START_BSS = .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x1fff0068 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PROVIDE (__bss_start__, __START_BSS)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like it does what i told it to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i connected the Segger debugger, it failed to connect and the program went straight ahead to run without able to stop.&lt;/P&gt;&lt;P&gt;please note that the program runs ok, just can not be break pointed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see these failed message on KDS console:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Failed to reset CPU. VECTRESET has confused core.&lt;BR /&gt;WARNING: CPU did not halt after reset.&lt;BR /&gt;WARNING: CPU did not halt after reset.&lt;BR /&gt;WARNING: S_RESET_ST not cleared&lt;BR /&gt;WARNING: Failed to reset CPU. VECTRESET has confused core.&lt;BR /&gt;WARNING: CPU did not halt after reset.&lt;BR /&gt;WARNING: CPU did not halt after reset.&lt;BR /&gt;WARNING: S_RESET_ST not cleared&lt;BR /&gt;ERROR: DAP error while reading AHB-AP IDR.&lt;BR /&gt;Resetting target&lt;BR /&gt;Halting target CPU...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i removed this declaration:&amp;nbsp;&lt;SPAN&gt;__attribute__ ((section(".ExtRam"))) union TYPE TestSram;, the program can halt right after main() function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can someone please help me figure out what i have done wrong? &amp;nbsp;I searched the forum but could not find a good example or a straight answer. &amp;nbsp;This has been very frustrated. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Henry&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2017 19:37:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/MK60F120M-External-RAM-Cause-Debugger-to-fail-resetting-target/m-p/679039#M8981</guid>
      <dc:creator>henrynguyen</dc:creator>
      <dc:date>2017-06-07T19:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: MK60F120M External RAM Cause Debugger to fail resetting target</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/MK60F120M-External-RAM-Cause-Debugger-to-fail-resetting-target/m-p/679040#M8982</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;Finally, i think i figured out what happened after reading on the GNU GCC linker description. &amp;nbsp;I post my answer here for someone who got stuck like me. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to declared the external RAM similar to the internal lower RAM including the loading option. &amp;nbsp;it seems to work ok. &amp;nbsp;But once i put a large structure in the external RAM, the linker choked because it checked the size of total data larger than .text size.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading further, i concluded that the external RAM with large data structure can not be part of the .text that got loaded at initialization. &amp;nbsp;I need (NOLOAD) as part of the external memory declaration. &amp;nbsp;if i don't put it there, the CPU will try to load it and it seems that it can not find it and somehow messed up. &amp;nbsp;The NOLOAD solve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_ROMStart = ___ROM_AT + SIZEOF(.data) + SIZEOF(.m_data_20000000); */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; .m_data_60000000 (NOLOAD) : /* AT(___m_data_60000000_ROMStart) */&amp;nbsp;&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; /* ___m_data_60000000_RAMStart = .; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; KEEP (*(.ExtRam)) /* This is an User defined section */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_RAMEnd = .; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; } &amp;gt; m_data_60000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ___m_data_60000000_ROMSize = ___m_data_60000000_RAMEnd - ___m_data_60000000_RAMStart; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Henry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 23:15:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/MK60F120M-External-RAM-Cause-Debugger-to-fail-resetting-target/m-p/679040#M8982</guid>
      <dc:creator>henrynguyen</dc:creator>
      <dc:date>2017-06-08T23:15:15Z</dc:date>
    </item>
  </channel>
</rss>

