RH850 Development Environment Migration Guide Migration from SuperH Family to RH850 Family Compiler (Building Guide)

R20UT3812EJ0100 June 15, 2016 Rev.1.00

Software Product Marketing Department, Software Business Division Renesas System Design Co., Ltd.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Preface HEW projects For RX family . This document describes the procedure for processing of CS+ projects and method of building in CS+ when porting a project from a For SuperH family SuperH family /C++ compiler (hereinafter SHC) to an RH850 family For , M16C family compiler (hereinafter CC-RH). For R32R family

For H8SX, H8S, . The contents of this document apply to the CS+ and High- performance Embedded Workshop (hereinafter HEW) IDEs, CC-RH, Porting of CS+ projects projects and SHC. The applicable versions are as follows. For RL family − CS+ for CC V4.00.00 For RL, family − CC-RH V1.03.00 − HEW V.4.09.01.007 For RX family − SHC V.9.04 Release 03 For RH850 family

For family Described in this document

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 2 Contents

Preface Page 2

. Porting a Project Page 4

− Procedures for Porting a Project Page 5 − Opening a HEW Project in CS+ Page 6 − For Reference: Creating a New CS+ Project Page 10 − Project Configurations Page 14 − Example of Project Configurations Page 15 − Automatic Conversion of Options Page 16 − Caution Page 29 . Building Page 30

− Managing the Build Environment Page 31 − Setting Build Options Page 32 − Setting the Order of Linkage Page 33 − Build Menu Page 34 − Building and Rebuilding Page 35

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 3 Porting a Project

© 2016 Renesas System Design Co., Ltd. All rights reserved. Procedures for Porting a Project

There are two ways to port an existing HEW project for SHC to the CS+ environment for CC-RH. Of the two procedures below, this document mainly describes procedure 1. 1. Diversion of an existing project Creating a new CS+ project for CC-RH by diverting the HEW project for SHC. 2. Newly creating a project in CS+ Using the source files which you have already created in creating and registering a project in CS+ for CC-RH. Contents Procedure 1 Procedure 2 Registering source files Automatic Manual Option settings Automatic (only partly) Manual Contention between the names of Names need to be modified Manual (consider this at the original source files and after the project is generated time of registration) automatically generated files

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 5 Opening a HEW Project in CS+ (1)

Select [Open Existing e2 studio/CubeSuite/High-performance Embedded Workshop/PM+ Project].

You can open workspaces which were created with HEW V.4.07 or later versions.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 6 Opening a HEW Project in CS+ (2)

Select “Workspace File for HEW(*.hws)” or “Project File for HEW(*.hwp)”.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 7 Opening a HEW Project in CS+ (3)

1. Select the project to be set for conversion from the [Project Convert Setting] dialog box. 2. Make the settings for the , session, kind of project, project name, and place of storage which are to be used with the ported project.

1. 2.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 8 Opening a HEW Project in CS+ (4)

A screenshot of the CS+ window right after a HEW project has been read.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 9 For Reference: Creating a New CS+ Project (1)

Select [Create New Project].

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 10 For Reference: Creating a New CS+ Project (2)

Select the type of microcontroller in (1) [Microcontroller] and the particular device in [Using microcontroller], labelled (1) and (2) at right, set a name for the project in [Project name] and the place where it is to be stored in (2) [Place], both labelled (3), and then click on the [Create] button.

(3)

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 11 For Reference: Creating a New CS+ Project (3)

A screenshot of the CS+ window right after creating a new project.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 12 For Reference: Creating a New CS+ Project (4)

Add the existing source files to the file branch of the [Project Tree]. New files can also be added.

(1) Add File or Add New File... (2) You can also add files by dragging and dropping on the file category in the project tree.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 13 Project Configurations

The HEW environment and CS+ environment have different project configurations. CS+ holds multiple sub-projects in one project.

Workspace Main Project

Project Sub Project

Project Sub Project

Project Sub Project

Project

You can freely create projects in HEW. You cannot create more than one project. For example, *.abs and *.lib files can be generated for each Projects other than this main project should be created as project and parent and child relationships between projects sub-projects which depend on the main project. can be set up.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 14 Example of Project Configurations

If a HEW workspace is opened with CS+, the project configuration is altered as follows.

Example: HEW Projects sample and sample_projectA are both in the workspace sample.

Example: CS+ A sub-project sample_projectA is in the project sample.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 15 Automatic Conversion of Options (Compiler: 1)

SHC options which are specified in HEW will be converted automatically in cases where CC-RH supports corresponding options.

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of Categ Name of option Tab Property option Tab Category Property ory C/C++ Source Compile Paths to additional included [Show entries for -include [Additional include paths] -I file directories : Include file directories]

Files to be included at the [Show entries for Options [Include files at head of compiling -preinclude Preprocess -Xpreinclude top of each compilation unit : Preinclude files] units]

Definition of macros [Show entries for : Defines] -define [Macro definition] -D Object [Output preprocessed source file : -preprocessor Output File [Output file type Yes] -P : Preprocessed source file (*.p/*.pp)] [Output line number information to -Xpreprocess=line Preprocess Expansion by the preprocessed file : Yes] preprocessor [Output preprocessed source file : Output File [Output file type -preprocessor Yes] : Suppress #line in preprocessed -noline -P [Output line number information to source file] Preprocess preprocessed file : No]

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 16 Automatic Conversion of Options (Compiler: 2)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property C/C++ Specifying a directory [Output directory] -objectfile Common Output File [Intermediate file output folder] -Xobj_path for the output of object Options Type and files Path Object Form of object code [Output file type : Assembly -code= Output File [Output assembly source file : Yes] -Xasm_option= source code(*.src)] asmcode -Xprn_path Output of debugging [Generate debug informations] -debug Compile Debug [Add debug information : Yes] -g information Options Information -nodebug [Add debug information : No] Not explicitly specified Output of listing files [Generate list file] -listfile Assemble List [Output assemble list file ; Yes] Xasm_option= -Xprn_path

List Assemble -NOListfile Options [Output assemble list file ; No] Not explicitly specified

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 17 Automatic Conversion of Options (Compiler: 3)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of Name of Cate Tab Property option Tab Category Property option gory C/C++ Optimize Compile Optimization [Optimize : for debug only] -optimize= [Level of optimizations : Debug precedence] -Onothing debug_only

Speed or size : [Optimize for speed] -speed Options [Optimize for size] -size [Optimize for both speed and size] -nospeed [Optimize : off] -optimize=0 [Level of optimizations : Preform the default -Odefault optimization] Speed or size : [Optimize for speed] -speed [Optimize for size] -size [Optimize for both speed and size] -nospeed Optimization [Optimize : on] [Optimize for speed] -optimize=1 [Level of optimizations : Speed precedence] -Ospeed Speed or size : -speed [Optimize for size] -optimize=1 [Level of optimizations : Code size precedence] -Osize -size [Optimize for both speed and size] -optimize=1 [Level of optimizations : Preform the default -Ospeed -nospeed optimization] -Ounroll=1 Optimization [Maximum number of loop expansions : 1] -Oinline=1 (Details) [Perform inline expansion : Yes(Only specified functions)]

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 18 Automatic Conversion of Options (Compiler: 4)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property C/C++ Optimize Compile (Details) Optimization Optimization for access to [Optimization for access to -map [Optimize accesses to external variables : -Omap external variables (inter- external variables : Inter-module] Yes(Optimizes the inter-module)] module) Options Optimization for access to [[Optimization for access to -smap [Optimize accesses to external variables : -Osmap external variables (intra- external variables : Inner- Yes(Optimizes the inner-module)] module) module] Code Output System for unrolling [Switch statement : If then] -case=Ifthen [Output code of switch statement : if-else] -Xswitch=ifelse statements [Switch statement : Table] -case=Table [Output code of switch statement : Table -Xswitch=table jump] Tab (Details) Optimization Controlling automatic inline [Automatic inline -inline [Preform inline expansion : Yes(Auto-detect)] -Oinline=2

expansion [Inline]: expansion : Default] [Maximum increasing rate of inline -Oinline_size=100 expansion size : 100]

[Automatic inline -inline= [Preform inline expansion : Yes(Auto-detect)] -Oinline=2 expansion : Custom] [Maximum increasing rate of inline -Oinline_size= [Maximum : number] expansion size : number]

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 19 Automatic Conversion of Options (Compiler: 5)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of Name of option Tab Category Property Tab Category Property option C/C++ Optimize variables] [Global Tab Compile Language C Treating external [Treat global variables as -GLOBAL_Volatile= [Handle external variables as if they are Not explicitly variables as volatile volatile qualified] 0 volatile qualified : No] specified -GLOBAL_Volatile= [Handle external variables as if they are -Xvolatile 1 Options volatile qualified : Yes] Optimization (Details) Optimization Sorting instructions [Schedule instructions : Disable] -SChedule=0 [Preform pipeline expansion : No] -Opipeline=off : [Schedule instructions : Enable] -SChedule=1 [Preform pipeline expansion : Yes] -Opipeline [Miscellaneous] Tab Unrolling loops [Loop unrolling : Enable] -loop [Maximum number of loop expansions : 4] -Ounroll=4 [Loop unrolling : Disable] -noloop [Maximum number of loop expansions : 0] -Ounroll=0 Specifying a maximum [Specify maximum unroll -max_unroll= [Maximum number of loop expansions: -Ounroll= unrolling factor for factor : Custom ] number number] number

unrolling loops : C Language C Optimization [Optimization considering type -ALIAS=ANSI [Compile strictly according to ANSI -Xalias=ansi considering the types of object indicated by pointer] standards : Yes] of items indicated by pointers Auto-selection of enum Miscellaneous options : -auto_enum [Enumeration type] -Xenum_type= size Other [enum size id made the auto smallest]

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 20 Automatic Conversion of Options (Compiler: 6, CPU)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property C/C++ Compile Encoding Character Character coding for Other User defined options : -euc [Character Encoding : EUC] -Xcharacter_set=euc_jp character strings -euc -sjis [Character Encoding : SJIS] -Xcharacter_set=sjis -sjis Options CPU Code Output Specifying the order of [Bit field’s members are allocated from the lower -BIt_order=Left [Order of bit-field members : Allocates -Xbit_order=left bit fields bit] -BIt_order=Right from left] -Xbit_order=right [Order of bit-field members : Allocates from right]

Alignment number for [Pack struct, union and class] -PACK=1 [Structure packing : 1 ] -Xpack=1 members of structures, -PACK=4 [Structure packing : 4 byte] -Xpack=4 unions, and class instances

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 21 Automatic Conversion of Options (Assembler)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Name of Place to be set Name of option Tab Category Property option Tab Category Property Assembly Source Options Assemble Preprocess Specifying include Show entries for : [Include file directories] -include Additional include paths -I file path names

Defining symbol Show entries for : [Defines] -define Macro definition -D replacement Object Information Debug Debugging Debug information : [With debug information] -debug [Add debug information : Yes] -g information Debug information : [Without debug -nodebug [Add debug information : No] Not explicitly specified information] List List Assemble Output of listing [Generate list file] -list [Output assemble list file ; Yes] -Xprn_path files -nolist [Output assemble list file ; No] Not explicitly specified Other Encoding Character Character coding User defined options : -euc [Character Encoding : EUC] -Xcharacter_set=euc_jp in source files -euc -sjis [Character Encoding : SJIS] -Xcharacter_set=sjis -sjis

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 22 Automatic Conversion of Options (Linker: 1)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Name of Place to be set Name of option Tab Category Property option Tab Category Property Link/Library : for entries Show Options Link Specifying input files Library files -LIBrary Library System libraries -LIBrary

Relocatable files and object files -Input Object file -Input

Binary files -Binary Input Binary file -Binary Input File Defining undefined Defines -DEFine Symbol definition -DEFine symbols Specifying the address [Use entry point] -ENTry Output [Specify execution start address : Yes] -ENTry where execution starts Code

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 23 Automatic Conversion of Options (Linker: 2)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property Link/Library Type Specifying Output Absolute(ELF/DWARF) -Form=Absolute No place to support (default) -Form=Absolute Options Create

forms of output : file output of Relocatable -Form=Relocate Output [Output : Relocatable file] -Form=Relocate File System library -Form=Library=S Library [Output file format : System libraries] -Form=Library=S

User library -Form=Library=U [Output file format : User libraries] -Form=Library=U Hex Output Hex HEX via absolute -Form=Hexadecimal [Hex file format : HEX file] -Form=Hexadecimal

Stype via absolute -Form=Stype Hex [Hex file format : Motorola S-record file] -Form=Stype Options Format

Binary via absolute -Form=Binary [Hex file format : Binary file] -Form=Binary

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 24 Automatic Conversion of Options (Linker: 3)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Name of Place to be set Name of Tab Category Property option Tab Category Property option Link/Library Options Link Information Debug Debugging information Output [Debug information : In separate -DEBug [Output debug information : Yes(Output to the output -DEBug debug file (*.dbg)] -NODEBug file)] -NODEBug [Debug information : None] [Output debug information : No] Options Output Hex Hex Unifying record size [Date record header] -Record [Unify record size] -RECord Format Specifying the number [Length of data record] -BYte_count [Specify byte count for data record: Yes] -BYte_count of in data records Show Specifying a value for Specify value filled in -Space [Fill unused areas in the output ranges with the -SPace output to empty areas unused area value : Yes] entries for : for entries Link Specifying output files Output file path -Output Output [Output folder] -Output

Options File [Output file name] (Details) Optimization Information file on Output file path -Map [Output external symbol allocation information file] -MAp allocation of external [Generate external symbol- symbols allocation information file]

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 25 Automatic Conversion of Options (Linker: 4)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property Link/Library Show Link Message Informational messages Output Output message -Message [Enable information message output : Yes] -Message

[Repressed information Options [Enable information message output : No] entries for : for entries level messages] -NOMessage -NOMessage

Notification of defined Output message -MSg_unused [Notify unused symbol : Yes] -MSg_unused symbols with no reference [Notify unused symbol] Padding at the ends of Padding -PADDING Output [Fill with padding data at the end of a -PADDING sections Code section : Yes] Specifying the output of List Generate list file -LISt List [Output link map file : Yes] -LISt listing files Specifying the information to [Output method : All] -Show=ALL [Output link map file : Yes(List -Show=ALL be output to listing files contents=ALL)]

[Output method : Custom] [Output link map file : Yes(List contents=specify)] [Show symbol] -Show=Symbol [Output symbol information : Yes] -Show=Symbol [Show reference] -Show=Reference [Output number of symbol reference : Yes] -Show=Reference [Show section] -Show=Section [Output section information : Yes] -Show=Section [Show cross reference] -Show=Xreference [Output cross reference information : Yes] -Show=Xreference [Show total section size] -Show=Total_size [output total sizes of sections : Yes] -Show=Total_size

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 26 Automatic Conversion of Options (Linker: 5)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Name of Place to be set Name of option Tab Category Property option Tab Category Property Link/Library Link Checking the consistency Verify CPU information check -Cpu Verify [Check section larger than specified -Cpu

of addresses Options range of address : Yes] Miscellaneous Stack information file Other Stack information output -STACk Others [Output stack information file : Yes] -STACk Specifying reduction of Low memory use during linkage -MEMory [Reduce memory occupancy] -MEMory memory usage Information Debug Compression of debugging Compress debug information -Compress [Output debug information : Yes(Output -Compress information options to the output file] -NOCOmpress [Output debug information : No] -NOCOmpress Options Output Hex Hex S9 records always to be Always output S9 record at the -S9 [Output S9 record at the end : Yes] -S9

output end Format

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 27 Automatic Conversion of Options (Linker: 6)

HEW (SHC) CS+ (CC-RH) Functions Place to be set Place to be set Name of option Name of option Tab Category Property Tab Category Property Link/Library User Link Message Changing the level of Other -CHange_message -CHange_message [Change warning message to information -CHange_message Options

messages options defined message : Yes] Information Debug Specifying concealment of -Hide -Hide [Delete local symbol name information : -Hide local symbol names Yes]

Displaying total size of -Total_size -Total_size [Display total size of sections : Yes] -Total_size sections Others

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 28 Caution

Delete startup files which are automatically generated by HEW, since they are unusable.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 29 Building

© 2016 Renesas System Design Co., Ltd. All rights reserved. Managing the Build Environment

The setting of options is managed differently in the HEW and CS+ environments.

The build options are saved The options are saved in in units called configurations. units called build modes. They can be added as desired.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 31 Setting Build Options

For CS+, the build options can be specified by property settings. The build options are specified in order of All settings are displayed by specifying a tab. [Tab]->[Category]->etc…, and the place they are to be set is then displayed.

Descriptions of options are also shown.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 32 Note: This setting Setting the Order of Linkage influences the result of building. The HEW and CS+ environments have different orders of linkage. By default, the HEW environment handles the files in ASCII order of their names, while CS+ has an internal order of management.

Order of ASCII by default

Able to customize Since CS+ has an internal order of management by default, the order will require rearrangement to have the order in CS+ conform to that in the HEW environment.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 33 Build Menu

Comparison of build functions

- Build - Build Project - Build All - Rebuild Project - Build Multiple... - Batch Build...

- Clean Current Project - Clean Project - Clean All Project

- Update All - Update Dependencies Dependencies

- Build Configurations... - Build Mode Settings ... A list of option settings can be displayed.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 34 Building and Rebuilding

Building and rebuilding can be executed from the [Build] menu, or by clicking on the buttons shown below.

Builds the project. Rebuilds the project.

© 2016 Renesas System Design Co., Ltd. All rights reserved. Page 35 Renesas System Design Co., Ltd.

© 2016 Renesas System Design Co., Ltd. All rights reserved.