3656 views|8 replies

35

Posts

0

Resources
The OP
 

About the memory FRAM of msp430fr2000!! [Copy link]

When I was using MSP430FR2000, we chose it because of its small memory, low price and few pins, but now we have encountered the problem of its memory. When I was writing the program, I introduced the header file of ds1302, but the problem came with it. Because the fram of this microcontroller is only 0.5K. FRAM: origin = 0xFE00, length = 0x180 There are 2 address arrays in ds1302: static uchar READ_RTC_ADDR[7] = {0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d}; static uchar WRITE_RTC_ADDR[7] = {0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c}; As long as there are these two arrays in the program, the compilation will not pass. Tip: profram will not fit into available memory, placement with alignment fails for section "ALL_FRAM" size 0x376. I searched on Baidu, and the solution online seems to be to manually modify the length of FRAM in the CMD file. But I really don't know how to do it, and I'm a little confused. I also tried to put this global variable into the function to be used. It doesn't work either. I can't solve it. Please help me see if the compiler software is CCSV8.3


R]J4%`CUFR62)8WX7UY~14H.png (32.96 KB, downloads: 0)

R]J4%`CUFR62)8WX7UY~14H.png
This post is from Microcontroller MCU

Latest reply

There is a MAP file in the debug folder, which contains the allocation of various resources (such as variables, constants, etc.) after you compile. In it, you can check the starting address of resource usage and occupancy. You should first check which resource is out of range. You can back up a copy of the MAP file, then reduce the array depth or reduce a few variables and recompile. The newly generated MAP file can be compared with the previous one to quickly locate the problem. Then you need to check the datasheet to see if there are any extra resources available in the chip address allocation map, and modify it appropriately.  Details Published on 2019-3-5 22:18
 

6366

Posts

4936

Resources
2
 
Are these two arrays constants? If so, define them as constants so that they do not occupy RAM space.
This post is from Microcontroller MCU
 
 

1368

Posts

6

Resources
3
 
1) As mentioned above, if the RAM is too small and there is still space in the program space, you can define it as a constant array or macro definition (macro definition is also a form of constant) 2) Another way is to define it directly in the program, of course, this may not be very flexible for transplantation
This post is from Microcontroller MCU

Comments

I have already done this now void Ds1302ReadTime(void) { uchar n; // for (n=0; n  Details Published on 2019-3-2 17:22
 
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 
 

35

Posts

0

Resources
4
 
Lazy Cat Loves Flying Published on 2019-3-2 08:44 1) As mentioned above, if the RAM is too small and there is still space in the program space, it can be defined as a constant array or macro definition (macro definition is also a form of constant) ...
I have directly taken these two arrays of global variables into the function before, but it still didn't work. Method 2. Defined as a constant array, I changed it to const uchar READ_RTC_ADDR[7] = {0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d}; const uchar WRITE_RTC_ADDR[7] = {0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c}; Because these are 2 address arrays, read-only. I just want it not to take up so much space. But the compilation still reports an error. Method 3, macro definition method. I defined it like this: //#define READ_RTC_ADDR[0] 0x81 //#define READ_RTC_ADDR[1] 0x83 //#define READ_RTC_ADDR[2] 0x85 //#define READ_RTC_ADDR[3] 0x87 //#define READ_RTC_ADDR[4] 0x89 //#define READ_RTC_ADDR[5] 0x8b //#define READ_RTC_ADDR[6] 0x8d But it can't be used directly, because the parameters of the function using these two arrays are uchar, so the compilation can't pass. I'll try the macro definition method again and change the function.
This post is from Microcontroller MCU
 
 
 

35

Posts

0

Resources
5
 
tiankai001 posted on 2019-3-2 07:22 Are these two arrays constants? If so, define them as constants so that they do not occupy RAM space
Changed to const uchar READ_RTC_ADDR[7] = {0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d}; const uchar WRITE_RTC_ADDR[7] = {0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c}; The result still fails
This post is from Microcontroller MCU
 
 
 

35

Posts

0

Resources
6
 
Lazy Cat Loves Flying Published on 2019-3-2 08:44 1) As mentioned above, if the RAM is too small and there is still room in the program space, it can be defined as a constant array or macro definition (macro definition is also a form of constant) ...
I have already done this now void Ds1302ReadTime(void) { uchar n; // for (n=0; n<3; n++) // { // TIME[n] = Ds1302Read(READ_RTC_ADDR[n]); // } TIME[0] = Ds1302Read(0x81); TIME[1] = Ds1302Read(0x83); TIME[2] = Ds1302Read(0x85); } The array is not needed anymore, just write the address directly, it still doesn’t pass. . . .
This post is from Microcontroller MCU
 
 
 

35

Posts

0

Resources
7
 
The memory of this msp430fr2000 is too small. I have deleted these two arrays. I only keep a global variable called TIME[3] which must be used. Its FRAM still exceeds the length of 0x180 in CMD. I have optimized it to the extreme and can only keep the length of 0x2d7, but it still exceeds it. Another problem is that as long as the main function uses the functions in ds1302, the compilation will fail. And using different functions will also bring different FRAM lengths, which means that I can't have global variables and I can't use too many functions. I think no matter how old this chip is, it shouldn't be able to put even a global variable... Anyway, the main function cannot put the ds1302 function, because the function in ds1302 mentions TIME[3]. The more times the function is used, the larger the fram. The following are the functions that my three main functions need to use. void Ds1302_Init(void) { uchar n; Ds1302Write(0x8E,0X00); //Disable write protection, that is, turn off the write protection function if(Ds1302Read(0xc1) != 0xaa) { for (n=0; n<3; n++)//Write 7 bytes of clock signal: minute, second, hour, day, month, and year { Ds1302Write(0x80 + n*2,TIME[n]); } Ds1302Write(0xc0,0xaa); //Open the write protection function // Ds1302Write(0x8E,0x80); //Open the write protection function } } void important_Init(void) //This is used to reassign the register after modifying the time { uchar n; Ds1302Write(0x8E,0X00); //Disable write protection, that is, turn off the write protection function for (n=0; n<3; n++)//Write 7 bytes of clock signal: minute, second, hour, day, month, and year { Ds1302Write(0x80 +n*2,TIME[n]); } Ds1302Write(0x8E,0x80); //Open the write protection function } void Ds1302ReadTime(void) { uchar n; for (n=0; n<3; n++)//Read 7 bytes of clock signal: minute, second, hour, day, month, and year { TIME[n] = Ds1302Read(0x81 + n*2); } }


This post is from Microcontroller MCU
 
 
 

1295

Posts

0

Resources
8
 
This post was last edited by Daqinzhengsheng on 2019-3-3 09:06 By directly putting the data in the backup memory through the pointer, 32 bytes can be saved! I guess it can be solved.
This post is from Microcontroller MCU
 
 
 

2856

Posts

260

Resources
9
 
There is a MAP file in the debug folder, which contains the allocation of various resources (such as variables, constants, etc.) after you compile. In it, you can check the starting address of resource usage and occupancy. You should first check which resource is out of range. You can back up a copy of the MAP file, then reduce the array depth or reduce a few variables and recompile. The newly generated MAP file can be compared with the previous one to quickly locate the problem. Then you need to check the datasheet to see if there are any extra resources available in the chip address allocation map, and modify it appropriately.
This post is from Microcontroller MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list