56800E Linker Command file  for 56F8367 question

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

56800E Linker Command file  for 56F8367 question

620 Views
bdang
Contributor II

Tool: Codewarrior tool for DSC56800/E version 8.3 build 091203

target: 56F8367 processor

 

I'm having issue of string constant. The code below to initialize a Global char array does not work (the array elements have wrong data when later being read out as ex: serial_dr = String[0] does not TX out ascii H correctly) :

char String[] = "Hello";      // defined as global variable

 

However, when assigning the array individually in main(), as below, it works (serial_dr=String[1] does send out 'e' ascii)

String[0]='H';

String[1]='e';

String[2]='l';

String[3]='l';

String[4]='o';

String[5]='\0';

 

I looked into the Linker command file trying to understand how the tool writing the "Hello" string into the array. Does the tool write the string "Hello" into p_flash_ROM_data(RX) (which is located in the program flash memory block as the executable code), and then when the code runs after power reset, the code copies the string from p_flash into the array String[] (in internal RAM)?

(It seems the p_flash_ROM_data section is located right after the executing code section. How does the tool know if the p_flash_ROM_data does not written over the chip's p_flash ROM total area with a very large string constant for example?)

 

MEMORY
{
.p_interrupts_ROM (RX) : ORIGIN = 0x0000, LENGTH = 0x00AC # reserved for interrupts
.p_flash_ROM (RX) : ORIGIN = 0x00AC, LENGTH = 0x3FF54 # 256K words contiguous flash minus interrupt space

# p_flash_ROM_data mirrors internal xRAM, mapping to origin and length
# the "X" flag in "RX" tells the debugger to download to p-memory.
# the download to p-memory is directed to the address determined by AT
# in the section definition below.

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

.p_boot_flash_ROM (RX) : ORIGIN = 0x40000, LENGTH = 0x4000 # 16K words
# .p_reserved : ORIGIN = 0x44000, LENGTH = 0xB800 # 46K words
.p_internal_RAM (RWX) : ORIGIN = 0x4F800, LENGTH = 0x0800 # 2K words
.p_external_RAM (RWX) : ORIGIN = 0x50000, LENGTH = 0x0000 # max available
.x_internal_RAM (RW) : ORIGIN = 0x0001, LENGTH = 0x3FFF
.x_flash_ROM (RW) : ORIGIN = 0x4000, LENGTH = 0x4000
.x_external_RAM (RW) : ORIGIN = 0x8000, LENGTH = 0x7000
.x_onchip_peripherals (RW) : ORIGIN = 0xF000, LENGTH = 0x1000
.x_external_RAM_2 (RW) : ORIGIN = 0x10000, LENGTH = 0xFEFF00
.x_EOnCE (RW) : ORIGIN = 0xFFFF00, LENGTH = 0x0000
}

 

Thank you,

Brian

Labels (1)
0 Kudos
2 Replies

407 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Brian,

It seems to be the same question as this other thread, it will be answered there:

56800E Linker Command file for 56F8367 question 

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

407 Views
bdang
Contributor II

Hi Carlos,

My apology for multiple posts of the same thing -- was not sure if anyone would see in legacy/classic. 5 days have past and not any answers yet.

Regards,

Brian

0 Kudos