Page 1 of 1

STM32F030F4 minimal example is not working

Posted: Tue Feb 26, 2019 6:58 pm
by ceremcem
Hi,

I'm trying to use my STM32F030F4 board with ChibiOS 18 Stable. The simple app can be compiled, but is not running when flashed to the board.

Here is the code: https://github.com/ceremcem/chibios-stm ... /b8a72f7cf

Board is simplest possible breakout board (built by me and known to work) without an external XTAL. I can load the code to the board and instead of hitting the breakpoint in "main()", GDB displays the following message:

Code: Select all

Temporary breakpoint 1 at 0x8000990: file /home/ceremcem/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.c, line 233.
Note: automatically using hardware breakpoints for read-only addresses.


Hitting Ctrl+C gives the following output:

Code: Select all

^C
Program received signal SIGTRAP, Trace/breakpoint trap.                       
0xfffffffe in ?? ()
(gdb) l
219     /* Driver exported functions.                                         
     */
220     /*===========================================================================*/
221
222     /**
223      * @brief   Low level HAL driver initialization.                       
224      *
225      * @notapi
226      */
227     void hal_lld_init(void) {
228
(gdb) l
229       /* Reset of all peripherals.
230          Note, GPIOs are not reset because initialized before this point in
231          board files.*/
232       rccResetAHB(~STM32_GPIO_EN_MASK);                                   
233       rccResetAPB1(0xFFFFFFFF);
234       rccResetAPB2(~RCC_APB2RSTR_DBGMCURST);                               
235
236       /* PWR clock enabled.*/
237       rccEnablePWRInterface(true);
238


Dependencies as listed here:

Code: Select all

ChibiOS/stable_18.2.x 903263a2c7467204f84df164efe0a1ca0028bbde
GCC 8.2.0


What could be the problem?

Re: STM32F030F4 minimal example is not working

Posted: Tue Feb 26, 2019 7:30 pm
by Giovanni
Hi,

You should check clock and GPIO settings, are those in the demo compatible with your own board? it is possible you need to create your own board files.

Check board.h and clock settings in mcuconf.h.

Giovanni

Re: STM32F030F4 minimal example is not working

Posted: Tue Feb 26, 2019 8:58 pm
by ceremcem
I've set all pins to their default (reset) states: https://github.com/ceremcem/chibios-stm ... h#L82-L144

External clocks are already disabled and internal clocks are already enabled. (I'm not sure what else to check for clock settings).

One interesting thing is that I've used #define STM32F030x6 because following lines are written in os/common/ext/ST/STM32F0xx/stm32f0xx.h:

Code: Select all

/* #define STM32F030x6 */  /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes)              */


...and there is no STM32F030x4 related inclusion here. However, STM32F030x4 is taken into consideration here.

If I use STM32F030x4 in board.h, following compile error is thrown:

Code: Select all

/home/ceremcem/ChibiOS/os/common/ext/ST/STM32F0xx/stm32f0xx.h:165:3: error: #er$
or "Please select first the target STM32F0xx device used in your application (i$
 stm32f0xx.h file)"                                                             
  #error "Please select first the target STM32F0xx device used in your applicat$
on (in stm32f0xx.h file)"                                                       
   ^~~~~                         


I'm confused what to use in board.h.

Re: STM32F030F4 minimal example is not working

Posted: Tue Feb 26, 2019 9:05 pm
by Giovanni
Apparently there Is a mismatch try defining both x4 and x6.

Giovanni

Re: STM32F030F4 minimal example is not working

Posted: Tue Feb 26, 2019 9:19 pm
by ceremcem
Giovanni wrote:Apparently there Is a mismatch try defining both x4 and x6.


I've set both. However, GDB hits the same point:

Code: Select all

Temporary breakpoint 8 at 0x8000900: file /home/ceremcem/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.c, line 233.

Re: STM32F030F4 minimal example is not working  Topic is solved

Posted: Fri Mar 01, 2019 1:35 pm
by ceremcem
Solved by this commit. The "MCU=cortex-m3" setting was mistakenly forgotten while switching to F0 mcu.