msgq_receive after printf causes unhandled interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

msgq_receive after printf causes unhandled interrupt

ソリューションへジャンプ
1,099件の閲覧回数
Peca
Contributor I

I am using MQX 3.7 on Kinetis K60, standard output is connected to ttyf serial port and I have the following problem.


If I print debug info before the tasks is waiting for a message from message queue

_io_printf("wait for message");msg = _msgq_receive( KODEK_queue, 0);

 I usually get the unhandled interrupt error

 

*** UNHANDLED INTERRUPT ***Vector #: 0x03 Task Id: 0x10003 Td_ptr 0x1fff5fccPC: 0x000006ea LR: 0x00004d9f PSP: 0x1fff6758 MSP: 0x1fff45a8 PSR: 0x00000003Memory dump:0x1fff6758 : 0x00000000 0xdff2cff3 0x00000073 0x000000000x1fff6768 : 0x1fff77f8 0x00005145 0x00005474 0x810002000x1fff6778 : 0x00005145 0x00000020 0x00000000 0x000000000x1fff6788 : 0x00000000 0x00000000 0x00000000 0x000000000x1fff6798 : 0x00000000 0x00000000 0x00000000 0x000000000x1fff67a8 : 0x00000020 0x00000000 0x1fff6fa0 0x000000000x1fff67b8 : 0x1fff3e80 0x1fff6fac 0x00006f97 0x000000000x1fff67c8 : 0x00000000 0x00000000 0x1fff67fc 0xdff2cff3Memory dump:0x1fff45a8 : 0x1fff3e80 0x00000002 0x1fff3e80 0x000000020x1fff45b8 : 0xdff2cff3 0x1fff6804 0x1fff116a 0x00004ff90x1fff45c8 : 0x00000000 0x00000000 0x1fff4e0c 0x000006210x1fff45d8 : 0x1fff3e80 0x00000000 0x00000003 0x000000c00x1fff45e8 : 0x00000000 0xfffffffd 0x7374616b 0x7374616b0x1fff45f8 : 0x7374616b 0x0b5845a2 0x00000160 0x1fff41a40x1fff4608 : 0x0001ffff 0xb9df3c4d 0x604b9d36 0xcbde07cb0x1fff4618 : 0x8257e5b2 0x868ab5bc 0x45a2a288 0xcf2fbbc3

When I comment _io_printf function

//_io_printf("wait for message");msg = _msgq_receive( KODEK_queue, 0);

 the error does not raise.

 

 

0 件の賞賛
返信
1 解決策
705件の閲覧回数
PetrM
Senior Contributor I

Hello,

 

it just looked like the printf function caused the unhandled exception and I doubt there's a problem in serial driver. So as  most probable I see the memory corruption and the origin could be in small task stack.

Anyway you can at least check the map file of your application to find functions into which the PC and LR registers point to, i.e. where the problem occured.

 

Regards,

PetrM

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
705件の閲覧回数
PetrM
Senior Contributor I

Hello,

 

it seems like memory corruption due to small task stack.

_io_printf() function consumes a lot of stack in some configurations.

 

PetrM

 

0 件の賞賛
返信
705件の閲覧回数
admin
Specialist II

Hello PertM:

 

It looks like you uderstand what does those memory dump message.

 

How do you it is memory corrution?

 

Or could you instruct us how to understand?

 

I have read some article on hardfault but I have problem to understand them?

 

Thanks

fzhu

0 件の賞賛
返信
706件の閲覧回数
PetrM
Senior Contributor I

Hello,

 

it just looked like the printf function caused the unhandled exception and I doubt there's a problem in serial driver. So as  most probable I see the memory corruption and the origin could be in small task stack.

Anyway you can at least check the map file of your application to find functions into which the PC and LR registers point to, i.e. where the problem occured.

 

Regards,

PetrM

 

0 件の賞賛
返信