cancel
Showing results for 
Search instead for 
Did you mean: 

adding a few cases in switch() gives below error "....ANY selector matching ..."

Ala
Senior

hi there

I have a STM32f030c8t6 which has 64kbyte FLASH. I've compiled my code before and I can see that only 34Kbyte is used.

now I want to develop my code.

I have a timer which interrupts every 4ms. entering timer interrupt, I have a function which is just a switch()/case with 15 cases. when I add 6 more cases I get below error

"...Error: L6406E: No space in execution regions with .ANY selector matching ...."

which is indicting that I do not have enough space in FLASH.

why is that? I mean, the code size was 33Kbytes, how can adding some more cases consume all of FLASH?

18 REPLIES 18

Is your Keul free? If yes you are over limit

no it has license

What I mean is that if you didn't use sprintf anywhere else in your code, and you added a one line case statement using it, then the linker might need to pull in several KB of code to facilitate that call that itself encodes to a few dozen bytes.

I​f nothing calls large sections of your code the linker discards it, until you create a dependency on it. Then it all has to come in.

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

The error message for the size exceeding evaluation limits is different.

This error comes from exceeding the bounds of the scatter file ​or linker script for a memory region.

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

Is your conf ?0693W00000QMWusQAH.png

The .MAP file (or verbose linker output) should be able to break down usage.

One trick to get closure is to make the FLASH section larger than the device's resources, now while the binary won't be usable it will allow the linker to complete in a way you can analyze/review the output.

Keil can decompose .AXF (ELF format) files with the FromELF tool, this can also disassemble and dump via FromELF -csd filename.elf >filename.lst

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

I have used sprintf(). it is inside a function which I call many times. is sprintf() that much problematic?

yes it is. how should I change it?

No, it's simply an example which drags in a great deal of dependencies. Often several orders of magnitude compared to the size of the code change you made. Incremental additions will have negligible impact.

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