I load a project into the chip STM32f103ZC whose internal sram is 48kBytes , there are also 2MBytes external sram on the board. But when I download and debug the project,the map file tells that 52KBytes read write memory has been used. Does it mean the ram? I think it doesn't exist error maybe because the linker command file makes 64KBytes for the ram just like the datasheet as below, but where is the extra data? Is it automatically stored in the external sram? I use the IAR under the Windows in C language.
1 Answer
Since your microcontroller has an external memory controller, I imagine the SRAM would be mapped directly onto the main address space. The memory map in the datasheet shows that 0x60000000 to 0x6fffffff is reserved for external SRAM (look for "FSMC" which is ST's name for their memory controller). This means that once properly configured, the MCU can access the external SRAM just like any other memory.
You can tell the linker where to locate variables and data using a configuration file. In IAR, such a file would end in .icf and are often found under the project directory. If you are using a development board, and the project you're loading is an example for that particular board, then the linker file may already be configured to place read/write data in the external SRAM.
-
\$\begingroup\$ Hi Tony, thank you for your answer. I know about the configuration file ending by .icf. Now the RAM is located from 0x20000000 to 0x2000ffff. So you mean that if I set the ram range from 0x60000000 to 0x6fffffff the program will locate the data to the external RAM? \$\endgroup\$ Commented Apr 22, 2015 at 9:37
-
\$\begingroup\$ Since your external SRAM is 2MB, it will be from
0x60000000
to0x601fffff
, so that's the range you'd define in the linker file. Make sure that the memory controller is configured properly in the initialization code though; on a Cortex-M3 like STM32 it would usually be throughSystemInit()
. Again, if you're using a demo project for your board it may already be done for you. \$\endgroup\$– Tony KCommented Apr 22, 2015 at 19:30