ROM usage information for HCS12

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

ROM usage information for HCS12

2,377 Views
greatj
Contributor I

Hi

 

Presently I am using freescale CW:5.7.0, limited version with 32K(32768 B) code size limitation.

 

I am aware that .map file shows you  the details of all the ROM,RAM memory usage. But I observed something which I am not able to understand. The map file shows the ROM used as 30892 Bytes, but the CW does compile the code as it shows that code is above 32KB.

 

Summary of section sizes per section type:
READ_ONLY (R):        78AB (dec:    30891)
READ_WRITE (R/W):     132A (dec:     4906)
NO_INIT (N/I):         CE1 (dec:     3297) 

 

 

the map file is attached for more information.

 

Pls enlighten me.

Labels (1)
0 Kudos
Reply
10 Replies

1,145 Views
kef
Specialist I

Codewarrior IDE takes and shows the sum of code/data sizes of all compiled modules, while map file shows code size after removing all unused variables and subroutines (deadstriping).

 

You may get code size also at the end of map file, "Total size of all blocks to be downloaded" is application code size:

 

ExeFile:
--------
Number of blocks to be downloaded: 9
Total size of all blocks to be downloaded: 30891

0 Kudos
Reply

1,145 Views
greatj
Contributor I

Thank you kef for your response.

 

May be I am not clear on my previous post. My actual question is the codewarrior(limited ver:smileyhappy: should compile the code size upto 32KB (32768 B), but it stops at 30892 telling the code size excedded the 32KB limit. I am not able to understand it.

 


 

 

0 Kudos
Reply

1,145 Views
kef
Specialist I

greatj,

 

Did you take used library routines into account? I guess map file is not updated when linker finds you exceeded 32kB. Maybe you see map file from the last successful linking attempt, I'm not sure.

0 Kudos
Reply

1,145 Views
greatj
Contributor I

Hi kef

 

I tried compiling the code of different sizes both above and below 30892 Bytes. During this trial and error procedure only I found the magic no: 30892 Bytes, from and above which the IDE will give 32KB limitation message.

 

All the time I changed the code size(for both above and below 30892B)  Iam getting ROM, RAM memory status changed.

 

For my verification I used only MAP file, do other normally used lib: routines doesnt get noted down in map file.
0 Kudos
Reply

1,145 Views
Lundin
Senior Contributor IV
The code size limit thing gets its information from the IDE and not the map file, so it is probably not too accurate.
0 Kudos
Reply

1,145 Views
greatj
Contributor I

HI Lundin,

You maybe right, but Iwant to be sure.......

0 Kudos
Reply

1,145 Views
Lundin
Senior Contributor IV
I have encountered the same problems before. The IDE typically counts -all- code in the project, while the map file counts the code which is actually used. Lots of it could be optimized away, but the IDE can't know this.
0 Kudos
Reply

1,145 Views
greatj
Contributor I

Hi Lundin,

 

Based on your suggestion, I commented some of the codes of certain files which I knew where not used anywhere , But still problem exists. I feel either it is a bug with Freeescle CW or we are missing something.

 

 

0 Kudos
Reply

1,145 Views
CompilerGuru
NXP Employee
NXP Employee

The linker, which is checking the license limitations, only considers allocated objects.

However the linker checks the objects which are read in from the C compiler, not the ones which

are written to the generated ELF file.

This is significant in multiple ways, first only C is limited, not other contributions. Well this would help you as you can indeed link apps > 32k, just as long as the >32k part is not from C.

However the linker counts initialized variables to the limit as well, not just code. Basically any content from C.

Therefore a struct like "int sample_arr[1000] = {1}; " counts as 2000 bytes even though when finally emitting the ELF file, the linker will only emit the information to zero out the whole thing and to write a single 1. So in the final ELF file this sample_arr variable only adds a few bytes to the ROM image (in the copy down and zero out data structures). That's why you can end up with a flash size smaller than 32k and still the linker starts complaining when you add one more byte to the app.


Daniel
 

Message Edited by CompilerGuru on 2010-02-01 02:06 AM
0 Kudos
Reply

1,145 Views
greatj
Contributor I

Thank you CompilerGuru,

 

I verified . It seems compiler is taking the global variable also into accout to put the 32K ROM restriction. Is there any way to verify from map file, so as to get exact details.

 

Thank you once again. 

 

 

0 Kudos
Reply