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 <[email protected]> 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... > > > > On Tue, Apr 24, 2012 at 5:35 PM, hedwin <[email protected]> wrote: > >> 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 <[email protected]>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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/rowboat?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "rowboat" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rowboat?hl=en. >> > > > > -- > thanks&Regards > k.v.raju > -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting
