User forums > Embedded development

Code completion and STM32 peripheral registers

(1/4) > >>

1essor1:
Hello!

The problem is I want to registers name being autocompleted like normal fields of a struct.
For example, I write GPIOA, then -> and bang - there should be list of GPIOA regs like MODER, OTYPER and other displayed, but nothing happens.



Registers i want access are just memory regions and GPIOA is structure describing them :

--- Code: ---typedef struct
{
  __IO uint32_t MODER;        /*!< GPIO port mode register,                                  Address offset: 0x00 */
  __IO uint16_t OTYPER;       /*!< GPIO port output type register,                           Address offset: 0x04 */
  uint16_t RESERVED0;         /*!< Reserved,                                                                 0x06 */
  __IO uint32_t OSPEEDR;      /*!< GPIO port output speed register,                          Address offset: 0x08 */
  __IO uint32_t PUPDR;        /*!< GPIO port pull-up/pull-down register,                     Address offset: 0x0C */
  __IO uint16_t IDR;          /*!< GPIO port input data register,                            Address offset: 0x10 */
  uint16_t RESERVED1;         /*!< Reserved,                                                                 0x12 */
  __IO uint16_t ODR;          /*!< GPIO port output data register,                           Address offset: 0x14 */
  uint16_t RESERVED2;         /*!< Reserved,                                                                 0x16 */
  __IO uint32_t BSRR;         /*!< GPIO port bit set/reset registerBSRR,                     Address offset: 0x18 */
  __IO uint32_t LCKR;         /*!< GPIO port configuration lock register,                    Address offset: 0x1C */
  __IO uint32_t AFR[2];       /*!< GPIO alternate function low register,                Address offset: 0x20-0x24 */
  __IO uint16_t BRR;          /*!< GPIO bit reset register,                                  Address offset: 0x28 */
  uint16_t RESERVED3;         /*!< Reserved,                                                                 0x2A */
}GPIO_TypeDef;

#define PERIPH_BASE           ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region */
#define AHB2PERIPH_BASE       (PERIPH_BASE + 0x08000000)
#define GPIOA_BASE            (AHB2PERIPH_BASE + 0x00000000)
#define GPIOA               ((GPIO_TypeDef *) GPIOA_BASE)

--- End code ---

Maybe I'm doing something wrong? Or there is some settings i don't know...

yvesdm3000:
Where is this struct declared and is that #include 'd ?

Yves

1essor1:
GPIO_TypeDef and all defines with addresses are in stm32f0xx.h. This file included to main.c where I write code for screenshots.

Quiss:
http://forums.codeblocks.org/index.php/topic,15482.0.html

1essor1:

--- Quote from: Quiss on March 20, 2017, 06:30:58 am ---http://forums.codeblocks.org/index.php/topic,15482.0.html

--- End quote ---
Thanks for link! Yes, this situation is similar to mine.

So, there is no way to deal with this problem? Maybe some CC tweaks that help it to do macro expansion deeper? If it will take more time, it still be ok.

Navigation

[0] Message Index

[#] Next page

Go to full version