Stack overflowing on simple task

Switch -fstack-check works a bit weird on embedded targets as for me: it checks 4k free space in stack. My advice - don’t use it, or replace Stack_Check routine by custom implementation.

See How to protect from stack overflow on embedded targets?