2017-12-21 05:44 AM
I am wroking on a project using two microcontrollers a STM32F412 and a STM32L011 (8K flash, 2k RAM) .The STM32L011 is used as RTC to manage the power comsumption of the STM32F412.
I used STM32CubeMx to generate the code to set the peripherics that I use within the L011 (I2C, RTC, RCC). The problem is the size of the generated code once compiled is bigger than the 8k available inside the flash of the L011.
I only compile the genretaded code without writting a line of code.!
How could be possible to get a bigger code than the place to stored it for a defined STM32?
I think I did something wrong but I can find what is wrong.
Someone could provide me any ideas to resolve this situation. (i can not change the micro)
You will find in attachment the .ioc file. The genrated code from STM32Cube Mx is trasnfered on a Eclipse platform
and is used GNU ARM tools.
.Thanks in advance for your help
Best regards
Serge LOPEZ
#stm32cubemx #stm32l0xx #program-size2018-01-11 02:45 AM
You're not using floating-point maths, are you ... ?
(and beware that Cube/HAL isn't sneaking it in through the back door)
Yes, definitely worth to check for that.
I don't use Cube, for this and other reasons (yes, and I repeat it ever time ...).
Another option is a better toolchain.
The Keil compiler, AFAIK, produces best results in regard to code size. IAR WB is not bad either.
But this might prove futile as well when you need to add another 'very important' feature - and you are again beyond the limits.
Versions of the STM32L011 with more Flash (16k instead of 8k) exist, so the swap would be rather painless.
2018-01-11 03:04 AM
I use Keil MicroLib often to reduce code size.
2018-01-11 03:12 AM
The only problem I see lack of good documentation for LL. If someone does not study datasheet carefully he/she may have a problem with using them. The HAL documentation at least shows how to use the drivers. Here, in case of LL, we can either study examples or staty datasheet. The latter is better but for requires some time.
Even such simple tick like starting SystTick (for HAL it's an easy task automated through CubeMX) in LL requires to debug the app to discover that IT is not enabled and you need to add extra function to enable it.
I would suggest adding better documentation how to use the LL drivers to avoid reverse engineering;)
2018-01-11 03:15 AM
I hope that someone with better experience/understanding of will correct my opinion about LL.
Besides I think the LL is good thing (it made me study the datasheet)
2018-01-11 09:20 AM
Today, LL can be used entirely stand-alone, but I'm pretty sure that you won't allow this for too long. I suppose LL will be soon only a subset of HAL, and using HAL will be the only way to create a project in a supported IDE.
It would be wise to keep the actual versions of CubeMX and the HAL drivers, archiving them on DVD and then carefully testing the new versions.
2018-01-11 10:05 AM
Right, I was thinking the same about keeping old CubeMX version. ST should share the older versions.
2018-01-12 12:55 PM
Try changing the values using ''STM32CubeMx'':
The default setting is:
_Min_Heap_Size = 0x200;
_Min_Stack_Size = 0x400;
or 1536 bytes reserved. (75% of 2048).
reduce to:
_Min_Heap_Size = 0x100;
_Min_Stack_Size = 0x200;
or
_Min_Heap_Size = 0x000;
_Min_Stack_Size = 0x200;
2018-01-12 01:02 PM
I guess care should be taken when playing with stack and the heap. Can reduce the values of these based on the app requirements. e.g. if you allocate an array of 0x200 bytes inside a function (main() is function as well) your app probably crashes as the stack is used by the array.... Also when you use malloc() or dynamic array you can run into trouble with heap when underestimated. Also need to take care when using foreign libs when we do not know what are exact requirements.
2018-01-12 02:49 PM
Apologies for jumping in, but have you found any documentation of the runtime library of Keil for ARM- description of functions, explanation what is the MicroLib at all? Is the source of the libraries available?
-- pa
2018-01-22 07:20 AM
Hello Andrew,
Thansk for your answer. I doesn't use floating point