Resolved! while debugging the program, it hits hardfault handler and sometime it wont
i check in the disassembly where it showed cannot acces memory address at 0x8020000 and some other address when redebugging using stm32f103c8t6 mcu is flash memory being corrupted or something else?