code size problem ,reduce the code size

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

code size problem ,reduce the code size

Jump to solution
1,383 Views
cathychang
Contributor I

hi everyone,

       I  want to reduce the code size . i reduced the code of psp/bsp and so on ,but the changed of the .s19'code  is so  small. i dont know which one is the improtant about code size?

 

1. in CodeWarrior Tools ,we can see code and data.
    for example:
        File                              code             data
      -MQX libraries              99k             8554
      -RTCS libraries           80172       15992
      -Source                         13592        5691
2. the size of intflash.elf.s19
      intflash.elf.s19           266KB 
3. read the MQX Code Size Report be created by codesize.exe about intflash.elf.xMAP.
       

MQX Code Size Report



MAP Fileintflash.elf.xMAP
Compilercwcf7

MQX Core Components Code (ROM)
 
MQX Core Code1297
MQX String Code-
MQX Scheduler Code2606
Interrupt Management Code918
Lightweight Memory Manager Code1328
Lightweight Semaphore Code776
Memory Manager Code506
Processor Support Code940
Queue Management Code298
Task Management Code2622
Time Management Code3825
Task Queues Component Code612
MQX Optional Components 
Event Component Code-
Idle Task Code-
I/O Subsystem Code5338
Kernel Log Component Code-
Lightweight Event Component Code-
Lightweight Log Component Code-
Lightweight Message Component Code-
Lightweight Timer Component Code-
Log Component Code-
Message Component Code4498
Mutex Component Code-
Semaphore Component Code-
Name Component Code-
Partition Component Code1422
Command-line TAD Code-
MPU Support Code-
Other PSP Code420
Total of MQX PSP Code27406

MQX BSP Code (ROM)
 
BSP Vector Table1024
BSP Bootstrap Loader Code-
Board Initialization Code355
BSP Interrupt Management Code620
Clock Management Code-
Low Power Management Code-
A/D Driver Code-
APC Flash Driver Code-
Ethernet Driver Code1932
Ethernet Phy Driver Code492
Ethernet FEC Driver Code5186
NAND Flash Driver Code-
FLASH Driver Code-
GPIO Driver Code-
I2C Driver Code-
PC-Card Driver Code-
Real Time Clock Driver Code-
Serial Port Driver Code3978
SPI Driver Code-
FlexCan Driver Code-
msCan Driver Code-
Display Driver Code-
DIU Driver Code-
Trivial File System Code-
Timer Driver Code312
SD Card Driver Code-
eSDHC Driver Code-
Other BSP Code652
Total of BSP Code14551

Summary of MQX Libraries Code (ROM)
 
Total of MQX PSP Code27406
Total of BSP Code14551
Total of MFS Code-
Total of RTCS Code62989
Total of USB Host Code-
Total of USB Device Data-
Total of Shell Code-
System Libraries Code (ROM) 
System Library Code (MSL/EWL...)1554
User Application-related Code (ROM) 
Application-specific Code17697

Overall Total
 
All ROM Code and Initialized Data sections124197

 

  i want to reduce code size, but i dont know which one is  the key factor about code size.

The size (the size of MAX lib + the size of RTCS lib + the size of the Source) is not the same as the size of .s19 ,i want to know what is different about  there kinds of size?

0 Kudos
1 Solution
643 Views
DavidS
NXP Employee
NXP Employee

Hi cathychang,

Our FTF2012 (Freescale technology Forum) had a class that covered optimization and configuration of MQX:

Hands-on Workshop: Tower System Solutions, Part 3: Optimizing and Configuring an MQX™ RTOS, Intermed...

http://www.freescale.com/webapp/Download?colCode=FTF12_ENT_F0081PDF&location=null&Parent_nodeId=1209...

 

I find that I do not tune the default configuration much but chaning from the debug target to the release target gives the fastest results as the release target turn more compiler optimizations on.

 

Hope this helps.

Regards,

David

View solution in original post

0 Kudos
3 Replies
644 Views
DavidS
NXP Employee
NXP Employee

Hi cathychang,

Our FTF2012 (Freescale technology Forum) had a class that covered optimization and configuration of MQX:

Hands-on Workshop: Tower System Solutions, Part 3: Optimizing and Configuring an MQX™ RTOS, Intermed...

http://www.freescale.com/webapp/Download?colCode=FTF12_ENT_F0081PDF&location=null&Parent_nodeId=1209...

 

I find that I do not tune the default configuration much but chaning from the debug target to the release target gives the fastest results as the release target turn more compiler optimizations on.

 

Hope this helps.

Regards,

David

0 Kudos
643 Views
c0170
Senior Contributor III

Hello cathychang,

 

If you are willing to reduce code size, your concern is  .text section in your map file.

 

To get familiar with ELF files, read wikipedia article named Executable and Linkable Format and google a bit. You will find out there are more section in ELF file, not only data and code.


How much kB reduction is your goal ?

 

Regards,

MartinK

643 Views
cathychang
Contributor I

i want to reduce code size into 128KB (this is the upper limit).

 

The size of .s19 file in my project  is 303KB after added the USB cdc function .

Summary of MQX Libraries Code (ROM) 
Total of MQX PSP Code27568
Total of BSP Code14799
Total of MFS Code-
Total of RTCS Code58595
Total of USB Host Code512
Total of USB Device Data18640
Total of Shell Code-
System Libraries Code (ROM) 
System Library Code (MSL/EWL...)1554
User Application-related Code (ROM) 
Application-specific Code19645

Overall Total
 
All ROM Code and Initialized Data sections141313

 

 

 

If it only have  MQX  and RTCS SNMP , the size of .s19 file is about 265KB;

 

Summary of MQX Libraries Code (ROM)

 

Total of MQX PSP Code

27406

Total of BSP Code

14551

Total of MFS Code

-

Total of RTCS Code

62989

Total of USB Host Code

-

Total of USB Device Data

-

Total of Shell Code

-

System Libraries Code (ROM)

 

System Library Code (MSL/EWL...)

1554

User Application-related Code (ROM)

 

Application-specific Code

17697


Overall Total

 

All ROM Code and Initialized Data sections

124197

 

i  want to know how to reduce this code --"All ROM Code and Initialized Data sections" ?

 

0 Kudos