In FLASH banks 0 and 1 I placed a simple bootloader which jumps to bank 4 where the main code is placed. Banks 2 and 3 are used as emulated EEPROM (see AN3969 application note). I wrote some unit tests to check if my application properly uses the emulation and to test if the data from EEPROM is properly read and written. I upgraded HAL from version 1.5.1 to 1.7.2 and where I could I replaced HAL with LL (for GPIO, TIMERs, UART) and then some issues appeared. After startup when the first test starts writing variable to EEPROM (by EE_WriteVariable) I get PGSERR and PGPERR, so the data is not written to emulated EEPROM. Before the upgrade all tests were passing. I use STLINKv2 for debugging. The program runs under FreeRTOS.