Hello Samuli,
The Flash IAP is used to get information about the target’s flash properties (including sector size). Try to run this simple Flash IAP example program to see whether it works on the NUCLEO-F401RE:
#include "mbed.h"
FlashIAP flash;
int main() {
printf("Starting...\r\n");
flash.init();
const uint32_t flash_start = flash.get_flash_start();
const uint32_t flash_size = flash.get_flash_size();
const uint32_t flash_end = flash_start + flash_size;
const uint32_t page_size = flash.get_page_size(); // in bytes
uint32_t sector_size = flash.get_sector_size(flash_end - 1); // in bytes
uint32_t addr = flash_end - sector_size; // address of first byte in the last sector
printf("flash_start = 0x%.8x\r\n", flash_start);
printf("flash_size = 0x%.8x\r\n", flash_size);
printf("flash_end = 0x%.8x\r\n", flash_end);
printf("page_size = 0x%.8x\r\n", page_size);
printf("sector_size = 0x%.8x\r\n", sector_size);
printf("addr = 0x%.8x\r\n", addr);
printf("----------------------\r\n");
flash.deinit();
}