• AVR Freaks

Hot!Error 1347 tripped by *removing* code

Author
sjb741
Super Member
  • Total Posts : 844
  • Reward points : 0
  • Joined: 2010/01/25 08:45:39
  • Location: 0
  • Status: offline
2020/11/27 03:22:37 (permalink)
4 (1)

Error 1347 tripped by *removing* code

XC8 2.20
 
I am trying to create a 'simple as possible' example to show the existence of the problem reported in this thread. However, whilst doing this, I encountered the problem in this thread's title.
error: (1347) can't find 0x1 words (0x1 withtotal) for psect "cstackCOMMON" in class "COMMON" (largest unused contiguous range 0x0)


I started by "commenting out" function calls, then compiling. Once I removed a certain function call, I encountered a linker error which is associated with insufficient RAM. At least I assume it's a RAM space issue, because it relates to the 'compiled stack'.
int main(void)
{
   SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP //#001
   //NOP(); //#002
   APP_KeyboardTasks(); //Lengthy function //#003
}//end main

If only #002 is enabled, it compiles OK.
If only #001 is enabled, I see the error above.
If I now add #002 or #003, it compiles OK.

Note that
   SYSTEM_Initialize( SYSTEM_STATE_USB_START );
is coded as just a NOP
void SYSTEM_Initialize( SYSTEM_STATE state )
{
   NOP();//For a breakpoint
}
   

 

The following compile OK
int main(void)
{
   //SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   //NOP();
   //APP_KeyboardTasks(); //Lengthy function
}//end main

-----------------------------------------------------------------------

int main(void)
{
   //SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   NOP();
   APP_KeyboardTasks(); //Lengthy function
}//end main

-----------------------------------------------------------------------

int main(void)
{
   SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   NOP();
   APP_KeyboardTasks(); //Lengthy function
}//end main

-----------------------------------------------------------------------

int main(void)
{
   //SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   //NOP();
   APP_KeyboardTasks(); //Lengthy function
}//end main

-----------------------------------------------------------------------

int main(void)
{
   SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   //NOP();
   APP_KeyboardTasks(); //Lengthy function
}//end main

 

The following fail with the error mentioned
 
int main(void)
{
   SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   //NOP();
   //APP_KeyboardTasks(); //Lengthy function
}//end main

-----------------------------------------------------------------------

int main(void)
{
   SYSTEM_Initialize( SYSTEM_STATE_USB_START ); //Just a NOP
   NOP();
   //APP_KeyboardTasks(); //Lengthy function
}//end main

 
From the compiler manual:
"error: (1347) can't find 0x1 words (0x1 withtotal) for psect "cstackCOMMON" in class "COMMON" (largest unused contiguous range 0x0)"

(1347) can’t find 0x* words (0x* withtotal) for psect “*” in segment “*” (largest unused contiguous range 0x
%lX) (Linker)
See also message (593). The new form of message also indicates the largest free block that the linker could find.
Unless there is a single space large enough to accommodate the psect, the linker will issue this message. Often
when there is banking or paging involved the largest free space is much smaller than the total amount of space
remaining.

(593) can’t find 0x* words (0x* withtotal) for psect “*” in segment “*” (Linker)
See message (491).

(491) This is lengthy, it offers advice tracking down the problem via the MAP file.
I found that the segment cstackCOMMON was missing from UNUSED ADDRESS RANGES.
#1

4 Replies Related Threads

    mad_c
    Super Member
    • Total Posts : 1271
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Error 1347 tripped by *removing* code 2020/11/29 13:32:19 (permalink)
    +1 (3)
    Hi,
     
    The error specifically relates to the use of common RAM, which is in short supply for a 16F device.
     
    If one part of a program is removed, the memory it was using might then be used by other parts of the program. The compiler should be able to manage the allocation of objects to common and banked memory, but without being able to compile your program, no one will be able to make any comment as to what you are seeing. Post a project that shows the error. Before doing that, though, you might want to try the latest compiler version.
     
    Jeff.
    #2
    sjb741
    Super Member
    • Total Posts : 844
    • Reward points : 0
    • Joined: 2010/01/25 08:45:39
    • Location: 0
    • Status: offline
    Re: Error 1347 tripped by *removing* code 2020/12/02 09:02:37 (permalink)
    +1 (1)
    Thank you Jeff
     
    Error 1347 still happens in the same circumstances under XC8 2.31
     
    Project is attached
     
    Regards
    Stephen
    #3
    mad_c
    Super Member
    • Total Posts : 1271
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Error 1347 tripped by *removing* code 2020/12/02 14:20:09 (permalink)
    +1 (1)
    Hi,
     
    This looks like a compiler issue, but it is also something that will go away once you start fleshing out the program.
     
    It seems to be related to the state parameter in SYSTEM_Initialize(). It looks like at one point, the compiler decided that the parameter did not need space allocated for it, since it was unused, and the common memory was then fully allocated for other objects. Then at a later point, something allocated space for it anyway, and since it was originally earmarked for common memory, that's where an attempt was made to locate it.
     
    As soon as you use state, the problem goes away, so for example have SYSTEM_Initialize() use if(state)  NOP(); for example. Send in a support ticket, as this should be investigated further. Thanks.
     
    Jeff.
    #4
    sjb741
    Super Member
    • Total Posts : 844
    • Reward points : 0
    • Joined: 2010/01/25 08:45:39
    • Location: 0
    • Status: offline
    Re: Error 1347 tripped by *removing* code 2020/12/03 02:33:43 (permalink)
    0
    OK: Great.
     
    I'm glad it was a genuine issue - I've put a ticket together (00599429)

    post edited by sjb741 - 2020/12/03 02:51:11
    #5
    Jump to:
    © 2021 APG vNext Commercial Version 4.5