This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
STM32 internal flash fix
- From: "simon dot kallweit at intefo dot ch" <simon dot kallweit at intefo dot ch>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Tue, 04 Nov 2008 09:28:38 +0100
- Subject: STM32 internal flash fix
This patch fixes flash size detection on early STM32 silicon.
Simon
diff -r 2ce894389251 packages/devs/flash/cortexm/stm32/current/ChangeLog
--- a/packages/devs/flash/cortexm/stm32/current/ChangeLog Mon Nov 03 17:47:29 2008 +0100
+++ b/packages/devs/flash/cortexm/stm32/current/ChangeLog Tue Nov 04 09:23:48 2008 +0100
@@ -1,3 +1,8 @@
+2008-11-04 Simon Kallweit <simon.kallweit@intefo.ch>
+
+ * src/stm32_flash.c:
+ Fixed detection on early silicon.
+
2008-10-07 Nick Garnett <nickg@ecoscentric.com>
* cdl/flash_stm32.cdl:
diff -r 2ce894389251 packages/devs/flash/cortexm/stm32/current/src/stm32_flash.c
--- a/packages/devs/flash/cortexm/stm32/current/src/stm32_flash.c Mon Nov 03 17:47:29 2008 +0100
+++ b/packages/devs/flash/cortexm/stm32/current/src/stm32_flash.c Tue Nov 04 09:23:48 2008 +0100
@@ -118,18 +118,20 @@
stf_diag("sig %08x id %08x\n", sig, id );
- flash_size = 1024*CYGHWR_HAL_STM32_DEV_SIG_FSIZE(sig);
+ flash_size = CYGHWR_HAL_STM32_DEV_SIG_FSIZE(sig);
if( CYGHWR_HAL_STM32_MCU_ID_DEV(id) == CYGHWR_HAL_STM32_MCU_ID_DEV_MEDIUM )
{
block_size = 1024;
- if( flash_size == 0xFFFF ) flash_size = 128*1024;
+ if( flash_size == 0xFFFF ) flash_size = 128;
}
else if( CYGHWR_HAL_STM32_MCU_ID_DEV(id) == CYGHWR_HAL_STM32_MCU_ID_DEV_HIGH )
{
block_size = 2048;
- if( flash_size == 0xFFFF ) flash_size = 512*1024;
+ if( flash_size == 0xFFFF ) flash_size = 512;
}
+
+ flash_size *= 1024;
stm32_dev->block_info[0].blocks = flash_size/block_size;
stm32_dev->block_info[0].block_size = block_size;