MSP430F5438A RAM16KB 使用过程中,超过4K 编译0错误,0警告,下载到单片机,直接程序跑飞
以下是MAP
544 bytes of CODE memory
6 058 bytes of DATA memory (+ 4 absolute )
下载到单片机以后直接运行,调试按键全部失灵
DIsassembly
<unavailable when executing>
<unavailable when executing>
<unavailable when executing>
Susan Yang:
是不是有大数组之类的放在了RAM?看起来是超内存了
若是可以的话,可以附一下代码
user5707170:
回复 Susan Yang:
#include "driverlib.h"#include "stdlib.h" #include "string.h" #include "task.h"#include "MyGpio.h" #include "Timer.h"#include "Adc12.h" #include "myUcs.h" #include "485_uart.h" #include "SSD128X64.h"#include "RS232.h" #include "W25q.h" uint8_t Buffer[128]; uint8_t *Write ="Text 123456789"; static uint8_t Bufferer[3550] ={0};//******************************************************************************//!//! Empty Project that includes driverlib//!//******************************************************************************void main(void){
WDT_A_hold(WDT_A_BASE); //Stop watchdog timer#if 0 // 一系列的初始化操作 //系统主频初始化 MainFrequencyInit(); //Gpio操作 GpioInit(); //定时器 1ms初始化 TimerInit1ms(); //485初始化 PcUart_Init(); //232初始化 RS232_Init(); //ADC 初始化 ADC12Init(); //SPI 初始化 W25QXX_Init(); //8080 OLED屏幕的初始化 SSD128X64_Init(); //任务的初始化 Task_Init(); _EINT(); //使能全局中断 //读取Flash ID W25Q_Enable(); W25q_ReadId(); W25QXX_Write(Write,0x00,12); W25QXX_Read(Buffer,0x00,128);#endif
memcpy(Bufferer,0,3550); while(1);#if 0 while(1) { Task_Handle(); //任务处理函数 }#endif }
以上是我的代码,仅仅申请了一个数组不到16K的数组,也用咱们官方给的空程序例程,只申请一个数组,然后进行了拷贝操作,也是一样的问题
Susan Yang:
回复 user5707170:
您是使用下面的代码配合例程内的空工程测试的?我这边可以正常下载
#include <msp430.h>#include "stdint.h" #include "string.h"uint8_t Buffer[128]={0}; uint8_t *Write ="Text 123456789"; static uint8_t Bufferer[3550] ={0};/*** main.c*/ int main(void) {WDTCTL = WDTPW | WDTHOLD; // stop watchdog timermemcpy(Bufferer,0,3550);return 0; }
user5707170:
回复 Susan Yang:
/* –COPYRIGHT–,BSD * Copyright (c) 2017, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * –/COPYRIGHT–*/
#include "driverlib.h"#include "stdint.h"#include "string.h"//******************************************************************************//!//! Empty Project that includes driverlib//!//******************************************************************************uint8_t Buffer[10240] ;void main (void){ memcpy(Buffer,0,10240); while(1); }
以下是map 内容
108 bytes of CODE memory 10 400 bytes of DATA memory
那试下这个,刚才那个,我还有其他的地方定义了,数据 ,这个是咱们官方的,空程序,我直接申请内存 10k 我16KRAM 这个应该可以通过的
Susan Yang:
回复 user5707170:
是这样的,最大RAM大小为16k,因此最大传输大小为8k(使用memcpy时)
所以一般不建议在MSP430上使用memcpy
user5707170:
回复 Susan Yang:
/* –COPYRIGHT–,BSD * Copyright (c) 2017, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * –/COPYRIGHT–*/
#include "driverlib.h"#include "stdint.h"#include "string.h"//******************************************************************************//!//! Empty Project that includes driverlib//!//******************************************************************************uint8_t Buffer[10240] ;void main (void){ for(int i=0;i< 10240;i++) { Buffer[i ] =i; __delay_cycles(150); } // memcpy(Buffer,0,10240); while(1); }
for 循环也是不可以的,
我使用了开发板提供的例程 (Backup of MSP-EXP439F5438_User_Experoence-User Experience F5438)如下
//**********************************************************************//******// MSP-EXP430F5438 Experimenter's Board – User Experience Demo// D. Dang// Texas Instruments Inc.// Ver 1.00 – May 2008// Ver 1.10 – Jan 2009 // * Review, documentation of code // * Removal of code for production test // * Additional support for MSP430EXP5438 Rev 1.x // Ver 1.20 – Oct 2009// * Added support for F5438A (PMM & REF module)// * Added support for use of TLV Device ID and ADC calibration values// Built with Code Composer Studio v3.2//**********************************************************************//******
#include "MSP-EXP430F5438 HAL\hal_MSP-EXP430F5438.h"#include "stdint.h"#include "string.h"uint8_t Buffer[4096];void main(void){ WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer memcpy(Buffer,0,4096); UserExperience(); }
这个例程 用memcpy 是没有任何问题的, 说明不是这个函数的问题,
Susan Yang:
回复 user5707170:
函数是可以使用的,但是不要超过8K.
您之前直接申请内存 10k ,16KRAM是不够用的
user5707170:
回复 user5707170:
同样创建空工程:不调用库函数仅仅做如下操作,同样不通过,考虑IAR哪里设置的问题
/* –COPYRIGHT–,BSD* Copyright (c) 2017, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.* –/COPYRIGHT–*/
#include <MSP430.h>
#include "stdint.h"
#include "string.h"
//******************************************************************************
//!
//!Empty Project that includes driverlib
//!
//******************************************************************************
uint8_t Buffer[10240] ;
void main (void)
{for(int i=0;i< 10240;i++){Buffer[i ] =i;__delay_cycles(150);}// memcpy(Buffer,0,10240);while(1);
}
验证IAR工程设置问题
做如下操作//**********************************************************************//******
//MSP-EXP430F5438 Experimenter's Board – User Experience Demo
//D. Dang
//Texas Instruments Inc.
//Ver 1.00 – May 2008
//Ver 1.10 – Jan 2009
//* Review, documentation of code
//* Removal of code for production test
//* Additional support for MSP430EXP5438 Rev 1.x
//Ver 1.20 – Oct 2009
//* Added support for F5438A (PMM & REF module)
//* Added support for use of TLV Device ID and ADC calibration values
//Built with Code Composer Studio v3.2
//**********************************************************************//******
/* –COPYRIGHT–,BSD* Copyright (c) 2017, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.* –/COPYRIGHT–*/
#include <MSP430.h>
#include "stdint.h"
#include "string.h"
//******************************************************************************
//!
//!Empty Project that includes driverlib
//!
//******************************************************************************
uint8_t Buffer[10240] ;
void main (void)
{for(int i=0;i< 10240;i++){Buffer[i ] =i;}memcpy(Buffer,0,10240);while(1);
}#if0
#include "MSP-EXP430F5438 HAL\hal_MSP-EXP430F5438.h"
#include "stdint.h"
#include "string.h"
uint8_t Buffer[4096];
void main(void)
{WDTCTL = WDTPW+WDTHOLD;// Stop watchdog timermemcpy(Buffer,0,4096);UserExperience();
}
#endif
没有任何问题,
user5707170:
回复 Susan Yang:
对的,memcpy 我测试了下是 超过 5000字节拷贝就会失败, 现在是一个for 循环不用memcpy 函数,也是同样的问题,我把该文件拷贝到官方开发板例程里面了,没有任何问题,我在想是IAR 哪里设置的问题,但是就是找不出来在哪里
Susan Yang:
回复 user5707170:
我是IAR下也试了一下,在Buffer[10240]时编译没有错误,但是调试也是不能运行到memcpy(Buffer,0,10240);后面的while(1);
会一直卡在memcpy(Buffer,0,10240);
TI中文支持网



