Skip to main content
Vu.Andy
Associate III
December 14, 2016
Question

Using Eclipse and GCC, codes compiled, downloaded but does not work

  • December 14, 2016
  • 12 replies
  • 2445 views
Posted on December 14, 2016 at 18:32

I was using Eclipse and GCC for the STM32F07x device.  The codes come from the STMCube F0 GPIO examples.   Everything was compiled.  I then use ST-Link utility to download the .hex file.  I verified that the codes downloaded correctly to the uC memory, but the codes do not seem to work. 

Does anybody know where I can start trouble shoot the codes?  Where should I look into first?

Thanks.

    This topic has been closed for replies.

    12 replies

    waclawek.jan
    Super User
    December 14, 2016
    Posted on December 14, 2016 at 18:54

    Try something very simple, such as a

    http://www.efton.sk/STM32/blinkyf0.zip

    , for start.

    What is your HW? How arre BOOT0 and NRST connected?

    JW

    Vu.Andy
    Vu.AndyAuthor
    Associate III
    December 14, 2016
    Posted on December 14, 2016 at 18:58

    I am actually using the GPIO blinky example from the STM32F0 library.  The HW is STM Discovery board so I think the board is OK, and I was able to work with the board using KEIL uVsion. 

    The same blinky example works fine using KEIL, but I am problem using Eclipse/GCC.

    I assume the BOOT0 and NRST are configured correctly since the board is working fine using KEIL.

    Thanks.

    waclawek.jan
    Super User
    December 14, 2016
    Posted on December 14, 2016 at 19:05

    The blinky example I gave is complete standalone, no magic in startup code, no libraries. Modify paths in c.bat, GPIO pin in blinky.c, then run c.bat blinky, then download resulting hex. It's for 'F031 and you should replace the cmsis header for the ''f07x's, but I'd be surprised if there is anything which would not work for such simple example in the 'F07x.

    Check also option bits - in some F0 the bootloader could be run by setting some of them.

    Vu.Andy
    Vu.AndyAuthor
    Associate III
    December 14, 2016
    Posted on December 14, 2016 at 19:22

    Let me take a look at your example.  The thought of having to change the cmsis makes me think your example for the F031 device may not work with my Discovery F07X device. 

    Thanks.

    waclawek.jan
    Super User
    December 14, 2016
    Posted on December 14, 2016 at 19:40

    The thought of having to change the cmsis makes me think your example for the F031 device may not work with my Discovery F07X device. 

    Well, there's enough compatibility within a family to have such a simple

    example workable across the whole family, but if you want to be absolutely

    sure, just copy your device's header from

    \Drivers\CMSIS\Device\ST\STM32F0xx\Include\ and

    then change the ♯ include in blinky.c.

    JW

    waclawek.jan
    Super User
    December 14, 2016
    Posted on December 14, 2016 at 19:54

    Keil for F0 should be

    https://community.st.com/0D50X00009XkW4oSAF

    .

    Anup Kumar Das
    ST Employee
    December 15, 2016
    Posted on December 15, 2016 at 10:52

    If you want to use 'Eclipse and GCC' then you can try 'System Workbench for STM32'. This is a free STM32 integrated development environment. Can download it from

    http://www.openstm32.org/HomePage

    . This tool will allow you to build download and debug stm32 code using GCC.
    Vu.Andy
    Vu.AndyAuthor
    Associate III
    December 15, 2016
    Posted on December 15, 2016 at 16:28

    Thanks.  Let me give it a try.

    arturdav87
    Associate II
    December 15, 2016
    Posted on December 15, 2016 at 17:42

    1. When you create new  project make sure you entered right data.

    2. Check your link files (*.ld). 

    0690X00000605sWQAQ.png
    Vu.Andy
    Vu.AndyAuthor
    Associate III
    December 15, 2016
    Posted on December 15, 2016 at 18:31

    That's a good point.  I actually created a blank C project.  I used the .S and .ld files from the templates folder provided by STM.  I am looking to how to specify the .S file but I think Eclipse did compile the .S file in the project but I have to make sure.  I am trying to see where in the project that the .S file is explicitly specified. 

    As for the Flash size and RAM size, I believe they are defined in the .ld file. 

    As for Instruction set, should I specified Thumb (-mthumb) or ARM (-marm)?  Currently specified as Thumb.

    Endianess : Toolchain default or Little endian or Big endian?

    Unaligned access: Enable, disable, or toolchain default?