Flash write HARD FAULT

Whenever there is an attempt to write to FLASH memory, the program throws a hardware fault. This issue is on the branch flash-operations. Further investigation is needed to find the root cause.

Some details regarding the issue:

  1. The FLASH is unlocked and the is verified by reading the corresponding bit LOCK in the CR register, after the unlock operation, performed through HAL_FLASH_Unlock().
  2. After the unlock operation, the HAL_FLASH_Program is called, which it should write the new data in FLASH. However the HAL_FLASH_Program functions causes a HARD FAULT, when the line *(__IO uint16_t*)Address = Data; (at line 834) is executed, called from the FLASH_Program_HalfWord function in the stm32f1xx_hal_flash.c file.

Two screenshots and the debug files are attached below.

Screenshot_from_2018-11-15_08-29-07

Screenshot_from_2018-11-15_08-29-03

FreertosMockup.list

FreertosMockup.elf

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information