Stationary cmd file: .p_flash_ROM_data : ORIGIN = 0x0001,LENGTH = 0x0FFF - why this length

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

Stationary cmd file: .p_flash_ROM_data : ORIGIN = 0x0001,LENGTH = 0x0FFF - why this length

933 Views
j___
Contributor IV

The linker command file in the directory:

C:\Program Files\Freescale\CodeWarrior for DSC56800E v8.3\Stationery\DSP56800x_EABI\MC56F83xx\MC56F8345\Simple_C\lcf\MC56F834x_ldm_pROM-xRAM_linker.cmd

is part of the stationary of CW 8.3. I have attached a copy to this post.

 

Why is the MEMORY segment .p_flash_ROM_data only 0x0FFF in length and start at address 0x0001. This seems to be the segment that holds the C-environment variables that will be copied out to RAM. The reason I say that is because in the SECTION there is a reference to __xRAM_data_start = .; This indicates to me that RAM is related.

 

What is odd to me is that the P-memory is 128KB, up to address 0xFFFF, in the MC56F8345. This equates to address 0x8000 in word addressing although I am not sure this comes into play on this part. This stationary is targeted at the MC56F8345. Further, the linker file has the directive, ".data_in_p_flash_ROM : AT(__pROM_data_start)" which indicates that .p_flash_ROM_data is to come AFTER the application program code (.text). Therefore, the code (.text) MUST be less than 0xFFF by a reasonable amount so that there is still room for the C-environment data image within the 0x1000 boundary (start addr 1 + 0xFFF len = 0x1000).

 

Why would C-enviromment image MEMORY segment be created in such a way as to restrict the application size so dramatically? All of the stationary linker command files that I looked at for the 56800e (568000E?) core were created this way? It seems odd to me.

 

Also, why would the address start at 0x0001?

 

Why not 0x0000 (which would be wierd)?

 

But more realistically, why not 0x20? This would allow for a really simple program but provide a meaningful start point above 0x0000. There cannot be a 1 byte\word C-program (remember the directory ...\Simple_C\lcf\). In fact, 0x20 is probably to low.

 

It is easy to say, well these are just demo starting points but that is not a reasonable answer. I am new to these parts and these values indicate to me that this was done this way for a reason, not just arbitrary numbers.

 

Any help in understanding would be GREATLY appreciated.

 

Regards,

Jim

 

P.S. Should this post be in the DSC forum or here in CW legacy tools where I have posted?

Original Attachment has been moved to: MC56F834x_ldm_pROM-xRAM_linker.cmd.zip

Labels (1)
3 Replies

498 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Jim

Size 0xFFF is only for the .p_flash_ROM_data which holds C-environment variables, not the size for both code and variables.

These variables are loaded into program flash following the code, the start address for these variables are __pROM_data_start.

The start address 0x0001 is in data RAM, which is the address to where the variables are copied from program flash. You can also set it as 0x0000. By default, these variables start from 0x0002 because of data alignment, below is extracted from the MAP file of this stationery project. 

------------------------------------------------------------------------------------------------------------------------

# .data_in_p_flash_ROM

#>00000001          __xRAM_data_start (linker command file)

  00000002 00000002 .data   F__malloc_pool_ptr     (MSL C 56800E lmm.lib alloc.o        )

  00000004 00000090 .data   F__files            (MSL C 56800E lmm.lib ansi_files.o   )

  00000094 00000000 fp_state.data FPE_state         (Runtime 56800E lmm.lib fp56800e.o     )

Best Regards

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

498 Views
j___
Contributor IV

Hi Fiona,

OK. Getting a little clearer but still some questions.

You will see that there are some notes in the linker file regarding using the (RX) flags to download to P-memory. That still does not make sense to me. The memory range of 0x0000 - 0x0FFF is only accessible by the X-bus, so it cannot (should not) be marked as 'X'.

The example in "Targeting MC56F83xx/DSP5685x Controllers" on page 290, shows this example with marking the RAM as (RX). Why is this different?

The comment in the LCF seems to relate to the debugger but if a program is linked and output file created .elf or .s, it seems that the debugger would just place data where indicated by the output file. I don't think the debugger references the LCF when loading code?

As a side note, I am using the Flash Programmer, "56800E Flash Programmer.exe", that is part of the CW 8.3. This is because CW cannot load the file, it always fails (yes, I tried adjusting the debugger clock). Therefore, I am not downloading with the debugger does this LCF comment make sense?

So, the point is, I don't understand this (RX) attribute for X-bus RAM.

I have attached the Small Data Model LCF. I am using a modified version of this LCF. It is from the directory:

C:\Program Files\Freescale\CodeWarrior for DSC56800E v8.3\Stationery\DSP56800x_EABI\MC56F83xx\MC56F8345\Simple_C\lcf\MC56F834x_sdm_pROM-xRAM_linker.cmd

Regards,

Jim

0 Kudos

498 Views
TICS_Fiona
NXP Employee
NXP Employee

Hi Jim

Are you asking this line in LCF?

  .p_flash_ROM_data    (RX) : ORIGIN = 0x0001,  LENGTH = 0x0FFF # internal xRAM mirror

“RX” means that this data section is placed in program memory and can be read.  The linker places the data into program flash. To prove it, you can open the output S-record file to view its address. In the S-record file, you will find these data are saved in program flash. 

They are copied to RAM in application’s start-up code.

I agree with you that the debugger does not check the LCF when it downloading the firmware, because the ELF already contains the address information, it only check the flash initialization file which is chosen in Target Settings.

RX.png

>> The example in "Targeting MC56F83xx/DSP5685x Controllers" on page 290, shows this example with marking the RAM as (RX). Why is this different?

Probably we are using the different reversion of Targeting Manual. I attach the manual included in CW8.3. On which page can I find the same example?

Best Regards

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos