I have a question about how or when configure interrupts using RTX in unprivileged mode, The question is: 1 - What happens if the program goes into an interrupt which uses OS directives before the OS is initialized?
I'm using a MDK-ARM + ver4.53 STM32F4 and this is a piece of pseudo code to illustrate my doubt.
int main(void) { //initialize the timer to generate an interrupt every 1ms TIM4_Config(); PeriphX_Config(); // All peripherals generate interrupts PeriphY_Config(); // PeriphZ_Config(); // // What happens if the program takes more than 1ms to reach this point? os_sys_init(task1); } __task void task1(void) { while(1){ //Wait event os_evt_wait_or (0x0008, 0xFFFF); // do something } } void TIM4_IRQHandler(void){ //Send event isr_evt_set (0x0008, task1); TIM_ClearITPendingBit(TIM4, TIM_IT_Update); }
One thing to consider is that initializing interrupts isn't the same as enabling interrupts.
So you should be able to initialize all interrupts and then start RTX. Then in that first thread, you can turn on all your interrupts - see the SVC (supervisor call) instruction.
Of course, the interrupt enable/disable register are in an accessible part of the memory. I will try that, thanks for the tip.