Command line arguments
steve at link-comm.com
Fri Oct 15 19:45:06 UTC 2004
>> > Chris & Lars,
>> > Ok, well, once again I'm confused...
>> > Are we talking about the same command line arguments?
>> yes, but in two different places of the boot process.
>> > At the time the rtems application is started up, the boot loader
>> > is the actively running program on the system; hence, it must
>> > take in the command line arguments and put them somewhere for
>> > the rtems application to retrieve.
>> yes, thats true and IMHO this should be placed in the BSP start.S and
>> passed on to the "int boot_card(int argc, char **argv, char **envp)"
>> > How can this be done in a boot-loader-independent way?
>> The first step, getting it from the boot loader to the boot_card
>> function, will be highly boot loader dependant.
>> But the step of getting the arguments from the boot_card function (or
>> c_rtems_main function) to the actual task can be made generic. How is
>> just the question?
>Got it! I was referring to the first step, and you were referring to
>the second step.
I think I contributed to the confusion. Let me clarify. We use POSIX_Init
to call rtems_main which calls tcb2_main which starts separate threads for
each of our tasks, then kills itself with rtems_task_delete( RTEMS_SELF ).
One of the tasks we start needs access to the command line arguments.
We could have retrieved them from uMon directly from that thread, but it
seemed like it would be better to retrieve them earlier (first step), pass
them into rtems_main in the typical argc/argv fashion, then into tcb2_main
and finally into the tasks (second step). That way the only place where
uMon-specific code would be needed was right before the call to rtems_main.
The problem I was addressing was that I couldn't find a way to pass the
arguments directly into the newly-started tasks (through rtems_task_create).
My workaround was to set global argc/argv values immediately before calling
rtems_task_create, making rtems_task_create call a thin wrapper rather than
my main task function, and to make that wrapper retrieve argc/argv from
the globals and pass them into my new task functions in the traditional way.
That has nothing directly to do with uMon.
In other words, I made it harder than it needed to be in an effort to make
all of the task main functions receive their argc/argv information in the
traditional way (and to keep the uMon-specific code used for the command
line arguments limited to one place in the startup code). If there is a
cleaner or more standardized way to do that, I would be happy to get rid of
the global argc/argv and wrappers that I am using now.
Link Communications, Inc.
1035 Cerise Rd
Billings, MT 59101-7378
(406) 245-5002 ext 102
(406) 245-4889 (fax)
MailTo:steve at link-comm.com
More information about the users