目前代码如下定义
void SysTick_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
vs32 counter;
void SYSTICK_Init_Config(u64 ticks)
{
SysTick->CTLR = 0x00000000; //控制寄存器复位
SysTick->SR = 0x00000000; //状态寄存器复位
SysTick->CNT = 0x00000000; //计数器复位,设置初始值为0
SysTick->CMP = ticks; //给重加载寄存器赋值
NVIC_SetPriority(SysTicK_IRQn, 15); //设置SysTick中断优先级
NVIC_EnableIRQ(SysTicK_IRQn); //使能开启Systick中断
SysTick->CTLR |= 0x0000000F; //启动系统计数器STK(HCLK/8时基)
}
void SysTick_Handler(void)
{
SysTick->SR = 0;
counter ++;
}
void main(){
.......省略其他
SYSTICK_Init_Config((SystemCoreClock)/144000);
}
while(1){
printf("%d\r\n",counter);
}
1.发现定义为vs32 counter正常输出值 定义vs64 counter输出值就异常了
// int64_t arm_2d_helper_get_system_timestamp(void)
u64 get_system_timestamp(void)
{
u64 ticks = counter;
//printf("qixin %d %d\r\n",ticks,counter);
return ticks;
}
// uint32_t arm_2d_helper_get_reference_clock_frequency(void)
uint32_t get_reference_clock_frequency(void)
{
return SystemCoreClock;
}