Home > other >  Call a function error
Call a function error

Time:12-05

Error:
The main c (12) : warning: # 223 - D: the function "GPIO_ResetBits" declared implicitly
GPIO_ResetBits (GPIOC, GPIO_Pin_6);
The main. (13) c: warning: # 61 - D: integer operation result is out of range
GPIOC - & gt; The CRL & amp;=~ (0 x0f & lt; <(uint32_t) 4 * 7);
The main c (15) : warning: # 223 - D: the function "GPIO_SetBits" declared implicitly
GPIO_SetBits (GPIOC, GPIO_Pin_7);
Main. C: 3 warnings, 0 errors
Linking...
./Objects/JCQLD. Axf: Error: L6218E: Undefined symbol GPIO_ResetBits (referred from the main. O).
./Objects/JCQLD. Axf: Error: L6218E: Undefined symbol GPIO_SetBits (referred from the main. O).
Not enough information to list image symbols.
Not enough information to list the load addresses in the image map.
Finished: 2 information, 2 0 warning and error messages.
". \ Objects \ JCQLD axf "- 2 Error (s), 3 Warning (s).
Target not created.
The Build Time Elapsed: 00:00:01

The following code, combined with their own board, refer to the online video, search for some problems related to web pages, not solve the
////////the main function///////
# include "stm32f10x_gpio. H"
# include "stm32f10x. H"
Int main (void)
{
RCC - & gt; APB2ENR |=(1 & lt; <4);
GPIOC - & gt; The CRL & amp;=~ (0 x0f & lt; <4 * 6);
GPIOC - & gt; The CRL |=(1 & lt; <4 * 6);
//GPIOC - & gt; The ODR |=(1 & lt; <6);
GPIO_ResetBits (GPIOC, GPIO_Pin_6);
GPIOC - & gt; The CRL & amp;=~ (0 x0f & lt; <(uint32_t) 4 * 7);
GPIOC - & gt; The CRL |=(1 & lt; <4 * 7);
GPIO_SetBits (GPIOC, GPIO_Pin_7);//here call gpio_setbits and gpio_resetbits appeared not define
}

///////stm32f10x. H///////
# # ifndef __STM32F10X_H
# define __STM32F10X_H

Typedef unsigned int uint32_t;//define the data type
Typedef unsigned short uint16_t;

# define PERIPH_BASE ((unsigned int) 0 x40000000)
# define APB2PERIPH_BASE (PERIPH_BASE + 0 x10000)
# define AHBPERIPH_BASE (PERIPH_BASE + 0 x20000)//bus address variable definition
# define RCC_BASE (AHBPERIPH_BASE + 0 x1000)/address/port clock variables defined
# define GPIOC_BASE (APB2PERIPH_BASE + 0 x1000)/address/port C variable definition

Typedef struct//define GPIO structure
{
Uint32_t CRL.
Uint32_t CRH.
Uint32_t IDR;
Uint32_t ODR;
Uint32_t BSRR;
Uint32_t BRR.
} GPIO_TypeDef;

Typedef struct//define RCC structure
{
Uint32_t CR;
Uint32_t CFGR;
Uint32_t CIR.
Uint32_t APB2RSTR;
Uint32_t APB1RSTR;
Uint32_t AHBENR;
Uint32_t APB2ENR;
} RCC_TypeDef;

# define RCC ((RCC_TypeDef *) RCC_BASE)//define RCC base address for RCC structure
# define GPIOC ((GPIO_TypeDef *) GPIOC_BASE)//define GPIO base address type of GPIO
//the last two sentences here inside the parentheses, double turnkey in brackets and single bag * brackets before how much difference between the content of the
# endif

///////stm32f10x_gpio. H///////
# # ifndef __STM32F10X_GPIO_H
# define __STM32F10X_GPIO_H
# include "stm32f10x. H"

# define GPIO_Pin_0 (uint16_t) x0001//binary 0:0 b0000 0001
# define GPIO_Pin_1 (uint16_t) x0002//binary 0:0 b0000 0010
# define GPIO_Pin_2 (uint16_t) 0 x0004//binary: 0 b0000 0100
# define GPIO_Pin_3 (uint16_t) 0 x0008
# define GPIO_Pin_4 (uint16_t) 0 x0010
# define GPIO_Pin_5 (uint16_t) 0 x0020
# define GPIO_Pin_6 (uint16_t) 0 x0040
# define GPIO_Pin_7 (uint16_t) 0 x0080
# define GPIO_Pin_8 (uint16_t) 0 x0100
# define GPIO_Pin_9 (uint16_t) 0 x0200
# define GPIO_Pin_10 (uint16_t) 0 x0400
# define GPIO_Pin_11 (uint16_t) 0 x0800
# define GPIO_Pin_12 (uint16_t) 0 x1000
# define GPIO_Pin_13 (uint16_t) 0 x2000
# define GPIO_Pin_14 (uint16_t) 0 x4000
# define GPIO_Pin_15 (uint16_t) 0 x8000
# define GPIO_Pin_all (uint16_t 0 XFFFF)

Void GPIO_Setbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin);
Void GPIO_Resetbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin);

# endif

///////stm32f10x_gpio c///////
# include "stm32f10x_gpio. H"

Void GPIO_Setbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin)
{
GPIOx - & gt; BSRR |=GPIO_pin;
}
Void GPIO_Resetbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin)
{
GPIOx - & gt; BSRR |=GPIO_pin;
}//here gpio_pin debugging always appear in front of the error is not defined, don't know where the problem, then rewrite the again after all the other parts will be prompted to issue

CodePudding user response:

Stm32f10x_gpio. C include file?

CodePudding user response:

CodePudding user response:

Now just don't understand how to prompt error, check the network call things define problem, but look at the others have

CodePudding user response:

Need to include the function declarations. H file, or extern line, also is can't find the function definition,

CodePudding user response:

Warning: # 223 - D: the function "GPIO_ResetBits" declared implicitly
GPIO_ResetBits (GPIOC, GPIO_Pin_6);

Statement GPIO_ResetBits function. H file does not include in

CodePudding user response:

GPIO_ResetBits function declaration. H file stm32f10x_gpio. H has been included in the main;
Void GPIO_Setbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin);
Void GPIO_Resetbits (GPIO_TypeDef * GPIOx, uint16_t GPIO_pin); In the two sentences of stm32f10x_GPIO. H GPIO_ResetBits and GPIO_setBits definition
  • Related