<?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: K64F, GDB load failed after RAM relocating</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615628#M36607</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As described &lt;A _jive_internal="true" href="https://community.nxp.com/message/872574"&gt;here&lt;/A&gt;, it is possible that the kinetis driver of OpenOCD is not able to automatically recognizes the second flash bank. By manually configuring both the banks of the MK64FN1M0VLL12 I was able to solve the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Feb 2017 08:51:14 GMT</pubDate>
    <dc:creator>Onemars</dc:creator>
    <dc:date>2017-02-01T08:51:14Z</dc:date>
    <item>
      <title>K64F, GDB load failed after RAM relocating (solved)</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615626#M36605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm working with a MK64FN1M0VLL12 in Kinetis Design Studio 3.2.0, I have a const buffer of 64 bytes allocated at 0x000F F000 and a RAM buffer of 64 bytes allocated at 0x2000 0000.&lt;/P&gt;&lt;P&gt;I've tried to follow "Relocating Code and Data Using the KDS GCC Linker File for Kinetis".&lt;/P&gt;&lt;P&gt;I can compile without errors but I cannot debug because I get the error "CMSIS-DAP: Write Error (0x04)" after "writing buffer of 64 byte at 0x000ff000".&lt;/P&gt;&lt;P&gt;But if I don't force the location of one of the two buffers, so the const buffer goes in the m_text section, or the RAM buffer goes in the m_data section, it works.&lt;/P&gt;&lt;P&gt;Do you know what it is wrong with this relocation?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Gabriele&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is the code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"

__attribute__ ((section(".xxx")))
uint8_t ucHeap[64];

__attribute__ ((section(".params")))
const uint8_t pars[64];

int main(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_InitPins();
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_BootClockRUN();

&amp;nbsp;&amp;nbsp;&amp;nbsp; memset(ucHeap, 0xEE, sizeof(ucHeap));
&amp;nbsp;&amp;nbsp;&amp;nbsp; memcpy(ucHeap, pars, sizeof(pars));

&amp;nbsp;&amp;nbsp;&amp;nbsp; for (;;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __asm("NOP");
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;These are the changes done on the linker file:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;MEMORY
{
&amp;nbsp; m_interrupts&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX)&amp;nbsp; : ORIGIN = 0x00000000, LENGTH = 0x00000400
&amp;nbsp; m_flash_config&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX)&amp;nbsp; : ORIGIN = 0x00000400, LENGTH = 0x00000010
&amp;nbsp; m_text&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; (RX)&amp;nbsp; : ORIGIN = 0x00000410, LENGTH = 0x000FEBF0
&amp;nbsp; m_params&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; (RW)&amp;nbsp; : ORIGIN = 0x000FF000, LENGTH = 0x00000100
&amp;nbsp; m_data&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; (RW)&amp;nbsp; : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
&amp;nbsp; m_data_2&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; (RW)&amp;nbsp; : ORIGIN = 0x20000000, LENGTH = 0x00030000
}

... (after .text)
&amp;nbsp; .params_section :
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; . = ALIGN(4);
&amp;nbsp;&amp;nbsp;&amp;nbsp; KEEP (*(.params))
&amp;nbsp;&amp;nbsp;&amp;nbsp; . = ALIGN(4);
&amp;nbsp; } &amp;gt; m_params

... (after .bss)
&amp;nbsp; .xxx_section : 
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; *(.xxx)
&amp;nbsp; } &amp;gt; m_data_2&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And this is the error:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Debug: 457 821 gdb_server.c:2647 gdb_input_inner(): received packet: 'Xff000,40:&amp;lt;binary-data&amp;gt;'&lt;BR /&gt;Debug: 458 821 gdb_server.c:1495 gdb_write_memory_binary_packet(): addr: 0x000ff000, len: 0x00000040&lt;BR /&gt;Debug: 459 821 target.c:1849 target_write_buffer(): writing buffer of 64 byte at 0x000ff000&lt;BR /&gt;Error: 460 832 cmsis_dap_usb.c:489 cmsis_dap_swd_write_reg(): CMSIS-DAP: Write Error (0x04)&lt;BR /&gt;Error: 461 836 arm_adi_v5.c:363 mem_ap_write(): Failed to write memory at 0x000ff004&lt;BR /&gt;Debug: 462 836 gdb_server.c:2647 gdb_input_inner(): received packet: 'X20000000,40:&amp;lt;binary-data&amp;gt;'&lt;BR /&gt;Debug: 463 836 gdb_server.c:1320 gdb_error(): Reporting -4 to GDB as generic error&lt;BR /&gt;Debug: 464 836 gdb_server.c:1495 gdb_write_memory_binary_packet(): addr: 0x20000000, len: 0x00000040&lt;BR /&gt;Debug: 465 836 target.c:1849 target_write_buffer(): writing buffer of 64 byte at 0x20000000&lt;BR /&gt;Debug: 466 871 gdb_server.c:2649 gdb_input_inner(): received packet: 'qL1200000000000000000'&lt;BR /&gt;Debug: 467 871 gdb_server.c:2649 gdb_input_inner(): received packet: 'm4d8,4'&lt;BR /&gt;Debug: 468 872 gdb_server.c:1363 gdb_read_memory_packet(): addr: 0x000004d8, len: 0x00000004&lt;BR /&gt;Debug: 469 872 target.c:1910 target_read_buffer(): reading buffer of 4 byte at 0x000004d8&lt;BR /&gt;Debug: 470 878 gdb_server.c:2649 gdb_input_inner(): received packet: 'D'&lt;BR /&gt;Debug: 471 878 target.c:1395 target_call_event_callbacks(): target event 24 (gdb-detach)&lt;BR /&gt;Debug: 472 878 gdb_server.c:1002 gdb_connection_closed(): GDB Close, Target: kinetis.cpu, state: halted, gdb_actual_connections=0&lt;BR /&gt;Debug: 473 878 target.c:1395 target_call_event_callbacks(): target event 6 (gdb-end)&lt;BR /&gt;Debug: 474 878 target.c:1395 target_call_event_callbacks(): target event 24 (gdb-detach)&lt;BR /&gt;Info : 475 878 server.c:476 server_loop(): dropped 'gdb' connection&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And the GDB trace:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;924,536 &amp;amp;"load F:\\\\PROGETTI\\\\Workspace\\\\test_ram\\\\Debug\\\\test_ram.elf\n"&lt;BR /&gt;924,537 ~"Loading section .params_section, size 0x40 lma 0xff000\n"&lt;BR /&gt;924,537 25+download,{section=".params_section",section-size="64",total-size="663166"}&lt;BR /&gt;924,537 25+download,{section=".params_section",section-sent="64",section-size="64",total-sent="64",t\&lt;BR /&gt;otal-size="663166"}&lt;BR /&gt;924,537 ~"Loading section .xxx_section, size 0x40 lma 0x20000000\n"&lt;BR /&gt;924,552 &amp;amp;"Load failed\n"&lt;BR /&gt;924,552 25^error,msg="Load failed"&lt;BR /&gt;924,553 (gdb) &lt;BR /&gt;924,554 27-gdb-exit&lt;BR /&gt;924,593 26^done,threads=[{id="1",target-id="Remote target",frame={level="0",addr="0x000004d8",func="\&lt;BR /&gt;Reset_Handler",args=[],file="../startup/startup_MK64F12.S",fullname="F:\\PROGETTI\\Workspace\\test_r\&lt;BR /&gt;am\\startup\\startup_MK64F12.S",line="326"},state="stopped"}]&lt;BR /&gt;924,593 (gdb) &lt;BR /&gt;924,594 27^exit&lt;BR /&gt;924,594 =thread-group-exited,id="i1"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 11:40:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615626#M36605</guid>
      <dc:creator>Onemars</dc:creator>
      <dc:date>2017-01-13T11:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: K64F, GDB load failed after RAM relocating</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615627#M36606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A clumsy workaround is to define the RAM buffer as 'extern' and then define its address in the SECTIONS of the linker file:&lt;/P&gt;&lt;PRE&gt;ucHeap = 0x20000000;&lt;/PRE&gt;&lt;P&gt;It is necessary to manually allocate the buffer by moving the start of m_data_2 in the MEMORY section:&lt;/P&gt;&lt;PRE&gt;m_data_2&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; (RW)&amp;nbsp; : ORIGIN = 0x20000100, LENGTH = 0x0002FF00&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jan 2017 09:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615627#M36606</guid>
      <dc:creator>Onemars</dc:creator>
      <dc:date>2017-01-16T09:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: K64F, GDB load failed after RAM relocating</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615628#M36607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As described &lt;A _jive_internal="true" href="https://community.nxp.com/message/872574"&gt;here&lt;/A&gt;, it is possible that the kinetis driver of OpenOCD is not able to automatically recognizes the second flash bank. By manually configuring both the banks of the MK64FN1M0VLL12 I was able to solve the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2017 08:51:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64F-GDB-load-failed-after-RAM-relocating-solved/m-p/615628#M36607</guid>
      <dc:creator>Onemars</dc:creator>
      <dc:date>2017-02-01T08:51:14Z</dc:date>
    </item>
  </channel>
</rss>

