Debug K70 on external RAM with MQX & CW 10.6 GCC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debug K70 on external RAM with MQX & CW 10.6 GCC

1,204 Views
seandema
Contributor IV


I'm attempting to get my code to debug out of external RAM on a K70 system running MQX 4.2 using CodeWarrior 10.6 built using GCC. I've attempted to follow the guide listed here Relocating Code and Data Using the CW GCC Linker File for Kinetis but still can't get things to run.

 

Attached are the linker .ld file, the .tcl script and .mem file I've created. I'm not en expert at working these kinds of files so there is a good chance I have something wrong here.

 

My debug configuration is setup according to the instructions linked to above. However when I start trying to debug I get a warning about not being able to set break points and then it tries to run from some place in internal flash

148088_148088.pngpastedImage_3.png

148089_148089.pngpastedImage_4.png

 

I probably just have something setup wrong. Does anyone have any idea what I've done wrong here?

 

Thanks,

Sean

Original Attachment has been moved to: ext_ddr.ld.zip

Original Attachment has been moved to: init_kinetis_ddr.tcl.zip

Original Attachment has been moved to: K70FN1M0_ddr.mem.zip

0 Kudos
2 Replies

590 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Sean,

By looking at the dissasembly image it seems like your code is not running from the ddr, please try using the attached *.tcl, *.mem and *.ld files for your project.

Let me know if it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 Kudos

590 Views
seandema
Contributor IV

Hi Carlos,

Thanks for the updated .ld, .tcl, and .mem files. I gave them a try and while the code does execute without giving me the break point warning it still appears to be executing from internal flash.

Here is the base of flash

pastedImage_0.png

and here is where it stops at main() in mqx_main.c when starting to debug

pastedImage_1.png

Both of these look like they are still executing from internal flash.

Though my variables appear to be in external DDR.

pastedImage_2.png

Looking at the memory section of the .ld file you attached I'm thinking things like rom need to be moved to an address that is in DDR.

MEMORY

{

    vectorrom  (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400

    cfmprotrom  (R): ORIGIN = 0x00000400, LENGTH = 0x00000020

    rom        (RX): ORIGIN = 0x00000420, LENGTH = 0x000FFBE0  /* Code + Const data */

    ram        (RW): ORIGIN = 0x70000000, LENGTH = 0x08000000  /* DDR2 - RW data */

    sram        (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000  /* SRAM - RW data */

    /* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */

    end_of_kd  (RW): ORIGIN = 0x77FFFFF0, LENGTH = 0x00000000

    /* Boot stack reused by MQX Kernel data */

    bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  /* Boot stack */

    end_bstack  (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000  /* Boot stack end address requires 4B alignment */

}

That is why I changed them to the 0x70000000 range in the .ld file attached in my original post

MEMORY

{

    vectorrom   (RWX): ORIGIN = 0x70000000, LENGTH = 0x00000400

    cfmprotrom  (RWX): ORIGIN = 0x70000400, LENGTH = 0x00000020

    rom         (RWX): ORIGIN = 0x70000420, LENGTH = 0x000FFBE0  /* Code + Const data */

    ram         (RWX): ORIGIN = 0x70100000, LENGTH = 0x03F00000  /* SRAM - RW data */

    /* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */

    end_of_kd   (RW): ORIGIN = 0x77FFFFF0, LENGTH = 0x00000000

    /* Boot stack reused by MQX Kernel data */

    bstack      (RW): ORIGIN = 0x74000000, LENGTH = 0x00000200  /* Boot stack */

    end_bstack  (RW): ORIGIN = 0x74000200, LENGTH = 0x00000000  /* Boot stack end address requires 4B alignment */

}

That didn't work, but from what I can gather from other posts I need to somehow tell the compiler/linker I want my code to be placed in external DDR.

Do you know what I need to change in the .ld file so I can debug my code and variables from external DDR? I'm using the .tcl & .mem files you attached and am assuming those files are both good for executing from DDR.

Thanks,

Sean

0 Kudos