User`s manual

RX600 & RX200 Series Simple Flash API for RX
R01AN0544EU0250 Rev.2.50 Page 17 of 33
March 4, 2014
3.11 Putting Flash API in User Boot Area
By default, the Renesas RX Toolchain will use 24 bits for the maximum distance that a branch instruction can jump to.
The options are 16, 24, or 32 bits. The smaller the chosen value, the smaller the compiled code will be. The reason for
this is that if you choose 16 or 24 bits then you are guaranteeing the Renesas RX Toolchain that the destination of all
branches will be within the range specified and therefore the compiler does not need to reserve 32 bits for branches.
With this guarantee the toolchain can save 1 byte per branch with 24 bit offsets or 2 bytes per branch with 16 bit offsets.
With regular applications, 24 bits will usually be fine. When using User Boot Mode with the Flash API though, 32 bit
branches are required. The reason for this is that the Flash API has to put some code in RAM when programming or
erasing ROM. Since the end of the User Boot Area is 0xFF800000 and the beginning of RAM is 0x00000000 this
means there is a distance of 0x800000. This appears to be within 24 bits, but branches can have positive or negative
offsets so the offset is a 2’s complement number and therefore the range is half in each direction. This means that calls
to Flash API routines in the User Boot Area cannot reach the functions in RAM with 24 bit branches. If the user does
not change this setting in the Renesas RX Toolchain then the user will get a ‘L2330 (E) Relocation size overflow’ error.
To set the Renesas RX Toolchain to use 32 bit branches, follow these steps:
In HEW:
1. Open up your project in HEW.
2. Go to Build >> RX Standard Toolchain.
3. Click the right arrow at the top-right of the ‘RX Standard Toolchain’ window until you can see the ‘CPU’ tab.
4. Click the ‘CPU’ tab.
5. Click the ‘Details…’ button.
6. In the window that comes up (‘CPU details’) choose ’32 bit’ for ‘Width of divergence of function’.
In e
2
studio:
1. Right click on your project folder and select ‘Properties’.
2. Expand ‘C/C++ Build’ and click on ‘Settings’.
3. Click on the ‘Tool Settings’ tab and choose Compiler >> CPU >> Advanced.
4. Choose ’32 bit’ for ‘Width of divergence of function’..