This is the mail archive of the ecos-discuss@sources.redhat.com 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]

redboot cyg_start routine


Hi, 
   i am confused with this routine as seen in the cyg_start(void) function
in redboot/src/main.c and its equivalent assembly code:
here is the jist of it:


do_version(0,0);

#ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
# ifdef CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT
    if (!script) {
      script = CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT;
#  ifndef CYGSEM_REDBOOT_FLASH_CONFIG
      script_timeout = CYGNUM_REDBOOT_BOOT_SCRIPT_DEFAULT_TIMEOUT;
#  endif
    }
# endif
    if (script) {
        // Give the guy a chance to abort any boot script
        unsigned char *hold_script = script;
        int script_timeout_ms = script_timeout * CYGNUM_REDBOOT_BOOT_SCRIPT_TIMEOUT_RESOLUTION;
        diag_printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", script_timeout_ms/1000, script_timeout_ms%1000);
        script = (unsigned char *)0;
        res = _GETS_CTRLC;  // Treat 0 timeout as ^C
        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
        res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
            if (res >= _GETS_OK) {
                diag_printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", script_timeout_ms/1000, script_timeout_ms%1000);
		continue; //Ignore anything but ^C
            }
            if (res != _GETS_TIMEOUT) break;
            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
        }
        if (res == _GETS_CTRLC) {
            script = (unsigned char *)0;  // Disable script
        } else {
            script = hold_script;  // Re-enable script
        }
    }
#endif



3000463c	[0xebffff87]   bl       do_version
30004640	[0xe59f81ac]   ldr      r8,0x300047f4 ; = #0x00004940
30004644	[0xe24b902c]   sub      r9,r11,#0x2c
30004648	[0xe3570000]   cmp      r7,#0
3000464c	[0x0a000002]   beq      0x3000465c  ; (cyg_start + 0x118)
30004650	[0xe59f01a0]   ldr      r0,0x300047f8 ; = #0x30008494
30004654	[0xebfffe7b]   bl       diag_printf
30004658	[0xe3a07000]   mov      r7,#0
3000465c	[0xe59f4198]   ldr      r4,0x300047fc ; = #0x00003244
30004660	[0xe3a06001]   mov      r6,#1
30004664	[0xe1a00004]   mov      r0,r4
30004668	[0xe3a01c01]   mov      r1,#0x100
3000466c	[0xe3a0200a]   mov      r2,#0xa
30004670	[0xe5886000]   str      r6,[r8,#0]
30004674	[0xeb00042e]   bl       _rb_gets
30004678	[0xe3a03000]   mov      r3,#0
3000467c	[0xe3700001]   cmn      r0,#1
30004680	[0xe5883000]   str      r3,[r8,#0]
30004684	[0x0affffef]   beq      0x30004648  ; (cyg_start + 0x104)
30004688	[0xe1500003] * cmp      r0,r3
3000468c	[0x0a000027]   beq      0x30004730  ; (cyg_start + 0x1ec)


the problem is i see a indefinite loop in the assembly code i.e at
address 30004684 which branches to the address 30004648 always
unconditionally..can some one justify this..?

   and which is its equivalent source line..?

  my redboot.image just goes into indefinite loop becoz of this
unconditional branching..!!

   
satish



-- 
Satish Kumar <satish@bvt.sc.sanyo.co.jp>


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


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