Makefile show better memory usage

This commit is contained in:
King Kévin 2019-11-19 10:23:48 +01:00
parent f4a000b4e6
commit 05b5167d0d
1 changed files with 2 additions and 1 deletions

View File

@ -73,6 +73,8 @@ ldflags << "-nostartfiles"
ldflags_linker = [ENV["LDFLAGS"]]
# only keep used sections
ldflags_linker = ["--gc-sections"]
# show memory usage
ldflags_linker << "--print-memory-usage"
# add libopencm3 libraries
library_paths = [LIBOPENCM3_LIB]
# project libraries
@ -153,7 +155,6 @@ end
desc "link binary"
rule '.elf' => ['.o', proc{|f| dependencies(f)}, '.ld', "#{LIBOPENCM3_LIB}/lib#{STM32F1_LIB}.a"] do |t|
sh "#{LD} #{archflags} #{ldflags.join(' ')} #{t.prerequisites[0..-3].join(' ')} -T#{t.name.ext('ld')} #{ldflags_linker.collect{|flag| "-Wl,"+flag}.join(' ')} #{library_paths.collect{|path| "-L"+path}.join(' ')} #{ldlibs.collect{|lib| "-l"+lib}.join(' ')} -Wl,--start-group #{ldlibs_linker.collect{|lib| "-l"+lib}.join(' ')} -Wl,--end-group --output #{t.name}"
sh "size #{t.name}"
end
desc "export binary"