AnsweredAssumed Answered

MK60F120M External RAM Cause Debugger to fail resetting target

Question asked by Henry Nguyen on Jun 7, 2017
Latest reply on Jun 8, 2017 by Henry Nguyen

Hello,

 

I am using KDS 3.0 with SDK 1.3.

 

We have an external SRAM connect to MK60F120M device.

I follow the notes in the following link: External Ram and Nand flash , Relocating Code and Data Using the KDS GCC Linker File for Kinetishttps://community.nxp.com/message/546255?commentID=546255#comment-546255 

 

When i declared the pointer to 0x60000000 to read / write raw data, the entire SRAM memory works fine.  No issue.

 

Then, i decide to put a data structure on the external RAM.

I follow this example to relocate data to external RAM Relocating Code and Data Using the KDS GCC Linker File for Kinetis .  

 

here is what i have on my linker file .ld:

 

MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E8
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_data_60000000 (RW) : ORIGIN = 0x60000000, LENGTH = 0x0200000
}

...

 

.mysection :
{
KEEP (*(.ExtRam))
} > m_data_60000000

 

Here is what i did in my example codes:

 

union TYPE {
     uint8_t bArray[SRAMTESTBYTE];
     uint64_t dWord[SRAMTESTBYTE >> 3];
};

__attribute__ ((section(".ExtRam"))) union TYPE TestSram;

 

After compiling it, i see the TestSram got assigned to external RAM space in the .map file as:

 

.m_data_20000000
                0x20000000 0x0 load address 0x000021b8
                0x20000000     . = ALIGN (0x4)
                0x20000000     ___m_data_20000000_RAMStart = .
*(.m_data_20000000)
                0x20000000     ___m_data_20000000_RAMEnd = .
                0x20000000    . = ALIGN (0x4)
                 0x00000000   ___m_data_20000000_ROMSize = (___m_data_20000000_RAMEnd - ___m_data_20000000_RAMStart)

.mysection 0x60000000 0x960
*(.ExtRam)
.ExtRam 0x60000000       0x960 ./Sources/main.o
               0x60000000        TestSram
               0x60000960       . = ALIGN (0x4)

.bss        0x1fff0068           0x130c load address 0x000021c0
               0x1fff0068          __START_BSS = .
                0x1fff0068          PROVIDE (__bss_start__, __START_BSS)

 

Looks like it does what i told it to do.

 

When i connected the Segger debugger, it failed to connect and the program went straight ahead to run without able to stop.

please note that the program runs ok, just can not be break pointed.

 

I can see these failed message on KDS console:

 

WARNING: Failed to reset CPU. VECTRESET has confused core.
WARNING: CPU did not halt after reset.
WARNING: CPU did not halt after reset.
WARNING: S_RESET_ST not cleared
WARNING: Failed to reset CPU. VECTRESET has confused core.
WARNING: CPU did not halt after reset.
WARNING: CPU did not halt after reset.
WARNING: S_RESET_ST not cleared
ERROR: DAP error while reading AHB-AP IDR.
Resetting target
Halting target CPU...

 

If i removed this declaration: __attribute__ ((section(".ExtRam"))) union TYPE TestSram;, the program can halt right after main() function.

 

can someone please help me figure out what i have done wrong?  I searched the forum but could not find a good example or a straight answer.  This has been very frustrated.  

 

Thanks,

Henry

Outcomes