3 # The commands used to compare 2.2 flash usage
4 # on 2.1 release: make PCB=9X EXT=FRSKY VOICE=YES AUDIO=YES AUTOSOURCE=YES AUTOSWITCH=YES HELI=YES TEMPLATES=YES GAUGES=NO
5 # => 64818 (program) + 3236 (data)
6 # on 2.2 release: cmake -DPCB=9X -DTELEMETRY=FRSKY -DAUDIO=YES -DVOICE=YES -DHELI=YES -DTEMPLATES=YES ~/git/opentx
7 # => 64828 (program) + 3236 (data)
9 from __future__
import print_function
17 options
= sys
.argv
[1:]
18 srcdir
= os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../.."
26 cmd
= ["git", "reset", "--hard", "FETCH_HEAD~%d" % index
]
27 proc
= subprocess
.Popen(cmd
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
28 output
, error
= proc
.communicate()
29 if proc
.returncode
!= 0:
30 print("HEAD~%d git reset failed" % index
)
34 cmd
= ["cmake"] + options
+ [srcdir
]
35 proc
= subprocess
.Popen(cmd
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
36 output
, error
= proc
.communicate()
37 if proc
.returncode
!= 0:
38 print("HEAD~%d cmake failed" % index
)
41 cmd
= ["make", "-j4", "firmware"]
42 proc
= subprocess
.Popen(cmd
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
43 output
, error
= proc
.communicate()
44 if proc
.returncode
!= 0:
45 print("HEAD~%d make firmware failed" % index
)
48 if os
.path
.isfile("firmware.bin"):
49 oldsize
= os
.stat("firmware.bin").st_size
51 oldsize
= int(subprocess
.check_output('avr-size -A firmware.hex | grep Total | cut -f2- -d " "', shell
=True))
54 print("HEAD~%d %d: increase by %d bytes" % (index
-1, size
, size
-oldsize
))
56 print("HEAD~%d %d: decrease by %d bytes" % (index
-1, size
, oldsize
-size
))
58 print("HEAD~%d %d" % (index
-1, size
))