This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ROM() Directive Effect on Code Generation

The ROM(small/compact/large) directive, selected by the "Code Rom Size" option in the uVision Target dialog, tells the compiler to generate ACALL / AJMP instructions inside functions (compact) or for the whole program (small).

There is also a "linker code packing" checkbox on the C51 optimization options. This optimization allows the linker to rearrange code to use the short instructions where possible, replacing LCALL / LJMP with the Ax versions.

Is the ROM directive thus redundant? Or is there some additional benefit to the code generated with the ROM(compact) memory model selection compared to ROM(large)?

(I'm contemplating switching from the large model to small. I have most of my variables explicitly assigned to a memory space, and make heavy use of overlaid data for auto variables (the "stack"). This noticably improves code size over the default to xdata. However, it seems that parameters that spill out of registers, and compiler-generated temporaries will still appear in xdata, with all the painful access that implies. So I was hoping a switch to the small model would move these locations into internal RAM as well, and buy me a little more code space. Hopefully it doesn't blow my "stack" size altogether.)

0