5
\$\begingroup\$

I'm building an application based on the STM32F030F4P6 microcontroller. During the development of the firmware, I realized that the flash memory of the microcontroller is too small.

Can I run my firmware from SPI flash memory? If yes, how could I do it?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ While STM32F0 cannot do this, for example STM32F7 can execute code from SPI flash. It has some integrated cache so that it can work fast even though external flash is slower than internal one. \$\endgroup\$
    – jpa
    Aug 22, 2018 at 19:17
  • 2
    \$\begingroup\$ While sold as a 16K part, the STM32F030F4P6 typically in practice actually has 32K of flash. It's not something you can necessarily count on, and it may not have been tested, but if you change your linker script and try, you'll probably find it is there and usable for prototypes. In production you may be able to shrink space by removing output messages, etc - or find an officially larger chip such as the one suggested. \$\endgroup\$ Aug 23, 2018 at 4:25
  • \$\begingroup\$ The whole point with having all these countless MCU families is that you should be able to upgrade within the same family without changing code or pin-out. Did you check if there is a compatible STM32F with more flash? \$\endgroup\$
    – Lundin
    Aug 23, 2018 at 8:16
  • \$\begingroup\$ That's true in general but the options for the TSSOP-20 packages are substantially more limited than the others. Still there do appear to be some that officially have 32K. \$\endgroup\$ Aug 23, 2018 at 21:53

2 Answers 2

2
\$\begingroup\$

In my answer of increase memory of an atmega32 there are a lot of generic possibilities to reduce flash size.

However, the most simple way (as Colin mentioned) is to use a microcontroller with more flash.

\$\endgroup\$
9
\$\begingroup\$

The bad news is no, you can't execute directly from SPI flash. You could store some of your program on the external flash, and copy it to RAM a bit at a time for execution, it would work, but it's a terrible idea overall. It's probably easier to change to a more suitable microcontroller.

The stm32f070f6p6 is a similar part with 32k instead of 16k of flash, it may even be pin compatible.

\$\endgroup\$

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.