1
\$\begingroup\$

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.

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ The map file also tells you the address of the memory. \$\endgroup\$
    – Turbo J
    Commented Apr 21, 2015 at 14:35

1 Answer 1

0
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\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\$
    – nan zhang
    Commented Apr 22, 2015 at 9:37
  • \$\begingroup\$ Since your external SRAM is 2MB, it will be from 0x60000000 to 0x601fffff, 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 through SystemInit(). Again, if you're using a demo project for your board it may already be done for you. \$\endgroup\$
    – Tony K
    Commented Apr 22, 2015 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.