Hi All,
Can anyone please explain, why "Filling bytes are inserted" in Copydown section of map file.Is there any specific format linker follows in filling bytes inserted?
COPYDOWN SECTION
---------------------------------------------------------------------------------------------
------- ROM-ADDRESS: 0xC04D ---- SIZE 4 ---
Filling bytes inserted
00032101
------- ROM-ADDRESS: 0xC051 ---- RAM-ADDRESS: 0x2101 ---- SIZE 1 ---
Name of initialized Object : temp:1
10
------- ROM-ADDRESS: 0xC052 ---- SIZE 1 ---
Filling bytes inserted
00
------- ROM-ADDRESS: 0xC053 ---- RAM-ADDRESS: 0x2103 ---- SIZE 1 ---
Name of initialized Object : arr:1
20
------- ROM-ADDRESS: 0xC054 ---- SIZE 4 ---
Filling bytes inserted
00172166
------- ROM-ADDRESS: 0xC058 ---- RAM-ADDRESS: 0x2166 ---- SIZE 23 ---
Name of initialized Object : Soft_Part
536F667477 6172652050 6172743A20
53572D3030 323030
------- ROM-ADDRESS: 0xC06F ---- SIZE 2 ---
Filling bytes inserted
0000
I have attached example code set and respective map file along with this mail.
Is there any document/app. note where i can find more info about the same.
Thanks in advance,
Kini
Hello
Basically COPYDOWN section provides information on the initialized data defined in the application.
Information stored in that section are processed by the startup code, to initialize global variables to their initialization value.
You can find information on format used to store copy down information oh HC12 in {Install}\Help\PDF\Build_Tools_Utilities.pdf. Check Table 7.1 ELF Startup Descriptor Field Semantics on page 119 (on manual delivered with CodeWarrior for HC12 V4.7.
Look at description for field toCopyDown.
You should find the information you require in there.
If you are using another version check the BuildTool Utility manual chapter "Smart Linker", section "Program startup" -> "Startup Descriptor (ELF)".
I hope this helps.
CrasyCat
Hi CrasyCat,
Thanks for the quick response and the material information given.
Well actually, if we chnage the order in which global variables declared in that file, "filling bytes" will be updated with new value.
Even if we have a closer look into those bytes, we can see that,
ROM-ADDRESS: 0xC054 ---- SIZE 4 ---
Filling bytes inserted
00172166
------- ROM-ADDRESS: 0xC058 ---- RAM-ADDRESS: 0x2166 ---- SIZE 23 ---
Name of initialized Object : Soft_Part
536F667477 6172652050 6172743A20
53572D3030 323030
0017 - i.e. 0x17 - 23(decimal) bytes are initialised
2166 - is the starting address of the variable to be initialised
But this understanding wont fit exactly for the previous section.
Filling bytes inserted
00032101
------- ROM-ADDRESS: 0xC051 ---- RAM-ADDRESS: 0x2101 ---- SIZE 1 ---
Name of initialized Object : temp:1
10
------- ROM-ADDRESS: 0xC052 ---- SIZE 1 ---
Filling bytes inserted
00
------- ROM-ADDRESS: 0xC053 ---- RAM-ADDRESS: 0x2103 ---- SIZE 1 ---
Name of initialized Object : arr:1
20
Again, i saw that, at the end of copydown section 2 bytes 0x0000 is inserted as filling bytes in all the cases.
------- ROM-ADDRESS: 0xC06F ---- SIZE 2 ---
Filling bytes inserted
0000
Again, i found that the filling byte pattern mainly depends upon memory model selected.
Can anyone please explain, how does linker determine where to put filling bytes and what all informatio will be embedded in those bytes?
Thanks in adv...
kini
Hello
The filling bytes are the actual value assigned to your global initialized variables.
If you have global pointer variables initialized with the pointer to an object, it is normal that the filling byte value changes when you change order in which global variable are defined.
There is a terminator record at the end of the list of block to initialize at startup. This is why you see a 2 byte block without associated RAM ADDRESS at the end of the COPYDOWN section.
------- ROM-ADDRESS: 0xC06F ---- SIZE 2 ---
Filling bytes inserted
0000
Also if you change the memory model, global variable of pointer type might be bigger (3 bytes instead of 2). So here again your COPYDOWN section will be different if you build with -Mb or -Ml.
If you want to get rid of this COPYDOWN section just make sure all global variables are initialized through assignment in your application. Do not use initialization value for global variables at all.
CrasyCat