2010-05-07 01:40 PM
How to determine FLASH page size
2011-05-17 04:50 AM
Try DBGMCU_IDCODE pg 1034
http://www.st.com/stonline/products/literature/rm/13902.pdf The built in boot-loader also returns an ID code, and there is the RAM/FLASH size at the end of the boot loader memory.2011-05-17 04:50 AM
Unfortunately DBGMCU_IDCODE is not reliable on all devices.On some it is 0 out of reset.
See the ''device limitations'' PDF's. e.g. ''Debug registers cannot be read by user software Description The DBGMCU_IDCODE and DBGMCU_CR debug registers are accessible only in debug mode (not accessible by the user software). When these registers are read in user mode, the returned value is 0x00. Workaround None.''2011-05-17 04:50 AM
2011-05-17 04:50 AM
As per last post I use this C code:
#define FLASH_SIZE_IN_K_ADDRESS 0x1FFFF7E0 PageSize = ((*(u16*)FLASH_SIZE_IN_K_ADDRESS) > 128) ? 2048 : 1024;2011-05-17 04:50 AM
Trevor,
I thought I'd be able to use that, but the ST web site shows Connectivity Line devices, such as the STM32F105V8, with 64K of FLASH. PM0042 reads: ''The memory organization is based on a main memory block containing 32 pages of 1 Kbyte (for low-density devices), 128 pages of 1 Kbyte (for medium-density devices), 128 pages of 2 Kbyte (for connectivity line devices) or 256 pages of 2 Kbyte (for high-density devices), ...'' I take from this that the Connectivity Line devices are available with as little as 64K of FLASH, but that the page size is still 2K. This tells me that the memory size, in itself, does not imply a page size. ST has NOT done a good job documenting this. It doesn't have to be this ambiguous! Justin2011-05-17 04:50 AM
James,
That's what I originally thought, too, but I haven't found anything in the ST documentation that actually states this. How did you learn this? Justin2011-05-17 04:50 AM
''The memory organization is based on a main memory block containing 32 pages of 1 Kbyte (for low-density devices), 128 pages of 1 Kbyte (for medium-density devices), 128 pages of 2 Kbyte (for connectivity line devices) or 256 pages of 2 Kbyte (for high-density devices), ...''
I take from this that the Connectivity Line devices are available with as little as 64K of FLASH, but that the page size is still 2K. This tells me that the memory size, in itself, does not imply a page size.It tells you the 256KB version has 128 x 2KB pages, it makes no reference to your 64KB version. You would be better served looking in the ''Flash Loader Demonstrator'' application and it's MAP files, which does appear to confirm your belief that they all have 2KB pages. [Product] Name=STM32_Connectivity-line_64K FlashSize=0040 ;;ADDR_FLASH_SIZE=1FFFF7E0; RAMSize=0014 ;;ADDR_RAM_SIZE =1FFFF7E2; PacketSize=FF ACKVAL=79 MAPNAME=Pages PagesPerSector=2 family = 1; [Page0] Name=Page0 Index=00 Address=08000000 Size=00000800 Type=111 UFO=111 ... [Product] Name=STM32_Connectivity-line_128K FlashSize=0080 ;;ADDR_FLASH_SIZE=1FFFF7E0; RAMSize=0020 ;;ADDR_RAM_SIZE =1FFFF7E2; PacketSize=FF ACKVAL=79 MAPNAME=Pages PagesPerSector=2 family = 1; [Page0] Name=Page0 Index=00 Address=08000000 Size=00000800 Type=111 UFO=111 ... [Product] Name=STM32_Connectivity-line_256K FlashSize=0100 ;;ADDR_FLASH_SIZE=1FFFF7E0; RAMSize=0040 ;;ADDR_RAM_SIZE =1FFFF7E2; PacketSize=FF ACKVAL=79 MAPNAME=Pages PagesPerSector=2 family = 1; [Page0] Name=Page0 Index=00 Address=08000000 Size=00000800 Type=111 UFO=111
2011-05-17 04:50 AM