cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to run NUCLEO STM32F303 with Atollic (Embedded C program).

Giampaolo Pantaleoni
Associate II
Posted on March 21, 2018 at 14:31

Hi,

I'm unable to run NUCLEO STM32F303 board with Atollic (Embedded C Program).

The processor is the STM32F303K8, the program is the template proposed by Atollic.

It's all Ok whith mbed Compiler.

The same program run correctly with NUCLEO STM32L013 and Atollic compiler.

The problem is that the main() function is never reached.

A Hard Fault during the startup phase (file startup_stm32f303x8.s) stops the program.

More in detail, when the instruction 'push  {r7} ' is executed (after calling SystemInit), a hard fault is generated.

The same don't happens using STM32L013 or STM32F722 MCUs (same program, same compiler).

Can you help me ?

Thnks 

Giampaolo

#hard-fault #stm32f3
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 23, 2018 at 13:25

Hallo,

I just solved the problem. 

The cause was the wrong linker file.

In the file generated by TrueSTUDIO for STM32F303K8, the stack was allocated to a reserved memory area (0x20004000).

With the stack correctly located at 0x20003000 (as from the data sheet of the MCU), everything works correctly.

I reported the problem in the forum discussion titled 'Stack lenght wrong in Atollic linker file'.

Here you can find both the files: the wrong and the right.

Thanks for your interest.

Best Regards,

Giampaolo

View solution in original post

4 REPLIES 4
Imen.D
ST Employee
Posted on March 23, 2018 at 12:30

Hello

pantaleoni.gp

,

Can you please precise which CubeF3 firmware package are you using ?

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on March 23, 2018 at 13:25

Hallo,

I just solved the problem. 

The cause was the wrong linker file.

In the file generated by TrueSTUDIO for STM32F303K8, the stack was allocated to a reserved memory area (0x20004000).

With the stack correctly located at 0x20003000 (as from the data sheet of the MCU), everything works correctly.

I reported the problem in the forum discussion titled 'Stack lenght wrong in Atollic linker file'.

Here you can find both the files: the wrong and the right.

Thanks for your interest.

Best Regards,

Giampaolo

Giampaolo Pantaleoni
Associate II
Posted on March 26, 2018 at 16:26

Hallo Imen,

I've just used Atollic C-project wizard.

A piece of the file (produced by the tool) follows.

Thanks again.

Best Regards.

Giampaolo Pantaleoni

/*

******************************************************************************

File: stm32f30_flash.ld

Info: Generated by Atollic TrueSTUDIO(R) 9.0.0 2018-03-26

Abstract: Linker script for STM32F303K8 device

Set heap size, stack size, stack location, memory areas and

sections according to application requirements.

The MIT License (MIT)

Copyright (c) 2018 STMicroelectronics

...

...

/* Entry Point */

ENTRY(Reset_Handler)

/* Highest address of the user mode stack */

_estack = 0x20004000; /* end of 16K RAM */

/* Generate a link error if heap and stack don't fit into RAM */

_Min_Heap_Size = 0; /* required amount of heap */

_Min_Stack_Size = 0x80; /* required amount of stack */
Posted on March 26, 2018 at 15:45

Hello

pantaleoni.gp

,

After check my project withSTM32Cube_FW_F3_V1.9.0 and TrueSTUDIO

V 9.0.0, I have in the linker file the End of RAM at

0x20003000.

Please check if you

are using an old version of Cube package that need update.

0690X0000060AGIQA2.png

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen