打印
[ZLG-MCU]

求助:IAR startup.c g_pfnVectors总是在RAM里面

[复制链接]
2594|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ATmega32L|  楼主 | 2008-2-23 08:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求助:IAR startup.c  g_pfnVectors总是在RAM里面


#pragma language=extended
#pragma segment="CSTACK"

typedef void (*pVectorEntry)(void);

extern "C" void __program_start( void );
void NmiSR(void);
void FaultISR(void);
void IntDefaultHandler(void);


__root static const  pVectorEntry g_pfnVectors[] @ "INTVEC" =
{
     (pVectorEntry)__segment_end("CSTACK") , // The initial stack pointer
    __program_start,                         // The reset handler
    NmiSR,                                  // The NMI handler
    FaultISR,                               // The hard fault handler
    IntDefaultHandler,                      // The MPU fault handler
    IntDefaultHandler,                      // The bus fault handler
    IntDefaultHandler,                      // The usage fault handler
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // SVCall handler
    IntDefaultHandler,                      // Debug monitor handler
    0,                                      // Reserved
    IntDefaultHandler,                      // The PendSV handler
    IntDefaultHandler,                      // The SysTick handler
    IntDefaultHandler,                      // GPIO Port A
    IntDefaultHandler,                      // GPIO Port B
    IntDefaultHandler,                      // GPIO Port C
    IntDefaultHandler,                      // GPIO Port D
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                      // UART0 Rx and Tx
    IntDefaultHandler,                      // UART1 Rx and Tx
    IntDefaultHandler,                      // SSI Rx and Tx
    IntDefaultHandler,                      // I2C Master and Slave
    IntDefaultHandler,                      // PWM Fault
    IntDefaultHandler,                      // PWM Generator 0
    IntDefaultHandler,                      // PWM Generator 1
    IntDefaultHandler,                      // PWM Generator 2
    IntDefaultHandler,                      // Quadrature Encoder
    IntDefaultHandler,                      // ADC Sequence 0
    IntDefaultHandler,                      // ADC Sequence 1
    IntDefaultHandler,                      // ADC Sequence 2
    IntDefaultHandler,                      // ADC Sequence 3
    IntDefaultHandler,                      // Watchdog timer
    IntDefaultHandler,                      // Timer 0 subtimer A
    IntDefaultHandler,                      // Timer 0 subtimer B
    IntDefaultHandler,                      // Timer 1 subtimer A
    IntDefaultHandler,                      // Timer 1 subtimer B
    IntDefaultHandler,                      // Timer 2 subtimer A
    IntDefaultHandler,                      // Timer 2 subtimer B
    IntDefaultHandler,                      // Analog Comparator 0
    IntDefaultHandler,                      // Analog Comparator 1
    IntDefaultHandler,                      // Analog Comparator 2
    IntDefaultHandler,                      // System Control (PLL, OSC, BO)
    IntDefaultHandler,                      // FLASH Control
    IntDefaultHandler,                      // GPIO Port F
    IntDefaultHandler,                      // GPIO Port G
    IntDefaultHandler,                      // GPIO Port H
    IntDefaultHandler,                      // UART2 Rx and Tx
    IntDefaultHandler,                      // SSI1 Rx and Tx
    IntDefaultHandler,                      // Timer 3 subtimer A
    IntDefaultHandler,                      // Timer 3 subtimer B
    IntDefaultHandler,                      // I2C1 Master and Slave
    IntDefaultHandler,                      // Quadrature Encoder 1
    IntDefaultHandler,                      // CAN0
    IntDefaultHandler,                      // CAN1
    IntDefaultHandler,                      // CAN2
    IntDefaultHandler,                      // Ethernet
    IntDefaultHandler                       // Hibernate
};


 void  NmiSR(void)
{
    while(1)
    {
    }
}

 void   FaultISR(void)
{
    while(1)
    {
    }
}

void IntDefaultHandler(void)
{
    while(1)
    {
    }
}



-carm
-DROMSTART=00000000
-DROMEND=0003FFFF
-DRAMSTART=20000000
-DRAMEND=20000FFF

-Z(CODE)INTVEC=ROMSTART-ROMEND
-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND
-Z(CODE)SWITAB=ROMSTART-ROMEND
-Z(CODE)CODE=ROMSTART-ROMEND
-Z(CONST)CODE_ID=ROMSTART-ROMEND
-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND
-Z(CONST)CHECKSUM=ROMSTART-ROMEND


-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND
-Z(DATA)CODE_I=RAMSTART-RAMEND

-Z(DATA)VTABLE=RAMSTART-RAMEND

-QCODE_I=CODE_ID

-D_CSTACK_SIZE=100
// -D_SVC_STACK_SIZE=10
-D_IRQ_STACK_SIZE=100
-D_HEAP_SIZE=100

-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
// -Z(DATA)SVC_STACK+_SVC_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE,HEAP+_HEAP_SIZE=RAMSTART-RAMEND


 -Felf


相关帖子

沙发
hotpower| | 2008-2-24 02:01 | 只看该作者

startup.c+.xcl

__root static const uVectorEntry g_pfnVectors[] @ "INTVEC" =
{
    { .ulPtr = __sfe( "CSTACK" ) },
    __program_start,                        // The reset handler
//.......
};

使用特权

评论回复
板凳
ATmega32L|  楼主 | 2008-2-24 10:11 | 只看该作者

找不出哪里有错

#pragma language=extended
#pragma segment="CSTACK"
extern "C" void __program_start( void );
void NmiSR(void);
void FaultISR(void);
void IntDefaultHandler(void);

typedef union
{
    void (*pfnHandler)(void);
    unsigned long ulPtr;  
}
uVectorEntry;

__root static const  uVectorEntry g_pfnVectors[] @ "INTVEC" =
{
   { .ulPtr = (unsigned long) __segment_end("CSTACK") },
__program_start,                                          


-DROMSTART=00000000
-DROMEND=0003FFFF

-Z(CODE)INTVEC=ROMSTART-ROMEND

可是用IAR软件仿真显示g_pfnVectors[]在0x20000000

找不出哪里有问题。

使用特权

评论回复
地板
hotpower| | 2008-2-24 22:58 | 只看该作者

__segment_size???

使用特权

评论回复
5
ATmega32L|  楼主 | 2008-2-25 10:19 | 只看该作者

__segment_size("INTVEC") = 16

__segment_size("INTVEC") = 16

hotpower能否给个可以直接编译的实例(包括库文件和头文件,仿真用simlator,可以直接编译)

使用特权

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

本版积分规则

144

主题

376

帖子

0

粉丝