I'm trying to compile a simple STM32F4 sample using Eclipse with the GNU ARM Eclipse plugin from http://gnuarmeclipse.livius.net/blog/.

I'm getting the following errors:

enter image description here

and the structure is as follows:

enter image description here

and the source code from main.c

#include "main.h"

 * Main application entry point.
int main() {

    do {
    } while(1);

 * Application initialization.
void init() {
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
    GPIO_InitTypeDef gpio;
    gpio.GPIO_Mode = GPIO_Mode_OUT;
    gpio.GPIO_Pin = LEDS;
    GPIO_Init(GPIOD, &gpio);

    GPIO_SetBits(GPIOD, LEDS);

 * Application loop.
void loop() {
    static uint32_t counter = 0;
    GPIO_ResetBits(GPIOD, LEDS);
    GPIO_SetBits(GPIOD, LED[counter % 4]);

 * Delay by given ms
 * @param ms
void delay(uint32_t ms) {
    ms *= 3360;
    while(ms--) {

Any ideas what these errors mean?

  • \$\begingroup\$ You haven't shown us the actual linker errors, try to find a line of the form some/path/file.c:362: undefined reference to `some_function' then recursive grep the supplied files for that function name and add the corresponding source file to your project. \$\endgroup\$ – Chris Stratton Feb 20 '13 at 20:42
  • \$\begingroup\$ I have no experience with Eclipse and STM32, but I do have some experience with GCC. When I see these errors my hunch is that the verbosity level can be increased somehow. I mean 'Error 1'? I've never seen a compiler just output 'Error 1'. \$\endgroup\$ – jippie Feb 20 '13 at 21:18
  • \$\begingroup\$ II'll try to get a bit more verbosity, that would in fact help quite a bit. Just not too sure how to get it out of the compiler. \$\endgroup\$ – josef.van.niekerk Feb 20 '13 at 21:24
  • \$\begingroup\$ HTron's answer is the correct one. You need that assembly file and you can obtain it from the firmware package that ST provides. Make sure to choose it from a folder of an IDE that uses gcc (will make sure no issues arise). Glad to see you're still working to get the toolchain running. \$\endgroup\$ – Gustavo Litovsky Feb 20 '13 at 23:13
  • \$\begingroup\$ @jippie: I've setup gcc as well and I got those same errors. They actually mean that make returned with some other error but in reality all is ok, and an output file is generated properly (if everything else is ok) and you can ignore those errors. Haven't found (or looked much) to remove them which would be nice. \$\endgroup\$ – Gustavo Litovsky Feb 20 '13 at 23:42

This error maybe because of the missing startup file "startup_stm32f4xx.S". Check if your you have this file. And also this file should have an extension ".S" not ".s" otherwise eclipse wouldn't recognise it.

Also check if you have a linker script file "Linker -> General -> Script file".

| improve this answer | |
  • \$\begingroup\$ Ah, I think the .S file is the culprit! \$\endgroup\$ – josef.van.niekerk Feb 21 '13 at 6:51
  • \$\begingroup\$ This was indeed the problem, I added startup_stm32f4xx.S and getting completely new errors. So onto the next issue in another question. :D \$\endgroup\$ – josef.van.niekerk Feb 21 '13 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.