Unhandled Interrupt message

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unhandled Interrupt message

2,074 Views
mich1985
Contributor III

Hello all,
changing the call of _io_printf() to printf() (code see below) results in an unhandled interrupt message, if this function is called. I know that this isn't the real reason for this error but where I can start my search to solve this strange behaviour?

...

*** UNHANDLED INTERRUPT ***
Vector #: 0x03 Task Id: 0x10004 Td_ptr: 0x1ffff9fc
PC: 0x00000782 LR: 0x000074ef PSP: 0x20006190 MSP: 0x1fff5958 PSR: 0x00000003

...

working:
int8_t parseMsg()
{
    while(1) { _time_delay(10); _io_printf("1"); }
    return 0;
}

not working:
int8_t parseMsg()
{
    while(1) { _time_delay(10); printf("1"); }
    return 0;
}

If I trying to run the same code in the debugger anything works fine.

Any hints? (stack size already checked)


Regards,
flo

0 Kudos
7 Replies

810 Views
konrada
Contributor IV

You get a value for PC and one for LR. Have you checked in the linker map in which function these addresses lie?

0 Kudos

810 Views
c0170
Senior Contributor III

Can you tell me one more thing, what target are you using?

0 Kudos

810 Views
mich1985
Contributor III

Hello all,

weird news - if I copy my well structured source code into one file, anything works fine. Maybe this has something to do my static buffers which where included in the other files via "extern unsigned char rxBuffer[RX_BUFFER_SIZE]". Are there any magic restrictions regarding "global" variables? The code has worked fine before on a ATmega2561...

 

Best Regard and have a nice weekend,

flo

0 Kudos

810 Views
PetrL
NXP Employee
NXP Employee

There is no magic and restrictions to global variables in the MQX.. It sounds to me more problem with compiler optimization/code generation. What compiler are you using.

 

Regards,

PetrL

0 Kudos

810 Views
mich1985
Contributor III

Thanks for your reply. I have downloaded the Eval Version  CodeWarrior for Microcontrollers 10.2 (Eclipse, Windows-hosted).

Your comment regarding to the compiler problem makes sense to me, because I have tried to build the same version of the code on an old Windows XP x86 machine. Here the previous crashing code works fine (same codewarrior - with valid license). My development system is a Windows 7 x64.

 

Are there any compiler flags  to play with? (the normal optimization flags in eclipse doesn't change anything).

 

Regards,

flo

 

0 Kudos

810 Views
c0170
Senior Contributor III

Hi mich1985,

 

you can find the information you requested in CW navigation bar Help -> User section.

Post more information about your buffer which causes the unhandled interrupt message. Have you found out where it invokes the interrupt?

 

Regards,

MartinK

0 Kudos

810 Views
mich1985
Contributor III

Hello,

I'm not really sure if thats the correct information, but under eclipse there are a lot of plugins...

 

MCU v10.2 Service Pack for Kinetis 100MHz K10 K20 K30 K40 K50 K60

com.freescale.mcu10_2.p2_2.win.sp.feature.group

Version: 1.0.1

 

Regarding the buffer - its just a normal unsigned char array which is defined on top of a source file with  "unsigned char rxBuffer[RX_BUFFER_SIZE]". Fread is used to fill this buffer with information received on the rs485 interface - which by the way works fine.

 

Because I have to switch my platform from k60n512 to k60f120m I have tried the same code on the new platform. This results in an unhandled interrupt message while calling a cgi function (not on all cgi calls - just for one function) - which works on the k60n512. Compiling this code on a 32bit machine results in a working image.

 

regards,

flo

 

 

0 Kudos