Re: [rowboat] u-boot command

157 views
Skip to first unread message

hedwin

unread,
Apr 24, 2012, 8:05:57 AM4/24/12
to row...@googlegroups.com, android-porting
Info you can find in any c book.
That said;

## is concatenate
# is stringfy

In you case it would look like this

cmd_tbl_t __u_boot_cmd_mtest Struct_Section = {"mtest", 5, 1,  do_mem_mtest, "simple RAM read/write test", "[start [end [pattern [iterations]]]]"}

This struct is placed in its own section because u-boot internals can than easily refer to this section to read/use the uboot commands.



On Tue, Apr 24, 2012 at 6:19 AM, venkat k raju <kvraj...@gmail.com> wrote:
Hi all,

i want to implement my own u-boot commands,so i gone through the u-boot source code i got this interface to build the u-boot commands.

U_BOOT_CMD(
        mtest,  5,      1,      do_mem_mtest,
        "simple RAM read/write test",
        "[start [end [pattern [iterations]]]]"
);

please can anybody explain me below chunk of code 

#define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \
cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage, help}

 #define Struct_Section  __attribute__ ((unused,section (".u_boot_cmd")))

here cmd_tbl_t is a structure 


thanks in advance!!





thanks&Regards
k.v.raju

--
You received this message because you are subscribed to the Google Groups "rowboat" group.
To post to this group, send email to row...@googlegroups.com.
To unsubscribe from this group, send email to rowboat+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rowboat?hl=en.

hedwin

unread,
Apr 24, 2012, 11:12:44 AM4/24/12
to venkat k raju, row...@googlegroups.com, android-porting
Indeed.

So basically the uboot commands are stored in a segment called .u_boot_cmd. When you enter a command on the command line u-boot will check if
the command is listed in this section (a bit of simplified comment) . If true it will execute the function that is assigned to the cmd field. In your case it
will execute do_mem_test. It is up to the cmd function to handle/verify the arguments, u-boot only passes them.


On Tue, Apr 24, 2012 at 2:50 PM, venkat k raju <kvraj...@gmail.com> wrote:
Hi hedwin,
thank you.

#define Struct_Section __attribute__ ((unused,section (".u_boot_cmd"))) 
then this should be something like this right!

cmd_tbl_t __u_boot_cmd_mtest  __attribute__ ((unused,section (".u_boot_cmd"))) = {"mtest", 5, 1,  do_mem_mtest, "simple RAM read/write test", "[start [end [pattern [iterations]]]]"}

i am sorry i am poor in this concepts , please can you tell me what actually is going on...
--
thanks&Regards
k.v.raju

venkat k raju

unread,
Apr 24, 2012, 12:19:41 AM4/24/12
to android-porting, rowboat

venkat k raju

unread,
Apr 24, 2012, 8:50:09 AM4/24/12
to row...@googlegroups.com, android-porting, Hedwin Koning
Hi hedwin,
thank you.

#define Struct_Section __attribute__ ((unused,section (".u_boot_cmd"))) 
then this should be something like this right!

cmd_tbl_t __u_boot_cmd_mtest  __attribute__ ((unused,section (".u_boot_cmd"))) = {"mtest", 5, 1,  do_mem_mtest, "simple RAM read/write test", "[start [end [pattern [iterations]]]]"}

i am sorry i am poor in this concepts , please can you tell me what actually is going on...
On Tue, Apr 24, 2012 at 5:35 PM, hedwin <hedwin...@gmail.com> wrote:



--
thanks&Regards
k.v.raju
Reply all
Reply to author
Forward
0 new messages