From feb5bde09cf9cc79e26b01080ec9400eef03f600 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 13 Nov 2021 19:04:38 +0100 Subject: [PATCH] * better code and data size info for FreeRTOS --- compiler/systems/t_freertos.pas | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/systems/t_freertos.pas b/compiler/systems/t_freertos.pas index f76db27332..93b7eb0aa8 100644 --- a/compiler/systems/t_freertos.pas +++ b/compiler/systems/t_freertos.pas @@ -1452,28 +1452,33 @@ function TlinkerFreeRTOS.postprocessexecutable(const fn : string;isdll:boolean): stringoffset:=secheader.sh_offset; seek(f,elfheader.e_shoff); + status.codesize:=0; status.datasize:=0; for i:=0 to elfheader.e_shnum-1 do begin blockread(f,secheader,sizeof(secheader)); secheader:=MaybeSwapSecHeader(secheader); secname:=ReadSectionName(stringoffset+secheader.sh_name); - if secname='.text' then + if pos('.text',secname)<>0 then begin Message1(execinfo_x_codesize,tostr(secheader.sh_size)); - status.codesize:=secheader.sh_size; + inc(status.codesize,secheader.sh_size); end - else if secname='.data' then + else if pos('.data',secname)<>0 then begin Message1(execinfo_x_initdatasize,tostr(secheader.sh_size)); inc(status.datasize,secheader.sh_size); end - else if secname='.bss' then + else if pos('.rodata',secname)<>0 then + begin + Message1(execinfo_x_initdatasize,tostr(secheader.sh_size)); + inc(status.datasize,secheader.sh_size); + end + else if pos('.bss',secname)<>0 then begin Message1(execinfo_x_uninitdatasize,tostr(secheader.sh_size)); inc(status.datasize,secheader.sh_size); end; - end; close(f); {$pop}