[U-Boot] SPL DM

Michal Simek monstr at monstr.eu
Tue Feb 3 14:16:49 CET 2015


Hi Simon,

I am playing with driver model and I have moved uartlite to it and
it is working fine for normal u-boot +10k but SPL size is dramatically
bigger. Without DM I can fit to 3k but now it has ~16k.

microblaze-generic:  all +10759  bss +4  data +560  rodata +1379
spl/u-boot-spl:all +9100  spl/u-boot-spl:bss -4  spl/u-boot-spl:data -48
 spl/u-boot-spl:rodata +5660  spl/u-boot-spl:text +3492  text +8816

This 9k is after removing all printf calling which is adding 6kB.


diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index afdacff80d8e..a9e4d96738a0 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -19,7 +19,7 @@ void *malloc_simple(size_t bytes)

        new_ptr = gd->malloc_ptr + bytes;
        if (new_ptr > gd->malloc_limit)
-               panic("Out of pre-reloc memory");
+               puts("Out of pre-reloc memory");
        ptr = map_sysmem(gd->malloc_base + gd->malloc_ptr, bytes);
        gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
        return ptr;
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 3fc7104359d3..d56fafcb8ee2 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -72,7 +72,7 @@ static void serial_find_console_or_panic(void)
        if (uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) &&
            uclass_get_device(UCLASS_SERIAL, INDEX, &dev) &&
            (uclass_first_device(UCLASS_SERIAL, &dev) || !dev))
-               panic("No serial driver found");
+               puts("No serial driver found");
 #undef INDEX
        gd->cur_serial_dev = dev;
 }


Here is diff between versions. I have setup CONFIG_SYS_MALLOC_SIMPLE
Simon: Have you tried to to reduce size in this too?
Interesting part is that new uartlite functions are not called that's why I am expecting
any other problem.

                 spl-u-boot-spl: add: 27/-13, grow: 2/-1 bytes: 4024/-576 (3448)
                 function                                   old     new   delta
                 device_bind                                  -     596    +596
                 device_probe_child                           -     508    +508
                 uclass_get                                   -     296    +296
                 lists_bind_drivers                           -     212    +212
                 uclass_resolve_seq                           -     188    +188
                 uclass_bind_device                           -     180    +180
                 uclass_find_device_by_seq                    -     172    +172
                 device_bind_by_name                          -     152    +152
                 uclass_get_device_by_seq                     -     140    +140
                 serial_find_console_or_panic                 -     136    +136
                 uclass_find_device                           -     132    +132
                 lists_driver_lookup_name                     -     128    +128
                 uclass_first_device                          -     108    +108
                 dm_init                                      -      96     +96
                 _serial_putc                                 -      96     +96
                 uclass_unbind_device                         -      92     +92
                 malloc_simple                                -      92     +92
                 uclass_get_device                            -      88     +88
                 lists_uclass_lookup                          -      80     +80
                 dm_init_and_scan                             -      80     +80
                 calloc                                       -      80     +80
                 uclass_find                                  -      72     +72
                 uclass_pre_probe_child                       -      60     +60
                 uclass_post_probe_device                     -      52     +52
                 strcmp                                       -      52     +52
                 dm_scan_platdata                             -      52     +52
                 serial_puts                                 44      80     +36
                 device_probe                                 -      32     +32
                 board_init_r                               232     248     +16
                 serial_current                               4       -      -4
                 userial0_setbrg                              8       -      -8
                 serial_init                                 56      48      -8
                 userial0_tstc                               20       -     -20
                 userial0_puts                               32       -     -32
                 userial0_putc                               32       -     -32
                 userial0_init                               32       -     -32
                 userial0_getc                               32       -     -32
                 uartlite_serial_getc                        40       -     -40
                 uartlite_serial0_device                     48       -     -48
                 uartlite_serial_init                        52       -     -52
                 uartlite_serial_puts                        80       -     -80
                 uartlite_serial_putc                        92       -     -92
                 get_current                                 96       -     -96


Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150203/54407c84/attachment.sig>


More information about the U-Boot mailing list