我正在尝试使用HT-IDE3000编写一个中断例程,但是当我在例程中编写一些代码时,链接器会发出有关RAM bank0溢出的错误。我正在使用Holtek C编译器V3并且用户指南说中断向量定义必须是void __attribute((interrupt(0x24))) TIM0_ISR(){}
而不是旧版本#pragma vector TIM_ISR @0x24
然后它说“中断服务程序可以访问的变量和其他函数定义为volatile“在Holtek C编译器V3用户指南的第34页,我的代码是;
#include "HT67F50.h"
typedef struct
{
/*volatile*/ uint8_t time2msflag:1;
/*volatile*/ uint8_t t500msflag:1;
/*volatile*/ uint8_t t1sflag:1;
/*volatile*/ uint8_t poweronflag:1;
const /*volatile*/ uint8_t reserved:4;
}Flag_t;
volatile uint8_t time2ms;
volatile uint8_t t500ms;
volatile uint8_t t1s;
volatile uint16_t time1s_dis;
volatile Flag_t flag;
void __attribute((interrupt(0x24))) TIM_ISR(void)
{
//_t0af = 0;
//if (++time2ms >= 2)
//{
//time2ms = 0;
//flag.time2msflag = 1;
//if (flag.poweronflag)
//{
//if (++time1s_dis >= 1000) // power on and all pixels illuminated for 2s
//{
//time1s_dis = 0;
//flag.poweronflag = 0;
//}
//}
//else
//{
//if (++t500ms >= 250)
//{
//t500ms = 0;
//flag.t500msflag = ~(flag.t500msflag); // second flash
//if (++t1s >= 2)
//{
//t1s = 0;
//flag.t1sflag = 1;
//}
//}
//}
//}
}
当我取消注释链接器的输出为
时Holtek (R) Cross C Compiler Version V3.4
Compiling D:\x-yedek\calismalar\holtek\termo\termo\driver\lcd_config.c ...
Holtek (R) Cross-Assembler Version HGASM0202
Copyright (C) 2002 Holtek Semiconductor INC. All rights reserved.
D:\x-yedek\calismalar\holtek\termo\termo\lcd_config.ASM
0 Errors, 0 Warnings
Linking...
Error(L1038) : RAM bank0 overflow, memory allocation fails for section '_rfmSendAck' (size 09H) in the file 'D:\x-yedek\calismalar\holtek\termo\termo\RFM69HC.OBJ'
Unallocated DATA Section List:
Class Length Name
DATA 0 [0h] _adcMainConfig
DATA 0 [0h] _adcChipInit
DATA 0 [0h] _adcCalibration
DATA 0 [0h] _adcRead
DATA 9 [9h] _portInputInit
DATA 4 [4h] _setPins
DATA 4 [4h] _resetPins
DATA 2 [2h] _getPins
DATA 5 [5h] _togglePin
DATA 1 [1h] _setPortAWakeUp
DATA 1 [1h] _setPotyAWakeUpMulti
DATA 1 [1h] _resetPortAWakeUp
DATA 1 [1h] _resetPotyAWakeUpMulti
DATA 3 [3h] _spiInit
DATA 7 [7h] _spiReadMulti
DATA 5 [5h] _rfmInit
DATA 1 [1h] _rfmSetAddress
DATA 1 [1h] _rfmNetworkAddress
DATA 7 [7h] _rfmSendData
DATA 9 [9h] _rfmSendAck
DATA 0 [0h] _rfmSetHighestPower
DATA 5 [5h] _encryption
DATA 0 [0h] _builtin_holtek_dtnorm
DATA 0 [0h] _builtin_holtek_dtinf
Total 1 error(s), Total 0 Warning(s)
'termo' - Total 1 error(s), 0 warning(s)
答案 0 :(得分:0)
我已经通过在ram bank0中创建常用的变量来解决它,在0x80h和0xFFh之间添加一个ram bank0地址定义并更改变量创建行;
{{1}}