cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor
Visitor
7,820 Views
Registered: ‎10-09-2007

How to install an exception handler?

Jump to solution

Hello, I am using a Microblaze-Xilkernel based system and I would like to handle some of the exeptions that may occur during operation. Is there any function to install a handler for those exeptions, as it exist for interrupt handling.This is, I use "register_int_handler" and "enable_interrupt" to say to Xilkernel who to call whenever an interrupt is signaled. Is there any way to do the same for exeptions?

 

Thanks in advance,

 

pafbat.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Xilinx Employee
Xilinx Employee
9,484 Views
Registered: ‎08-07-2007

Re: How to install an exception handler?

Jump to solution

Hi pafbat,

 

It's not clear if you are using MicroBlaze or PowerPC. The datasheet talks about both MicroBlaze and PPC. The former description is for MicroBlaze while the latter one is for PPC.

 

I'm not quite sure why you are worrying that stack overflow could overwrite the reset vectors. but if you are trying to avoid the reset vector of the bootloader being overwritten by the one of the applicaiton to be loaded, then you can:

Add "-xl-mode-bootstrap" option when compiling the applicatio, if it's MicroBlaze

or modify the Linker Script, if it's PPC. The default linker scripts and the tools for generating the linker scripts specify boot.o as a startup file. You must emove the STARTUP directive in such linker scripts. You must also modify the ENTRY irective to be _start instead of _boot.

View solution in original post

0 Kudos
4 Replies
Highlighted
Xilinx Employee
Xilinx Employee
7,811 Views
Registered: ‎08-07-2007

Re: How to install an exception handler?

Jump to solution

Hi pafbat,

 

Below is copied from the xilkernel datasheet:

Xilkernel handles exceptions for the MicroBlaze processor, treating them as faulting conditions
by the executing processes/threads. Xilkernel kills the faulting process and reports using a
message to the console (if verbose mode is on) as to the nature of the exception. You cannot
register your own handlers for these exceptions and Xilkernel handles them all natively.
Xilkernel does not handle exceptions for the PowerPC processor. The exception handling API
and model that is available for the Standalone Board Support Package (BSP) is available for
Xilkernel. You might want to register handlers or set breakpoints (during debug) for exceptions
that are of interest to you.

 

-XF

0 Kudos
Highlighted
Visitor
Visitor
7,800 Views
Registered: ‎10-09-2007

Re: How to install an exception handler?

Jump to solution

Hi XF. Thanks for the response. I am not sure I completely understand the answer though. In the first part the datasheet stands that

"<You cannot register your own handlers for these exceptions and Xilkernel handles them all natively.>"

However later on it stands:

"<You might want to register handlers ... for exceptions that are of interest to you.>"

Therefore, I guess that it is impossible to install a function to be called whenever an exception occurs, is that?

 

My real problem is that as in Xilkernel is not possible to use the -stack-overflow (don't remember exactly) option to avoid the stack overwriting the reset and interrupts vectors, I would like to avoid this situation in any way. My system is running on external memory and what I have in the internal block ram is just the bootloader, so whenever a reset is committed, the bootloader reloads the code from external ROM to external SRAM.

If this bootloader or the reset vector is overwritten, then the system must be either "Proged"  or re-powered.

 

I hope I made myself clear, and sorry for my english...

 

pafbat

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
9,485 Views
Registered: ‎08-07-2007

Re: How to install an exception handler?

Jump to solution

Hi pafbat,

 

It's not clear if you are using MicroBlaze or PowerPC. The datasheet talks about both MicroBlaze and PPC. The former description is for MicroBlaze while the latter one is for PPC.

 

I'm not quite sure why you are worrying that stack overflow could overwrite the reset vectors. but if you are trying to avoid the reset vector of the bootloader being overwritten by the one of the applicaiton to be loaded, then you can:

Add "-xl-mode-bootstrap" option when compiling the applicatio, if it's MicroBlaze

or modify the Linker Script, if it's PPC. The default linker scripts and the tools for generating the linker scripts specify boot.o as a startup file. You must emove the STARTUP directive in such linker scripts. You must also modify the ENTRY irective to be _start instead of _boot.

View solution in original post

0 Kudos
Highlighted
Visitor
Visitor
7,761 Views
Registered: ‎10-09-2007

Re: How to install an exception handler?

Jump to solution

Sorry I didn't make my self clear, I just did not undertand that the second part was only for PPC. I am using a Microblaze-Xilkernel system. I definitely consider that the question I opened in this threar is solved. Therefore I will close this thread and open a new one with the problem of overwriting the reset vector or bootloader, ok?

Thanks a lot xiaofeip!

 

pafbat.

0 Kudos