56F8367 Internal PRAM: Linking and Programming Issues

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

56F8367 Internal PRAM: Linking and Programming Issues

648 Views
steve_n
Contributor II

Hello,

 

Target: DSC 56F8367, LDM

IDE: CodeWarrior for MCU 10.6.4

 

I am looking to create a project wich has code in both P ROM and internal P RAM. The program entry point as well as most of the code would be in PROM, with some additional code placed and linked to PRAM. I am having some issues achieving this and I am not sure if it possible.

 

Relevant linker sections look like this:

 

.p_Interrupts (RWX) : ORIGIN = 0x00000000, LENGTH = 0x000000AC
.p_Code (RWX) : ORIGIN = 0x000000AC, LENGTH = 0x0003FF54
.p_CodeInternalRAM (RWX) : ORIGIN = 0x0004F800, LENGTH = 0x0800

.ApplicationCodeInternalRAM
{
 F_PcodeInternalRAM_start_addr = .;
 OBJECT (FPRAMFunc1, PRAMFuncs_c.obj)
 OBJECT (FPRAMFunc2, PRAMFuncs_c.obj)
 F_PcodeInternalRAM_end_addr = .;
} > .p_CodeInternalRAM

.ApplicationCode :
{

F_Pcode_start_addr = .;

# .text sections
 OBJECT (F_EntryPoint, Cpu_c.obj)
 * (.text)
 * (rtlib.text)
 * (startup.text)
 * (fp_engine.text)
 * (user.text)
 * (.data.pmem)

F_Pcode_end_addr = .;

# save address where the data starts in pROM
 . = ALIGN(2);
 __pROM_data_start = .;

} > .p_Code

 

My code compiles and links without error - I have PROM code calling the PRAM functions. The memory map shows everything as I want it to be, and the .elf.s file has lines targeted for 0x0004F800 (PRAM). But, when I debug and step through it I can see the PROM JSRs to the PRAM functions are jumping to 0x0000. It is as if the linker has a placeholder for the PRAM jsrs but never actually linked to it.

 

Is it possible to have PROM and PRAM code linked to each other in a single ELF?

 

Second issue is that the debugger is not downloading the PRAM section. That section is all zeros. Is there an option somewhere I need to select to program the PRAM?

Labels (1)
0 Kudos
1 Reply

450 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the RAM code disappears after power off, in order to run some code in PRAM even after power off, you have to save the code in flash, and copy the part of code to RAM by your application code in initialization stage. For example, if you want to erase/program program flash section or boot section, you have to run the erasing/programming code in PRAM if there is only one flash block.

therefore, I do not think it is okay just to change ther link file to save the code in PRAM.

I suggest you use PE to generate a project and add the "IntFlash" bean with "Program_Boot_Flash" type,the PE will generate the code. You can refer to the code to know how to copy code from flash to RAM.

Hope it can help you

BR

Xiangjun Rong

0 Kudos