Does the STR71x port run in System Mode, when the scheduler is runing? The intrinsic keyword __disable_interrupt and __enable_interrup can only be used in supervisor mode. I want to disable all interrupts, to be able to stop the CPU from accessing the FLASH. Best regards, Frank Andersen
The scheduler itself runs in supervisor mode. The tasks run in system mode. Either way I think you can call the intrinsic functions ok.
Well forgot to write that I am using the IAR compiler and the interrupts are not disabled when calling portEnterCritical (__disable_interrupt) Best regards, Frank Andersen
So you are calling portENTER_CRITICAL() but interrupts remain enabled? In the debugger registers window, can you expand the CPSR register and say what the I, F, T and mode bits are set to immediately before and immediately after calling portENTER_CRITICAL();
Yes, the TimerTickInterrupt keeps running. Mode is not changed when calling portENTER_CRITICAL() it remains in System Mode. Mode = 0b11111 if I instead call EIC_IRQConfig( DISABLE ); then the interrupts are disabled. So maybe the __disable_interrupt() in the function portENTER_CRITICAL() has to be changed? Best regards, Frank Andersen
I just tried this on my STR712F. Stepping into the enter/exit critical section functions I can see the I bit in the status register change when the disable_interrupts and enable_interrupts intrinsic functions are called. Have you changed any build options? Looking in the header files the intrinsic functions have several conditional compilations around them. Regards.
Ok, just tried to look at the I bit in the CPSR register and you right they do change. All thoug it is stated in IAR manual that __disable_interrupt and __enable_interrupt only works in supervisor mode. It puzzel me how the interrupts are enabled if I only call portENTER_CRITICAL(); from within a task. I steped thru the code and found in YeildProcessor that when restorecontex in called the CriticalNesting is set zero, is that correct. I have not changed any build options. Best regards, Frank Andersen
each task has its own critical nesting value so restoring the context of a task can set the value to zero. this is right.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.