[ECOS] Is there any way to branch in Boot Script

Sergei Gavrikov w3sg@SoftHome.net
Fri Jul 20 04:38:00 GMT 2007


On Fri, Jul 20, 2007 at 10:46:17AM +0900, ariga masahiro wrote:
> Hi,Sergei and others,
> 

Hello,

Don't TOP post, please.

> I found plf_misc.c,
> but content is very diffrent with your answer.
> I  put all content down.
> 
> Would you elaborate how to include your tweak
> int my file?

That was just a canvas. So, place the include lines on top of the
source, as you do it as well

#include <pkgconf/system.h>
#ifdef CYGPKG_REDBOOT
#include <redboot.h>            // script declaration
#endif

and the function in any other place

#ifdef CYGPKG_REDBOOT
# ifdef CYGSEM_REDBOOT_PLF_STARTUP
void
cyg_plf_redboot_startup (void) {
    ...
}
# endif // CYGSEM_REDBOOT_PLF_STARTUP
#endif // CYGPKG_REDBOOT

> 
> Next is content of
> C:\cygwin\opt\ecos\ecos-2.0\packages\hal\sh\inserter\current\src\plf_misc.c
                     ^^^^^^^^

You use a very obsolete a eCos stuff. I would suggest you to update the
eCos stuff from the official eCos anon CVS:

http://ecos.sourceware.org/anoncvs.html.

I don't sure that RedBoot from ecos 2.0 did contain the needed things
for my tweak.

Regards,

Sergei


> ------
> #include <pkgconf/hal.h>
> 
> #include <cyg/hal/hal_if.h>             // interfacing API
> #include <cyg/hal/plf_io.h>
> 
> externC void cyg_hal_init_superIO(void);
> 
> void
> hal_platform_init(void)
> {
> #ifdef CYGPRI_HAL_SH_SH77X9_SUPERIO
>    // Init superIO before calling if_init (which will use UARTs)
>    cyg_hal_init_superIO();
> #endif
> 
>    hal_if_init();
> }
> 
> // eof plf_misc.c
> --------
> 
> I am very obliged to you.
> 
> Masahiro Ariga
> 
> ----- Original Message ----- 
> From: "ariga masahiro" <ariga@link-lab.co.jp>
> To: "Sergei Gavrikov" <w3sg@SoftHome.net>
> Cc: <ecos-discuss@ecos.sourceware.org>
> Sent: Friday, July 20, 2007 10:23 AM
> Subject: Re: [ECOS] Is there any way to branch in Boot Script
> 
> 
> >Hi,Sergei and others,
> >
> >Thank you,Sergei,for your very "brainwashing" answer.
> >
> >But although I earnestly grepped "cyg_plf_redboot_startup",
> >or even "CYGSEM_REDBOOT_PLF_STARTUP",
> >I could not hit any file in my ecos source directory.
> >
> >Since your answer is very suitable to "what I want to do",
> >please elaborate a little more,please?
> >
> >By the way my target uses SH7709 CPU.
> >
> >I am looking forward to your kindly answer.
> >
> >Masahiro Ariga
> >
> >----- Original Message ----- 
> >From: "Sergei Gavrikov" <w3sg@SoftHome.net>
> >To: "ariga masahiro" <ariga@link-lab.co.jp>
> >Cc: <ecos-discuss@ecos.sourceware.org>
> >Sent: Thursday, July 19, 2007 3:24 AM
> >Subject: Re: [ECOS] Is there any way to branch in Boot Script
> >
> >
> >>On Wed, Jul 18, 2007 at 09:09:07PM +0300, Sergei Gavrikov wrote:
> >>>On Tue, Jul 17, 2007 at 04:37:33PM +0900, ariga masahiro wrote:
> >>>> Hi,Everyone,
> >>>>
> >>>> I beseech you to help me out of next predicament.
> >>>>
> >>>> What I want to do is this:
> >>>>  In RedBoot Boot Script,read Target Board DIPSW-settled value,
> >>>>  and compare already-written value in a certain address.
> >>>>  (for example,use mcmp command)
> >>>>  If same, continue next Boot Script command.
> >>>>  If differs,quit Boot Script and return to RedBoot's prompt.
> >>>>
> >>>> My questions are:
> >>>>  1.Is there any way to know mcmp result(that is ,succeeded or 
> >>>> errored).
> >>>>    Preferably in RedBoot Boot Script.
> >>>>  2.Is there any way to use branching statement(like,if-else),
> >>>>    in RedBoot Boot Script
> >>>
> >>>It's pity, but RedBoot != shell, so it hasn't such behaviours. Some guys
> >>>dream about those behaviours :-) But, every RedBoot command (redboot.h)
> >>>is just it
> >>>
> >>>typedef void cmd_fun(int argc, char *argv[]);
> >>>
> >>>Therefore, it is no way to return any result (Ups, I did think about
> >>>`argv' :). Also, there is no global variable, something like the DOS
> >>>`errorlevel' (to check/collect the fails) there. More that, if the
> >>>RedBoot's parser does meet wrong line in a script, it passes the line a
> >>>bit noisely and then it continues to parse a rest of the script.
> >>>
> >>>>  3.Is there any way to realize above-mentioned "what I want to do".
> >>>
> >>>I had same needs (to read the DIP switches). And I did use such a way.
> >>>Well, if your RedBoot/eCos aren't fucked binaries, i.e. if you have the
> >>>target sources, you can put same stuff in your plf_misc.c file
> >>>
> >>>---------------------------------------------------------->8
> >>>#include <pkgconf/system.h>
> >>>
> >>>#ifdef CYGPKG_REDBOOT
> >>>#include <redboot.h>            // script declaration
> >>>
> >>>#define DIPSW_MASK (1 << 7)     // FIXME: put yours
> >>>
> >>>#ifdef CYGSEM_REDBOOT_PLF_STARTUP
> >>>void
> >>>cyg_plf_redboot_startup (void)
> >>>{
> >>>    int             switches = 0;
> >>>
> >>>    // put a code to read the switches here
> >>>
> >>>    if (switches & DIPSW_MASK)
> >>>        // don't run the script
> >>>        script = 0;
> >>>}
> >>>#endif // CYGSEM_REDBOOT_PLF_STARTUP
> >>>#endif // CYGPKG_REDBOOT
> >>>---------------------------------------------------------->8
> >>>
> >>>Note: before to build RedBoot with this tweak, set this option in your
> >>>`ecos.ecc':
> >>>
> >>>cdl_option CYGSEM_REDBOOT_PLF_STARTUP {user_value 1};
> >>>
> >>>For more details, look at cyg_start () in redboot/current/src/main.c,
> >>>you would find your own way for that.
> >>>
> >>
> >>A bit more, redboot.cdl contains yet another option... So, with a code
> >>above, you can run an alternate script instead default one, if you put
> >>there something like this
> >>
> >>cdl_option CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT {1 {alt_script}};
> >>
> >>Note: a declaration/filling that `alt_script' is your deal, certainly.
> >>
> >>Sergei
> >>
> >

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list