Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

STM32 undefined reference to`RCC_APB2PeriphClockCmd' Problem

Status
Not open for further replies.

lizerd

Newbie level 4
Joined
Nov 14, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Sweden
Activity points
1,343
Hi, i am struggling to get my first project running now for 5 days.
im running latest crossworks and i have installed the STM32F10x_StdPeriph_Lib as a should and then pointed to it on the MCU package installations.

it don´t make any differers if a move the referenced files to the project folder or refers them in Preprocessor Options / User Include Directories.

Any one have any ideé about this problem ??

it always say the same.

C:/Users/Lizerd/Documents/CrossWorks Projects/test66/main.c:12: undefined reference to `RCC_APB2PeriphClockCmd'
C:/Users/Lizerd/Documents/CrossWorks Projects/test66/main.c:17: undefined reference to `GPIO_Init'

the code is
Code:
#include "stm32f10x.h"
#include "stm32f10x_conf.h"

GPIO_InitTypeDef GPIO_InitStructure;

void Delay(__IO uint32_t nCount);

int main()
{
    SystemInit();

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
                         RCC_APB2Periph_GPIOC, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
    GPIO_Init(GPIOB, &GPIO_InitStructure);
    GPIO_Init(GPIOC, &GPIO_InitStructure);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
                         RCC_APB2Periph_GPIOC, DISABLE);
 
    /* Enable the GPIO_LED Clock */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

    /* Configure the GPIO_LED pin */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    while(1)
    {
        // LED0 on
        GPIOB->BSRR = GPIO_Pin_8;
        // delay
        Delay(0xAFFFF);
        // LED0 off
        GPIOB->BRR = GPIO_Pin_8;
        // delay
        Delay(0xAFFFF);
    }
}

void Delay(__IO uint32_t nCount)
{
  for(; nCount != 0; nCount--);
}



Then a moved those files to project folder
Code:
stm32f10x_rcc h and c
stm32f10x_gpio h and c
stm32f10x_conf.h
stm32f10x.h


i have include/link to
Code:
stm32f10x_conf.h
stm32f10x_gpio.c
stm32f10x_rcc.c
stm32f10x.h


i have change stm32f10x_conf.h to
Code:
/* Includes ------------------------------------------------------------------*/
/* Uncomment the line below to enable peripheral header file inclusion */
/* #include "stm32f10x_adc.h" */
/* #include "stm32f10x_bkp.h" */
/* #include "stm32f10x_can.h" */
/* #include "stm32f10x_cec.h" */
/* #include "stm32f10x_crc.h" */
/* #include "stm32f10x_dac.h" */
/* #include "stm32f10x_dbgmcu.h" */
//#include "stm32f10x_dma.h"
//#include "stm32f10x_exti.h"
//#include "stm32f10x_flash.h"
//#include "stm32f10x_fsmc.h"
#include "stm32f10x_gpio.h"
/*#include "stm32f10x_i2c.h"*/
/* #include "stm32f10x_iwdg.h" */
//#include "stm32f10x_pwr.h"
#include "stm32f10x_rcc.h"
/* #include "stm32f10x_rtc.h" */
/* #include "stm32f10x_sdio.h" */
//#include "stm32f10x_spi.h"
/* #include "stm32f10x_tim.h" */
//#include "stm32f10x_usart.h"
/* #include "stm32f10x_wwdg.h" */
//#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */




then a get another error so i´m moving in the right direction i think =)

now a get
THUMB Flash Debug/stm32f10x_gpio.o: In function `GPIO_DeInit':
C:/Users/Lizerd/Documents/CrossWorks Projects/test66/stm32f10x_gpio.c:110: undefined reference to `assert_param'

THUMB Flash Debug/stm32f10x_gpio.o: In function `GPIO_Init':
C:/Users/Lizerd/Documents/CrossWorks Projects/test66/stm32f10x_gpio.c:177: undefined reference to `assert_param'


very thankful for all the help a can get, would be very happy if a can get this to compile without any errors.
Best regards // Micke
 

Re: STM32 undefined reference to`RCC_APB2PeriphClockCmd' Pro

Hi

I never worked before with this compiler - but it looks like a preprocessor problem

Try to teak a working demo from the demo folder and check the project content

Most of my work is done with KEIL or IAR compliers and from time to time i encounter the same problems

All the best

Bobi

The microcontroller specialist
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top