avr-size doesn't support all avr processors. SOLUTION

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Its common knowledge that avr-size doesn't know anything about recent avr chips, and so can only say how much each space in the ELF occupies, not how much is used from the available space.

 

So, I created a pure python3 utility to do it.  It does not call any external programs or needs no external libraries, and should run on any host with a stock python3 install. 

 

Get it here:  https://github.com/stevenj/elfsize

 

Its a single file, that when run takes a simple ini file which defines the memory layout of the device in question, and the ELF to analyse.  It gives output like this:

 

Attiny816 | SECTION | Address | Size | Used | Percentage Used

 

Attiny816 | SECTION          | Address |  Size |  Used | Percentage Used
----------+------------------+---------+-------+-------+------------------------------------------
FLASH     | .text            |  0x0000 |  8192 |   152 | [--------------------------------]   1.9%
          | PAGES            |  0x0000 |    32 |     1 | [█-------------------------------]   3.1%
EEPROM    |                  |  0x1400 |   128 |     0 | [--------------------------------]   0.0%
SRAM      | .data            |  0x3e00 |   512 |     2 | [--------------------------------]   0.4%
          | .bss             |  0x3e02 |   512 |     1 | [--------------------------------]   0.2%
          | TOTAL            |  0x3e00 |   512 |     3 | [--------------------------------]   0.6%
FUSE      | .fuse            |  0x1280 |     9 |     9 | [████████████████████████████████] 100.0%
LOCK      | .lock            |  0x1300 |     1 |     1 | [████████████████████████████████] 100.0%
USERROW   | .user_signatures |  0x1300 |    32 |     5 | [█████---------------------------]  15.6%

It can also analyse block usage in Flash.  So (taken from the above example) while you may have used "152" bytes of flash, that's actually 1 whole flash block, so you have actually use 3.1% of the flash, not the 1.9% of absolute used space.  Both figures are useful when checking program size, so i include both in the output.

 

Its a fairly straight forward script, and the ELF parser is much more sophisticated than I need for this job, so it would be possible to add all kinds of automated analysis.

 

I wrote it for my own purposes, but figure maybe someone else could use it, so here it is.  One advantage of the configurable device, is you can define that flash is only 1K, for example if you are writing a bootloader, etc.  If a region of memory is not defined in the INI it is ignored.

 

Its usage is pretty straight forward, but if anyone uses it and has questions, they can ask here or on github.  I will do my best to help.