Since the STM32F407 has 512kB flash memory, the jump address might shift depending on the memory layout. Had the same problem when I moved to a bigger MCU.
So try using this instead:
if ((sp_value & 0x2FFC0000) != 0x20000000)