打印
[Cortex-M0技术交流]

sourceinsight无法处理结构指针

[复制链接]
6632|11
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
kiya_21|  楼主 | 2011-7-11 17:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
cmsis里自带的“NVIC->”不能自动列出来结构体成员,这是啥原因?
比如敲入NVIC->I不能自动带出NVIC->ISER。
如果重新定义 NVIC_Type *nvic;,然后nvic->i就可以自动带出nvic->ISER。为啥??

定义如下:
#define NVIC                ((NVIC_Type *)          NVIC_BASE)        

typedef struct
{
  __IO uint32_t ISER[1];                      /*!< Interrupt Set Enable Register            */
       uint32_t RESERVED0[31];
  __IO uint32_t ICER[1];                      /*!< Interrupt Clear Enable Register          */
       uint32_t RSERVED1[31];
  __IO uint32_t ISPR[1];                      /*!< Interrupt Set Pending Register           */
       uint32_t RESERVED2[31];
  __IO uint32_t ICPR[1];                      /*!< Interrupt Clear Pending Register         */
       uint32_t RESERVED3[31];
       uint32_t RESERVED4[64];
  __IO uint32_t IP[8];                        /*!< Interrupt Priority Register              */
}  NVIC_Type;

相关帖子

沙发
kiya_21|  楼主 | 2011-7-11 17:03 | 只看该作者
/* Memory mapping of Cortex-M0 Hardware */
#define SCS_BASE            (0xE000E000)                              /*!< System Control Space Base Address    */
#define NVIC_BASE           (SCS_BASE +  0x0100)                      /*!< NVIC Base Address                    */

NVIC_BASE是地址

使用特权

评论回复
板凳
kiya_21|  楼主 | 2011-7-11 17:12 | 只看该作者
貌似定义一个指向NVIC结构体的常指针可以解决这个问题?比如
NVIC_Type * const nvic = ((NVIC_Type *) NVIC_BASE);
,然后nvic->i就可以带出nvic->ISER了。

使用特权

评论回复
地板
kiya_21|  楼主 | 2011-7-11 17:14 | 只看该作者
为啥这个就不行呢?不应该啊。
#define NVIC                ((NVIC_Type *)          NVIC_BASE)

使用特权

评论回复
5
hotpower| | 2011-7-11 21:22 | 只看该作者
网友三心(Swallow_0322)用sourceinsight感知的红杏系列。

https://bbs.21ic.com/icview-234000-1-1.html

使用特权

评论回复
6
kiya_21|  楼主 | 2011-7-12 13:45 | 只看该作者
网友三心(Swallow_0322)用sourceinsight感知的红杏系列。

https://bbs.21ic.com/icview-234000-1-1.html
hotpower 发表于 2011-7-11 21:22

貌似和我说的一样,不知有没有修改sourceinsight配置的办法?

对红杏头文件进行如下调整:①将所有用#define定位全局结构体变量处调整为定义一个该类型的结构体;

使用特权

评论回复
7
kiya_21|  楼主 | 2011-7-12 14:36 | 只看该作者
搭车问大叔个问题,您一般访问某个寄存器的某几位是用struct的位结构方法还是用bit define,如
struct{
     unsigned bDR3SEL0: 2;
     unsigned bDSPTIMER: 4;  
}ch;

or define
        #define bDSPTIMER                0x30
        #define bDR3SEL0                0x0F                // SVFW

使用特权

评论回复
8
hotpower| | 2011-7-12 17:06 | 只看该作者
结构,联合及位域,还有枚举。

使用特权

评论回复
9
kiya_21|  楼主 | 2011-7-12 17:41 | 只看该作者
大叔可有例程借我参考,这里满屏都是c++,我想要c的:)

使用特权

评论回复
10
Swallow_0322| | 2011-7-13 15:00 | 只看该作者
9# kiya_21

有没有修改sourceinsight配置的办法?

这个还不知道!

我是这样使用大叔的红杏头文件的:
在SI环境下添加调整后的红杏头文件(俺命名为NUC1xxM051Seriescfg_FALSE.h),可以达到在编辑程序的时候智能感知的功能,然后在Keil工程下添加大叔本来的红杏头文件(NUC1xxM051Seriescfg_V120.h)以正确编译。

C/C++环境下一样使用。

使用截图:


大叔的红杏头文件V1.20:
NUC1xxM051Seriescfg_V120.rar (25.84 KB)

【NUC1xxM051Seriescfg_FALSE.h】(仅供参考,仅调整了部分内容)
NUC1xxM051Seriescfg_FALSE.rar (25.91 KB)





使用特权

评论回复
11
hotpower| | 2011-7-13 15:16 | 只看该作者
C和C++没多少差异呀。不要晕。

使用特权

评论回复
12
kiya_21|  楼主 | 2011-7-13 18:06 | 只看该作者
谢谢二位,在搭车问个问题,一般用什么软件来做注释管理呀

比如,下面这段代码肯定是用软件来管理注释的:


/**************************************************************************//**
* $Id: lpc12xx_libcfg_default.h 550 2010-09-20 06:55:52Z cnh20509 $
*
* @file     lpc12xx_libcfg_default.h
* @brief         Default Library configuration header file
* @version  1.0
* @date     26. Sep. 2010
* @author   NXP MCU Team
*
* @note
* Copyright (C) 2010 NXP Semiconductors(NXP). All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* NXP Semiconductors assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. NXP Semiconductors
* reserves the right to make changes in the software without
* notification. NXP Semiconductors also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
******************************************************************************/

/* Library Configuration group ----------------------------------------------------------- */
/** @defgroup LIBCFG_DEFAULT
* @ingroup LPC1200CMSIS_FwLib_Drivers
* @{
*/

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

64

帖子

5

粉丝