I am using the KEA64 family and I am wondering if it is possible to get the flash size of the MCU at runtime?
There is no register containing the Flash size but you can test it as follows:
- try to read a byte/word from Flash at 0xfff0 - if it causes a hard fault (which you need to handle appropriately) it is < 64k, otherwise it is 64k
- repeat at 0x7ff0 - if it also fauts it is 16k or else it is 32k
Retrieving data ...