4

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() {
    init();

    do {
        loop();
    } while(1);
}

/**
 * Application initialization.
 */
void init() {
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
    GPIO_InitTypeDef gpio;
    GPIO_StructInit(&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;
    ++counter;
    GPIO_ResetBits(GPIOD, LEDS);
    GPIO_SetBits(GPIOD, LED[counter % 4]);
    delay(250);
}

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

Any ideas what these errors mean?

josef.van.niekerk
  • 3,600
  • 7
  • 44
  • 63
  • 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. – Chris Stratton Feb 20 '13 at 20:42
  • 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'. – jippie Feb 20 '13 at 21:18
  • 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. – josef.van.niekerk Feb 20 '13 at 21:24
  • 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. – Gustavo Litovsky Feb 20 '13 at 23:13
  • @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. – Gustavo Litovsky Feb 20 '13 at 23:42

1 Answers1

3

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".