Is it possible to debug a codewarrior bare board project on on-chip ram on an LS1021A?
We've stripped our code to be less than the 64 KB size of the on-chip ram, but it appears that when we step through our project our instructions are still running at addresses that would be associated with DRAM (0x80000000 and beyond). Do we need to edit the .mem and .tcl files? Also, how does one edit the .mem and .tcl files and not break anything?
Patrick
Hello Patrick Morrow,
I think no you do not want to edit the .tcl and .mem files for this purpose.
As .tcl file is used to initialize registers, memory locations, and other components on a target board. And .mem file is used to define the rules the debugger follows when accessing a target board's memory.
Instead, this is the work of linker. Please check in your .map file if .text section is located in DRAM (0x80000000). The .map file is locate in the same path as .elf file. And try to add/modify your .ld file(this is the liker files for project, which tell how to build), to put those sections you would like into OCRAM as below:
/* Specify the memory areas */
MEMORY
{
ocram0 (rx) : ORIGIN = 0x10000000, LENGTH = 64K
ocram1 (rx) : ORIGIN = 0x10010000, LENGTH = 64K
m_ram (rx) : ORIGIN = 0x80000000, LENGTH = 512M
}
/* Define output sections */
SECTIONS
{
/* The program code and other data goes into RAM */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} > ocram0
...
}
Have a great day,
Lunmin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks Lunmin, that seems to be the solution we were looking for.
Patrick