This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

size of the executable using make command

I want to get size of the project executable and display it in make file. How to get exact size of the executable file in make file.

Can you please provide the make file command to extract this information.

Parents
  • Hi,

    You can get the size by calling arm-none-eabi-size _build/outfile.out

    It will give you something like this:

    
       text    data     bss     dec     hex filename
      37568     128    4112   41808    a350 _build/example.out
    
    

    Flash size = text RAM = data+bss dec = RAM+Flash

    Go to your makefile.common and add it somewhere, for instance in the .out->.hex conversion:

    
    ## Create binary .hex file from the .out file
    $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
    	$(OBJCOPY) -O ihex $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
    	arm-none-eabi-size $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
    
    

    Note, if you check out my colleagues repo and use those makefiles, then it's taken care of for you: github.com/.../template

    Best regards Håkon

Reply
  • Hi,

    You can get the size by calling arm-none-eabi-size _build/outfile.out

    It will give you something like this:

    
       text    data     bss     dec     hex filename
      37568     128    4112   41808    a350 _build/example.out
    
    

    Flash size = text RAM = data+bss dec = RAM+Flash

    Go to your makefile.common and add it somewhere, for instance in the .out->.hex conversion:

    
    ## Create binary .hex file from the .out file
    $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
    	$(OBJCOPY) -O ihex $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex
    	arm-none-eabi-size $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out
    
    

    Note, if you check out my colleagues repo and use those makefiles, then it's taken care of for you: github.com/.../template

    Best regards Håkon

Children
Related