How can I find out the size of my program and how much program space if left on a K60?

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

How can I find out the size of my program and how much program space if left on a K60?

8,881 Views
barrypurtymun
Contributor II

In other environments, finding out how much program space is left is obvious.  I am sure the same is the case with KDS.  Please enlighten me.  

6 Replies

6,494 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi barry

Also, please check the following post.

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

Best Regards

Jorge Alcala

0 Kudos
Reply

6,494 Views
mjbcswitzerland
Specialist V

Hi Barry

Look in the console output - it should show you the details. Eg.

Invoking: Cross ARM GNU Create Flash Image
arm-none-eabi-objcopy -O ihex "uTaskerV1.4_BM.elf"  "uTaskerV1.4_BM.hex"
Finished building: uTaskerV1.4_BM.hex
 
Invoking: Cross ARM GNU Create Listing
arm-none-eabi-objdump --source --all-headers --demangle --line-numbers --wide "uTaskerV1.4_BM.elf" > "uTaskerV1.4_BM.lst"
Finished building: uTaskerV1.4_BM.lst
 
Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "uTaskerV1.4_BM.elf"
   text       data        bss        dec        hex    filename
  43933        196      16552      60681       ed09    uTaskerV1.4_BM.elf
Finished building: uTaskerV1.4_BM.siz
 

19:12:24 Build Finished (took 20s.755ms)

If you generate a binary file output too you can simply look at its exact size in file explorer.

Regards

Mark

http://www.utasker.com/kinetis.html

6,494 Views
barrypurtymun
Contributor II

That is where I thought it would be. Maybe I am not looking at the right console. Is it in there somewhere? I can’t see it. Also, from your example output consule below, how do I know how much program space is left?

11:51:38 **** Incremental Build of configuration Debug for project x****

make all

Building file: ../Sources/x.c

Invoking: Cross ARM GNU C Compiler

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -I"C:/nxp/workspace/x/Static_Code/PDD" -I"C:/nxp/workspace/x/Static_Code/IO_Map" -I"C:/nxp/workspace/x/Sources" -I"C:/nxp/workspace/X/Generated_Code" -std=c99 -MMD -MP -MF"Sources/X.d" -MT"Sources/X.o" -c -o "Sources/X.o" "../Sources/X.c"

Finished building: ../Sources/X.c

Building target: X.elf

Invoking: Cross ARM GNU C++ Linker

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T "C:/nxp/workspace/X/Project_Settings/Linker_Files/ProcessorExpert.ld" -Xlinker --gc-sections -L"C:/nxp/workspace/X/Project_Settings/Linker_Files" -Wl,-Map,"X.map" -u printffloat -specs=nano.specs -specs=nosys.specs -o "X.elf" ./Sources/Events.o ./Sources/FT800.o ./Sources/X.o ./Sources/main.o ./Project_Settings/Startup_Code/startup.o ./Generated_Code/AD_BUSY.o ./Generated_Code/ASerialLdd1.o ./Generated_Code/ATODRESET.o ./Generated_Code/BitIoLdd1.o ./Generated_Code/BitIoLdd10.o ./Generated_Code/BitIoLdd11.o ./Generated_Code/BitIoLdd12.o ./Generated_Code/BitIoLdd13.o ./Generated_Code/BitIoLdd2.o ./Generated_Code/BitIoLdd3.o ./Generated_Code/BitIoLdd4.o ./Generated_Code/BitIoLdd5.o ./Generated_Code/BitIoLdd6.o ./Generated_Code/BitIoLdd7.o ./Generated_Code/BitIoLdd8.o ./Generated_Code/BitIoLdd9.o ./Generated_Code/C11.o ./Generated_Code/C21.o ./Generated_Code/CAL1.o ./Generated_Code/CS.o ./Generated_Code/CS_ADC.o ./Generated_Code/CS_EEROM.o ./Generated_Code/CS_POT.o ./Generated_Code/Cpu.o ./Generated_Code/Inhr1.o ./Generated_Code/MCUC1.o ./Generated_Code/OS0.o ./Generated_Code/OS1.o ./Generated_Code/OS2.o ./Generated_Code/PD.o ./Generated_Code/PE_LDD.o ./Generated_Code/Q4C1.o ./Generated_Code/SM1.o ./Generated_Code/SM2.o ./Generated_Code/SMasterLdd1.o ./Generated_Code/SMasterLdd2.o ./Generated_Code/TI1.o ./Generated_Code/TI2.o ./Generated_Code/TI3.o ./Generated_Code/TU1.o ./Generated_Code/TU2.o ./Generated_Code/TU3.o ./Generated_Code/Term1.o ./Generated_Code/TimerIntLdd1.o ./Generated_Code/TimerIntLdd2.o ./Generated_Code/TimerIntLdd3.o ./Generated_Code/Vectors.o ./Generated_Code/WAIT1.o

Finished building target: X.elf

11:51:39 Build Finished (took 1s.342ms)

Barry Purtymun

Link Engineering Company

623-505-9245 Direct

480-862-5015 Mobile

623-505-9250 Main

http://www.linkeng.com<http://www.linkeng.com/>;

0 Kudos
Reply

6,494 Views
mjbcswitzerland
Specialist V

Barry

Your build is not generating a binary/HEX file - you can check a box somewhere in the settings to get it to use objcpy() to do this and it possibly does the size command too.

In case of problems just call a bat file with command to do whatever is missing; it is more flexible that what KDS offers (the GCC binary folder contains all of the standard utilities to do such things).

The remaining size in Flash is (FLASH_SIZE - code size), assuming you have no areas reserved in Flash for parameter storage or file systems.

Regards

Mark

0 Kudos
Reply

6,494 Views
barrypurtymun
Contributor II

Ok, I found an option called print size. Here is what I get.

Invoking: Cross ARM GNU Print Size

arm-none-eabi-size --format=berkeley "x.elf"

text data bss dec hex filename

49892 204 3364 53460 d0d4 x.elf

Finished building: x.siz

I looked at the .elf file in windows and it’s property shows 1.07 MB. The my controller is the Kinetis® K60: 150MHz Cortex-M4F up to 1MB Flash (144pin).

I appreciate your support.

Barry Purtymun

Link Engineering Company

623-505-9245 Direct

480-862-5015 Mobile

623-505-9250 Main

http://www.linkeng.com<http://www.linkeng.com/>;

0 Kudos
Reply

6,494 Views
mjbcswitzerland
Specialist V

Barry

An ELF file contains lots of data (eg. symbol information of debugging) and so has nothing to do with the size of the binary that is loaded (eve small code of a few kBytes may have an ELF of 1 Mega Byte in size).

Configure to generate a .bin output and then you have the the exact size accurate to a byte.

Regards

Mark