File corruption after reboot

Modified files are getting corrupted after hardware reser (Power Off followed by Power On). I managed to replicate this issue in 2 boards, including the Evaluation Board.

Doesn’t matter if the file is being accessed via SSH or by a program, on hardware reset the file is either empty or completely corrupted, even if on last reboot it had contents.

Same thing happens in the 5.2 upstream version.

On the program, write files using:

https://linux.die.net/man/2/write

with O_SYNC flag.

Thanks for your Input.

Best regards,
Jaski