完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
原子哥,新人。编译出现错误,怎么办,找了好久都没找到原因。
..OutputSTM32-DEMO.axf: Error: L6218E: Undefined symbol err (referred from gsm.o). 未定义的符号错误。。。。。怎么办。。。。 gsm.c源码如下: #include "stm32f10x.h" #include #include #include //#include "stm32f10x_lib.h" #include "gsm.h" #include "usart1.h" #include "usart3.h" #include "Gsmtime.h" /*----------------------------------------------------------------------- -----------------------------------------------------------------------*/ int num_of_sms; #define SMS_CMD_LEN 64 char at_readsms[SMS_CMD_LEN]; char tpy_sms_content[SMS_CMD_LEN]; char tpy_send_tel_num[SMS_CMD_LEN]; char tp_content[BUFLEN]; unsigned char is_gprs_mode_ok = 1; //gprs start succeed unsigned char is_gprs_mode_start_succeed = 0; //gprs connect ok SIM300_STATUS current_status = INIT0; //REG #define ATE0_CMD "ATE0x00Dx00A" /// ???????? #define CREG_CMD "AT+CREG?x00Dx00A" /// ?é??????×??á?é?? #define SIMCARD_CMD "AT+CPIN?x00Dx00A" //SEND SMS #define GSM_MSG_MODE "AT+CMGF=1x00Dx00A" #define GSM_MSG_MODE_CN "AT+CMGF=0x00Dx00A" //#define GSM_CENTER_NUM "AT+CSCA="+8613800512500"x00Dx00A" #define GSM_CHAR_MODE "AT+CSCS="GSM"x00Dx00A" #define GSM_CHAR_MODE_CN "AT+CMEE=0x00Dx00A" #define GSM_SEND_TEXT "AT+CMGS="+8613512963352"x00Dx00A" /*----------------------------------------------------------------------- -----------------------------------------------------------------------*/ //static void S_INIT0() //?????????? ·?????±????? { PUT("S_INIT0 rn"); // printf("S_INIT0rn"); clear_buf_uart3(); send_string_uart3(ATE0_CMD); current_status = ECHO0 ; } //static void S_ECHO0() //??±????????? ·???SIM?¨?ì?? { if(buf_uart3.buf[2] == 'O' && buf_uart3.buf[3] == 'K') { PUT("ECHO0 OK rn"); // printf("ECHOO OKrn"); delay_GSM(5000); is_gprs_mode_start_succeed = 1; //???÷GPRS???é???? clear_buf_uart3(); current_status = SIMCARD ; send_string_uart3(SIMCARD_CMD); }else{ PUT(buf_uart3.buf); PUT("ECHO0 ERR rn"); clear_buf_uart3(); send_string_uart3(ATE0_CMD); } } /*----------------------------------------------------------------------- -----------------------------------------------------------------------*/ //static void S_SIMCARD() //SIM?¨?ì?????? ·????????é?? { char *t = NULL ; PUT(buf_uart3.buf); t = strstr((const char*)buf_uart3.buf,"OK"); if(t) { PUT("SIMCARD OK rn"); delay_GSM(5000); clear_buf_uart3(); current_status = CREG ; send_string_uart3(CREG_CMD); }else{ PUT(buf_uart3.buf); PUT("SIMCARD ERR rn"); clear_buf_uart3(); send_string_uart3(SIMCARD_CMD); } } /*----------------------------------------------------------------------- -----------------------------------------------------------------------*/ //static void S_CREG() { if(((buf_uart3.buf[9]=='0')&& (buf_uart3.buf[11]=='1'))|| ((buf_uart3.buf[9]=='0')&& (buf_uart3.buf[11]=='5'))) { PUT("S_REG OK rn"); current_status = INIT_FINISH_OK; }else{ PUT(buf_uart3.buf); PUT("S_REG ERR rn"); debug_put_word(buf_uart3.buf[9]); debug_put_word(buf_uart3.buf[11]); send_string_uart1("rn"); clear_buf_uart3(); current_status = CREG ; send_string_uart3(CREG_CMD); } } void init_gprs_mode(void) { PUT("start init GSM modern"); while(1) { err ++; if(err > MAX_ERROR_COUNT) //error { err = 0 ; is_gprs_mode_ok = 0; PUT("GPRS MODE REGISTER [NO]"); break; } #if 0 if(is_gprs_mode_start_succeed) { PUT("GPRS MODE REGISTER [OK]"); } #endif delay_GSM(5000); switch(current_status) { case INIT0: S_INIT0(); //ATE0 break ; case ECHO0: S_ECHO0(); //SIMCARD break ; case SIMCARD: S_SIMCARD(); //REG break ; case CREG: S_CREG(); //FINISH break ; case INIT_FINISH_OK: return ; default: clear_buf_uart3(); break ; } } } //static void S_GSM_MSG_MODE_S() { PUT("S_GSM_MSG_MODE_S OK rn"); clear_buf_uart3(); current_status = GSM_MSG_MODE_S ; //?¨??PDP???????° send_string_uart3(GSM_MSG_MODE); } //static void S_GSM_CHAR_MODE_S() { if((buf_uart3.buf[2]=='O')&&(buf_uart3.buf[3]=='K')) { PUT("S_GSM_CHAR_MODE_S OK rn"); clear_buf_uart3(); current_status = GSM_CHAR_MODE_S; send_string_uart3(GSM_CHAR_MODE); } else { PUT("S_GSM_CHAR_MODE_S NO rn"); clear_buf_uart3(); send_string_uart3(GSM_MSG_MODE); } } //static void S_GSM_CHAR_MODE_RET_S() { if((buf_uart3.buf[2]=='O')&&(buf_uart3.buf[3]=='K')) { PUT("S_GSM_CHAR_MODE_RET_S OK rn"); clear_buf_uart3(); current_status = GSM_TEXT_MODE_FINISH; } else { PUT("S_GSM_CHAR_MODE_RET_S NO rn"); clear_buf_uart3(); send_string_uart3(GSM_CHAR_MODE); } } //static void init_sms_to_send() { current_status = GSM_SEND_TEXT_S; while(1) { err ++; if(err>MAX_ERROR_COUNT) { err = 0 ; break; } delay_GSM(1000); switch(current_status) { case GSM_SEND_TEXT_S: S_GSM_MSG_MODE_S(); break ; case GSM_MSG_MODE_S: S_GSM_CHAR_MODE_S(); break ; case GSM_CHAR_MODE_S: S_GSM_CHAR_MODE_RET_S(); break ; case GSM_TEXT_MODE_FINISH: return ; default: clear_buf_uart3(); break ; } } } void send_gsm_text(unsigned char * buf , unsigned int count) { unsigned int i ; char send_sms_cmd_num[SMS_CMD_LEN]; memset((void*)send_sms_cmd_num,0,SMS_CMD_LEN); init_sms_to_send(); //·??????°???????? if(current_status != GSM_TEXT_MODE_FINISH) return ; sprintf(send_sms_cmd_num,"AT+CMGS="+86%s"x00Dx00A",TELNUM); PUT(send_sms_cmd_num); send_string_uart3(send_sms_cmd_num); delay_GSM(100); for( i = 0 ;i < count ; i ++) { for ( i = 0 ; i < strlen((const char*)buf) ; i ++) { send_data_uart3(buf); } } delay_GSM(100); send_data_uart3(0X1A); delay_GSM(10000); PUT("SEND TEXTrn"); } unsigned char is_gprs_mode_status_ok(void) { return is_gprs_mode_ok; } |
|
相关推荐
1个回答
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2550 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2335 浏览 5 评论
3166 浏览 3 评论
2807 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2768 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
622浏览 1评论
863浏览 0评论
981浏览 0评论
633浏览 0评论
458浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 11:33 , Processed in 0.911907 second(s), Total 44, Slave 38 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号