11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Error and Warning Messages(492) can’t find * words for psect "*" in segment "*" (Linker)One of the main tasks the linker performs is positioning the blocks (or psects) of code and data that isgenerated from the program into the memory available for the target device. This error indicates thatthe linker was unable to find an area of free memory large enough to accomodate one of the psects.The error message indicates the name of the psect that the linker was attempting to position and thesegment name which is typically the name of a class which is defined with a linker -A option.Section 3.9.1 lists each compiler-generated psect and what it contains. Typically psect nameswhich are, or include, text relate to program code. Names such as bss or data refer to variableblocks. This error can be due to two reasons.First, the size of the program or the progam’s data has exceeded the total amount of space on theselected device. In other words, some part of your device’s memory has completely filled. If this isthe case, then the size of the specified psect must be reduced.The second cause of this message is when the total amount of memory needed by the psect beingpositioned is sufficient, but that this memory is fragmented in such a way that the largest contiguousblock is too small to accomodate the psect. The linker is unable to split psects in this situation. Thatis, the linker cannot place part of a psect at one location and part somewhere else. Thus, the linkermust be able to find a contiguous block of memory large enough for every psect. If this is the causeof the error, then the psect must be split into smaller psects if possible.To find out what memory is still available, generate and look in the map file, see Section 2.4.9 forinformation on how to generate a map file. Search for the string UNUSED ADDRESS RANGES. Underthis heading, look for the name of the segment specified in the error message. If the name is notpresent, then all the memory available for this psect has been allocated. If it is present, there will beone address range specified under this segment for each free block of memory. Determine the sizeof each block and compare this with the number of words specified in the error message.Psects containing code can be reduced by using all the compiler’s optimizations, or restructringthe program. If a code psect must be split into two or more small psects, this requies splitting afunction into two or more smaller functions (which may call each other). These functions may needto be placed in new modules.Psects containing data may be reduced when invoking the compiler optimizations, but the effectis less dramatic. The program may need to be rewritten so that it needs less variables. Section5.9.1 has information on interpreting the map file’s call graph if the compiler you are using usesa compiled stack. (If the string Call grpah: is not present in the map file, then the compiledcode uses a hardware stack.) If a data psect needs to be split into smaller psects, the definitionsfor variables will need to be moved to new modules or more evenly spread in the existing modules.Memory allocation for auto variables is entirely handled by the compiler. Other than reducing thenumber of these variables used, the programmer has little control over their operation. This applieswhether the compiled code uses a hardware or compiled stack.For example, after receiving the message:291

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!