This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Difference between "go" on Script and manual enter?


Hi ,

Concerning my question about Script "go" not going well,
(I re_post my first question below),
I traced applications in both cases
(that is,manually "go" and Script "go").

And I discovered some factors(although I can't pinpont darn cause)
of different behaviors.

I relate my finding in hope that you could pinpoint cause,
(I apologize,too difficult to fathom source.)
and appreciate you to resolve this pain in my neck.

I use abbreviations MAN for manually "go", SCR for Script "go".

Both cases,first try to diag_printf "Network stack using".
in diag.cxx
at function
_vprintf(void (*putc)(char c, void **param), void **param, const char *fmt, va_list ap)
(*putc)(c, param); //here,MAN:print 'N' to host PC, SCR:nothing though c contains 'N'


from here I traced,
both traced to,
_diag_write_char(char c, void **param)
{
    diag_write_char(c);
}

and,
externC void diag_write_char(char c)
{
    /* Translate LF into CRLF */

    if( c == '\n' )
    {
        HAL_DIAG_WRITE_CHAR('\r');
    }

    HAL_DIAG_WRITE_CHAR(c);
}
and both execute HAL_DIAG_WRITE_CHAR(c);

after jump to
hal_if.h
__data_VV(CYGNUM_CALL_IF_CONSOLE_PROCS, __call_if_console_procs_t)

hal_if.c
void
hal_if_diag_write_char(char c)
{
    hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS();

    if (__chan)
        CYGACC_COMM_IF_PUTC(*__chan, c);
    else {
        __chan = CYGACC_CALL_IF_DEBUG_PROCS();

        // FIXME: What should be done if assertions are not enabled?
        // This is a bad bad situation - we have no means for diag
        // output; we want to hit a breakpoint to alert the developer
        // or something like that.
        CYG_ASSERT(__chan, "No valid channel set");

        CYGACC_COMM_IF_PUTC(*__chan, c);
    }

    // Check interrupt flag
    if (CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG()) {
        CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG_SET(0);
        cyg_hal_user_break(0);
    }
}

from here behaves differentry,
both cases execute CYGACC_COMM_IF_PUTC(*__chan, c);
MAN:
traced to
hal_if.c
__call_voidCOMM1(IF_PUTC, void, __comm_if_putc_t, cyg_uint8)

and
/* Lock the scheduler. */
externC void cyg_scheduler_lock(void)
{
    Cyg_Scheduler::lock();

and
    static void inc_sched_lock()
    {
        sched_lock++;
    };

then,SH serial routine,
/sh/sh3/v2_0/src/sh3_scif.c
cyg_hal_plf_scif_putc(void* __ch_data, cyg_uint8 c)

and properly print string to host PC HYPERTERMINAL.

Whereras,
SCR:
traced to
hal_if.h
__call_voidCOMM1(IF_PUTC, void, __comm_if_putc_t, cyg_uint8)

and
externC void cyg_scheduler_lock(void)
{
    Cyg_Scheduler::lock();
    // get_sched_lock() is unsigned, see below "cyg_ucount32 lock"
    CYG_ASSERT( (0xff000000 & (Cyg_Scheduler::get_sched_lock())) == 0,
                "Scheduler overlocked" );
}

and
 static void inc_sched_lock()
 {
     sched_lock++;
 };

and
nop_service(void)
{
    // This is the default service. It always returns false (0), and
    // _does not_ trigger any assertions. Clients must either cope
    // with the service failure or assert.
    return 0;
}

and
externC void cyg_scheduler_unlock(void)
{
    cyg_ucount32 slock = Cyg_Scheduler::get_sched_lock();

after repeat,and never jump to
      cyg_hal_plf_scif_putc(void* __ch_data, cyg_uint8 c)
and nothin print to host PC

I think CYGACC_COMM_IF_PUTC is setted in
cyg_hal_plf_scif_init(int scif_index, int comm_index,
                     int rcv_vect, cyg_uint8* base)
{
     |
     |

   // Initialize channel procs
   CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index);
   comm = CYGACC_CALL_IF_CONSOLE_PROCS();
   CYGACC_COMM_IF_CH_DATA_SET(*comm, chan);
   CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_scif_write);
   CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_scif_read);
   CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_scif_putc);
   CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_scif_getc);
   CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_scif_control);
   CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_scif_isr);
   CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_scif_getc_timeout);

   // Restore original console
   CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
}

and both cases execute this routine at starting time.
all points considered,converge to next part.

hal_if_diag_write_char(char c)
{
    hal_virtual_comm_table_t* __chan = CYGACC_CALL_IF_CONSOLE_PROCS();

here, I am sorry my spirit collapsed.

Do you think this part happens to be any cause of my trouble?

Please enlighten me.

Masahiro Ariga

-- Below is my first question.
I tested and confirmed that it worked,
when I loaded ROM-reserved application using "fis load"
and executed "go" command manually(that is, entered commands at
RedBoot prompt).

But when I tried to do the same thing on Boot Script,
application never ran !!

Strangely,if I write only "fis load" on Script,execute Script,
and after that I enter "go" command manually and execute,
then application properly run.

I wonder what is difference between excuting "go" manually
and on Boot Script.

I tried some delays before "go", but no effect.

I post both outputs,and "fconfig" entering log.

first only execute "fis load" on Script,
------------------
My Flash ID is 4:22f9:19:0
config=0x8ffee000 cfg_base=0xa03ff000
Ethernet eth0: MAC address 00:40:31:08:01:00
IP: 0.0.0.0/255.255.255.0, Gateway: 0.0.0.0
Default server: 0.0.0.8, DNS server IP: 0.0.0.8

RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version v2_0 - built 13:16:32, Jul 20 2007

Platform: inserter (SH 7709S)
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.

RAM: 0x8c000000-0x90000000, 0x8c00afa0-0x8ffed000 available
FLASH: 0xa0000000 - 0xa0400000, 64 blocks of 0x00010000 bytes each.
== Executing boot script in 3.000 seconds - enter ^C to abort
RedBoot> fis load -b 0x8c010000 basic1
RedBoot>
------------------

then,enter "go" manually,and application ran,
------------------
RedBoot> go 0x8c010000
Network stack using 65536 bytes for misc space
                   65536 bytes for mbufs
                   131072 bytes for mbuf clusters
[cyg_net_init] Init: mbinit(0x00000000)
[cyg_net_init] Init: cyg_net_init_devs(0x00000000)
Init device 'lan91cxx_eth0'
[cyg_net_init] Init: loopattach(0x00000000)
[cyg_net_init] Init: ifinit(0x00000000)
IFP: 0x8c0427e0, next: 0x8c0904d8
IFP: 0x8c0904d8, next: 0x00000000
[cyg_net_init] Init: domaininit(0x00000000)
[cyg_net_init] Init: cyg_net_add_domain(0x8c0431d4)
New domain internet at 0x00000000
[cyg_net_init] Init: cyg_net_add_domain(0x8c042c5c)
New domain route at 0x00000000
[cyg_net_init] Init: cyg_route_init(0x00000000)
[cyg_net_init] Done
Hello eCos World!!!

Thread A, count: 1  message: 75
Thread A, count: 2  message: 75
Thread B, message: 68
------------------

then,excute both commands on Script,
Application never ran,
------------------
My Flash ID is 4:22f9:19:0
config=0x8ffee000 cfg_base=0xa03ff000
Ethernet eth0: MAC address 00:40:31:08:01:00
IP: 0.0.0.0/255.255.255.0, Gateway: 0.0.0.0
Default server: 0.0.0.8, DNS server IP: 0.0.0.8

RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version v2_0 - built 13:16:32, Jul 20 2007

Platform: inserter (SH 7709S)
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.

RAM: 0x8c000000-0x90000000, 0x8c00afa0-0x8ffed000 available
FLASH: 0xa0000000 - 0xa0400000, 64 blocks of 0x00010000 bytes each.
== Executing boot script in 3.000 seconds - enter ^C to abort
RedBoot> fis load -b 0x8c010000 basic1
RedBoot> go 0x8c010000 -w 5
About to start execution at 0x8c010000 - abort with ^C within 5 seconds
------------------

next is "fconfig" entering log,
------------------
RedBoot> fconfig
Run script at boot: true
Boot script:
.. fis load -b 0x8c010000 basic1
Enter script, terminate with empty line
fis load -b 0x8c010000 basic1
go 0x8c010000 -w 5

Boot script timeout (1000ms resolution): 3
Use BOOTP for network configuration: false
Gateway IP address:
Local IP address:
Local IP address mask: 255.255.255.0
Default server IP address: 0.0.0.8
Console baud rate: 38400
DNS server IP address: 0.0.0.8
GDB connection port: 9000
Force console for special debug messages: false
Network hardware address [MAC]: 0x00:0x40:0x31:0x08:0x01:0x00
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xa03f0000-0xa0400000: .
... Program from 0x8ffef000-0x8ffff000 at 0xa03f0000: .
RedBoot>
------------------

My Application is a sample program in Anthony J. Massa's "Embedded
Software Development with eCos".


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]