cancel
Showing results for 
Search instead for 
Did you mean: 

Use 256KB flash MCU for 210KB code

Nitish Arora
Associate II
Posted on February 15, 2017 at 13:29

Shall I use STM32L476RCT6 (256KB Flash) MCU for the project which was when compiled on keil shows the total memory equivalent to 210KB.

Please Help!!

#stm #memory-space #stm32 #stm32l4 #memory
6 REPLIES 6
AvaTar
Lead
Posted on February 15, 2017 at 14:41

What are the alternatives ?

Obviously not a silicon with less Flash.

I have some difficulties to understand the point of your question.

Posted on February 16, 2017 at 06:06

When I compile my code, the total size of code with all the data and variables is equivalent to 210 KB.  Is it advisable to use a MCU with 256KB flash or shall I look towards a MCU with 512 KB flash.

Posted on February 16, 2017 at 06:19

I have found lately that the more memory inside the processor tends to be a cheaper processor.

If it is not cheaper now, it will be shortly

example, '091 with 256k flash, is cheaper than the '072 with 128k flash

otherwise these processors seem almost identical.

most of the processors are pin for pin, and usually the internal peripheral function pins line up as well.

do you think you will be adding any more functionality ?

because then you will definitely need to upgrade the chip.

I found that you cannot program the full 256k flash using a nucleo board that has that same capacity.

ie. the '091 nucleo board cannot transfer 256k to the target processor. it is a maximum of about 220k.

if you are using JTag, then this is not a problem.

Posted on February 16, 2017 at 08:30

Code is stored in flash, variables are stored in RAM. The initializers for variables are stored in flash, but uninitialized values are not.

Is your program complete? If it is, you have 46K of flash left over. It sounds like you chose wisely.

If your program is not complete, the choice is clear, change processors or look through your map file and see where all of your flash went to. 

Posted on February 16, 2017 at 08:55

Considering that Keil uVision is not cheap and quite good at optimizing code, I would conclude you are talking about a commercial project.

And unless this is the 'top version' with no extension or follow-up planned, I would consider a version with more code space as well.

Posted on February 16, 2017 at 12:11

During the life of the design do you expect the code size to exceed 256KB? Do you want to be able to update all devices in the field with new software without complication or changing of boards?

There are many parts which share a common pinout these can be changed in the BOM over time to accommodate more memory without spinning the PCB. 

You will need to determine if buying larger quantities of the bigger part is more cost effective and future proofs the original design. And if the cost of the STM32 is a significant or fractional part of the overall BOM cost, or sell price.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..