Closed yannS2016 closed 5 years ago
I believe the strangeness with the size return is actually due to it parsing the .hex, not the .elf - .elf includes all the symbols, sections, fuse, lock bit settings etc, whereas .hex only has the binary data. size
has nothing more than this binary data so returns it all as flash '.data'.
If you do /home/pi/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/binarm-none-eabi-size build-mkrzero/MZeroBlink.elf
you should get the full breakdown, eg:
text data bss dec hex filename
10104 256 1964 12324 3024 build-mzero_pro_bl_dbg/MZeroBlink.elf
Clearly it this behaviour should be changed and SAMD builds should pass the .elf to size rather than .hex.
As for why it not working after upload, I'm not sure about this. I'm not sure anyone has actually tried and tested a MKRZero, there could be some differences?
The avr-size
provided by the Arduino app or if you compile binutils yourself has a patch that's a few years old to provide the size for avr boards.
The patch hasn't evolved in years and does not contain all the new boards/mcu's.
And alternative for avr is to use avr-objdump
like this:
$ avr-objdump -Pmem-usage file.elf
I can't test it for arm but if it works, I think it could be generalized in the Makefile to not be dependent on a size
bin that's broken.
I'm confused, I think we're talking about different things. The arm-none-eabi-size
tool works as the avr-size
if you pass the .elf. The output in this issue and default for ARM boards is to pass the .hex, which size
is unable to present a full breakdown because it's just a binary file with no sections.
I'm not sure why AVR builds pass the .elf to the size
and ARM passes the .hex but should be a fairly simple fix.
# M Zero Blink
make size
/home/john/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-size build-mzero_pro_bl_dbg/MZeroBlink.hex
text data bss dec hex filename
0 10360 0 10360 2878 build-mzero_pro_bl_dbg/MZeroBlink.hex
# AVR Blink
make size
/usr/bin/avr-size --mcu=atmega328p -C --format=avr build-uno/Blink.elf
AVR Memory Usage
----------------
Device: atmega328p
Program: 920 bytes (2.8% Full)
(.text + .data + .bootloader)
Data: 9 bytes (0.4% Full)
(.data + .bss + .noinit)
Ah ok, I see sort of what you were getting at. ARM was falling back to 'Basic (not AVR-aware)' and so not getting the .elf file. I've made a quick fix, which means arm-size is properly supported.
Thanks Guy for your support!
Also @tuna-f1sh , the code actually compiles fined, my mistake with the small testing sample is that i assumed the MKR Zero board used LED 13 as the build in LAMP, which is not. after fixing that i got it to pass the simple test. will communicate more on this board as i go. Also the fix you provided fix the issue of size. Tanks Again.
@tuna-f1sh is your fix going to become a PR?
Goo day all!
I have done some work using the make file with AVR based board so far with great success. however, i have switched to ARM board( arduino mkrzero) for a staret. i have the tools and core correctly setup as i can build and upload fine om the arduino IDE. This is the process i follow using the MzeroBlink example:
Note: build system: Linux Debian( rapsberry PI 2)
this build as below:
the build completes without issues but the size command return something strange:
and obviously the code wont do a thing after upload. Can anyone help in this regard? Thanks