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]

Re: Problem while Performing SoftReset when exception occurs


On Fri, 2003-02-14 at 22:39, venkatadri potluri wrote:
> 
> 
> i am using MPC860 based board. when ever exception occurs i want to reset
> the board.i am generating CYGNUM_HAL_VECTOR_DTLB_MISS exception for
> testing.
> 

Have you tried calling HAL_PLATFORM_RESET() in your handler?  This 
should invoke a sequence which resets the platform and is much safer
than just calling the reset handler.

> The problem i am facing is when ever exception occurs control is going to
> exception handler and then to _exception_reset, up to here it is OK. While
> booting up ecos again control is hanging in cyg_hal_invoke_constuctors().
>  if we debug inside cyg_hal_invoke_constuctors(), control path is like
> this
> 
> 
> 
> Cyg_Exception_Control::Cyg_Exception_Control
>                     |
> 		    |
>        cyg_hal_default_exception_vsr
>                     |
>                     |
>         cyg_hal_exception_handler
>                     |
> 		    |
> Cyg_Exception_Control::deliver_exception
> 
> 
> and control is switching between cyg_hal_exception_handler and
> deliver_exception.  i guess  exception was not cleared properly.
> 
> so how to clear the  exception or solve this problem..
>        
> 
>  my code...
> 
> 
> static int d0;
> externC void exception_init ();
> externC void handler(cyg_addrword_t data, cyg_code_t number,
> cyg_addrword_t info);
> 
> externC
> void exception_init ()
> {
>         cyg_exception_handler_t *old_handler;
>         cyg_addrword_t old_data;
>     cyg_exception_set_handler(
>         CYGNUM_HAL_VECTOR_DTLB_MISS,
>         &handler,
>         (cyg_addrword_t)&d0,
>         &old_handler,
>         &old_data);
> 
> 
> }
> 
> externC
> void handler(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t
> info)
> {
> 
> 
>   diag_printf("\nException Number : %d \n",number);
> 
>         // Do cleanup of interrupt_handlers
>    hal_interrupt_handlers[0] =(CYG_ADDRWORD)hal_default_decrementer_isr;
>         for ( int i=1;i<CYGNUM_HAL_ISR_COUNT;i++)
>                 hal_interrupt_handlers[i] = (CYG_ADDRWORD)hal_default_isr;
> 
>        cyg_exception_clear_handler(number);
> 
> 
>      // Reset the stack pointer
>         asm volatile ("lis 1, __interrupt_stack@h;");
>         asm volatile ("ori 1,1,__interrupt_stack@l;");
> 
> 
>         // Reboot
>         asm volatile ("b __exception_reset;");
>         //asm volatile ("b main");
> 
> 
> }
> 
> thanks in advance
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Venkatadri Potluri
> Research Engineer
> Center For Development Of Telematics,
> Sneha Complex, 71/1,
> Miller's Road,
> Bangalore-560052.
> 
> Phones:
>   Office:080-2263399 extn:327,328,2282168.
>      Res:080-3535423(pp)
>      Fax:080-2263256
>    Email:potluri@cdotb.ernet.in
>          pvenkatadri@sify.com     	
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
> 
> 
> 
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss

-- 
.--------------------------------------------------------.
|       Mind: Embedded Linux and eCos Development        |
|--------------------------------------------------------|
| Gary Thomas              email:  gary.thomas@mind.be   |
| Mind ( http://mind.be )  tel:    +1 (970) 229-1963     |
| gpg: http://www.chez-thomas.org/gary/gpg_key.asc       |
'--------------------------------------------------------'


-- 
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]