/* Given the flash address, return the block number. Return error if the address is not a start block address.  */
static s32 stm32_flash_get_block(u8 *addr)
/* Given the flash address, return the block number. Return error if the address is not a start block address.  */
static s32 stm32_flash_get_block(u8 *addr)
{
	s32 i = 0;
	u8 *base = (u8 *)CONFIG_MEM_NVM_BASE;
	while (i < STM32_FLASH_BLOCKS) {
		if (addr == base)
			break;
		base += flash_bsize[i];
		i++;
	}
	if (i == STM32_FLASH_BLOCKS)
		i = -EINVAL;
	return i;
}