ILOP and ILAD

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

ILOP and ILAD

2,735 次查看
vcz
Contributor II

Hello. I need to different type of reboot on my firmware, but unfortunately i can't use watchdog...

 

So I choose ILOP and ILAD but I seems to be the same flag (ILOP of SRS register), could you please comfirm or invalidate this apsect ?

 

Thanks a lot !

标签 (1)
0 项奖励
回复
4 回复数

1,798 次查看
abartky
Contributor IV

vcz,

 

The STS register has separate bits for ILOP and ILAD.  ILOP is bit D4 and ILAD is bit D3 in the SRS.

 

You can generate an illegal instruction in C using inline assembly with:

 

asm(dbc $8d);

 

You can generate an invalid address by creating a pointer, setting it to an invalid memory address and then writing to that address.

 

After that the micrcontroller will reset and in your startup code, you can read the SRS to see if you got an ILOP, ILAD or other reset cause.

 

Hope this helps,

 

Alan

0 项奖励
回复

1,798 次查看
vcz
Contributor II

Hello and thanks for your answer.

 

Unfortunatly, I'm using mc9s08aw16 MCU and bit 3 of SRS register is empty, according to the datasheet...

 

Moreover I'm using SDCC as compiler, so  "asm(dbc $8d);" does not works, but this is not the problem I know how to make SDCC generate ILOP and ILAD.

 

No, the real problem is that ILAD and ILOP seems to be the same flag in SRS register...

Indeed when the MCU reboot after ILOP or ILAD, ILOP flag is 1 for the both. When I electically reset the MCU, ILOP flag is 0. So I cannot make difference between ILOP and ILAD.

 

Best regards

0 项奖励
回复

1,798 次查看
vcz
Contributor II

After many tests on the subject, ILAD flag is not available on the mc9s08aw16 MCU...

 

So I did what I had to do with watchdog reboot ! 

0 项奖励
回复

1,798 次查看
bigmac
Specialist III

Hello,

 

Yes, you are correct, ILAD is not available as a reset source for the 9S08AWxx devices. The reason for this is that the 9S08AW60 does not have an unavailable address within its memory map.  Since the 9S08AW16 is based on the larger device, it also does not offer illegal address detection.

 

Regards,

Mac

 

0 项奖励
回复