I managed to dig deeper into the problem.
I found out that when my application does not start it is because MCU is entering Low Power Wait mode.
I have not enabled any of power saving options available in ProcessorExpert yet but I see that it is executing "wfi" command (line 46):
ASM_PUBLIC_BEGIN(_sched_execute_scheduler_internal)
ASM_PUBLIC_FUNC(_sched_execute_scheduler_internal)
ASM_LABEL(_sched_execute_scheduler_internal)
#if MQX_ENABLE_USER_MODE
cpsid i
push {r0}
mrs r0, IPSR
cmp r0, #0xb
pop {r0}
bne _sched_execute_scheduler_internal2
push {lr}
//bl _set_pend_sv
cpsie i
pop {pc}
ASM_LABEL(_sched_execute_scheduler_internal2)
cpsie i
#endif
// store active task registers
STORE_ALL_REGISTERS
// disable interrupts
cpsid i
GET_KERNEL_DATA r0
ldr r3, [r0, #KD_ACTIVE_PTR] // get active task descriptor
str r1, [r3, #TD_STACK_PTR] // store task SP to task descriptor td
#if MQX_KERNEL_LOGGING
KLOG r0, ASM_PREFIX(_klog_execute_scheduler_internal) // kernel log this function
#endif
ASM_LABEL(sched_internal)
ldr r1, [r0, #KD_CURRENT_READY_Q] // get current ready q
ASM_LABEL(find_noempty_que)
ldr r2, [r1, #0] // address of first td
cmp r2, r1 // ready_q structure itself?
bne switch_task
ldr r1, [r1, #RQ_NEXT_Q] // try next queue
movs r1, r1
bne find_noempty_que
// r1 is 0 -> empty
ASM_LABEL(no_one_to_run)
// wait for interrupt
cpsie i
wfi
cpsid i
// TODO check r0, must be kernel data
ldr r1, [r0, #KD_READY_Q_LIST] // get first que from ready list
b find_noempty_que
ASM_LABEL(switch_task)
// update kernel structures
str r1, [r0, #KD_CURRENT_READY_Q] // store addr for active que
str r2, [r0, #KD_ACTIVE_PTR] // active task descriptor
ldrh r3, [r2, #TD_TASK_SR]
strh r3, [r0, #KD_ACTIVE_SR] // restore priority mask for enabled interrupt for active task
Any ideas what and why is hapenning?