Skip to main content
Renesas India - Knowledgebase

Why RAM not cleared to 0 when I executed an object file using a compiler?

Latest Updated:11/21/2014


I executed an object file generated by the RL78/78K0R compiler (CA78K0R) and, although execution under the debugger proceeded to the main function, the RAM was not cleared to 0.


There may be a problem with the settings for the startup routine.
The default startup routine clears the following areas to 0.

  • Stack area
  • SADDR area
  • Sections for variables that do not have initial values (@@DATA, @@DATAL*, and @@DATS sections)
    *: An option setting determines whether this area is initialized or not.

The problem is arising for one of the following two reasons.

  1. A new section has been created.
  2. The startup routine registered with CubeSuite+ has been customized

Actions in response to the above two reasons are described below.

  1. If you are using #pragma section to specify a new section, the startup routine is required to include code for copying variables with initial values or clearing variables with no initial values to 0.

    For details, refer to the section on the startup routine in the user's manual of the compiler you are using.

  2. If you are using the CA78K0R C compiler for the RL78 family under CubeSuite+, a startup routine must be registered under the category for the startup routine.

    Check that the startup routine file has been registered under [File] in the [Project Tree] panel of CubeSuite+, in the same way as other source files. If it is not under the [Startup] category, move it to that category or register it there.
Suitable Products
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 and 78K Families
Compiler for RL78 Family and 78K0R [CA78K0R]