OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3568|回复: 1

sim800c远程下载程序项目

[复制链接]

21

主题

34

帖子

0

精华

初级会员

Rank: 2

积分
87
金钱
87
注册时间
2017-9-27
在线时间
30 小时
发表于 2018-9-26 09:07:59 | 显示全部楼层 |阅读模式
1金钱
前辈好,
无线下载项目用的是stm32战舰板子,
由于战舰板子的ram只够建立5万字节的数组,但实际要存放到数组里的代码数据要大于5万,
导致小代码可以成功远程升级,
而大代码数组存不下而无法升级,

所以我想采用一遍通过sim800c接收数据,
一遍往flash里面写代码的方法解决ram数组太小的问题,
但是现在没有边收边写代码的思路,

所以请前辈们帮忙提供些边下边写的编程思路,
或者其他思路,
非常感谢!

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

117

主题

598

帖子

1

精华

资深版主

Rank: 8Rank: 8

积分
1702
金钱
1702
注册时间
2012-5-10
在线时间
439 小时
发表于 2018-9-26 11:53:35 | 显示全部楼层
[mw_shl_code=c,true]MyRes CommunicateWithNcdServerInGPRS(HttpBuf * httpBuf)
{
        //??????
        xQueueReset(GetUsart5TXQueue());
               
        //????
        httpBuf->tempInt = httpBuf->sendDataLen;
        while(httpBuf->tempInt > 800)
        {
                if(My_Pass == SendDataToQueue(GetUsart5TXQueue(), NULL, httpBuf->sendBuf + (httpBuf->sendDataLen - httpBuf->tempInt),
                        800, 1, 1000 / portTICK_RATE_MS, 10 / portTICK_RATE_MS, EnableUsart5TXInterrupt))
                {
                        httpBuf->tempInt -= 800;
                        vTaskDelay(100 / portTICK_RATE_MS);
                }
                else
                        goto END;
        }
               
        if(httpBuf->tempInt > 0)
        {
                if(My_Pass != SendDataToQueue(GetUsart5TXQueue(), NULL, httpBuf->sendBuf + (httpBuf->sendDataLen - httpBuf->tempInt),
                        httpBuf->tempInt, 1, 1000 / portTICK_RATE_MS, 10 / portTICK_RATE_MS, EnableUsart5TXInterrupt))
                        goto END;
        }
               
        //????,????1s
        httpBuf->tempShort = 0;
        httpBuf->recvDataLen = 0;
        httpBuf->j = 0;
        memset(httpBuf->recvBuf, 0, HttpRecvBufSize);
        while(pdPASS == ReceiveDataFromQueue(GetUsart5RXQueue(), NULL, httpBuf->recvBuf, HttpRecvBufSize,
                &httpBuf->tempShort, 1, 20000 / portTICK_RATE_MS, 1000 / portTICK_RATE_MS, 2000 / portTICK_RATE_MS))
        {
                if(httpBuf->isPost)
                {
                        httpBuf->recvDataLen += httpBuf->tempShort;
                        break;
                }
               
                //??????GET??,????????,????
                else
                {
                        //????????
                        if(httpBuf->j < 2)
                        {
                                httpBuf->tempP = strstr(httpBuf->recvBuf, fileLengthParmString);
                                if(httpBuf->tempP)
                                {
                                        httpBuf->fileLength = strtol(httpBuf->tempP+fileLengthParmStringLen, NULL, 10);
                                        httpBuf->fileLength -= fileStartStrLen;
                                        httpBuf->j++;
                                }
                               
                                //?????
                                httpBuf->tempP = strstr(httpBuf->recvBuf, fileStartStr);
                                if(httpBuf->tempP)
                                {
                                        httpBuf->tempInt = httpBuf->tempP - httpBuf->recvBuf + fileStartStrLen;
                                        httpBuf->tempShort -= httpBuf->tempInt;
                                        WriteAppFile(httpBuf->recvBuf + httpBuf->tempInt, httpBuf->tempShort, true);
                                        httpBuf->recvDataLen += httpBuf->tempShort;
                                        httpBuf->j++;
                                }
                        }
                        else
                        {
                                WriteAppFile(httpBuf->recvBuf, httpBuf->tempShort, false);
                                httpBuf->recvDataLen += httpBuf->tempShort;
                               
                                if(httpBuf->recvDataLen >= httpBuf->fileLength)
                                        break;
                        }
                }
        }
               
        END:
                if(httpBuf->isPost)
                {
                        httpBuf->tempP = strstr(httpBuf->recvBuf, "success");
                        if(httpBuf->tempP)
                                return My_Pass;
                }
       
                return My_Fail;
}[/mw_shl_code]
如有技术问题,微信扫头像交流,STM32,JAVA,服务器
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-8 04:40

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表