黄金会员
主题
帖子
积分7443
阅读权限40
注册时间2008-11-16
最后登录1970-1-1
在线时间 小时
|
原GandF公布的是用ICCAVR6.31编译的,我已经可以编译了,但是空间已经用尽,我想将代码移植到M328上用,刚好ICCAVR6.31又不支持,
下了个ICCAVR7.22是支持的,但是编译不过。
我用ICCAVR6.31新建了一个工程,代码很简单如下,只抄了一个含有汇编代码的函数,可以编译通过。但在7.22会出现undefined symbol 'push_gset1'错误如下:
ERROR file 'main.o': undefined symbol 'push_gset1'
!ERROR file 'mymath.o': undefined symbol 'push_gset2'
!ERROR file 'main.o': undefined symbol 'pop_gset1'
!ERROR file 'mymath.o': undefined symbol 'pop_gset2'
问题出在汇编代码的第一行和最后一行:
asm("rcall push_gset1");
asm("rcall pop_gset1");
另外2个rcall的mul32z和div32to16定义可以在mymath.c找到
asm("rcall _mul32z");
asm("rcall _div32to16");
请问这个问题如何解决?- #include "main.h"
- // ADCset = (1024 * uiV) / uiK ,
- unsigned int cal_ADC(unsigned int Vset,unsigned int K)
- {
- // uiR = div32to16(mul32z(V,1000),I);
- asm("rcall push_gset1");
- asm("movw R20,R18");
- asm("ldi R18,1024");
- asm("ldi R19,1024/256");
- asm("rcall _mul32z");
- asm("std y+1,R21");
- asm("std y+0,R20");
- asm("rcall _div32to16");
- asm("rcall pop_gset1");
- }
- // 主程序
- void main(void)
- {
- CLI(); // disable all interrupts
- // 初始化
- DDRB = 0b00000110; // PB0(PWM_LOW),PB1(PWM),PB2(1KHz),PB3-5(KEYA B C)
- PORTB = 0b00111000; //
- DDRC = 0b00010000; // ADC4 BELL
- PORTC = 0b00000000; //
- DDRD = 0b11111110; // PD0 RxD,PD1 TxD,PD2-7 LCD
- PORTD = 0b00000000; //
- key_loop = KEYLOCKSET; // 锁定增减
- cal_ADC(1,2);
- } // *** main() end ***
复制代码 |
|