 | C251 User's Guide |  |
|
|
| ROM Compiler Directive| Abbreviation | None. | | Arguments | SMALL, COMPACT, LARGE, MEDIUM, or HUGE. | | Default | ROM (LARGE) | | µVision | Options — C251 Compiler — Memory Model — Code size limits. | | Description | You use the ROM directive to specify the size of the program memory. This directive affects the coding of the JMP and CALL instructions. | Memory Size | Description |
|---|
| SMALL | CALL and JMP instructions are coded as ACALL and AJMP. The maximum program size may be 2 Kbytes. The entire program must be allocated within the 2 Kbyte program memory space. | | COMPACT | CALL instructions are coded as LCALL. JMP instructions are coded as AJMP within a function. The size of a function must not exceed 2 Kbytes. The entire program may, however, comprise a maximum of 64 Kbytes. | | LARGE | CALL and JMP instructions are coded as LCALL and LJMP. This allows you to use the entire address space without any restrictions. Program size is limited to 64 Kbytes. Function size is also limited to 64 Kbytes. | | MEDIUM | External targets are coded as LCALL, targets within the current code module are coded as AJMP or ACALL. A single code segment is limited to 2 Kbytes of code. | | HUGE | All function targets not explicitely modified with near are invoked with ECALL instructions. Intrasegment branches are codes with short jumps or LJMP's, depending on the target distance. |
Note - ROM(HUGE) lets your program use the entire 16MB address space of the MCS® 251 microcontroller. In this memory model, a function declaration without a near modifier is a far function. far functions are invoked using the ECALL instruction (with a 24-bit address) and return using the ERET instruction. The compiler appends a question mark character to each far function in the generated object module to differentiate between near and far functions. For example, MyFunction() is converted to MyFunction? when the object module is created.
| | Example |
C251 SAMPLE.C ROM(HUGE)
#pragma ROM (MEDIUM)
|
|
|