STM32F0 - run user program from SPI flash memory

STM32F0 - run user program from SPI flash memory



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?





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.
– jpa
Aug 22 at 19:17





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.
– Chris Stratton
Aug 23 at 4:25






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?
– Lundin
Aug 23 at 8:16






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.
– Chris Stratton
Aug 23 at 21:53




2 Answers
2



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.



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.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)