Frequently Asked Questions

Why do I get an OUT OF ROM error when there seems to be ROM left?

The OUT OF ROM error can occur when a function will not fit into a segment. A function and all of its inline functions must fit into one hardware page. Sometimes decisions are made automatically by the linker. This will cause too many functions to be INLINE for a function to fit into a segment. To correct the problem, the user may need to use #SEPARATE to force a function to be separate. Consider the following example:

TEST.C 

MAIN ?614 RAM=5 
   DELAY_MS 0/19 RAM=1 
   READ_DATA (INLINE) RAM=5 
   PROCESS_DATA (INLINE) RAM=11 
   OUTPUT_DATA (INLINE) RAM=6 
   PUTHEX (INLINE) RAM=2 
      PUTHEX1 0/18 RAM=2 
      @PUTCHAR_9600_52_49 0/30 RAM=2 @PUTCHAR_9600_52_49 0/30 RAM=2 
   PUTHEX1 0/18 RAM=2 
      @PUTCHAR_9600_52_49 0/30 RAM=2 
      @PUTCHAR_9600_52_49 0/30 RAM=2

This example shows a main program with several INLINE functions that it calls. The resulting size of MAIN() is 614 locations and this will not fit into a 512 location page in the 56 device. The linker will put a ? in for the segment number since it would not fit in any segment. Note that the x/y notation is the page number (x) and number of locations (y). As a general rule, the linker will INLINE functions called only once to save stack space and in this program caused the function to get too large. The solution in this example will be to put a #SEPARATE before the declaration for PROCESS_DATA or maybe one of the other big functions called by MAIN(). The result might look like the following:

TEST.C 

MAIN ?406 RAM=5 
   DELAY_MS 0/19 RAM=1 
   READ_DATA (INLINE) RAM=5 
   PROCESS_DATA (INLINE) RAM=11 
   OUTPUT_DATA (INLINE) RAM=6 
   PUTHEX (INLINE) RAM=2 
      PUTHEX1 0/18 RAM=2 
         @PUTCHAR_9600_52_49 0/30 RAM=2 
         @PUTCHAR_9600_52_49 0/30 RAM=2 
      PUTHEX1 0/18 RAM=2 
         @PUTCHAR_9600_52_49 0/30 RAM=2 
         @PUTCHAR_9600_52_49 0/30 RAM=2