Evaluation Board: STM3210E-EVAL Tool: uVision4/ULINK Debugger Processor: STM32F103ZE
When calling os_mut_init() before os_sys_init() the HardFault_Handler is called because of an exception. This exception is generated in the second (0x08000298) line of instruction in SVC_Handler:
SVC_Handler: 0x08000294 F3EF8009 MRS r0,PSP 0x08000298 6981 LDR r1,[r0,#0x18] 0x0800029A F8311C02 LDRH r1,[r1,#-0x02] 0x0800029E F431417F BICS r1,r1,#0xFF00 0x080002A2 D124 BNE 0x080002EE
Does this mean that os_sys_init() needs to be called before os_mut_init()?
Yes. RTX kernel must be initialized before kernel primitives can be used.