Hi Mike,

> On Monday 23 July 2012 12:01:04 Lukasz Majewski wrote:
> > Dear Mike,
> > > On Tuesday 03 July 2012 05:38:09 Lukasz Majewski wrote:
> > > > --- /dev/null
> > > > +++ b/common/cmd_dfu.c
> > > > 
> > > > +int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > > > argv[])
> > > 
> > > static
> > 
> > It can be static (static int do_dfu). On the other hand the
> > U_BOOT_CMD macro defines:
> > 
> > int (*cmd)(struct cmd_tbl_s *, int, int, char * const []); at
> > struct cmd_tbl_s, which is int.
> 
> i don't understand what you're trying to say
> 
> > > > +       static char *s = "dfu";
> > > 
> > > no need to declare this static
> > 
> > Why not? The s ptr is further passed to g_dnl_init(s), so my intend
> > was to declare string in the data segment of this translation unit.
> > In this way the data under this ptr will not vanish.
> 
> except your g_dnl_init already copies the incoming string to local
> storage, so where it is stored doesn't matter.  further, the "dfu" is
> going to be in .rodata (thus never going away), it is only the "s"
> pointer which will be stored in .data, not the thing it points to.
> 
> had you done:
>       char s[] = { 'd', 'f', 'u', '\0', };
> then you'd get 4 bytes on the stack

Thanks for clarification

Regards,
Lukasz Majewski


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to