PRM File: "be sure the option -OnB=b..."

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PRM File: "be sure the option -OnB=b..."

Jump to solution
2,192 Views
BasePointer
Contributor II
Hi,
 
I'm using LC60 with the prm file below.
NV_SAVE_SEG is where my data are stored in.
FLASH_ROUTINE_SEG is for my flash_write routine.
 
There is a note in Placement Section "ROM1,ROM2 In case you want to use ROM1,ROM2 as well, be sure the option -OnB=b is passed to the compiler."
 
What does exactly this note mean?
If I don't add this option to the compiler, Can't I call flash_write routine in FLASH_ROUTINE_SEG from ROM, ROM1 or ROM2 segment?
 
 
 
Code:
/* This is a linker parameter file for the mc9s08lc60 */NAMES END /* CodeWarrior will pass all the needed files to the linker by command line.
 But here you may add your own files too. */SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */        Z_RAM                    =  READ_WRITE   0x0060 TO 0x00FF;  // 160 byte    RAM                      =  READ_WRITE   0x0100 TO 0x085F;  // 1888 byte    NO_INIT_RAM_SEG          =  NO_INIT      0x0860 TO 0x0C5F;  // 1024 byte    MY_STK                   =  NO_INIT      0x0C60 TO 0x105F;  // 1024 byte    NV_SAVE_SEG              =  READ_ONLY    0x1060 TO 0x12FF;  // reserve 672 (512) byte for NV    ROM1                     =  READ_ONLY    0x1300 TO 0x17FF;    ROM                      =  READ_ONLY    0x1870 TO 0xFEAF;    FLASH_ROUTINE_SEG        =  READ_ONLY    0xFEB0 TO 0xFFAF;    ROM2                     =  READ_ONLY    0xFFC0 TO 0xFFD1;/*  INTVECT                  =  READ_ONLY    0xFFD2 TO 0xFFFF; Reserved for Int. Vectors*/ENDPLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */    _DATA_ZEROPAGE, MY_ZEROPAGE         INTO  Z_RAM;    DEFAULT_RAM                         INTO  RAM;    NO_INIT_RAM                         INTO  NO_INIT_RAM_SEG;    SSTACK                              INTO  MY_STK;    NV_SAVE_AREA                        INTO  NV_SAVE_SEG;    FLASH_ROUTINE_AREA                  INTO  FLASH_ROUTINE_SEG;    _PRESTART, STARTUP, DEFAULT_ROM,     ROM_VAR, STRINGS, COPY              INTO  ROM; /* ROM1,ROM2 In case you want to use ROM1,ROM2                                                      as well, be sure the option -OnB=b                                                       is passed to the compiler. */ENDSTACKSIZE 0x400VECTOR 0 _Startup /* Reset vector: this is the default entry point for an application. */
 
This is a C project.
Regards,
BP.
Labels (1)
Tags (1)
0 Kudos
1 Solution
414 Views
CompilerGuru
NXP Employee
NXP Employee
The code will either run fine without -OnB=b, or it fail during linking.
If the code fails at runtime somewhere, then the problem is somewhere else :smileywink:.
If you get a "fixup overflow" something at link time and you did change the prm to place near code into multiple segments, then adding -OnB=b will fix the issue.

Daniel

View solution in original post

0 Kudos
3 Replies
414 Views
CrasyCat
Specialist III
Hello
 
Option -OnB=b disables JSR to BSR optimization.
Basically, when in a source file implementation of the called function is preceding the calling function and if the code of the called function is small enough, the compiler will call the function with a BSR (instead of a JSR).
 
This is working well as long as the function are allocated next to each other.
If you tell in the .prm file you want to allocate .text into ROM, ROM1, ROM2, the called function might be allocated in ROM and the calling function in ROM1. The code will then not be working any more.
 
So if you are allocating your code in non-contiguous memory area it is recommended to activate option -OnB=b.
 
CrasyCat
415 Views
CompilerGuru
NXP Employee
NXP Employee
The code will either run fine without -OnB=b, or it fail during linking.
If the code fails at runtime somewhere, then the problem is somewhere else :smileywink:.
If you get a "fixup overflow" something at link time and you did change the prm to place near code into multiple segments, then adding -OnB=b will fix the issue.

Daniel
0 Kudos
414 Views
BasePointer
Contributor II
Thank you.
0 Kudos