From 5b5d13b1d09a004aad211a682a22f8efb83ffe19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 25 Dec 2017 18:10:20 +0100 Subject: [PATCH] updated parsemap to also process RAM --- Makefile | 4 ++++ STM32F072RBTx_FLASH.ld | 2 +- User | 2 +- parsemap.php | 51 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 32eb514..7d2a9d5 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ # 2015-07-22 - first version # ------------------------------------------------ +DISABLE_DEBUG := 0 +DISABLE_MSC := 0 +DISABLE_TEST_UNIT := 0 + include User/gex.mk GEX_PLAT=F072_DISCOVERY diff --git a/STM32F072RBTx_FLASH.ld b/STM32F072RBTx_FLASH.ld index 2969ce6..4a40fb3 100644 --- a/STM32F072RBTx_FLASH.ld +++ b/STM32F072RBTx_FLASH.ld @@ -36,7 +36,7 @@ ENTRY(Reset_Handler) _estack = 0x20004000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ +_Min_Stack_Size = 0x200; /* required amount of stack */ /* Specify the memory areas */ MEMORY diff --git a/User b/User index 45910e7..cffedd7 160000 --- a/User +++ b/User @@ -1 +1 @@ -Subproject commit 45910e7f04003016f34fa93af10510f7f98594a6 +Subproject commit cffedd7a9a21a22076f9e134bf739c05defc064b diff --git a/parsemap.php b/parsemap.php index 5ddb677..b85bac7 100755 --- a/parsemap.php +++ b/parsemap.php @@ -17,7 +17,6 @@ file_put_contents("main.flash.map", $flash); file_put_contents("main.ram.map", $ram); $flash = preg_replace('/(\.(text|rodata)\.[^ ]*?)\n/', '$1', $flash); - $lines = explode("\n", $flash); $sections = []; @@ -49,7 +48,55 @@ usort($sections, function($a,$b) { return -($a->size - $b->size); }); -$limit = 60; +echo "--- FLASH ---\n"; +$limit = 40; +foreach($sections as $s) { + if ($s->type=='DATA')echo "\033[33m";else echo "\033[32m"; + echo "{$s->type}\033[0m {$s->addr} \033[96m{$s->size}\033[0m\t". + "\033[36m{$s->name}\033[0m"; + + for($i=0;$i<36-strlen($s->name);$i++) echo " "; + + echo "{$s->file}\n"; + + if($limit--==0) break; +} + + + +$ram = preg_replace('/(\.(bss|data)\.[^ ]*?)\n/', '$1', $ram); +$lines = explode("\n", $ram); + +$sections = []; +foreach($lines as $l) { + if ((false !== strpos($l, '0x0000000020')) && (false !== strpos($l, '.bss.') || false !== strpos($l, '.data.'))) { + //echo "$l\n"; + preg_match('/\s*.(bss|data).([^ ]+)\s+0x00000000(20[\da-f]+)\s+0x([\da-f]+)\s+(.*)/', $l, $m); + //print_r($m); + $sec = new stdClass; + $sec->type = $m[1]=='bss'?'BSS ':'DATA'; + $sec->name = $m[2]; + $sec->addr = "0x".$m[3]; + $sec->size = hexdec($m[4]); + $sec->file = $m[5]; + + if (($p=strrpos($sec->file, 'arm-none-eabi/')) !== false) { + $sec->file = "\033[90m".substr($sec->file, $p)."\033[0m"; + } else { + $sec->file = "\033[35m".str_replace("build/","",$sec->file)."\033[0m"; + } + + //print_r($sec); + $sections[] = $sec; + } +} + +usort($sections, function($a,$b) { + return -($a->size - $b->size); +}); + +echo "\n--- RAM ---\n"; +$limit = 20; foreach($sections as $s) { if ($s->type=='DATA')echo "\033[33m";else echo "\033[32m"; echo "{$s->type}\033[0m {$s->addr} \033[96m{$s->size}\033[0m\t".