PIC Vietnam

PIC Vietnam (http://www.picvietnam.com/forum/index.php)
-   Lỗi lập trình ngôn ngữ cấp cao (http://www.picvietnam.com/forum/forumdisplay.php?f=65)
-   -   lỗi ccsc v4.033 khi viết chương trình lớn hơn 50% rom (http://www.picvietnam.com/forum/showthread.php?t=6784)

tdm 04-08-2010 10:46 AM

lỗi ccsc v4.033 khi viết chương trình lớn hơn 50% rom
 
1 Attachment(s)
mình dùng ccsc v4.033 khi dịch nếu chương trình nhỏ hơn 50% rom thì OK.
lớn hơn 50% rom thì nó báo lỗi.có cách nào khắc phục không ,nhờ các bạn chỉ giúp cho.

lybao_huy 04-08-2010 11:21 AM

Vấn đề này là do trong 1 hàm nào đó của bạn chứa qua nhiều code, nhưng nếu bạn tách các đoạn code trong hàm ra làm nhiều hàm nhỏ hơn, sau đó gọi nó thì ok, còn không là bị lỗi. Bạn coi trong Errors Messages trong Help của CCS.
**Out of ROM, A segment or the program is too large

A function and all of the INLINE functions it calls must fit into one segment (a hardware code page). For example, on the PIC16 chip a code page is 512 instructions. If a program has only one function and that function is 600 instructions long, you will get this error even though the chip has plenty of ROM left. The function needs to be split into at least two smaller functions. Even after this is done, this error may occur since the new function may be only called once and the linker might automatically INLINE it. This is easily determined by reviewing the call tree. If this error is caused by too many functions being automatically INLINED by the linker, simply add a #SEPARATE before a function to force the function to be SEPARATE. Separate functions can be allocated on any page that has room. The best way to understand the cause of this error is to review the call tree.

tdm 04-08-2010 12:04 PM

Trích:

Nguyên văn bởi lybao_huy (Post 37762)
Vấn đề này là do trong 1 hàm nào đó của bạn chứa qua nhiều code, nhưng nếu bạn tách các đoạn code trong hàm ra làm nhiều hàm nhỏ hơn, sau đó gọi nó thì ok, còn không là bị lỗi. Bạn coi trong Errors Messages trong Help của CCS.
**Out of ROM, A segment or the program is too large

A function and all of the INLINE functions it calls must fit into one segment (a hardware code page). For example, on the PIC16 chip a code page is 512 instructions. If a program has only one function and that function is 600 instructions long, you will get this error even though the chip has plenty of ROM left. The function needs to be split into at least two smaller functions. Even after this is done, this error may occur since the new function may be only called once and the linker might automatically INLINE it. This is easily determined by reviewing the call tree. If this error is caused by too many functions being automatically INLINED by the linker, simply add a #SEPARATE before a function to force the function to be SEPARATE. Separate functions can be allocated on any page that has room. The best way to understand the cause of this error is to review the call tree.

cảm ơn bạn. mình sẽ thử lại.

tdm 04-08-2010 01:41 PM

Trích:

Nguyên văn bởi lybao_huy (Post 37762)
Vấn đề này là do trong 1 hàm nào đó của bạn chứa qua nhiều code, nhưng nếu bạn tách các đoạn code trong hàm ra làm nhiều hàm nhỏ hơn, sau đó gọi nó thì ok, còn không là bị lỗi. Bạn coi trong Errors Messages trong Help của CCS.
**Out of ROM, A segment or the program is too large

A function and all of the INLINE functions it calls must fit into one segment (a hardware code page). For example, on the PIC16 chip a code page is 512 instructions. If a program has only one function and that function is 600 instructions long, you will get this error even though the chip has plenty of ROM left. The function needs to be split into at least two smaller functions. Even after this is done, this error may occur since the new function may be only called once and the linker might automatically INLINE it. This is easily determined by reviewing the call tree. If this error is caused by too many functions being automatically INLINED by the linker, simply add a #SEPARATE before a function to force the function to be SEPARATE. Separate functions can be allocated on any page that has room. The best way to understand the cause of this error is to review the call tree.

lỗi nó ở chỗ này:
while(1)
{
if(a==0)
{
}
else if(a==1)
{
tại đây mình viết quá nhiều code
}
else
{
}
}

quangdiemhp 10-03-2013 11:35 PM

Sao của mình nó cũng cứ báo out of rom ở cái đoạn chương trình con này nhỉ
void read_rom()
{
k=read_eeprom(4);
for (j=0;j<k;j++){
e=e*10;
e=e+read_eeprom(j);}
}
//int16 e; trong CSS
//Mình lưu e0 vào vị trí 1, e1 vào vị trí 2, ....e3 vào vị trí 3, còn vị trí 4 lưu giá trị của i (tức là số có 4 chữ số). Cái hàm k=read_eeprom(4); là đọc giá trị của i (i=4).=> tính ra số e để gán trở lại giá trị value duty cho pwn.


Múi giờ GMT. Hiện tại là 02:54 AM.

Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam