Relocate a function to RAM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Relocate a function to RAM

381 次查看
aladinbakkay
Contributor I

To relocate a function to RAM using CodeWorrior for MPC5668x, i used the syntax below :

1- In linker command file :

I added memory segment "my_ram" and section called "my_ram"

MEMORY
{
resetvector : org = 0x000C0000, len = 0x00000008
sw_ident : org = 0x000C0020, len = 0x00000080
coreHand_flash : org = 0x000C00A0, len = 0x00001000
internal_flash : org = 0x000C10A0, len = 0x001CEF60

// resetvector : org = 0x00020000, len = 0x00000008
// sw_ident : org = 0x00020020, len = 0x00000080
// coreHand_flash : org = 0x000200A0, len = 0x00001000
// internal_flash : org = 0x000210A0, len = 0x001CEF60

my_ram: org = 0x40000000, len = 0x00001000
internal_ram: org = 0x40001000, len = 0x00009000

heap : org = 0x4000A000, len = 0x00002000 /* Heap start location */
stack : org = 0x4000C000, len = 0x00004000 /* Start location for Stack */

}

SECTIONS
{
.__bam_bootarea LOAD(0x000C0000) : {} > resetvector
.__app_ident LOAD(0x000C0020) : {} > sw_ident
.__core_handlers (VLECODE) LOAD(0x000C00A0) : {*(.__core_handlers)} > coreHand_flash

GROUP : {

.init : {}
.init_vle (VLECODE) : {
*(.init)
*(.init_vle)
}

.text : {}
.text_vle (VLECODE) : {
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}

} > internal_flash

GROUP : {
.__user_interrupts__ ALIGN(4096) : {*(.__user_interrupts__)}
.data : {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
.PPC.EMB.sdata0 : {}
.PPC.EMB.sbss0 : {}
} > internal_ram

.my_ram :{} > my_ram

}

2) Code :

The function supposed to be relocated are in the code placed be between following pragmas:

#pragma push

#pragma section code_type ".my_ram" ".my_ram" code_mode=far_abs

 

#pragma pop

But i had an Link Error after compilation : " Linker command file output section '.my_ram' has a type or input which is incompatible with section '.my_ram in file ..., Change the type or add an input for this section"

aladinbakkay_0-1671440024290.png

 

I didn't understand the meaning of this error message, how to solve this problem please?

0 项奖励
回复
1 回复

363 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I think that this should solve the problem:

.my_ram (VLECODE) :{} > my_ram

instead of

.my_ram :{} > my_ram

Regards,

Lukas

 

0 项奖励
回复