MPC5604P / CodeWarrior - Linkerfile settings

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

MPC5604P / CodeWarrior - Linkerfile settings

Jump to solution
2,106 Views
steffenrose
Contributor III

Hello,

 

I want to create a bootloader. This question is for the application.

I want to move my application to address 0x8000.

 

I'm the meaning I have changed all addresses.

But in case of:

 

 

GROUP  : {

      .text : {}

      .text_vle (VLECODE) ALIGN(0x08)  : {

         *(.text)

         *(.text_vle)

       }

       .rodata (CONST) : {

         *(.rdata)

         *(.rodata)

       }

...

 

    } > internal_flash

 

the section .text_vle have different load and run addresses.

Memory map:

                       Starting Size     File     ROM      RAM Buffer  S-Record

                       address           Offset   Address  Address     Line

.text_vle 0000a000 000074e0 000008c0 00002000 00002000      2

objdump confirm, that this section is located on 0x2000 within the .elf file

 

In case I change the Load address for .text_vle the next section .rodata is move to 0x2000.

 

 

What is wrong?

Where is the address 0x2000 from?

 

I attached my Linker file and my Mapping file.

 

In general:

I'm the meaning, that the Linkerfile definition

GROUP  : {

...

       .rodata (CONST) : {

         *(.rdata)

         *(.rodata)

       }

   ...

    } > internal_flash

means, that load and run address is the same and it is located in "internal_flash"-Memory.

 

Thank you.

Original Attachment has been moved to: MPC5604P_M26V_BOOT.lcf.zip

Original Attachment has been moved to: Boot_Slave.MAP.zip

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,428 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

just quick answer now - take a look at document AN_qorriva_bootloader.pdf in:

https://community.freescale.com/servlet/JiveServlet/download/427962-279359/bootloader.zip

I described all settings that need to be done when moving application to another address.

If it still doesn't work, just let me know.

Regards,

Luks

View solution in original post

0 Kudos
9 Replies
1,429 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

just quick answer now - take a look at document AN_qorriva_bootloader.pdf in:

https://community.freescale.com/servlet/JiveServlet/download/427962-279359/bootloader.zip

I described all settings that need to be done when moving application to another address.

If it still doesn't work, just let me know.

Regards,

Luks

0 Kudos
1,428 Views
steffenrose
Contributor III

Hello Lukas,

Thank you very much.

Chapter "Building a ROM Image" was the relevant part.

I read the chapters and I understand, that my "normal" used value und your suggest value for the "RAM Buffer address" is located in Flash.

Is this setting not used?

Also I found the description of  "At startup, the program uses the _rom_copy_info structure..." with the hint, that I can also copy code to the RAM automatically.

But I don't found information, where I can control the .PPC.EMB.seginfo/_rom_copy_info functionality.

Are there additional documentation for the Linker internas as in the help document?

Regards

Steffen

0 Kudos
1,428 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Steffen,

I'm not CodeWarrior expert, not sure how it works exactly but the documentation says that the addresses should be set to the same value:

pastedImage_2.png

Regarding code in RAM - I have shared sample project in this thread:

MPC5646C

or direct link:

https://community.freescale.com/servlet/JiveServlet/download/328503-260629/MPC5607B%20-%20Code%20in%...

Take a look at main.c and linker file. If you do it in this way, the code will be automatically copied to RAM during startup.

Best Regards,

Lukas

1,428 Views
steffenrose
Contributor III

Hello Lukas,

thank you very much for your help and your many small examples.

Do you have an addition documentation for Linking internals?

I understand now, that the following two lines are differently

#pragma section RX ".ramfunction" ".ramfunction" data_mode=far_abs code_mode=far_abs

#pragma section code_type ".ramfunction" ".ramfunction" data_mode=far_abs code_mode=far_abs

But I cannot find additional information for the additional work of code_type.

The documentation say only, that I require with the first line additional _declspec() .

---------

Also I search additional infromation to create an true uninitialized section (NOINIT). Means a section that is not erased with zeros at the beginning (like .bss).

#pragma section RW ".xx" ".command"

__declspec(section ".xx") U8 cobl_command[16];

I think I require this information:

(Mapping)

2] __init_data (func,weak) found in Runtime.PPCEABI.VS.UC.a __start.o

3] _bss_init_info (object,global) found in Linker Generated Symbol File

How can I remove my .command section from the _bss_init_info list?

(The alternativ way - remove this region completely and use a pointer to this "unknown" region I know.)

Background:

I want to have a memory region for communication between application and bootloader. The startup code should not erase and initialize it.

Thank you very much.

bye

Steffen

0 Kudos
1,428 Views
TICS_Fiona
NXP Employee
NXP Employee

Regarding the code_type,  - R = read, W = write, or X = execute

Best Regards

Fiona

0 Kudos
1,428 Views
steffenrose
Contributor III

Can you explain, what you want to say?

Has code_type not the access type RX?

Thank you.

Steffen

0 Kudos
1,428 Views
steffenrose
Contributor III
0 Kudos
1,428 Views
angelo_d
Senior Contributor I

not expert of this cpu, but you should be able to define yourself where the sections are set in memory.

This is what the linker file is needed for. So define section names and assign the addresses you want. Then

you should be able to put them there, using the > symbol.

0 Kudos
1,428 Views
steffenrose
Contributor III

Hi,

of course I did set the memory definition in the attached Linkerfile.

An I used the section definition as you suggest.

But the linker seems to have an additional "anything", that move sections without addition LOAD() to address 0x2000. I cannot find this setting.

I'm the meaning, that in case od using a linker file all settings located in it.

0 Kudos