(MPC5674F) How to normally allocate all program variable data to external memory?

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

(MPC5674F) How to normally allocate all program variable data to external memory?

558 Views
chunghohwang
Contributor II

Development environment:
- Code Warrior IDE version 5.9.0

I am developing using the MPC5674F. The target board is equipped with external memory (SRAM).

In order to allocate all program variable data to external memory (SRAM), I modified the code in the LCF file as follows:


* File name : MPC5674F_MVx264.lcf

MEMORY
{
......
// Add External Memory area
EXSRAM : org = 0x20000000, len = 0x001FFFFF
}

SECTIONS
{
......
// Delete program data allocation default code
/*
GROUP : {

.__uninitialized_intc_handlertable ALIGN(20) : {}

.data : {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
} > internal_ram
*/

// Add program data allocation code

GROUP : {

.__uninitialized_intc_handlertable ALIGN(20) : {}

.data : {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
} > EXSRAM

.......
......

}


And then, I modified the code to do setting EBI (External BUS Interface) as follows.


* File name : __PPC_eabi_init.c

asm void __init_user(void)
{
.....
.....
// Call SetExternalBusInterface() function for External Bus Interface initialization
bl SetExternalBusInterface

frfree
blr

}


After, The build was done well and I confirmed that variables are allocated in the external memory (SRAM) using the debugger and map file.

However, the variable values was not initialized and the garbage value was stored.
I want to know what's wrong.

How to normally allocate all program variable data to external memory?

0 Kudos
1 Reply

387 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, linker file modification seems to be right, what I am not sure if it is correct, is EBI initialization in Codewarrior template.

Try to use External_SRAM_init function I have written in following example code in main file:

Example XPC567XFKIT PinToggleStationery CW210 

Hope it helps