User forums > Using Code::Blocks
Code Completion works bad
oBFusCATed:
Can you provide simple project with one such struct + all the required defines?
tanq:
Yes, here it is (20K size) http://ifile.it/6wqf8i2
This is complete project, it builds successfully and works in hardware. Can be used as template for cortex-m0 / cortex-m3 AMRs.
YAGARTO toolchain used to build. Alternatively, CodeSourcery or KGP toolchain can be used. However they will require to edit standart library paths in "linker path" options.
oBFusCATed:
Simple project means: one c or cpp with all needed code, and no external requirements
tanq:
Small extract from the project above. No need for additional headers and defines.
--- Code: ---/* structure declaration demo */
#ifdef __cplusplus
#define __I volatile /*!< defines 'read only' permissions */
#else
#define __I volatile const /*!< defines 'read only' permissions */
#endif
#define __O volatile /*!< defines 'write only' permissions */
#define __IO volatile /*!< defines 'read / write' permissions */
typedef struct
{
__IO uint32_t PCON; /*!< Offset: 0x000 Power control Register (R/W) */
__IO uint32_t GPREG0; /*!< Offset: 0x004 General purpose Register 0 (R/W) */
__IO uint32_t GPREG1; /*!< Offset: 0x008 General purpose Register 1 (R/W) */
__IO uint32_t GPREG2; /*!< Offset: 0x00C General purpose Register 2 (R/W) */
__IO uint32_t GPREG3; /*!< Offset: 0x010 General purpose Register 3 (R/W) */
__IO uint32_t GPREG4; /*!< Offset: 0x014 General purpose Register 4 (R/W) */
} LPC_PMU_TypeDef;
/*@}*/ /* end of group LPC11xx_PMU */
#define LPC_AHB_BASE (0x50000000UL)
#define LPC_PMU_BASE (LPC_APB0_BASE + 0x38000)
#define LPC_PMU ((LPC_PMU_TypeDef *) LPC_PMU_BASE )
/* function declaration demo (from math.h) */
#define _PARAMS(paramlist) paramlist
extern double acos _PARAMS((double));
void main(void)
{
LPC_PMU->PCON = 0x20; /* members of LPC_PMU-> are not shown */
((LPC_PMU_TypeDef *) LPC_PMU_BASE)->PCON = 0x20; /*this is the same, but members of LPC_PMU_TypeDef now visible*/
acos(20.5); /*this autocompletes only if _PARAMS macro substituted in "settings" menu */
}
--- End code ---
tanq:
After some additional testing I found that CPP files with classes are handled much better.
Navigation
[0] Message Index
[*] Previous page
Go to full version