Minimum.exe Text Size Outliers

Joel Sherrill joel at rtems.org
Wed May 26 20:47:28 UTC 2021


Another minimum size report. If the text size after
subtracting the FDT blob is below 64K, the BSP is not
in the report. The adjusted size is reported.

It looks like some significant percentage of those over 64k
are managing to pull in printf or something in the family. I
wonder if we should ban printf() from BSPs and drivers in favor
of printk?

--joel

On Wed, May 26, 2021 at 1:14 PM Christian Mauderer <oss at c-mauderer.de>
wrote:

>
>
> On 26/05/2021 19:23, Joel Sherrill wrote:
> >
> >
> > On Wed, May 26, 2021 at 6:02 AM Sebastian Huber
> > <sebastian.huber at embedded-brains.de
> > <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >
> >     On 25/05/2021 20:33, Christian Mauderer wrote:
> >      >
> >      >>
> >      >> I thought Sebastian added a "malloc" for the BSP to use before
> the
> >      >> heap was initialized. But I don't remember the name. Am I
> >     remembering
> >      >> correctly?
> >      >
> >      > I don't really know that malloc. But I doubt that it works that
> >     early.
> >      > Again: Copying the FDT is one of the first things that these BSPs
> >     do. If
> >      > you want to know the exact location: For ARM it's here:
> >      >
> >      >
> >     https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S#n325
> >     <https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S#n325
> >
> >      >
> >      > So it's really basic setup before that. It's interrupt stack,
> >     switching
> >      > modes, setup stack pointer and then it's already copy FDT.
> >
> >     Yes, there is an early "malloc". This is _Memory_Allocate() using
> >     _Memory_Get(). However, for the device tree copy this is not early
> >     enough. We don't know the device tree location provided by the boot
> >     loader. It could be somewhere in the memory area used by the
> >     application. So, it is important to copy this very early into a fixed
> >     location. Also, the device tree may be used to get the size of the
> >     memory provided by _Memory_Get().
> >
> >
> > I assume read-only is only from the perspective of higher level
> > language code. Is it possible that being read-only it could be
> > mapped to Flash?
>
> If the code is mapped to flash, the BSP is broken. I think there are
> options for such a case so that the FDT is placed in another section.
> Not sure whether any BSP is using them.
>
> This kind of copy should be only done on BSPs that run out of RAM. Like
> I said earlier: Normally that's the case for BSPs that are loaded by
> U-Boot.
>
> >
> > For the purposes of minimum size analysis, I will subtract the
> > size of the FDT block from the minimum .text size and if it
> > is still over 64, flag it.
>
> Sounds reasonable.
>
> Best regards
>
> Christian
>
> >
> > --joel
> >
> >
> >     --
> >     embedded brains GmbH
> >     Herr Sebastian HUBER
> >     Dornierstr. 4
> >     82178 Puchheim
> >     Germany
> >     email: sebastian.huber at embedded-brains.de
> >     <mailto:sebastian.huber at embedded-brains.de>
> >     phone: +49-89-18 94 741 - 16
> >     fax:   +49-89-18 94 741 - 08
> >
> >     Registergericht: Amtsgericht München
> >     Registernummer: HRB 157899
> >     Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas
> Dörfler
> >     Unsere Datenschutzerklärung finden Sie hier:
> >     https://embedded-brains.de/datenschutzerklaerung/
> >     <https://embedded-brains.de/datenschutzerklaerung/>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210526/9a6521bc/attachment-0001.html>
-------------- next part --------------
======= arm-beagleboardorig-minimum.exe  354960 in text =====
   text	   data	    bss	    dec	    hex	filename
 354960	   1368	263884740	264241068	fbfffac	arm-beagleboardorig-minimum.exe
Text Size Adjusted for bsp_fdt_blob:  92816
80006b94 00000d2c T _IO_Vprintf
801016c0 00001000 B _ISR_Stack_area_begin
800543a8 0000157c r ti_padconf_devmap
8000e688 0000170c T _dtoa_r
8000bdbc 0000270c T _svfprintf_r
======= arm-beagleboardxm-minimum.exe  354960 in text =====
   text	   data	    bss	    dec	    hex	filename
 354960	   1368	263884740	264241068	fbfffac	arm-beagleboardxm-minimum.exe
Text Size Adjusted for bsp_fdt_blob:  92816
80006b94 00000d2c T _IO_Vprintf
801016c0 00001000 B _ISR_Stack_area_begin
800543a8 0000157c r ti_padconf_devmap
8000e688 0000170c T _dtoa_r
8000bdbc 0000270c T _svfprintf_r
======= arm-beagleboneblack-minimum.exe  354960 in text =====
   text	   data	    bss	    dec	    hex	filename
 354960	   1368	263884740	264241068	fbfffac	arm-beagleboneblack-minimum.exe
Text Size Adjusted for bsp_fdt_blob:  92816
80006b94 00000d2c T _IO_Vprintf
801016c0 00001000 B _ISR_Stack_area_begin
800543a8 0000157c r ti_padconf_devmap
8000e688 0000170c T _dtoa_r
8000bdbc 0000270c T _svfprintf_r
======= arm-beaglebonewhite-minimum.exe  354960 in text =====
   text	   data	    bss	    dec	    hex	filename
 354960	   1368	263884740	264241068	fbfffac	arm-beaglebonewhite-minimum.exe
Text Size Adjusted for bsp_fdt_blob:  92816
80006b94 00000d2c T _IO_Vprintf
801016c0 00001000 B _ISR_Stack_area_begin
800543a8 0000157c r ti_padconf_devmap
8000e688 0000170c T _dtoa_r
8000bdbc 0000270c T _svfprintf_r
======= arm-nucleo-h743zi-minimum.exe   73680 in text =====
   text	   data	    bss	    dec	    hex	filename
  73680	    504	34135552	34209736	209ffc8	arm-nucleo-h743zi-minimum.exe
70004499 000007b8 T _IO_Vprintf
70003095 00000a6c T HAL_RCCEx_PeriphCLKConfig
700126d8 00000f00 B bsp_interrupt_handler_table
700138c0 00001000 B _ISR_Stack_area_begin
700065e1 00001528 T UART_SetConfig
======= arm-stm32h7-minimum.exe   73680 in text =====
   text	   data	    bss	    dec	    hex	filename
  73680	    504	34135552	34209736	209ffc8	arm-stm32h7-minimum.exe
70004499 000007b8 T _IO_Vprintf
70003095 00000a6c T HAL_RCCEx_PeriphCLKConfig
700126d8 00000f00 B bsp_interrupt_handler_table
700138c0 00001000 B _ISR_Stack_area_begin
700065e1 00001528 T UART_SetConfig
======= i386-pc386-minimum.exe  100328 in text =====
   text	   data	    bss	    dec	    hex	filename
 100328	   9148	  24320	 133796	  20aa4	i386-pc386-minimum.exe
00120b00 00001000 B _ISR_Stack_area_begin
001128dc 000011dd T _dtoa_r
0011c520 00001400 b idtHdl
0011de20 00002710 B i386_gdb_remcomStack
0010fd50 000029e3 T _svfprintf_r
======= i386-pc486-minimum.exe  108836 in text =====
   text	   data	    bss	    dec	    hex	filename
 108836	   9148	  24320	 142304	  22be0	i386-pc486-minimum.exe
00122c40 00001000 B _ISR_Stack_area_begin
00114a0c 000011dd T _dtoa_r
0011e660 00001400 b idtHdl
0011ff60 00002710 B i386_gdb_remcomStack
00111e80 000029e3 T _svfprintf_r
======= i386-pc586-minimum.exe  111956 in text =====
   text	   data	    bss	    dec	    hex	filename
 111956	   9148	  24320	 145424	  23810	i386-pc586-minimum.exe
00123880 00001000 B _ISR_Stack_area_begin
00115290 0000138f T _dtoa_r
0011f280 00001400 b idtHdl
00120b80 00002710 B i386_gdb_remcomStack
00112490 00002be8 T _svfprintf_r
======= i386-pc586-sse-minimum.exe  112148 in text =====
   text	   data	    bss	    dec	    hex	filename
 112148	   9372	  24256	 145776	  23970	i386-pc586-sse-minimum.exe
001239c0 00001000 B _ISR_Stack_area_begin
00115310 0000138f T _dtoa_r
0011f3a0 00001400 b idtHdl
00120ca0 00002710 B i386_gdb_remcomStack
00112510 00002be8 T _svfprintf_r
======= i386-pc686-minimum.exe  114612 in text =====
   text	   data	    bss	    dec	    hex	filename
 114612	   9148	  24320	 148080	  24270	i386-pc686-minimum.exe
00123300 00001000 B _ISR_Stack_area_begin
00115ca0 0000138f T _dtoa_r
0011ed00 00001400 b idtHdl
00120600 00002710 B i386_gdb_remcomStack
00112ea0 00002be8 T _svfprintf_r
======= i386-pcp4-minimum.exe  103344 in text =====
   text	   data	    bss	    dec	    hex	filename
 103344	   9436	  24256	 137036	  2174c	i386-pcp4-minimum.exe
001217c0 00001000 B _ISR_Stack_area_begin
001134ec 000011dd T _dtoa_r
0011d180 00001400 b idtHdl
0011ea80 00002710 B i386_gdb_remcomStack
00110960 000029e3 T _svfprintf_r
======= mips-malta-minimum.exe  129820 in text =====
   text	   data	    bss	    dec	    hex	filename
 129820	   1024	  11872	 142716	  22d7c	mips-malta-minimum.exe
8002bc14 000005d4 T rtems_termios_enqueue_raw_characters
80018938 00000788 t RBTree_Control_RB_REMOVE_COLOR
8001ed08 00000e88 T _IO_Vprintf
80030d80 00002000 B _ISR_Stack_area_begin
80032d80 00002000 B _ISR_Stack_area_end
======= powerpc-beatnik-minimum.exe  154493 in text =====
   text	   data	    bss	    dec	    hex	filename
 154493	  23912	  92876	 271281	  423b1	powerpc-beatnik-minimum.exe
00009954 00000bfc t setbat
000193dc 0000106c T _IO_Vprintf
0001f5fc 00001398 T _dtoa_r
0001c66c 000029c8 T _vfprintf_r
000412a0 00004000 B _ISR_Stack_area_begin
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mcp750-minimum.exe  130977 in text =====
   text	   data	    bss	    dec	    hex	filename
 130977	  24380	 380496	 535853	  82d2d	powerpc-mcp750-minimum.exe
0008aee0 00002000 B _ISR_Stack_area_begin
00016dc8 000029bc T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mtx603e-minimum.exe  130673 in text =====
   text	   data	    bss	    dec	    hex	filename
 130673	  24324	 380496	 535493	  82bc5	powerpc-mtx603e-minimum.exe
0008aee0 00002000 B _ISR_Stack_area_begin
00016d4c 00002988 T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mvme2100-minimum.exe  124253 in text =====
   text	   data	    bss	    dec	    hex	filename
 124253	  22916	 380484	 527653	  80d25	powerpc-mvme2100-minimum.exe
0008aec0 00002000 B _ISR_Stack_area_begin
000156ec 00002988 T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mvme2307-minimum.exe  131029 in text =====
   text	   data	    bss	    dec	    hex	filename
 131029	  24240	 380496	 535765	  82cd5	powerpc-mvme2307-minimum.exe
0008aee0 00002000 B _ISR_Stack_area_begin
00016ea8 000029e8 T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mvme3100-minimum.exe  168173 in text =====
   text	   data	    bss	    dec	    hex	filename
 168173	  27216	  25081	 220470	  35d36	powerpc-mvme3100-minimum.exe
00016174 0000107c T _IO_Vprintf
0001f9dc 0000171c T _dtoa_r
00019ea4 00002a50 T _svfprintf_r
0001c8fc 00002b18 T _vfprintf_r
00035a80 00004000 B _ISR_Stack_area_begin
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-mvme5500-minimum.exe  121013 in text =====
   text	   data	    bss	    dec	    hex	filename
 121013	  19128	  93696	 233837	  3916d	powerpc-mvme5500-minimum.exe
00036d54 00000de4 b rtemsIrq
000136a4 00001088 T _IO_Vprintf
00018ca4 00001398 T _dtoa_r
00015d14 000029c8 T _vfprintf_r
000386a0 00004000 B _ISR_Stack_area_begin
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-qemuprep-altivec-minimum.exe  126669 in text =====
   text	   data	    bss	    dec	    hex	filename
 126669	  23060	 379760	 529489	  81451	powerpc-qemuprep-altivec-minimum.exe
0008ac00 00002000 B _ISR_Stack_area_begin
00015ed0 000029c8 T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-qemuprep-minimum.exe  123765 in text =====
   text	   data	    bss	    dec	    hex	filename
 123765	  22980	 379760	 526505	  808a9	powerpc-qemuprep-minimum.exe
0008ac00 00002000 B _ISR_Stack_area_begin
000154c0 000029bc T _vfprintf_r
00086de0 00003000 b log_page_pool
00080050 00006a0c B residualCopy
00060000 00020000 b cc_memory
FOUND: __wrap_printf()
FOUND: close()
======= powerpc-qoriq_e6500_64-minimum.exe  331076 in text =====
   text	   data	    bss	    dec	    hex	filename
 331076	   1304	519814736	520147116	1f00d0ac	powerpc-qoriq_e6500_64-minimum.exe
Text Size Adjusted for bsp_fdt_blob:  68932
00000000050105e0 00000000000005d0 b _Thread_Objects
0000000000009e10 0000000000000700 T _CPU_Exception_frame_print
000000000000b7f0 0000000000000ee4 T _IO_Vprintf
0000000005013600 0000000000002000 B _ISR_Stack_area_begin
0000000005010d68 0000000000002500 B bsp_interrupt_handler_table


More information about the devel mailing list