cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to compile any of the example code...

Posted on June 03, 2010 at 14:48

Hi there,

Before I go mad and smash up the STM8s Discovery Board, could someone please help me get some basic code up and running, Grom did manage to get the PWM code to work on the unit after many attempts...

All I require is some basic code to set up the Uart2 and transmit and recieve commands to and from hyperterminal, then all I require is to get the ADC to recieve an input from a thermister....

Nothing too complicated, but this is the only processor that I have never been able to get working straight from the box...

7 REPLIES 7
Posted on June 03, 2010 at 18:00

Hi there,

After spending now 2 days solid trying to get a piece of example code to work (UM0884) I've now decided to post the code online...

To me there seems to be a number of files missing, that prevent the code from compiling. Yet if this is meant to be working code I would have thought that all necessary files would be there...

Posted on June 03, 2010 at 18:13

These are the error messages that I get...

Can anyone help us out?

I am using STVD Version 4.1.15

Nothing has changed since Grom helped me compile the first example code that I could not get to also compile...

Seems to be a pattern appearing here, something must be wrong with my settings...

Any help or adivise on this would be greatly appreciated...

----------- Project stvd_project - STM8 Cosmic - Configuration Debug -------------

Removing intermediate files ... Done!

----------- Project stvd_project - STM8 Cosmic - Configuration Debug -------------

Compiling ..\..\src\main.c...

cxstm8 -i''..\..\..\temp sensor\rs232 - um0884\libraries\stm8s_stdperiph_driver\inc'' +mods0 -pp -i..\..\..\discover\inc -i..\..\..\..\libraries\stm8_touchsensing_driver\inc -i..\..\..\..\libraries\stm8s_stdperiph_driver\inc -i..\..\inc -i''E:\Program Files\COSMIC\CXSTM8_32K\Hstm8'' -clRelease\ -coRelease\ ..\..\src\main.c

..\..\src\main.c:

Compiling ..\..\src\stm8_interrupt_vector.c...

cxstm8 -i''..\..\..\temp sensor\rs232 - um0884\libraries\stm8s_stdperiph_driver\inc'' +mods0 -pp -i..\..\..\discover\inc -i..\..\..\..\libraries\stm8_touchsensing_driver\inc -i..\..\..\..\libraries\stm8s_stdperiph_driver\inc -i..\..\inc -i''E:\Program Files\COSMIC\CXSTM8_32K\Hstm8'' -clRelease\ -coRelease\ ..\..\src\stm8_interrupt_vector.c

..\..\src\stm8_interrupt_vector.c:

Compiling ..\..\src\stm8s_it.c...

cxstm8 -i''..\..\..\temp sensor\rs232 - um0884\libraries\stm8s_stdperiph_driver\inc'' +mods0 -pp -i..\..\..\discover\inc -i..\..\..\..\libraries\stm8_touchsensing_driver\inc -i..\..\..\..\libraries\stm8s_stdperiph_driver\inc -i..\..\inc -i''E:\Program Files\COSMIC\CXSTM8_32K\Hstm8'' -clRelease\ -coRelease\ ..\..\src\stm8s_it.c

..\..\src\stm8s_it.c:

Running Linker

clnk -l''E:\Program Files\COSMIC\CXSTM8_32K\Lib'' -o Release\stvd_project.sm8 -mRelease\stvd_project.map Release\stvd_project.lkf

#error clnk Release\stvd_project.lkf:1 symbol _GPIO_WriteReverse not defined (Release\stm8s_it.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_DeInit not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_TimeBaseInit not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _GPIO_Init not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _UART2_DeInit not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _UART2_Init not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_ICInit not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_ClearITPendingBit not defined (Release\stm8s_it.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_ITConfig not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _CLK_HSIPrescalerConfig not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _BEEP_LSICalibrationConfig not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _Main_Menu not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _CLK_GetClockFreq not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_Cmd not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_GetCapture1 not defined (Release\main.o )

#error clnk Release\stvd_project.lkf:1 symbol _TIM3_ClearFlag not defined (Release\main.o )

The command: ''clnk -l''E:\Program Files\COSMIC\CXSTM8_32K\Lib'' -o Release\stvd_project.sm8 -mRelease\stvd_project.map Release\stvd_project.lkf '' has failed, the returned value is: 1

exit code=1.

stvd_project.elf - 18 error(s), 0 warning(s)

spiovan9
Associate II
Posted on June 03, 2010 at 18:47

HI,

At the moment I cannot get through your troubles much,

but if this can help I successfully compiled and run either Hyperterminal and ADC examples provided with the Discovery demo board.

Bye

Stefano

Posted on June 03, 2010 at 19:02

Neither can I...

I just cannot understand why I have never been able to compile any of the example code...

It's not like i've never done this before, however this is the first time that I have ever used the ST Microprocessor...

The reason I am stressing out so much, is that I require a working prototype ASAP in preparation for my third year project that kicks off in August..

You see I am a BSc Forensic Science Student and the university does not have any equipment that allows me to record the Ambient and Buried temperatures for my third year project. So I decided to get back to what I know and build a system from scratch, as this is what I did for over 10 years whilst employed as a Research and Development Engineer...

But for some reason the system appears to be fighting me...

qili
Associate II
Posted on June 04, 2010 at 00:51

no problem compiling here. you need to open up the workspace, or add the project to your own workspace.

stvd is a bear to work with, though.

qili
Associate II
Posted on June 04, 2010 at 02:16

here is a piece of code that will get you start it: it doesn't do what you wanted to do but it will compile and blink the led on the discovery, without relying on the fwlib.

you will see the tim2 initialization, but it is not used.

=======================

//simple example

/* Includes ------------------------------------------------------------------*/

#include <iostm8s.h>

#include <math.h>

#include <stdio.h>                          //because we used printf

/* Global variables ----------------------------------------------------------*/

#define LED_PORT      PD_ODR    //leds on portd

#define LED_PIN       (1<<0)    //pd0

#define LED_PIN2      (1<<5)    //pd2

#define LED_SET(bits) LED_PORT |= (bits)    //set bits on led_port

#define LED_CLR(bits) LED_PORT &=~(bits)    //clear bits on led_port

#define LED_FLP(bits) LED_PORT ^= (bits)    //flip bits on led_port

#define NOP()         asm(''nop'')            //nop

#define ei()          asm(''rim'')            //enable interrupt

#define di()          asm(''sim'')            //disable all interrupt

void delay(unsigned int dly) {              //waste some cycle

  while (dly--)

    continue;

}

void delay_us(unsigned int us) {            //delay a us

  while (us--)

  {NOP(); }                           //16Mhz, /8=2 instructions per cycle.

}

void delay_ms(unsigned int ms) {            //delay ms

  while (ms--)

    delay_us(150);                         //for each ms, call delay_us() 1000x

}

void clk_configuration(void) {

  CLK_CKDIVR = 0x00; /* fCPU=fMASTER = 16MHz */

}

void gpio_init(void){

//  PD_ODR = 0x00;

  PD_DDR |= (LED_PIN | LED_PIN2); /* set led_pin to Output. */

  PD_CR1 |= (LED_PIN | LED_PIN2); /* set led_pin to PushPull. */

  PD_CR2 = 0x00; /* Output speed up to 2MHz. */

}

void tim2_init(void) {

  TIM2_PSCR = 0x00; /* Configure TIM2 prescaler =16. */

  TIM2_ARRH = 0xC1; /* Configure TIM2 period. */

  TIM2_ARRL = 0x7F; /* Configure TIM2 period. */

  TIM2_CNTRH = 0xC1;

  TIM2_CNTRL = 0x7F;

  TIM2_CR1 |= 0x81; /* Enable TIM2. */

  TIM2_IER |= 0x01; /* Enable TIM2 OVR interrupt. */

}

void mcu_init(void) {       //initialiate the mcu

//  asm(''sim''); /* disable interrupts */

//  di();

//  clk_configuration();      //set up the clock

  gpio_init();              //initialize gpio/portd

//  tim2_init();

//  asm(''rim'') ; /* enable interrupts */

//  ei();

}

void main(void) {

  unsigned int ms_count;

  mcu_init();             //initialize the mcu

  ms_count = 0;

  LED_CLR(LED_PIN);       //clear led_pin

  LED_SET(LED_PIN2);      //set led_pin2

  while (1) {

    ms_count++;

    LED_FLP(LED_PIN | LED_PIN2);        //flip led_pin

//    printf(''ms_count=%5d\n'', ms_count); //print ou tthe value of ms_count on terminal io

    delay_ms(1000);

  }

}

simonarthur9
Associate
Posted on June 05, 2010 at 11:21

The system requirements for STM8S-Discovery include STVD version 4.1.2 or later.  You should upgrade your STVD to the latest version.