From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Tue, 24 Jul 2012 22:48:00 +0200 Subject: [U-Boot] [PATCH 5/7] dfu:cmd: Support for DFU u-boot command In-Reply-To: <201207241400.32530.vapier@gentoo.org> References: <1341308291-14663-1-git-send-email-l.majewski@samsung.com> <201207200020.17935.vapier@gentoo.org> <20120723180104.4fbccddb@amdc308.digital.local> <201207241400.32530.vapier@gentoo.org> Message-ID: <20120724224800.7239b3ae@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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