How to have acces to code size using MC toolbox for kinetis ?

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

How to have acces to code size using MC toolbox for kinetis ?

2,376 Views
m_benderradji
Contributor II

Hi,

Currently, i am using MC toolbox for kinetis and i work especially with KV10 family for my application.

I would like to know how to have access to the "code size of my application". For information, i am using GCC compiler.

Thanks in advance for your support

Regards

0 Kudos
10 Replies

2,083 Views
m_benderradji
Contributor II

Hello NXP team,

Any feedback please ?

Thanks

0 Kudos

2,083 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi m.benderradji@outlook.fr‌,

All the code that is generated is based on the NXP S32K SDK drivers - hence the need for additional program space. You can easily see which drivers are used and how much program/data memory space it takes by checking the map file generated for each model.

Even for a simple Simulink model you have pointed out, there are a lot of initializations that happen under the hood in order to startup the MCU.

pastedImage_1.png

Fortunately, Simulink comes with a set of optimization features that may help you to reduce the code size or improve the execution speed of the program.

pastedImage_2.png

The ugly truth is that those optimization works for the Simulink model part (user application) and not the "mcu startup code" which is injected by the NXP toolbox in order to bring the MCU up to life.

To reduce the code size even further, you may use the cross-compiler optimization flags. In case of GCC you can enable the -Os flag instead of -O1 (GCC flags are described here)

pastedImage_3.png 

Anyhow,  keep in mind that there is a minimum size that is required for SDK driver initialization that can't be reduced further since it is absolutely necessary for the MCU startup.

Hope this address your concerns!

Best regards,
Daniel

0 Kudos

2,083 Views
m_benderradji
Contributor II

Hello Marius,

Thank you very match for your support, i succeeded to identify the code size (refer to the following): 

pastedImage_1.png

However, i'm a little bit surprised to see that a simple application like LED toggling (gpio_s32k144 exemple below) costs almost 27 kByte. Is there any explanation ? is there a way to reduce the size ? thanks in advance

Best regards

pastedImage_2.png

0 Kudos

2,083 Views
m_benderradji
Contributor II

Hi,

Any feedback please ?

Tanks in advance

0 Kudos

2,083 Views
mariuslucianand
NXP Employee
NXP Employee

Hello m.benderradji@outlook.fr‌,

Yes, it is possible by analyzing the .map file. But it easier to use the arm-none-eabi-size tool. Please check the link [1] to see how to use it and to understand the values please read [2]. Also the same question has been discussed on [3].

[1] Code Size Information with gcc for ARM/Kinetis | MCU on Eclipse 

[2] text, data and bss: Code and Data Size Explained | MCU on Eclipse 

[3] How to check the code size and memory use in codewarrior V10.3 

Hope this helps you!

Best Regards, 

Marius

0 Kudos

2,083 Views
m_benderradji
Contributor II

Hi Razvan,

Thanks for your support

First, i  wish to inform you that i don't have UNIKS OS. Secondely, I did not completely understand how to have acces to the size of my application using readelf utility or grep. 

Is it possible with <name_of_application>.map we can have some information or summery about the code size (especially for flash).

rEGARDS

0 Kudos

2,083 Views
m_benderradji
Contributor II

Hello,

any feedback please ?

regards

0 Kudos

2,082 Views
constantinrazva
NXP Employee
NXP Employee

Hello m.benderradji@outlook.fr‌,

There are many ways to see information about the generated elf file, one of them being the readelf utility. This is available if you have a UNIX OS or cygwin or something similar. You can see details about all the sections by using this line:

readelf --section-details <name_of_elf>.elf

You can also use grep to filter the output to what you want to see.

None of these utilities however is part of what we develop - these can be used for every file that is of ELF type, so nothing particular to ones generated by our toolbox.

Kind regards,

Razvan.

0 Kudos

2,082 Views
m_benderradji
Contributor II

Hi,

I want to see how large is the generated elf size

REGARDS

0 Kudos

2,083 Views
mariuslucianand
NXP Employee
NXP Employee

Hello m.benderradji@outlook.fr‌,

So your application code size is larger than the board size flash, or you want to see how large is the generated elf size?

Best Regards, 

Marius

0 Kudos