CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

function too big for a ROM page

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Daniel1956



Joined: 31 Jan 2019
Posts: 7
Location: Quebec

View user's profile Send private message Send e-mail

function too big for a ROM page
PostPosted: Mon Mar 25, 2019 10:06 pm     Reply with quote

Hi!
I use a PIC16F1789 with the CCS 5.081 compiler.
in a Windows 10.
I have a big function that I can not compile because the compiler informs me that it is very big to be in a page of the ROM.
This is message:

D:\Bobinneuse\Firmware\bobineuse_V1-21.c:346:1: Error#71 Out of ROM, A segment or the program is too large parametre_bobinage
Seg 01000-017FF, 075B left, need 00949
Seg 01800-01FFF, 0800 left, need 00949
Seg 02000-027FF, 0800 left, need 00949
Seg 02800-02FFF, 0800 left, need 00949
Seg 03000-0339B, 039C left, need 00949
Seg 0339C-037FF, 0000 left, need 00949 Reserved
Seg 03800-03AC1, 02C2 left, need 00949
Seg 03AC2-03FFF, 0000 left, need 00949 Reserved
Seg 00000-00002, 0000 left, need 00949 Reserved
Seg 00003-00003, 0001 left, need 00949
Seg 00004-0003D, 0000 left, need 00949 Reserved
Seg 0003E-007FF, 0006 left, need 00949
Seg 00800-00FFF, 0045 left, need 00949

I know there is the solution to do two smaller functions to do the job but I wonder if there is another solution to this problem?

This is fonction:

int * parametre_bobinage(long *longeur_maximum, int *num_tab_min, int *position_max, short model, short fil, long requis)
{
switch(model)
{
case 1:
if(fil==16)
{
*longeur_maximum = BOBINE_1_16;
*num_tab_min = tableau_16[1];
*position_max = *tableau_16[tableau_16[6]];
return &tableau_16[tableau_16[1]];
}
else
{
*longeur_maximum = BOBINE_1_8;
*num_tab_min = tableau_5[1];
*position_max = *tableau_5[tableau_5[6]];
return &tableau_5[tableau_5[1]];
break;
}
break;

case 2:
if(fil==16)
{
*longeur_maximum = BOBINE_2_16;
*num_tab_min = tableau_16[2];
*position_max = tableau_16[tableau_16[7]];
return &tableau_16[tableau_16[2]];
}
else
{
*longeur_maximum = BOBINE_2_8;
*num_tab_min = tableau_5[2];
*position_max = *tableau_5[tableau_5[7]];
return &tableau_5[tableau_5[2]];
}
break;

case 3:
if(fil==16)
{
*longeur_maximum = BOBINE_3_16;
*num_tab_min = tableau_16[3];
*position_max = tableau_16[tableau_16[8]];
return &tableau_16[tableau_16[3]];
}
else
{
*longeur_maximum = BOBINE_3_8;
*num_tab_min = tableau_5[3];
*position_max = tableau_5[tableau_5[8]];
return &tableau_5[tableau_5[3]];
}
break;

case 4:
if(fil==16)
{
*longeur_maximum = BOBINE_4_16;
*num_tab_min = tableau_16[4];
*position_max = tableau_16[tableau_16[9]];
return &tableau_16[tableau_16[4]];
}
else
{
*longeur_maximum = BOBINE_4_8;
*num_tab_min = tableau_5[4];
*position_max = tableau_5[tableau_5[9]];
return &tableau_5[tableau_5[4]];
}
break;

case 5 || 0:
if(fil==16)
{
*longeur_maximum = BOBINE_5_16;
*num_tab_min = tableau_16[5];
*position_max = tableau_16[tableau_16[10]];
return &tableau_16[tableau_16[5]];
}
else
{
*longeur_maximum = BOBINE_5_8;
*num_tab_min = tableau_5[5];
*position_max = tableau_5[tableau_5[10]];
return &tableau_5[tableau_5[2]];
}
break;

case 6:
if(fil==16)
{
*longeur_maximum = BOBINE_5_16;
*num_tab_min = tableau_16[11];
*position_max = tableau_16[tableau_16[16]];
return &tableau_16[tableau_16[11]];
}
else
{
*longeur_maximum = BOBINE_5_8;
*num_tab_min = tableau_5[11];
*position_max = tableau_5[tableau_5[16]];
return &tableau_5[tableau_5[11]];
}
break;
}
if (*longeur_maximum >= requis)
{
SET_TIMER1(0); // LONGEUR_BOBINE = 0
}
else
{
bobine_requise(requis, *longeur_maximum, model);
key = 1;
}
aff_enroule(requis);
}

Regard,
Daniel


Last edited by Daniel1956 on Tue Mar 26, 2019 7:45 pm; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Tue Mar 26, 2019 2:51 am     Reply with quote

No.
Splitting is the only solution.
Generally is is better to always keep code into small parts. This allows them
to be split but also allows the compiler to optimise better. Packing smaller
bits into different patterns that better fit into the memory pages. Splitting
also allows RAM allocation to be improved as memory can be re-used between
functions.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group