CPU : K60FN1M0M15
KDS compiler & Debugger GNU
Linker file.ld add MEM_ExternalRam to MEMORY.
MEMORY
{
MEM_vectorrom (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
MEM_cfmprotrom (R) : ORIGIN = 0x00000400, LENGTH = 0x00000020
MEM_Versionrom (RX) : ORIGIN = 0x00000420, LENGTH = 0x00000030
MEM_rom (RX) : ORIGIN = 0x00000480, LENGTH = 0x000FFBF0
MEM_crcrom (RX) : ORIGIN = 0x0007EFF8, LENGTH = 0x00000008
MEM_bootswaprom (RX) : ORIGIN = 0x0007F000, LENGTH = 0x00001000
MEM_ram (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 /* SRAM - RW data */
/* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */
MEM_end_of_kd (RW) : ORIGIN = 0x2000FFF0, LENGTH = 0x00000000
/* Boot stack reused by MQX Kernel data */
MEM_bstack (RW) : ORIGIN = 0x2000FA00, LENGTH = 0x00000200 /* Boot stack */
MEM_end_bstack (RW) : ORIGIN = 0x2000FC00, LENGTH = 0x00000000 /* Boot stack end address requires 4B alignment */
MEM_ExternalRam (RXW) : ORIGIN = 0xA0000000, LENGTH = 0x00020000 /* External Ram =RW data 128 K */
}
Added Section :
.ExternalRam :
{ . = ALIGN (0x4);
__ExternalRam_Start = .;
KEEP(*(.ExternalRamSection))
. = ALIGN (0x4);
__ExternalRam_End = .;
} > MEM_ExternalRam
Code file Addded :
__attribute__((section(".ExternalRamSection"))) struct Diagnostics_Queue_Struct External_Diagnostics_Queue;
MAP File :
.ExternalRam 0xa0000000 0x401c
0xa0000000 . = ALIGN (0x4)
0xa0000000 __ExternalRam_Start = .
*(.ExternalRamSection)
.ExternalRamSection
0xa0000000 0x401c ./Source/Run/Diagnostics.o
0xa0000000 External_Diagnostics_Queue
0xa000401c . = ALIGN (0x4)
0xa000401c __ExternalRam_End = .
OUTPUT(BlackBox.elf elf32-littlearm)
This will compile and like OK but when I start the debugger to download my code into the target board I get.
Connection from "127.0.0.1" via 127.0.0.1
Disconnected from "127.0.0.1" via 127.0.0.1
Target Disconnected.
Target Disconnected.
If I remove :
__attribute__((section(".ExternalRamSection"))) struct Diagnostics_Queue_Struct External_Diagnostics_Queue;
Recompile and start the debugger it will work OK.
Jim Burton
I have already use the "Relocating code and data Using the KDS GCC Linker file (.ld) for Kinetis" and Link and locate my code for loading into Memory. My memory map look ok but when I start the debugger it's stop loading and exit, I cat never get into the debugger. I thing if try to access memory a address 0xA0000000 where I located my external ram data. I this time the flexbus is not setup and a memory access will fail. I'm use MQX and flexbus is program in the BPS file after the CPU start. The debugger never get to the point that the CPU start running.
Jim
Hello JIM,
Have you configure this part in the DOC
"Relocating code and data Using the KDS GCC Linker file (.ld) for Kinetis"
And does your board is customer board? If yes , please first be sure the external RAM is right.
Hope it helps
Alice
Hello Jim,
About the relocate code into RAM, please refer to this DOC:
Relocating Code and Data Using the KDS GCC Linker File for Kinetis
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------