cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 compile process size

zioMorgan
Associate II

Hi everyone.

I've got a question about a strange aspect of my project and the compiling process.

I have some files to be compiled for my project. The compile process goes fine, everything is correctly compiled and looking both on console output and build target, all the required file are correctly compiled.

What strangely happens is that if I look to the size of the .text section at the end of compile process, it is equal to only 96Bytes which are a very small size infact my code doesn't work correctly both on debug and on release.

Any suggestions where can I look to try to fix the issue? 

I've already given a look to the linked files (headers) and source location tab (all the required folders are into the sources list), same for .make files, and .map files Wich contains all the required files. The only strange file is the .list file that is very small and, looking to the disassembly cose, there isn't all the code I was expecting but only a small piece.

 

Any advice?

 

5 REPLIES 5
TDK
Super User

 

Can you include the entire project?

What happens when you try to debug the code? Does it launch? What does "doesn't work correctly" mean here?

If you feel a post has answered your question, please click "Accept as Solution".

Hi TDK

I cannot include the project, Sorry.

When I say that code doesn't work I mean that when I start the debug, program counter jumps to an invalid address (0xFFFFFF). This is an expected behavior because the flash memory is not written. If I look to the Memory address where the code should we loaded in fact I count only 96 bytes.

TDK
Super User

Can you show the full output of the Console tab when you build the program?

If you feel a post has answered your question, please click "Accept as Solution".
Andrew Neil
Super User

@zioMorgan wrote:
AndrewNeil_0-1753435428379.png

How to get a proper screenshot:

https://support.microsoft.com/en-gb/windows/use-snipping-tool-to-capture-screenshots-00246869-1843-655f-f220-97299b865f6b

much better than a photograph of the screen!

Or just copy & paste it as text.

 

What optimisation setting are you using?

Maybe your code is all being optimised away?

 

Your .bss section is large - is your code meant to run in RAM, or something? 

 

More details would help - see: How to write your question to maximize your chances to find a solution

 

Examine the Map file to see what's actually being included in the image.

Use the CubeIDE Build Analyser:

https://community.st.com/t5/stm32-mcus-products/stm32l011g4u6tr-build-error-flash-overflow/m-p/822515/highlight/true#M282693

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Pavel A.
Super User

This can mean that most of your code is not referred by main() and functions called from it, therefore the linker eliminates the unreferenced code. Check that your functions are actually called in the code.

Also this can happen if the linker cannot find the proper startup .s file or because a broken linker script.