cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Linker script generation problem

pawcuq
Associate II

Hello,

I noticed that when I create new project in STM32CubeMX 6.7.0 (STM32F030F4Px) and set "Minimum Heap Size" to 0x0 and "Minimum Stack Size" to 0x0, the linker script is not generated (project with default settings, I only change "Toolchain / IDE" to STM32CubeIDE and enable "Generate peripheral initialization as a pair of '.c/.h' files per peripheral") and I can't compile the project, STM32CubeIDE generates error:

Error: Cannot find the specified linker script. Check the linker settings in the build configuration.
make: *** [makefile:87: fail-specified-linker-script-missing] Error 2
"make -j12 all" terminated with exit code 2. Build might be incomplete.

In the same project when I set the Heap/Stack size to their default values (for STM32F030F4Px Heap has 0x200 size and Stack is 0x400) linker script also is not generated.

Am I doing something wrong or is it STM32CubeMX bug?

1 ACCEPTED SOLUTION

Accepted Solutions
Semer CHERNI
ST Employee

Hello @Community member​ 

First let me thank you for posting.

From CubeMx point of view the main issue in this use case is the fact that the tool is not generating the linker script.

Also after changing the values form 0 to a greater value the linker script is not generated.

As a temporary solution, you can import the linker file from the FW pack of the MCU.

With this being said, this problem is raised internally to be reviewed. I'll keep you posted with the updates.

Internal ticket number: 143360 (This is an internal tracking number and is not accessible or usable by customers).

Thanks for your contribution.

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
KnarfB
Principal III

It maybe a bug, but at least stack size 0 is not useful. These values don't do any harm except of guaranteeing at link time that sufficient RAM memory will be available at run-time, similar to a static assert. Use small values that work. You may add a bug tag to your post.

hth

KnarfB

pawcuq
Associate II

@KnarfB​ Thanks for answer.

In meantime I checked that the minimal stack value in STM32CubeMX project should be higher than 0x0 (0x1 works fine) to avoid problems with generating/changing linker script.

Yes, but already when the main() function is called, 8 bytes of stack are used. Not talking about your own function calls, interrupts etc.. If you call printf, more stack is used and, surprisingly, the first printf call calls malloc and needs ~1kB of heap.

So, if you're very thight in memory, lowering stack and heap values does nothing except postponing link time errors to hard to diagnose run-time errors.

hth

KnarfB

Yes I understand that - what I meant was that setting stack size in STM32CubeMX to 0x0 before generating code, breaks generating/updating linker script without any warning from STM32CubeMX.

Semer CHERNI
ST Employee

Hello @Community member​ 

First let me thank you for posting.

From CubeMx point of view the main issue in this use case is the fact that the tool is not generating the linker script.

Also after changing the values form 0 to a greater value the linker script is not generated.

As a temporary solution, you can import the linker file from the FW pack of the MCU.

With this being said, this problem is raised internally to be reviewed. I'll keep you posted with the updates.

Internal ticket number: 143360 (This is an internal tracking number and is not accessible or usable by customers).

Thanks for your contribution.

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

pawcuq
Associate II

Thanks Semer for detailed explanation.