Topic : UNRESOLVED EXTERNAL on a simple program

Forum : ST7/STM8

Original Post
Post Information Post
December 20, 2010 - 12:31am
Guest

Hi ,
I have no experience with ST microcontroller and i'm trying to write a small program in C for STM8S207RB.
I want , simply, turns on and off a pin on a port but using some existing function I have an error.
I have included all header file, right path for the library and tried to solve the problem without results.

I normally use AVR microcontroller with AVRGCC compiler and RIDE enviroment looks like more powerfull but more complex.Please help me

Thanks

#include "stm8s.h"
#include "stm8s_conf.h"

#define LEDS_PORT (GPIOA)
#define LED1_PIN (GPIO_PIN_1)

/* Private function prototypes -----------------------------------------------*/
void Delay (u16 nCount);

/* Private functions ---------------------------------------------------------*/
void Delay(u16 nCount)
{
while (nCount != 0)
{ nCount--; }
}

void main(void)
{
u8 Leds;
GPIO_Init(LEDS_PORT,LED1_PIN , GPIO_MODE_OUT_PP_LOW_FAST);
while (1)
{
/* LEDs ON */
GPIO_WriteHigh(LEDS_PORT, Leds);
Delay((u16)60000);
Delay((u16)60000);
/* LEDs OFF */
GPIO_WriteLow(LEDS_PORT, Leds);
Delay((u16)60000);
Delay((u16)60000);
}
}

----------------Build Started: 'Application0' in configuration 'Standard'--------------------------

Building C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\main.c
Running: ST7/STM8 Compiler
"C:\Programmi\Raisonance\Ride\Bin\RCSTM8.EXE" "C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\main.c" QUIET GENERATEDEPFILE CODE DB OJ("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\main.obj") PR("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\main.lst") PIN("C:\Programmi\Raisonance\Ride\Inc;C:\Programmi\Raisonance\Ride\Inc\ST7;C:\Programmi\Raisonance\Ride\Examples\STM8\ST_Libraries\STM8SFWLib\library\inc;C:\Programmi\Raisonance\Ride\inc\Sources\ST7-STM8\startup;C:\Programmi\Raisonance\Ride\inc\STM8;C:\Programmi\Raisonance\Ride\Examples\STM8\ST_Libraries\STM8SFWLib\library\src;C:\Programmi\Raisonance\Ride\inc;C:\Programmi\Raisonance\Ride\inc\ST7") STM8(SMALL) O(3,SIZE) NOINITSTATICVAR SMALLOBJECT ET(INT)
RCSTM8 COMPILATION COMPLETE. 0 WARNING, 0 ERROR

Building C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\Application0.rapp
Running: ST7/STM8 Linker
"C:\Programmi\Raisonance\Ride\Bin\RLSTM8.EXE" -CP "C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\main.obj" TO("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\Application0.aof") "LIBPATH(C:\Programmi\Raisonance\Ride\Lib\ST7;C:\Programmi\Raisonance\Ride\inc\STM8;C:\Programmi\Raisonance\Ride\Examples\STM8\ST_Libraries\STM8SFWLib\library\inc;C:\Programmi\Raisonance\Ride\Examples\STM8\ST_Libraries\STM8SFWLib\library\src;C:\Programmi\Raisonance\Ride\inc)" PR("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\Application0.map") SCINAME(STM8) GENERATEDEPFILE CODESIZE(0x20000) CODESTART(0x8000) RAMSIZE(0x1800) DATASTART(0x0000) EEPROMSTART(0x4000) EEPROMSIZE(0x800) STACKSIZE(0x400) STACKTOP(6144) REMOVEUNCALLED IX XML("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\Application0.Standard.xml") XMLRIDE("C:\Documents and Settings\paolo\Desktop\lavori_2010\AGV2\casco\Application0-globals.Standard.xml") CODE(0x8080)
LINKER/LOCATOR RLST7 V2.32.10.307 Lite (32 Kb code limited)
Copyright (c) Raisonance S.A.S. 1987-2010. All rights reserved.
***ERROR 100 : UNRESOLVED EXTERNAL
SYMBOL : ?GPIO_Init(MAIN)
***ERROR 100 : UNRESOLVED EXTERNAL
SYMBOL : ?GPIO_WriteHigh(MAIN)
***ERROR 100 : UNRESOLVED EXTERNAL
SYMBOL : ?GPIO_WriteLow(MAIN)
LINK/LOCATE RUN COMPLETE, 3 ERRORS FOUND.

Replies
Post Information Post
+1
0
-1
December 23, 2010 - 7:59pm
Guest

solved with #include "stm8s_gpio.c" instead of #include "stm8s_gpio.h"
now my leds are blinking!!!!

+1
0
-1
December 24, 2010 - 9:40am
Raisonance Support Team

Hi Paolo,

Indeed this fixes your problem. However it is not the good solution, as including a C file in another C file may lead to various problems on larger projects.

The standard way to handle your problem is to add the "stm8s_gpio.c" file to your application:
- Right-click on your application
- Select "Add existing file..."
- Browse to the stm8s_gpio.c file
- Press return

You can now build your application.

Best regards,