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.
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.
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
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
Thank you very much for your input!!!
Hey Hakon, I think "Flash size = text; RAM = data + bss; dec = RAM+flash" would be easier to read. Right now it's a little hard to figure out how the line parses.