Pular para o conteúdo principal
Knowledgebase
Home
Renesas Brasil - Knowledgebase

Is there a way of optimizing access to external variables?

Latest Updated:02/27/2015

Question:

Is there a way of optimizing access to external variables?

Answer:

Specifying the –Omap option leads to the generation of code where access to external variables is relative to the ep register (register r30) as the base. However, ep-relative access is not possible for variables that are allocated to addresses more than ±4 M locations from ep.

Code for gp-relative access to such variables is generated in the following cases.

  • The user defines "__gp_data" and stores its value in gp.
  • The target variable is allocated to a location that is accessible by gp (±4 M locations from gp).

Example: How to define "__gp_data" (with the value of gp as 0xfede5000)

    ----------------------------
    .public __gp_data
    __gp_data .equ 0xfede5000

    …

    mov  __gp_data, gp
    ----------------------------
Suitable Products
C Compiler Package for RH850 Family