Check if program counter is corrupted

Hi to all My project runs in IAR 8.32, with freertos 9, on STM32L152VE. All I need is to check from interrupt that PC runs. Clear, that I can see the program counter register and check if it was changed from previous view, but I think that it is wrong way, because occasionally it can be in tha same instruction. So, I will be glad if you can advise me the right approach. Thanks a lot for your time and consideration

Check if program counter is corrupted

It is not clear what you are asking. If you are executing code in an interrupt then the program counter is running otherwise you would not be able to execute the code that you want to use to check if that is the case. If you are asking for a way to check [from an interrupt] if tasks are running, then that is a different question, and has many different solutions. You could, for example, use a hardware watchdog timer that would expire were tasks not to perform certain actions within a given time. For example, most of the demo project that come with FreeRTOS use what in the demos is called a ‘check task’. That mechanism works by having all the other tasks maintain a cycle count. Each time a task completes an iteration of their implementing function without any errors then it increments its cycle count – if the task detects an error it stops incrementing the count. The check task looks at each cycle count to check it is still incrementing. If any of the counts stops it knows one of the tasks has an error condition and can act as appropriate for the application.

Check if program counter is corrupted

Hi Thanks a lot for the answer. I will use it. And I also found CFSR register.