1025
CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual Document Number: CWMCURS08CMPREF Rev 10.6, 01/2014

CodeWarrior Development Studio for Microcontrollers V10.x RS08

Embed Size (px)

Citation preview

Page 1: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio forMicrocontrollers V10.x RS08 Build

Tools Reference Manual

Document Number: CWMCURS08CMPREFRev 10.6, 01/2014

Page 2: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

2 Freescale Semiconductor, Inc.

Page 3: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Contents

Section number Title Page

Chapter 1Overview

1.1 Accompanying Documentation..................................................................................................................................49

1.2 Additional Information Resources..............................................................................................................................50

Chapter 2Using Compiler

Chapter 3Introduction

3.1 Compiler Environment................................................................................................................................................53

3.1.1 Designing a Project....................................................................................................................................54

3.2 Creating and Managing Project Using CodeWarrior IDE..........................................................................................54

3.2.1 Creating Project Using New Bareboard Project Wizard............................................................................55

3.2.2 Analysis of Groups in CodeWarrior Projects View...................................................................................58

3.2.3 Analysis of Files in CodeWarrior Projects View.......................................................................................60

3.3 Using Standalone Compiler........................................................................................................................................62

3.3.1 Configuring Compiler................................................................................................................................62

3.3.1.1 Selecting Input Files.................................................................................................................66

3.3.1.2 Compiling C Source Code Files...............................................................................................67

3.4 Build Tools (Application Programs)...........................................................................................................................76

3.5 Startup Command-Line Options.................................................................................................................................76

3.6 Highlights....................................................................................................................................................................77

3.7 CodeWarrior Integration of Build Tools.....................................................................................................................78

3.7.1 Combined or Separated Installations.........................................................................................................78

3.7.2 RS08 Compiler Build Settings Panels.......................................................................................................78

3.7.2.1 RS08 Compiler.........................................................................................................................79

3.7.2.2 RS08 Compiler > Output.........................................................................................................80

3.7.2.3 RS08 Compiler > Output > Configure Listing File.................................................................81

3.7.2.4 RS08 Compiler > Output > Configuration for list of included files in make format...............82

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 3

Page 4: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

3.7.2.5 RS08 Compiler > Input............................................................................................................83

3.7.2.6 RS08 Compiler > Language.....................................................................................................87

3.7.2.7 RS08 Compiler > Language > CompactC++ features.............................................................88

3.7.2.8 RS08 Compiler > Host.............................................................................................................89

3.7.2.9 RS08 Compiler > Code Generation.........................................................................................89

3.7.2.10 RS08 Compiler > Messages.....................................................................................................90

3.7.2.11 RS08 Compiler > Messages > Disable user messages.............................................................92

3.7.2.12 RS08 Compiler > Preprocessor................................................................................................93

3.7.2.13 RS08 Compiler > Type Sizes...................................................................................................95

3.7.2.14 RS08 Compiler > General........................................................................................................96

3.7.2.15 RS08 Compiler > Optimization...............................................................................................96

3.7.2.16 RS08 Compiler > Optimization > Mid level optimizations.....................................................98

3.7.2.17 RS08 Compiler > Optimization > Mid level branch optimizations.........................................98

3.7.2.18 RS08 Compiler > Optimization > Tree optimizer...................................................................99

3.7.2.19 RS08 Compiler > Optimization > Optimize Library Function................................................100

3.7.3 CodeWarrior Tips and Tricks....................................................................................................................101

3.8 Integration into Microsoft Visual C++ 2008 Express Edition (Version 9.0 or later).................................................101

3.8.1 Integration as External Tools.....................................................................................................................102

3.8.2 Integration with Visual Studio Toolbar.....................................................................................................103

3.9 Object-File Formats....................................................................................................................................................105

3.9.1 ELF/DWARF Object-File Format.............................................................................................................105

3.9.2 Mixing Object-File Formats.......................................................................................................................105

Chapter 4Graphical User Interface

4.1 Launching Compiler...................................................................................................................................................107

4.1.1 Interactive Mode........................................................................................................................................108

4.1.2 Batch Mode................................................................................................................................................108

4.2 Compiler Main Window.............................................................................................................................................109

4.2.1 Window Title.............................................................................................................................................110

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

4 Freescale Semiconductor, Inc.

Page 5: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

4.2.2 Content Area..............................................................................................................................................110

4.2.3 Toolbar.......................................................................................................................................................111

4.2.4 Status Bar...................................................................................................................................................112

4.2.5 Compiler Menu Bar...................................................................................................................................113

4.2.6 File Menu...................................................................................................................................................113

4.2.7 Compiler Menu..........................................................................................................................................115

4.2.8 View Menu.................................................................................................................................................115

4.2.9 Help Menu..................................................................................................................................................116

4.3 Editor Settings Dialog Box.........................................................................................................................................117

4.3.1 Global Editor (shared by all tools and projects)........................................................................................117

4.3.2 Local Editor (shared by all tools)...............................................................................................................118

4.3.3 Editor Started with Command Line...........................................................................................................119

4.3.3.1 Examples:.................................................................................................................................120

4.3.4 Editor Started with DDE............................................................................................................................120

4.3.5 CodeWarrior (with COM)..........................................................................................................................122

4.3.6 Modifiers....................................................................................................................................................123

4.4 Save Configuration Dialog Box..................................................................................................................................124

4.5 Environment Configuration Dialog Box.....................................................................................................................125

4.6 Standard Types Settings Dialog Box..........................................................................................................................126

4.7 Option Settings Dialog Box........................................................................................................................................127

4.8 Smart Control Dialog Box..........................................................................................................................................129

4.9 Message Settings Dialog Box.....................................................................................................................................130

4.9.1 Changing the Class associated with a Message.........................................................................................132

4.9.2 Retrieving Information about an Error Message........................................................................................132

4.10 About Dialog Box.......................................................................................................................................................133

4.11 Specifying Input File...................................................................................................................................................133

4.11.1 Compiling Using Command Line in Toolbar............................................................................................133

4.11.1.1 Compiling New File.................................................................................................................134

4.11.1.2 Compiling Already Compiled File...........................................................................................134

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 5

Page 6: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

4.11.1.3 Using File > Compile Menu Entry...........................................................................................134

4.11.1.4 Using Drag and Drop...............................................................................................................134

4.11.2 Message/Error Feedback............................................................................................................................134

4.11.3 Use Information from Compiler Window..................................................................................................135

4.11.4 Use User-Defined Editor............................................................................................................................135

Chapter 5Environment

5.1 Current Directory........................................................................................................................................................138

5.2 Environment Macros...................................................................................................................................................139

5.3 Global Initialization File (mcutools.ini).....................................................................................................................140

5.4 Local Configuration File (usually project.ini)............................................................................................................140

5.5 Paths............................................................................................................................................................................141

5.6 Line Continuation.......................................................................................................................................................142

5.7 Environment Variable Details.....................................................................................................................................143

5.7.1 COMPOPTIONS: Default Compiler Options............................................................................................143

5.7.2 COPYRIGHT: Copyright entry in object file............................................................................................144

5.7.3 DEFAULTDIR: Default Current Directory...............................................................................................145

5.7.4 ENVIRONMENT: Environment File Specification..................................................................................146

5.7.5 ERRORFILE: Error filename Specification..............................................................................................147

5.7.6 GENPATH: #include "File" Path...............................................................................................................148

5.7.7 INCLUDETIME: Creation Time in Object File........................................................................................149

5.7.8 LIBRARYPATH: `include <File>' Path....................................................................................................150

5.7.9 OBJPATH: Object File Path......................................................................................................................151

5.7.10 TEXTPATH: Text File Path......................................................................................................................152

5.7.11 TMP: Temporary Directory.......................................................................................................................153

5.7.12 USELIBPATH: Using LIBPATH Environment Variable.........................................................................154

5.7.13 USERNAME: User Name in Object File..................................................................................................155

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

6 Freescale Semiconductor, Inc.

Page 7: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

Chapter 6Files

6.1 Input Files...................................................................................................................................................................157

6.1.1 Source Files................................................................................................................................................157

6.1.2 Include Files...............................................................................................................................................157

6.2 Output Files.................................................................................................................................................................158

6.2.1 Object Files................................................................................................................................................158

6.2.2 Error Listing...............................................................................................................................................159

6.2.2.1 Interactive Mode (Compiler Window Open)...........................................................................159

6.2.2.2 Batch Mode (Compiler Window not Open).............................................................................159

6.3 File Processing............................................................................................................................................................159

Chapter 7Compiler Options

7.1 Option Recommendation............................................................................................................................................163

7.2 Compiler Option Details.............................................................................................................................................163

7.2.1 Option Groups............................................................................................................................................163

7.2.2 Option Scopes............................................................................................................................................164

7.2.3 Option Detail Description..........................................................................................................................165

7.2.3.1 Using Special Modifiers...........................................................................................................166

7.2.3.1.1 Examples.............................................................................................................166

7.2.3.2 -!: Filenames are Clipped to DOS Length...............................................................................168

7.2.3.3 -AddIncl: Additional Include File............................................................................................168

7.2.3.4 -Ansi: Strict ANSI....................................................................................................................169

7.2.3.5 -ArgFile: Specify a file from which additional command line options will be read...............170

7.2.3.6 -BfaB: Bitfield Byte Allocation...............................................................................................171

7.2.3.7 -BfaGapLimitBits: Bitfield Gap Limit.....................................................................................173

7.2.3.8 -BfaTSR: Bitfield Type-Size Reduction..................................................................................175

7.2.3.9 -C++ (-C++f, -C++e, -C++c): C++ Support............................................................................176

7.2.3.10 -Cc: Allocate Const Objects into ROM...................................................................................177

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 7

Page 8: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

7.2.3.11 -Ccx: Cosmic Compatibility Mode for Space Modifiers and Interrupt Handlers....................179

7.2.3.12 -Ci: Bigraph and Trigraph Support..........................................................................................181

7.2.3.13 -Cn: Disable compactC++ features..........................................................................................184

7.2.3.14 -Cni: No Integral Promotion....................................................................................................186

7.2.3.15 -Cppc: C++ Comments in ANSI-C..........................................................................................188

7.2.3.16 -Cq: Propagate const and volatile qualifiers for structs...........................................................189

7.2.3.17 -CswMaxLF: Maximum Load Factor for Switch Tables.........................................................190

7.2.3.18 -CswMinLB: Minimum Number of Labels for Switch Tables................................................192

7.2.3.19 -CswMinLF: Minimum Load Factor for Switch Tables..........................................................193

7.2.3.20 -CswMinSLB: Minimum Number of Labels for Switch Search Tables..................................195

7.2.3.21 -Cu: Loop Unrolling.................................................................................................................197

7.2.3.22 -Cx: Switch Off Code Generation............................................................................................199

7.2.3.23 -D: Macro Definition...............................................................................................................199

7.2.3.24 -Ec: Conversion from 'const T*' to 'T*'...................................................................................201

7.2.3.25 -Eencrypt: Encrypt Files..........................................................................................................202

7.2.3.26 -Ekey: Encryption Key.............................................................................................................204

7.2.3.27 -Env: Set Environment Variable..............................................................................................205

7.2.3.28 -F (-F2, -F2o): Object File Format...........................................................................................206

7.2.3.29 -Fd: Double is IEEE32.............................................................................................................207

7.2.3.30 -H: Short Help..........................................................................................................................208

7.2.3.31 -I: Include File Path..................................................................................................................209

7.2.3.32 -IEA: Specify the address of the interrupt exit address register...............................................210

7.2.3.33 -La: Generate Assembler Include File.....................................................................................210

7.2.3.34 -Lasm: Generate Listing File...................................................................................................211

7.2.3.35 -Lasmc: Configure Listing File................................................................................................213

7.2.3.36 -Ldf: Log Predefined Defines to File.......................................................................................214

7.2.3.37 -Li: List of Included Files to ".inc" File...................................................................................216

7.2.3.38 -Lic: License Information........................................................................................................217

7.2.3.39 -LicA: License Information about every Feature in Directory................................................218

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

8 Freescale Semiconductor, Inc.

Page 9: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

7.2.3.40 -LicBorrow: Borrow License Feature......................................................................................219

7.2.3.41 -LicWait: Wait until Floating License is Available from Floating License Server.................220

7.2.3.42 -Ll: Write Statistics Output to File...........................................................................................221

7.2.3.43 -Lm: List of Included Files in Make Format............................................................................223

7.2.3.44 -LmCfg: Configuration for List of Included Files in Make Format (option -Lm)...................224

7.2.3.45 -Lo: Append Object File Name to List (enter [<files>])..........................................................226

7.2.3.46 -Lp: Preprocessor Output.........................................................................................................227

7.2.3.47 -LpCfg: Preprocessor Output Configuration............................................................................228

7.2.3.48 -LpX: Stop after Preprocessor..................................................................................................230

7.2.3.49 -M (-Mb, -Ms): Memory Model..............................................................................................231

7.2.3.50 -N: Show Notification Box in Case of Errors..........................................................................232

7.2.3.51 -NoBeep: No Beep in Case of an Error....................................................................................233

7.2.3.52 -NoClrVol: Do not use CLR for volatile variables in the direct page.....................................234

7.2.3.53 -NoDebugInfo: Do Not Generate Debug Information.............................................................234

7.2.3.54 -NoPath: Strip Path Info...........................................................................................................236

7.2.3.55 -Oa: Alias Analysis Options....................................................................................................236

7.2.3.56 -O (-Os, -Ot): Main Optimization Target.................................................................................237

7.2.3.57 -O[nf|f]: Create Sub-Functions with Common Code...............................................................239

7.2.3.58 -ObjN: Object File Name Specification...................................................................................239

7.2.3.59 -Obsr: Generate Always Near Calls.........................................................................................240

7.2.3.60 -Od: Disable Mid-level Optimizations.....................................................................................243

7.2.3.61 -Odb: Disable Mid-level Branch Optimizations......................................................................244

7.2.3.62 -OdocF: Dynamic Option Configuration for Functions...........................................................246

7.2.3.63 -Oi: Inlining..............................................................................................................................248

7.2.3.64 -Ona: Disable alias checking....................................................................................................250

7.2.3.65 -OiLib: Optimize Library Functions........................................................................................250

7.2.3.66 -OnB: Disable Branch Optimizer.............................................................................................252

7.2.3.67 -Onbsr: Disable far to near call optimization...........................................................................253

7.2.3.68 -OnCopyDown: Do Generate Copy Down Information for Zero Values................................253

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 9

Page 10: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

7.2.3.69 -OnCstVar: Disable CONST Variable by Constant Replacement...........................................255

7.2.3.70 -Onp: Disable Peephole Optimizer..........................................................................................256

7.2.3.71 -OnPMNC: Disable Code Generation for NULL Pointer to Member Check..........................257

7.2.3.72 -Onr: Disable Reload from Register Optimization..................................................................258

7.2.3.73 -Ont: Disable Tree Optimizer..................................................................................................259

7.2.3.74 -Ontc: Disable tail call optimization........................................................................................265

7.2.3.75 -Ostk: Reuse Locals of Stack Frame........................................................................................268

7.2.3.76 -Pe: Do Not Preprocess Escape Sequences in Strings with Absolute DOS Paths ..................269

7.2.3.77 -Pio: Include Files Only Once..................................................................................................271

7.2.3.78 -Prod: Specify Project File at Startup......................................................................................273

7.2.3.79 -Qvtp: Qualifier for Virtual Table Pointers..............................................................................274

7.2.3.80 -Rp[t|e]: Large return Value Type............................................................................................275

7.2.3.81 -SIP2: Specify the address of the System Interrupt Pending 2 register...................................275

7.2.3.82 -T: Flexible Type Management................................................................................................276

7.2.3.83 -V: Prints the Compiler Version..............................................................................................282

7.2.3.84 -View: Application Standard Occurrence................................................................................283

7.2.3.85 -WErrFile: Create "err.log" Error File.....................................................................................284

7.2.3.86 -Wmsg8x3: Cut File Names in Microsoft Format to 8.3.........................................................286

7.2.3.87 -WmsgCE: RGB Color for Error Messages.............................................................................287

7.2.3.88 -WmsgCF: RGB Color for Fatal Messages.............................................................................288

7.2.3.89 -WmsgCI: RGB Color for Information Messages...................................................................288

7.2.3.90 -WmsgCU: RGB Color for User Messages.............................................................................289

7.2.3.91 -WmsgCW: RGB Color for Warning Messages......................................................................290

7.2.3.92 -WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode...................291

7.2.3.93 -WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode.....................293

7.2.3.94 -WmsgFob: Message Format for Batch Mode.........................................................................294

7.2.3.95 -WmsgFoi: Message Format for Interactive Mode..................................................................296

7.2.3.96 -WmsgFonf: Message Format for no File Information............................................................298

7.2.3.97 -WmsgFonp: Message Format for no Position Information....................................................299

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

10 Freescale Semiconductor, Inc.

Page 11: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

7.2.3.98 -WmsgNe: Maximum Number of Error Messages..................................................................301

7.2.3.99 -WmsgNi: Maximum Number of Information Messages........................................................302

7.2.3.100 -WmsgNu: Disable User Messages..........................................................................................303

7.2.3.101 -WmsgNw: Maximum Number of Warning Messages...........................................................304

7.2.3.102 -WmsgSd: Setting a Message to Disable.................................................................................305

7.2.3.103 -WmsgSe: Setting a Message to Error.....................................................................................306

7.2.3.104 -WmsgSi: Setting a Message to Information...........................................................................307

7.2.3.105 -WmsgSw: Setting a Message to Warning..............................................................................308

7.2.3.106 -WOutFile: Create Error Listing File.......................................................................................309

7.2.3.107 -Wpd: Error for Implicit Parameter Declaration......................................................................310

7.2.3.108 -WStdout: Write to Standard Output.......................................................................................312

7.2.3.109 -W1: Do Not Print Information Messages...............................................................................313

7.2.3.110 -W2: Do Not Print Information or Warning Messages............................................................314

Chapter 8Compiler Predefined Macros

8.1 Compiler Vendor Defines...........................................................................................................................................317

8.2 Product Defines...........................................................................................................................................................318

8.3 Data Allocation Defines..............................................................................................................................................318

8.4 Various Defines for Compiler Option Settings...........................................................................................................318

8.5 Option Checking in C Code........................................................................................................................................319

8.6 ANSI-C Standard Types 'size_t', 'wchar_t' and 'ptrdiff_t' Defines.............................................................................320

8.6.1 Macros for RS08........................................................................................................................................322

8.7 Division and Modulus.................................................................................................................................................322

8.7.1 Macros for RS08........................................................................................................................................323

8.8 Object-File Format Defines........................................................................................................................................323

8.9 Bitfield Defines...........................................................................................................................................................323

8.9.1 Bitfield Allocation......................................................................................................................................323

8.9.2 Bitfield Type Reduction.............................................................................................................................325

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 11

Page 12: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

8.9.3 Sign of Plain Bitfields................................................................................................................................326

8.9.3.1 Macros for RS08......................................................................................................................327

8.9.4 Type Information Defines..........................................................................................................................327

8.9.5 Freescale RS08-Specific Defines...............................................................................................................329

Chapter 9Compiler Pragmas

9.1 Pragma Details............................................................................................................................................................331

9.1.1 #pragma CONST_SEG: Constant Data Segment Definition.....................................................................332

9.1.2 #pragma CREATE_ASM_LISTING: Create an Assembler Include File Listing.....................................335

9.1.3 #pragma DATA_SEG: Data Segment Definition......................................................................................336

9.1.4 #pragma INLINE: Inline Next Function Definition..................................................................................338

9.1.5 #pragma INTO_ROM: Put Next Variable Definition into ROM..............................................................339

9.1.6 #pragma LINK_INFO: Pass Information to the Linker.............................................................................340

9.1.7 #pragma LOOP_UNROLL: Force Loop Unrolling...................................................................................342

9.1.8 #pragma mark: Entry in CodeWarrior IDE Function List.........................................................................342

9.1.9 #pragma MESSAGE: Message Setting......................................................................................................344

9.1.10 #pragma NO_ENTRY: No Entry Code.....................................................................................................345

9.1.11 #pragma NO_EXIT: No Exit Code............................................................................................................347

9.1.12 #pragma NO_FRAME: No Frame Code...................................................................................................348

9.1.13 #pragma NO_INLINE: Do not Inline next function definition.................................................................350

9.1.14 #pragma NO_LOOP_UNROLL: Disable Loop Unrolling........................................................................351

9.1.15 #pragma NO_RETURN: No Return Instruction........................................................................................352

9.1.16 #pragma NO_STRING_CONSTR: No String Concatenation during preprocessing................................353

9.1.17 #pragma ONCE: Include Once..................................................................................................................354

9.1.18 #pragma OPTION: Additional Options.....................................................................................................355

9.1.19 #pragma REALLOC_OBJ: Object Reallocation.......................................................................................357

9.1.20 #pragma STRING_SEG: String Segment Definition................................................................................358

9.1.21 #pragma TEST_CODE: Check Generated Code.......................................................................................360

9.1.22 #pragma TRAP_PROC: Mark function as interrupt function...................................................................362

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

12 Freescale Semiconductor, Inc.

Page 13: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

Chapter 10ANSI-C Frontend

10.1 Implementation Features.............................................................................................................................................363

10.1.1 Keywords...................................................................................................................................................363

10.1.2 Preprocessor Directives..............................................................................................................................364

10.1.3 Language Extensions.................................................................................................................................365

10.1.3.1 Pointer Qualifiers.....................................................................................................................365

10.1.3.2 Special Keywords....................................................................................................................366

10.1.3.3 Binary Constants (0b)..............................................................................................................366

10.1.3.4 Hexadecimal constants ($).......................................................................................................367

10.1.3.5 #warning directive....................................................................................................................367

10.1.3.6 Global Variable Address Modifier (@address).......................................................................367

10.1.3.7 Variable Allocation using @"SegmentName".........................................................................369

10.1.3.7.1 Absolute Functions.............................................................................................370

10.1.3.7.2 Absolute Variables and Linking.........................................................................370

10.1.3.8 The __far Keyword .................................................................................................................371

10.1.3.8.1 Using the __far Keyword for Pointers................................................................372

10.1.3.8.2 __far and Arrays.................................................................................................372

10.1.3.8.3 __far and typedef Names....................................................................................373

10.1.3.8.4 __far and Global Variables.................................................................................373

10.1.3.8.5 __far and C++ Classes........................................................................................375

10.1.3.8.6 __far and C++ References..................................................................................376

10.1.3.8.7 Using the __far Keyword for Functions.............................................................376

10.1.3.9 __near Keyword.......................................................................................................................377

10.1.3.10 Compatibility...........................................................................................................................378

10.1.3.11 __alignof__ keyword...............................................................................................................378

10.1.3.12 __va_sizeof__ keyword...........................................................................................................379

10.1.3.13 interrupt keyword.....................................................................................................................380

10.1.3.14 __asm Keyword.......................................................................................................................381

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 13

Page 14: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

10.1.4 Implementation-Defined Behavior............................................................................................................381

10.1.4.1 Right Shifts..............................................................................................................................381

10.1.4.2 Initialization of Aggregates with non Constants......................................................................382

10.1.4.3 Sign of char..............................................................................................................................382

10.1.4.4 Division and Modulus..............................................................................................................382

10.1.5 Translation Limitations..............................................................................................................................382

10.2 ANSI-C Standard........................................................................................................................................................385

10.2.1 Integral Promotions....................................................................................................................................385

10.2.2 Signed and Unsigned Integers....................................................................................................................385

10.2.3 Arithmetic Conversions.............................................................................................................................386

10.2.4 Order of Operand Evaluation.....................................................................................................................386

10.2.4.1 Examples of operator precedence............................................................................................387

10.2.5 Rules for Standard-Type Sizes...................................................................................................................387

10.3 Floating-Type Formats................................................................................................................................................387

10.3.1 Floating-Point Representation of 500.0 for IEEE......................................................................................388

10.3.2 Representation of 500.0 in IEEE32 Format...............................................................................................389

10.4 Volatile Objects and Absolute Variables....................................................................................................................390

10.5 Bitfields.......................................................................................................................................................................391

10.5.1 Signed Bitfields..........................................................................................................................................391

10.5.1.1 Recommendations....................................................................................................................392

10.6 Segmentation...............................................................................................................................................................392

10.7 Optimizations..............................................................................................................................................................396

10.7.1 Peephole Optimizer....................................................................................................................................396

10.7.2 Strength Reduction.....................................................................................................................................396

10.7.3 Shift Optimizations....................................................................................................................................397

10.7.4 Branch Optimizations................................................................................................................................397

10.7.5 Dead-Code Elimination..............................................................................................................................397

10.7.6 Constant-Variable Optimization................................................................................................................397

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

14 Freescale Semiconductor, Inc.

Page 15: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

10.7.7 Tree Rewriting...........................................................................................................................................398

10.7.7.1 Switch Statements....................................................................................................................398

10.7.7.2 Absolute Values.......................................................................................................................399

10.7.7.3 Combined Assignments...........................................................................................................399

10.8 Using Qualifiers for Pointers......................................................................................................................................400

10.9 Defining C Macros Containing HLI Assembler Code................................................................................................403

10.9.1 Defining a Macro.......................................................................................................................................404

10.9.2 Using Macro Parameters............................................................................................................................405

10.9.3 Using the Immediate-Addressing Mode in HLI Assembler Macros.........................................................406

10.9.4 Generating Unique Labels in HLI Assembler Macros...............................................................................406

10.9.5 Generating Assembler Include Files (-La Compiler Option).....................................................................407

10.9.5.1 General.....................................................................................................................................408

10.9.5.1.1 Example..............................................................................................................409

10.9.5.2 Macros......................................................................................................................................410

10.9.5.3 enums.......................................................................................................................................412

10.9.5.4 Types........................................................................................................................................412

10.9.5.5 Functions..................................................................................................................................414

10.9.5.6 Variables..................................................................................................................................414

10.9.5.7 Comments................................................................................................................................415

10.9.5.8 Guidelines................................................................................................................................417

Chapter 11Generating Compact Code

11.1 Compiler Options........................................................................................................................................................419

11.1.1 -Oi: Inline Functions..................................................................................................................................419

11.2 Relocatable Data.........................................................................................................................................................420

11.2.1 Using -Ostk................................................................................................................................................421

11.3 Programming Guidelines............................................................................................................................................421

11.3.1 Constant Function at a Specific Address...................................................................................................421

11.3.2 HLI Assembly............................................................................................................................................422

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 15

Page 16: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

11.3.3 Post- and Pre-Operators in Complex Expressions.....................................................................................424

11.3.3.1 Example...................................................................................................................................424

11.3.4 Boolean Types............................................................................................................................................425

11.3.5 printf() and scanf().....................................................................................................................................425

11.3.6 Bitfields......................................................................................................................................................425

11.3.7 Struct Returns.............................................................................................................................................426

11.3.8 Local Variables..........................................................................................................................................427

11.3.9 Parameter Passing......................................................................................................................................428

11.3.10 Unsigned Data Types.................................................................................................................................428

11.3.11 abs() and labs()...........................................................................................................................................428

11.3.11.1 abs() and labs().........................................................................................................................429

11.3.11.2 memcpy() and memcpy2().......................................................................................................430

11.3.12 Data Types.................................................................................................................................................431

11.3.13 Tiny or Short Segments..............................................................................................................................431

11.3.14 Qualifiers....................................................................................................................................................431

Chapter 12RS08 Backend

12.1 Non-ANSI Keywords..................................................................................................................................................433

12.2 Memory Models..........................................................................................................................................................433

12.2.1 SMALL Memory Model............................................................................................................................433

12.2.2 BANKED Memory Model.........................................................................................................................434

12.2.2.1 See also....................................................................................................................................434

12.3 Data Types..................................................................................................................................................................434

12.3.1 Scalar Types...............................................................................................................................................434

12.3.2 Floating Point Types..................................................................................................................................435

12.3.3 Pointer Types and Function Pointers.........................................................................................................435

12.3.4 Structured Types, Alignment.....................................................................................................................436

12.3.5 Bitfields......................................................................................................................................................436

12.4 Register Usage............................................................................................................................................................436

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

16 Freescale Semiconductor, Inc.

Page 17: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

12.5 Parameter Passing.......................................................................................................................................................437

12.6 Entry and Exit Code....................................................................................................................................................437

12.7 Pragmas.......................................................................................................................................................................438

12.7.1 TRAP_PROC ............................................................................................................................................438

12.7.2 NO_ENTRY...............................................................................................................................................439

12.7.3 NO_EXIT...................................................................................................................................................439

12.8 Interrupt Functions......................................................................................................................................................439

12.8.1 Interrupt Vector Table Allocation..............................................................................................................439

12.9 Segmentation...............................................................................................................................................................439

12.10 Optimizations..............................................................................................................................................................440

12.10.1 Lazy Instruction Selection.........................................................................................................................440

12.10.2 Branch Optimizations................................................................................................................................441

12.10.3 Constant Folding........................................................................................................................................441

12.10.4 Volatile Objects..........................................................................................................................................441

12.11 Programming Hints.....................................................................................................................................................441

Chapter 13High-Level Inline Assembler for the Freescale RS08

13.1 Syntax.........................................................................................................................................................................443

13.1.1 Mixing HLI Assembly and HLL................................................................................................................443

13.1.2 Example.....................................................................................................................................................444

13.1.3 C Macros....................................................................................................................................................444

13.2 Special Features..........................................................................................................................................................445

13.2.1 Caller/Callee Saved Registers....................................................................................................................445

13.2.2 Reserved Words.........................................................................................................................................445

13.2.3 Pseudo-Opcodes.........................................................................................................................................446

13.2.3.1 DC - Define constant................................................................................................................446

13.2.3.2 __RETADDR - Specify the return address location................................................................446

13.2.4 Accessing Variables...................................................................................................................................447

13.2.5 Constant Expressions.................................................................................................................................447

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 17

Page 18: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

Chapter 14ANSI-C Library Reference

Chapter 15Library Files

15.1 Directory Structure......................................................................................................................................................451

15.2 Generating a Library...................................................................................................................................................451

15.3 Common Source Files.................................................................................................................................................452

15.4 Startup Files................................................................................................................................................................452

15.5 Library Files................................................................................................................................................................453

Chapter 16Special Features

16.1 Memory Management -- malloc(), free(), calloc(), realloc(); alloc.c, and heap.c......................................................455

16.2 Signals - signal.c.........................................................................................................................................................455

16.3 Multi-byte Characters - mblen(), mbtowc(), wctomb(), mbstowcs(), wcstombs(); stdlib.c.......................................456

16.4 Program Termination - abort(), exit(), atexit(); stdlib.c..............................................................................................456

16.5 I/O - printf.c................................................................................................................................................................456

16.6 Locales - locale.*........................................................................................................................................................458

16.7 ctype............................................................................................................................................................................458

16.8 String Conversions - strtol(), strtoul(), strtod(), and stdlib.c......................................................................................458

Chapter 17Library Structure

17.1 Error Handling............................................................................................................................................................459

17.2 String Handling Functions..........................................................................................................................................459

17.3 Memory Block Functions...........................................................................................................................................460

17.4 Mathematical Functions..............................................................................................................................................460

17.5 Memory Management.................................................................................................................................................462

17.6 Searching and Sorting.................................................................................................................................................463

17.7 System Functions........................................................................................................................................................464

17.8 Time Functions...........................................................................................................................................................465

17.9 Locale Functions.........................................................................................................................................................465

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

18 Freescale Semiconductor, Inc.

Page 19: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

17.10 Conversion Functions.................................................................................................................................................465

17.11 printf() and scanf()......................................................................................................................................................466

17.12 File I/O........................................................................................................................................................................466

Chapter 18Types and Macros in Standard Library

18.1 errno.h.........................................................................................................................................................................469

18.2 float.h..........................................................................................................................................................................469

18.3 limits.h........................................................................................................................................................................470

18.4 locale.h........................................................................................................................................................................471

18.5 math.h..........................................................................................................................................................................473

18.6 setjmp.h.......................................................................................................................................................................473

18.7 signal.h........................................................................................................................................................................473

18.8 stddef.h........................................................................................................................................................................474

18.9 stdio.h..........................................................................................................................................................................474

18.10 stdlib.h.........................................................................................................................................................................475

18.11 time.h..........................................................................................................................................................................476

18.12 string.h........................................................................................................................................................................477

18.13 assert.h........................................................................................................................................................................477

18.14 stdarg.h........................................................................................................................................................................477

18.15 ctype.h.........................................................................................................................................................................478

Chapter 19Standard Functions

19.1 abort()..........................................................................................................................................................................481

19.2 abs().............................................................................................................................................................................482

19.3 acos() and acosf()........................................................................................................................................................483

19.4 asctime()......................................................................................................................................................................483

19.5 asin() and asinf().........................................................................................................................................................484

19.6 assert().........................................................................................................................................................................485

19.7 atan() and atanf().........................................................................................................................................................485

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 19

Page 20: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

19.8 atan2() and atan2f().....................................................................................................................................................486

19.9 atexit().........................................................................................................................................................................487

19.10 atof()............................................................................................................................................................................488

19.11 atoi()............................................................................................................................................................................489

19.12 atol()............................................................................................................................................................................489

19.13 bsearch()......................................................................................................................................................................490

19.14 calloc()........................................................................................................................................................................491

19.15 ceil() and ceilf()...........................................................................................................................................................492

19.16 clearerr()......................................................................................................................................................................492

19.17 clock().........................................................................................................................................................................493

19.18 cos() and cosf()...........................................................................................................................................................493

19.19 cosh() and coshf().......................................................................................................................................................494

19.20 ctime().........................................................................................................................................................................495

19.21 difftime().....................................................................................................................................................................495

19.22 div().............................................................................................................................................................................496

19.23 exit()............................................................................................................................................................................497

19.24 exp() and expf()...........................................................................................................................................................497

19.25 fabs() and fabsf().........................................................................................................................................................498

19.26 fclose()........................................................................................................................................................................499

19.27 feof()...........................................................................................................................................................................499

19.28 ferror().........................................................................................................................................................................500

19.29 fflush().........................................................................................................................................................................500

19.30 fgetc()..........................................................................................................................................................................501

19.31 fgetpos()......................................................................................................................................................................502

19.32 fgets()..........................................................................................................................................................................503

19.33 floor() and floorf().......................................................................................................................................................503

19.34 fmod() and fmodf().....................................................................................................................................................504

19.35 fopen().........................................................................................................................................................................505

19.36 fprintf()........................................................................................................................................................................506

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

20 Freescale Semiconductor, Inc.

Page 21: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

19.37 fputc()..........................................................................................................................................................................507

19.38 fputs()..........................................................................................................................................................................507

19.39 fread()..........................................................................................................................................................................508

19.40 free()............................................................................................................................................................................509

19.41 freopen()......................................................................................................................................................................509

19.42 frexp() and frexpf().....................................................................................................................................................510

19.43 fscanf()........................................................................................................................................................................510

19.44 fseek().........................................................................................................................................................................511

19.45 fsetpos().......................................................................................................................................................................512

19.46 ftell()...........................................................................................................................................................................513

19.47 fwrite()........................................................................................................................................................................513

19.48 getc()...........................................................................................................................................................................514

19.49 getchar()......................................................................................................................................................................515

19.50 getenv().......................................................................................................................................................................515

19.51 gets()...........................................................................................................................................................................515

19.52 gmtime()......................................................................................................................................................................516

19.53 isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), and isxdigit()517

19.54 labs()...........................................................................................................................................................................518

19.55 ldexp() and ldexpf()....................................................................................................................................................519

19.56 ldiv()............................................................................................................................................................................519

19.57 localeconv().................................................................................................................................................................520

19.58 localtime()...................................................................................................................................................................521

19.59 log() and logf()............................................................................................................................................................521

19.60 log10() and log10f()....................................................................................................................................................522

19.61 longjmp().....................................................................................................................................................................522

19.62 malloc().......................................................................................................................................................................523

19.63 mblen()........................................................................................................................................................................524

19.64 mbstowcs()..................................................................................................................................................................524

19.65 mbtowc().....................................................................................................................................................................525

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 21

Page 22: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

19.66 memchr().....................................................................................................................................................................526

19.67 memcmp()...................................................................................................................................................................526

19.68 memcpy() and memmove().........................................................................................................................................527

19.69 memset().....................................................................................................................................................................528

19.70 mktime()......................................................................................................................................................................529

19.71 modf() and modff().....................................................................................................................................................529

19.72 perror()........................................................................................................................................................................530

19.73 pow() and powf()........................................................................................................................................................531

19.74 printf().........................................................................................................................................................................531

19.75 putc()...........................................................................................................................................................................532

19.76 putchar()......................................................................................................................................................................533

19.77 puts()...........................................................................................................................................................................533

19.78 qsort()..........................................................................................................................................................................534

19.79 raise()..........................................................................................................................................................................535

19.80 rand()...........................................................................................................................................................................535

19.81 realloc().......................................................................................................................................................................536

19.82 remove()......................................................................................................................................................................537

19.83 rename()......................................................................................................................................................................537

19.84 rewind().......................................................................................................................................................................538

19.85 scanf().........................................................................................................................................................................539

19.86 setbuf()........................................................................................................................................................................539

19.87 setjmp().......................................................................................................................................................................540

19.88 setlocale()....................................................................................................................................................................540

19.89 setvbuf()......................................................................................................................................................................541

19.90 signal()........................................................................................................................................................................542

19.91 sin() and sinf().............................................................................................................................................................543

19.92 sinh() and sinhf().........................................................................................................................................................544

19.93 sprintf().......................................................................................................................................................................545

19.94 sqrt() and sqrtf()..........................................................................................................................................................548

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

22 Freescale Semiconductor, Inc.

Page 23: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

19.95 srand().........................................................................................................................................................................549

19.96 sscanf()........................................................................................................................................................................549

19.97 strcat().........................................................................................................................................................................552

19.98 strchr().........................................................................................................................................................................553

19.99 strcmp().......................................................................................................................................................................554

19.100 strcoll()........................................................................................................................................................................554

19.101 strcpy()........................................................................................................................................................................555

19.102 strcspn().......................................................................................................................................................................556

19.103 strerror()......................................................................................................................................................................556

19.104 strftime().....................................................................................................................................................................557

19.105 strlen().........................................................................................................................................................................558

19.106 strncat().......................................................................................................................................................................559

19.107 strncmp().....................................................................................................................................................................559

19.108 strncpy()......................................................................................................................................................................560

19.109 strpbrk().......................................................................................................................................................................561

19.110 strrchr().......................................................................................................................................................................561

19.111 strspn()........................................................................................................................................................................562

19.112 strstr()..........................................................................................................................................................................562

19.113 strtod().........................................................................................................................................................................563

19.114 strtok().........................................................................................................................................................................564

19.115 strtol()..........................................................................................................................................................................565

19.116 strtoul()........................................................................................................................................................................566

19.117 strxfrm()......................................................................................................................................................................567

19.118 system().......................................................................................................................................................................568

19.119 tan() and tanf()............................................................................................................................................................568

19.120 tanh() and tanhf()........................................................................................................................................................569

19.121 time()...........................................................................................................................................................................570

19.122 tmpfile()......................................................................................................................................................................570

19.123 tmpnam().....................................................................................................................................................................571

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 23

Page 24: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

19.124 tolower()......................................................................................................................................................................571

19.125 toupper()......................................................................................................................................................................572

19.126 ungetc().......................................................................................................................................................................572

19.127 va_arg(), va_end(), and va_start()...............................................................................................................................573

19.128 vfprintf(), vprintf(), and vsprintf()..............................................................................................................................574

19.129 wctomb().....................................................................................................................................................................575

19.130 wcstombs()..................................................................................................................................................................576

Chapter 20Appendices

Chapter 21Porting Tips and FAQs

21.1 Migration Hints...........................................................................................................................................................579

21.1.1 Porting from Cosmic..................................................................................................................................579

21.1.1.1 Getting Started.........................................................................................................................579

21.1.1.2 Cosmic Compatibility Mode Switch........................................................................................580

21.1.1.3 Assembly Equates....................................................................................................................580

21.1.1.4 Inline Assembly Identifiers......................................................................................................580

21.1.1.5 Pragma Sections.......................................................................................................................581

21.1.1.6 Inline Assembly Constants.......................................................................................................582

21.1.1.7 Inline Assembly and Index Calculation...................................................................................582

21.1.1.8 Inline Assembly and Tabs........................................................................................................583

21.1.1.9 Inline Assembly and Operators................................................................................................583

21.1.1.10 @interrupt................................................................................................................................584

21.1.1.11 Inline Assembly and Conditional Blocks.................................................................................584

21.1.1.12 Compiler Warnings..................................................................................................................585

21.1.1.13 Linker *.prm File (for the Cosmic compiler) and Linker *.prm File (for this compiler)........585

21.1.2 Allocation of Bitfields................................................................................................................................586

21.1.3 Type Sizes and Sign of char.......................................................................................................................587

21.1.4 @bool Qualifier.........................................................................................................................................587

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

24 Freescale Semiconductor, Inc.

Page 25: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

21.1.5 @tiny and @far Qualifier for Variables....................................................................................................587

21.1.6 Arrays with Unknown Size........................................................................................................................588

21.1.7 Missing Prototype......................................................................................................................................589

21.1.8 _asm("sequence").......................................................................................................................................589

21.1.9 Recursive Comments.................................................................................................................................589

21.1.10 Interrupt Function, @interrupt...................................................................................................................590

21.1.11 Defining Interrupt Functions......................................................................................................................590

21.1.11.1 Defining an Interrupt Function................................................................................................591

21.1.11.1.1 Using the TRAP_PROC Pragma........................................................................591

21.1.11.1.2 Using the interrupt keyword...............................................................................591

21.1.11.2 Initializing the Vector Table....................................................................................................592

21.1.11.2.1 Using the Linker Commands..............................................................................592

21.1.11.2.2 Using the interrupt Keyword..............................................................................592

21.1.11.3 Placing an Interrupt Function in a Special Section..................................................................593

21.1.11.3.1 Defining a Function in a Specific Segment........................................................593

21.1.11.3.2 Allocating a Segment in Specific Memory.........................................................593

21.2 General Optimization Hints........................................................................................................................................594

21.3 Frequently Asked Questions (FAQs), Troubleshooting.............................................................................................595

21.3.1 Making Applications..................................................................................................................................595

21.3.1.1 The Compiler Reports an Error, but WinEdit Does not Display it..........................................595

21.3.1.2 Some Programs Cannot Find a File.........................................................................................595

21.3.1.3 The Compiler Seems to Generate Incorrect Code...................................................................595

21.3.1.4 The code seems to be correct, but the application does not work............................................596

21.3.1.5 The linker cannot handle an object file....................................................................................596

21.3.1.6 The make Utility does not Make the entire Application..........................................................596

21.3.1.7 The make utility unnecessarily re-compiles a file...................................................................597

21.3.1.8 The help file cannot be opened by double clicking on it in the file manager or in the

explorer....................................................................................................................................597

21.3.1.9 How can constant objects be allocated in ROM?....................................................................597

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 25

Page 26: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

21.3.1.10 The compiler cannot find my source file. What is wrong?......................................................598

21.3.1.11 How can I switch off smart linking?........................................................................................598

21.3.1.12 How to avoid the `no access to memory' warning?.................................................................598

21.3.1.13 How can the same memory configuration be loaded every time the simulator or debugger

is started?..................................................................................................................................598

21.3.1.14 How can a loaded program in the simulator or debugger be started automatically and stop

at a specified breakpoint?.........................................................................................................598

21.3.1.15 How can an overview of all the compiler options be produced?.............................................599

21.3.1.16 How can a custom startup function be called after reset?........................................................599

21.3.1.17 How can a custom name for the main() function be used?......................................................599

21.3.1.18 How can the reset vector be set to the beginning of the startup code?....................................599

21.3.1.19 How can the compiler be configured for the editor?................................................................600

21.3.1.20 Where are configuration settings saved?.................................................................................600

21.3.1.21 What should be done when "error while adding default.env options" appears after starting

the compiler?............................................................................................................................600

21.3.1.22 After starting up the ICD Debugger, an "Illegal breakpoint detected" error appears. What

could be wrong?.......................................................................................................................600

21.3.1.23 Why can no initialized data be written into the ROM area?....................................................600

21.3.1.24 Problems in the communication or losing communication......................................................601

21.3.1.25 What should be done if an assertion happens (internal error)?................................................601

21.3.1.26 How to get help on an error message?.....................................................................................601

21.3.1.27 How to get help on an option?.................................................................................................601

21.4 EBNF Notation...........................................................................................................................................................601

21.4.1 Terminal Symbols......................................................................................................................................602

21.4.2 Non-Terminal Symbols..............................................................................................................................603

21.4.3 Vertical Bar................................................................................................................................................603

21.4.4 Brackets......................................................................................................................................................603

21.4.5 Parentheses.................................................................................................................................................603

21.4.6 Production End...........................................................................................................................................604

21.4.7 EBNF Syntax.............................................................................................................................................604

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

26 Freescale Semiconductor, Inc.

Page 27: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

21.4.8 Extensions..................................................................................................................................................604

21.5 Abbreviations, Lexical Conventions...........................................................................................................................605

21.6 Number Formats.........................................................................................................................................................605

21.7 Precedence and Associativity of Operators for ANSI-C............................................................................................606

21.8 List of all Escape Sequences.......................................................................................................................................607

Chapter 22Global Configuration File Entries

22.1 [Options] Section........................................................................................................................................................609

22.1.1 DefaultDir..................................................................................................................................................609

22.2 [XXX_Compiler] Section...........................................................................................................................................610

22.2.1 SaveOnExit................................................................................................................................................610

22.2.2 SaveAppearance.........................................................................................................................................610

22.2.3 SaveEditor..................................................................................................................................................610

22.2.4 SaveOptions...............................................................................................................................................611

22.2.5 RecentProject0, RecentProject1, etc..........................................................................................................611

22.2.6 TipFilePos..................................................................................................................................................611

22.2.7 ShowTipOfDay..........................................................................................................................................612

22.2.8 TipTimeStamp...........................................................................................................................................612

22.3 [Editor] Section...........................................................................................................................................................612

22.3.1 Editor_Name..............................................................................................................................................613

22.3.2 Editor_Exe.................................................................................................................................................613

22.3.3 Editor_Opts................................................................................................................................................613

22.4 Example......................................................................................................................................................................614

Chapter 23Local Configuration File Entries

23.1 Editor_Name...............................................................................................................................................................617

23.1.1 Editor_Name..............................................................................................................................................617

23.1.2 Editor_Exe.................................................................................................................................................618

23.1.3 Editor_Opts................................................................................................................................................618

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 27

Page 28: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

23.1.4 Example [Editor] Section...........................................................................................................................619

23.2 [XXX_Compiler] Section...........................................................................................................................................619

23.2.1 RecentCommandLineX..............................................................................................................................619

23.2.2 CurrentCommandLine...............................................................................................................................620

23.2.3 StatusbarEnabled........................................................................................................................................620

23.2.4 ToolbarEnabled..........................................................................................................................................621

23.2.5 WindowPos................................................................................................................................................621

23.2.6 WindowFont...............................................................................................................................................622

23.2.7 Options.......................................................................................................................................................622

23.2.8 EditorType.................................................................................................................................................622

23.2.9 EditorCommandLine..................................................................................................................................623

23.2.10 EditorDDEClientName..............................................................................................................................623

23.2.11 EditorDDETopicName...............................................................................................................................624

23.2.12 EditorDDEServiceName............................................................................................................................624

23.3 Example......................................................................................................................................................................624

Chapter 24Known C++ Issues in RS08 Compilers

24.1 Template Issues...........................................................................................................................................................627

24.2 Operators.....................................................................................................................................................................628

24.2.1 Binary Operators........................................................................................................................................630

24.2.2 Unary operators..........................................................................................................................................630

24.2.3 Equality Operators.....................................................................................................................................632

24.3 Header Files................................................................................................................................................................632

24.4 Bigraph and Trigraph Support....................................................................................................................................633

24.5 Known Class Issues....................................................................................................................................................633

24.6 Keyword Support........................................................................................................................................................636

24.7 Member Issues............................................................................................................................................................636

24.8 Constructor and Destructor Functions........................................................................................................................640

24.9 Overload Features.......................................................................................................................................................642

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

28 Freescale Semiconductor, Inc.

Page 29: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

24.10 Conversion Features....................................................................................................................................................644

24.10.1 Standard Conversion Sequences................................................................................................................644

24.10.2 Ranking implicit conversion sequences.....................................................................................................646

24.10.3 Explicit Type Conversion..........................................................................................................................647

24.11 Initialization Features..................................................................................................................................................648

24.12 Known Errors..............................................................................................................................................................649

24.13 Other Features.............................................................................................................................................................652

Chapter 25RS08 Compiler Messages

25.1 Compiler Messages.....................................................................................................................................................665

25.1.1 C1: Unknown message occurred ...............................................................................................................665

25.1.2 C2: Message overflow, skipping <kind> messages ..................................................................................665

25.1.3 C50: Input file '<file>' not found ..............................................................................................................666

25.1.4 C51: Cannot open statistic log file <file> .................................................................................................666

25.1.5 C52: Error in command line <cmd> .........................................................................................................666

25.1.6 C53: Message <Id> is not used by this version. The mapping of this message is ignored. ......................667

25.1.7 C54: Option <Option> . ............................................................................................................................667

25.1.8 C56: Option value overriden for option <OptionName>. Old value `<OldValue>', new value

`<NewValue>'. ..........................................................................................................................................668

25.1.9 C64: Line Continuation occurred in <FileName> ....................................................................................668

25.1.10 C65: Environment macro expansion message '<description>' for <variablename> .................................669

25.1.11 C66: Search path <Name> does not exist .................................................................................................670

25.1.12 C1000: Illegal identifier list in declaration ...............................................................................................670

25.1.13 C1001: Multiple const declaration makes no sense ..................................................................................670

25.1.14 C1002: Multiple volatile declaration makes no sense ..............................................................................671

25.1.15 C1003: Illegal combination of qualifiers ..................................................................................................671

25.1.16 C1004: Redefinition of storage class ........................................................................................................672

25.1.17 C1005: Illegal storage class ......................................................................................................................672

25.1.18 C1006: Illegal storage class ......................................................................................................................673

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 29

Page 30: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.19 C1007: Type specifier mismatch ..............................................................................................................673

25.1.20 C1008: Typedef name expected ................................................................................................................673

25.1.21 C1009: Invalid redeclaration .....................................................................................................................674

25.1.22 C1010: Illegal enum redeclaration ............................................................................................................674

25.1.23 C1012: Illegal local function definition ....................................................................................................675

25.1.24 C1013: Old style declaration .....................................................................................................................675

25.1.25 C1014: Integral type expected or enum value out of range ......................................................................676

25.1.26 C1015: Type is being defined ...................................................................................................................677

25.1.27 C1016: Parameter redeclaration not permitted .........................................................................................678

25.1.28 C1017: Empty declaration ........................................................................................................................678

25.1.29 C1018: Illegal type composition ...............................................................................................................679

25.1.30 C1019: Incompatible type to previous declaration ...................................................................................679

25.1.31 C1020: Incompatible type to previous declaration ...................................................................................680

25.1.32 C1021: Bit field type is not 'int' ................................................................................................................680

25.1.33 C1022: 'far' used in illegal context ............................................................................................................681

25.1.34 C1023: 'near' used in illegal context .........................................................................................................681

25.1.35 C1024: Illegal bit field width ....................................................................................................................682

25.1.36 C1025: ',' expected before '...' ....................................................................................................................682

25.1.37 C1026: Constant must be initialized .........................................................................................................683

25.1.38 C1027: Reference must be initialized .......................................................................................................683

25.1.39 C1028: Member functions cannot be initialized .......................................................................................684

25.1.40 C1029: Undefined class ............................................................................................................................684

25.1.41 C1030: Pointer to reference illegal ...........................................................................................................685

25.1.42 C1031: Reference to reference illegal .......................................................................................................685

25.1.43 C1032: Invalid argument expression ........................................................................................................685

25.1.44 C1033: Ident should be base class or data member ..................................................................................686

25.1.45 C1034: Unknown kind of linkage .............................................................................................................687

25.1.46 C1035: Friend must be declared in class declaration ................................................................................687

25.1.47 C1036: Static member functions cannot be virtual ...................................................................................688

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

30 Freescale Semiconductor, Inc.

Page 31: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.48 C1037: Illegal initialization for extern variable in block scope ................................................................688

25.1.49 C1038: Cannot be friend of myself ...........................................................................................................689

25.1.50 C1039: Typedef-name or ClassName expected ........................................................................................690

25.1.51 C1040: No valid :: classname specified ....................................................................................................690

25.1.52 C1041: Multiple access specifiers illegal ..................................................................................................691

25.1.53 C1042: Multiple virtual declaration makes no sense ................................................................................692

25.1.54 C1043: Base class already declared in base list ........................................................................................692

25.1.55 C1044: User defined Constructor is required ...........................................................................................692

25.1.56 C1045: <Special member function> not generated ...................................................................................693

25.1.57 C1046: Cannot create compiler generated <Special member="" function>=""> for nameless class .......693

25.1.58 C1047: Local compiler generated <Special member function> not supported ........................................694

25.1.59 C1048: Generate compiler defined <Special member function>...............................................................695

25.1.60 C1049: Members cannot be extern ...........................................................................................................696

25.1.61 C1050: Friend must be a class or a function .............................................................................................697

25.1.62 C1051: Invalid function body ...................................................................................................................697

25.1.63 C1052: Unions cannot have class/struct object members containing Con/Destructor/Assign-Operator ..698

25.1.64 C1053: Nameless class cannot have member functions ...........................................................................699

25.1.65 C1054: Incomplete type or function in class/struct/union ........................................................................699

25.1.66 C1055: External linkage for class members not possible .........................................................................699

25.1.67 C1056: Friend specifier is illegal for data declarations ............................................................................700

25.1.68 C1057: Wrong return type for <FunctionKind> .......................................................................................701

25.1.69 C1058: Return type for FunctionKind must be <ReturnType> ................................................................701

25.1.70 C1059: Parameter type for <FunctionKind> parameter <No> must be <Type> ......................................702

25.1.71 C1060: <FunctionKind> wrong number of parameters ............................................................................702

25.1.72 C1061: Conversion operator must not have return type specified before operator keyword ...................702

25.1.73 C1062: Delete can only be global, if parameter is (void *) ......................................................................703

25.1.74 C1063: Global or static-member operators must have a class as first parameter .....................................703

25.1.75 C1064: Constructor must not have return type .........................................................................................704

25.1.76 C1065: 'inline' is the only legal storage class for Constructors ................................................................705

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 31

Page 32: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.77 C1066: Destructor must not have return type ...........................................................................................705

25.1.78 C1067: Object is missing decl specifiers ..................................................................................................705

25.1.79 C1068: Illegal storage class for Destructor ...............................................................................................706

25.1.80 C1069: Wrong use of far/near/rom/uni/paged in local scope ...................................................................706

25.1.81 C1070: Object of incomplete type ............................................................................................................707

25.1.82 C1071: Redefined extern to static .............................................................................................................707

25.1.83 C1072: Redefined extern to static .............................................................................................................708

25.1.84 C1073: Linkage specification contradicts earlier specification ................................................................708

25.1.85 C1074: Wrong member function definition ..............................................................................................709

25.1.86 C1075: Typedef object id already used as tag ..........................................................................................710

25.1.87 C1076: Illegal scope resolution in member declaration ............................................................................710

25.1.88 C1077: <FunctionKind> must not have parameters .................................................................................711

25.1.89 C1078: <FunctionKind> must be a function .............................................................................................711

25.1.90 C1080: Constructor/destructor: Parenthesis missing ................................................................................712

25.1.91 C1081: Not a static member ......................................................................................................................713

25.1.92 C1082: <FunctionKind> must be non-static member of a class/struct .....................................................713

25.1.93 C1084: Not a member ...............................................................................................................................714

25.1.94 C1085: <ident> is not a member ...............................................................................................................714

25.1.95 C1086: Global unary operator must have one parameter .........................................................................715

25.1.96 C1087: Static unary operator must have one parameter ...........................................................................715

25.1.97 C1088: Unary operator must have no parameter ......................................................................................716

25.1.98 C1089: Global binary operator must have two parameters .......................................................................716

25.1.99 C1090: Static binary operator must have two parameters ........................................................................716

25.1.100 C1091: Binary operator must have one parameter ....................................................................................717

25.1.101 C1092: Global unary/binary operator must have one or two parameters .................................................717

25.1.102 C1093: Static unary/binary operator must have one or two parameters ...................................................717

25.1.103 C1094: Unary/binary operator must have no or one parameter ................................................................718

25.1.104 C1095: Postfix ++/-- operator must have integer parameter .....................................................................718

25.1.105 C1096: Illegal index value ........................................................................................................................718

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

32 Freescale Semiconductor, Inc.

Page 33: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.106 C1097: Array bounds missing ...................................................................................................................719

25.1.107 C1098: Modifiers for non-member or static member functions illegal ....................................................719

25.1.108 C1099: Not a parameter type ....................................................................................................................720

25.1.109 C1100: Reference to void illegal ..............................................................................................................720

25.1.110 C1101: Reference to bitfield illegal ..........................................................................................................721

25.1.111 C1102: Array of reference illegal .............................................................................................................721

25.1.112 C1103: Second C linkage of overloaded function not allowed ................................................................722

25.1.113 C1104: Bit field type is neither integral nor enum type ............................................................................722

25.1.114 C1105: Backend does not support non-int bitfields ..................................................................................723

25.1.115 C1106: Non-standard bitfield type ............................................................................................................724

25.1.116 C1107: Long long bit fields not supported yet .........................................................................................724

25.1.117 C1108: Constructor cannot have own class/struct type as first and only parameter .................................725

25.1.118 C1109: Generate call to Copy Constructor ...............................................................................................725

25.1.119 C1110: Inline specifier is illegal for data declarations .............................................................................726

25.1.120 C1111: Bitfield cannot have indirection ...................................................................................................727

25.1.121 C1112: Interrupt specifier is illegal for data declaration ..........................................................................727

25.1.122 C1113: Interrupt specifier used twice for same function ..........................................................................728

25.1.123 C1114: Illegal interrupt number ................................................................................................................728

25.1.124 C1115: Template declaration must be class or function ...........................................................................729

25.1.125 C1116: Template class needs a tag ...........................................................................................................729

25.1.126 C1117: Illegal template/non-template redeclaration .................................................................................730

25.1.127 C1118: Only bases and class member functions can be virtual ................................................................730

25.1.128 C1119: Pure virtual function qualifier should be (=0) ..............................................................................731

25.1.129 C1120: Only virtual functions can be pure ...............................................................................................732

25.1.130 C1121: Definition needed if called with explicit scope resolution ...........................................................733

25.1.131 C1122: Cannot instantiate abstract class object ........................................................................................734

25.1.132 C1123: Cannot instantiate abstract class as argument type ......................................................................736

25.1.133 C1124: Cannot instantiate abstract class as return type ............................................................................738

25.1.134 C1125: Cannot instantiate abstract class as a type of explicit conversion ................................................739

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 33

Page 34: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.135 C1126: Abstract class cause inheriting pure virtual without overriding function(s) ................................741

25.1.136 C1127: Constant void type probably makes no sense ...............................................................................742

25.1.137 C1128: Class contains private members only ...........................................................................................743

25.1.138 C1129: Parameter list missing in pointer to member function type .........................................................743

25.1.139 C1130: This C++ feature is disabled in your current cC++/EC++ configuration .....................................745

25.1.140 C1131: Illegal use of global variable address modifier ............................................................................745

25.1.141 C1132: Cannot define an anonymous type inside parentheses .................................................................746

25.1.142 C1133: Such an initialization requires STATIC CONST INTEGRAL member ......................................747

25.1.143 C1134: Static data members are not allowed in local classes ...................................................................749

25.1.144 C1135: Ignore Storage Class Specifier cause it only applies on objects ..................................................750

25.1.145 C1136: Class <Ident> is not a correct nested class of class <Ident> ........................................................751

25.1.146 C1137: Unknown or illegal segment name ...............................................................................................752

25.1.147 C1138: Illegal segment type .....................................................................................................................753

25.1.148 C1139: Interrupt routine should not have any return value nor any parameter ........................................754

25.1.149 C1140: This function is already declared and has a different prototype ...................................................756

25.1.150 C1141: Ident <ident> cannot be allocated in global register ....................................................................757

25.1.151 C1142: Invalid Cosmic modifier. Accepted: , , or (-ANSI off) ................................................................757

25.1.152 C1143: Ambiguous Cosmic space modifier. Only one per declaration allowed ......................................758

25.1.153 C1144: Multiple restrict declaration makes no sense ...............................................................................758

25.1.154 C1390: Implicit virtual function ...............................................................................................................758

25.1.155 C1391: Pseudo Base Class is added to this class ......................................................................................761

25.1.156 C1392: Pointer to virtual methods table not qualified for code address space (use -Qvtprom or -

Qvtpuni) ....................................................................................................................................................764

25.1.157 C1393: Delta value does not fit into range (option -Tvtd) ........................................................................764

25.1.158 C1395: Classes should be the same or derive one from another ..............................................................766

25.1.159 C1396: No pointer to STATIC member: use classic pointer ....................................................................770

25.1.160 C1397: Kind of member and kind of pointer to member are not compatible ...........................................772

25.1.161 C1398: Pointer to member offset does not fit into range of given type (option -Tpmo) ..........................774

25.1.162 C1400: Missing parameter name in function head ...................................................................................775

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

34 Freescale Semiconductor, Inc.

Page 35: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.163 C1401: This C++ feature has not been implemented yet ..........................................................................776

25.1.164 C1402: This C++ feature (<Feature>) is not implemented yet .................................................................776

25.1.165 C1403: Out of memory .............................................................................................................................777

25.1.166 C1404: Return expected ............................................................................................................................777

25.1.167 C1405: Goto <undeclared label>=""> in this function .............................................................................778

25.1.168 C1406: Illegal use of identifierList ...........................................................................................................778

25.1.169 C1407: Illegal function-redefinition .........................................................................................................779

25.1.170 C1408: Incorrect function-definition ........................................................................................................779

25.1.171 C1409: Illegal combination of parameterlist and identlist ........................................................................779

25.1.172 C1410: Parameter-declaration - identifier-list mismatch ..........................................................................780

25.1.173 C1411: Function-definition incompatible to previous declaration ...........................................................780

25.1.174 C1412: Not a function call, address of a function .....................................................................................780

25.1.175 C1413: Illegal label-redeclaration .............................................................................................................781

25.1.176 C1414: Casting to pointer of non base class .............................................................................................782

25.1.177 C1415: Type expected ..............................................................................................................................782

25.1.178 C1416: No initializer can be specified for arrays .....................................................................................783

25.1.179 C1417: Const/volatile not allowed for type of new operator ....................................................................783

25.1.180 C1418: ] expected for array delete operator ..............................................................................................784

25.1.181 C1419: Non-constant pointer expected for delete operator ......................................................................784

25.1.182 C1420: Result of function-call is ignored .................................................................................................785

25.1.183 C1421: Undefined class/struct/union ........................................................................................................786

25.1.184 C1422: No default Ctor available .............................................................................................................787

25.1.185 C1423: Constant member must be in initializer list ..................................................................................788

25.1.186 C1424: Cannot specify explicit initializer for arrays ................................................................................789

25.1.187 C1425: No Destructor available to call .....................................................................................................789

25.1.188 C1426: Explicit Destructor call not allowed here .....................................................................................789

25.1.189 C1427: 'this' allowed in member functions only .......................................................................................790

25.1.190 C1428: No wide characters supported ......................................................................................................790

25.1.191 C1429: Not a destructor id ........................................................................................................................791

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 35

Page 36: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.192 C1430: No destructor in class/struct declaration ......................................................................................791

25.1.193 C1431: Wrong destructor call ...................................................................................................................792

25.1.194 C1432: No valid classname specified .......................................................................................................793

25.1.195 C1433: Explicit Constructor call not allowed here ...................................................................................794

25.1.196 C1434: This C++ feature is not yet implemented .....................................................................................795

25.1.197 C1435: Return expected ............................................................................................................................795

25.1.198 C1436: delete needs number of elements of array ....................................................................................796

25.1.199 C1437: Member address expected ............................................................................................................797

25.1.200 C1438: ... is not a pointer to member ident ...............................................................................................800

25.1.201 C1439: Illegal pragma __OPTION_ACTIVE__, <Reason> ....................................................................802

25.1.202 C1440: This is causing previous message <MsgNumber> .......................................................................803

25.1.203 C1441: Constant expression shall be integral constant expression ...........................................................804

25.1.204 C1442: Typedef cannot be used for function definition ...........................................................................805

25.1.205 C1443: Illegal wide character ...................................................................................................................805

25.1.206 C1444: Initialization of <Variable> is skipped by 'case' label ..................................................................806

25.1.207 C1445: Initialization of <Variable> is skipped by 'default' label .............................................................808

25.1.208 C1800: Implicit parameter-declaration (missing prototype) for '<FuncName>' .......................................810

25.1.209 C1801: Implicit parameter-declaration for '<FuncName>' .......................................................................811

25.1.210 C1802: Must be static member .................................................................................................................812

25.1.211 C1803: Illegal use of address of function compiled under the pragma REG_PROTOTYPE ..................813

25.1.212 C1804: Ident expected ..............................................................................................................................813

25.1.213 C1805: Non standard conversion used ......................................................................................................813

25.1.214 C1806: Illegal cast-operation.....................................................................................................................814

25.1.215 C1807: No conversion to non-base class ..................................................................................................815

25.1.216 C1808: Too many nested switch-statements .............................................................................................816

25.1.217 C1809: Integer value for switch-expression expected ..............................................................................817

25.1.218 C1810: Label outside of switch-statement ................................................................................................818

25.1.219 C1811: Default-label twice defined ..........................................................................................................818

25.1.220 C1812: Case-label-value already present ..................................................................................................819

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

36 Freescale Semiconductor, Inc.

Page 37: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.221 C1813: Division by zero ...........................................................................................................................819

25.1.222 C1814: Arithmetic or pointer-expression expected ..................................................................................820

25.1.223 C1815: <Name> not declared (or typename) ............................................................................................820

25.1.224 C1816: Unknown struct- or union-member ..............................................................................................821

25.1.225 C1817: Parameter cannot be converted to non-constant reference ...........................................................821

25.1.226 C1819: Constructor call with wrong number of arguments ......................................................................822

25.1.227 C1820: Destructor call must have 'void' formal parameter list .................................................................823

25.1.228 C1821: Wrong number of arguments ........................................................................................................824

25.1.229 C1822: Type mismatch .............................................................................................................................825

25.1.230 C1823: Undefining an implicit parameter-declaration .............................................................................826

25.1.231 C1824: Indirection to different types ........................................................................................................827

25.1.232 C1825: Indirection to different types ........................................................................................................827

25.1.233 C1826: Integer-expression expected .........................................................................................................828

25.1.234 C1827: Arithmetic types expected ............................................................................................................829

25.1.235 C1828: Illegal pointer-subtraction ............................................................................................................829

25.1.236 C1829: + - incompatible Types .................................................................................................................830

25.1.237 C1830: Modifiable lvalue expected ..........................................................................................................831

25.1.238 C1831: Wrong type or not an lvalue .........................................................................................................832

25.1.239 C1832: Const object cannot get incremented ...........................................................................................832

25.1.240 C1833: Cannot take address of this object ................................................................................................833

25.1.241 C1834: Indirection applied to non-pointer ................................................................................................834

25.1.242 C1835: Arithmetic operand expected .......................................................................................................834

25.1.243 C1836: Integer-operand expected .............................................................................................................835

25.1.244 C1837: Arithmetic type or pointer expected .............................................................................................835

25.1.245 C1838: Unknown object-size: sizeof (incomplete type) ...........................................................................835

25.1.246 C1839: Variable of type struct or union expected ....................................................................................836

25.1.247 C1840: Pointer to struct or union expected ...............................................................................................836

25.1.248 C1842: [ incompatible types .....................................................................................................................836

25.1.249 C1843: Switch-expression: integer required .............................................................................................837

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 37

Page 38: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.250 C1844: Call-operator applied to non-function ..........................................................................................838

25.1.251 C1845: Constant integer-value expected ..................................................................................................838

25.1.252 C1846: Continue outside of iteration-statement .......................................................................................839

25.1.253 C1847: Break outside of switch or iteration-statement .............................................................................839

25.1.254 C1848: Return <expression> expected .....................................................................................................841

25.1.255 C1849: Result returned in void-result-function ........................................................................................841

25.1.256 C1850: Incompatible pointer operands .....................................................................................................841

25.1.257 C1851: Incompatible types .......................................................................................................................842

25.1.258 C1852: Illegal sizeof operand ...................................................................................................................842

25.1.259 C1853: Unary minus operator applied to unsigned type ...........................................................................842

25.1.260 C1854: Returning address of local variable ..............................................................................................843

25.1.261 C1855: Recursive function call .................................................................................................................844

25.1.262 C1856: Return <expression> expected .....................................................................................................845

25.1.263 C1857: Access out of range ......................................................................................................................847

25.1.264 C1858: Partial implicit parameter-declaration ..........................................................................................848

25.1.265 C1859: Indirection operator is illegal on Pointer To Member operands ..................................................848

25.1.266 C1860: Pointer conversion: possible loss of data .....................................................................................850

25.1.267 C1861: Illegal use of type 'void' ................................................................................................................851

25.1.268 C2000: No constructor available ...............................................................................................................852

25.1.269 C2001: Illegal type assigned to reference. ................................................................................................852

25.1.270 C2004: Non-volatile reference initialization with volatile illegal ............................................................853

25.1.271 C2005: Non-constant reference initialization with constant illegal ..........................................................853

25.1.272 C2006: (un)signed char reference must be const for init with char ..........................................................854

25.1.273 C2007: Cannot create temporary for reference in class/struct ..................................................................854

25.1.274 C2008: Too many arguments for member initialization ...........................................................................855

25.1.275 C2009: No call target found! ....................................................................................................................856

25.1.276 C2010: <Name> is ambiguous ..................................................................................................................856

25.1.277 C2011: <Name> can not be accessed .......................................................................................................858

25.1.278 C2012: Only exact match allowed yet or ambiguous! ..............................................................................860

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

38 Freescale Semiconductor, Inc.

Page 39: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.279 C2013: No access to special member of base class ..................................................................................861

25.1.280 C2014: No access to special member of member class ............................................................................862

25.1.281 C2015: Template is used with the wrong number of arguments ..............................................................863

25.1.282 C2016: Wrong type of template argument ................................................................................................864

25.1.283 C2017: Use of incomplete template class .................................................................................................864

25.1.284 C2018: Generate class/struct from template .............................................................................................865

25.1.285 C2019: Generate function from template ..................................................................................................865

25.1.286 C2020: Template parameter not used in function parameter list ..............................................................866

25.1.287 C2021: Generate NULL-check for class pointer ......................................................................................867

25.1.288 C2022: Pure virtual can be called only using explicit scope resolution ...................................................868

25.1.289 C2023: Missing default parameter ............................................................................................................870

25.1.290 C2024: Overloaded operators cannot have default arguments .................................................................870

25.1.291 C2025: Default argument expression can only contain static or global objects or constants ...................871

25.1.292 C2200: Reference object type must be const ............................................................................................872

25.1.293 C2201: Initializers have too many dimensions .........................................................................................872

25.1.294 C2202: Too many initializers for global Ctor arguments .........................................................................873

25.1.295 C2203: Too many initializers for Ctor arguments ....................................................................................874

25.1.296 C2204: Illegal reinitialization ...................................................................................................................876

25.1.297 C2205: Incomplete struct/union, object can not be initialized ..................................................................877

25.1.298 C2206: Illegal initialization of aggregate type ..........................................................................................877

25.1.299 C2207: Initializer must be constant ..........................................................................................................877

25.1.300 C2209: Illegal reference initialization .......................................................................................................879

25.1.301 C2210: Illegal initialization of non-aggregate type ..................................................................................880

25.1.302 C2211: Initialization of a function ............................................................................................................880

25.1.303 C2212: Initializer may be not constant .....................................................................................................880

25.1.304 C2401: Pragma <ident> expected .............................................................................................................882

25.1.305 C2402: Variable <Ident> <State> .............................................................................................................882

25.1.306 C2450: Expected: ......................................................................................................................................883

25.1.307 C2550: Too many nested scopes ...............................................................................................................884

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 39

Page 40: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.308 C2700: Too many numbers .......................................................................................................................884

25.1.309 C2701: Illegal floating-point number .......................................................................................................885

25.1.310 C2702: Number too large for float ............................................................................................................886

25.1.311 C2703: Illegal character in float number ..................................................................................................886

25.1.312 C2704: Illegal number ..............................................................................................................................887

25.1.313 C2705: Possible loss of data .....................................................................................................................887

25.1.314 C2706: Octal Number ...............................................................................................................................888

25.1.315 C2707: Number too large ..........................................................................................................................889

25.1.316 C2708: Illegal digit ...................................................................................................................................889

25.1.317 C2709: Illegal floating-point exponent ('-', '+' or digit expected) .............................................................890

25.1.318 C2800: Illegal operator .............................................................................................................................890

25.1.319 C2801: <Symbol> missing" ......................................................................................................................891

25.1.320 C2802: Illegal character found: <Character> ............................................................................................892

25.1.321 C2803: Limitation: Parser was going out of sync! ...................................................................................892

25.1.322 C2900: Constant condition found, removing loop ....................................................................................893

25.1.323 C2901: Unrolling loop ..............................................................................................................................893

25.1.324 C3000: File-stack-overflow (recursive include?) .....................................................................................894

25.1.325 C3100: Flag stack overflow -- flag ignored ..............................................................................................895

25.1.326 C3200: Source file too big ........................................................................................................................895

25.1.327 C3201: Carriage-Return without a Line-Feed was detected .....................................................................896

25.1.328 C3202: Ident too long ...............................................................................................................................896

25.1.329 C3300: String buffer overflow ..................................................................................................................897

25.1.330 C3301: Concatenated string too long ........................................................................................................897

25.1.331 C3302: Preprocessor-number buffer overflow .........................................................................................898

25.1.332 C3303: Implicit concatenation of strings ..................................................................................................899

25.1.333 C3304: Too many internal ids, split up compilation unit .........................................................................899

25.1.334 C3400: Cannot initialize object (destination too small) ............................................................................900

25.1.335 C3401: Resulting string is not zero terminated .........................................................................................900

25.1.336 C3500: Not supported fixup-type for ELF-Output occurred ....................................................................901

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

40 Freescale Semiconductor, Inc.

Page 41: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.337 C3501: ELF Error <...................................................................................................................................902

25.1.338 C3600: Function has no code: remove it! .................................................................................................902

25.1.339 C3601: Pragma TEST_CODE: mode <Mode>, size given <Size> expected <Size>, hashcode given

<HashCode>, expected <HashCode> .......................................................................................................903

25.1.340 C3602: Global objects: <Number>, Data Size (RAM): <Size>, Const Data Size (ROM): <Size> .........903

25.1.341 C3603: Static '<Function>' was not defined .............................................................................................904

25.1.342 C3604: Static '<Object>' was not referenced ............................................................................................904

25.1.343 C3605: Runtime object '<Object>' is used at PC <PC> ............................................................................905

25.1.344 C3606: Initializing object '<Object>' ........................................................................................................906

25.1.345 C3700: Special opcode too large ..............................................................................................................906

25.1.346 C3701: Too many attributes for DWARF2.0 Output ...............................................................................907

25.1.347 C3800: Segment name already used .........................................................................................................907

25.1.348 C3801: Segment already used with different attributes ............................................................................907

25.1.349 C3802: Segment pragma incorrect ............................................................................................................908

25.1.350 C3803: Illegal Segment Attribute .............................................................................................................909

25.1.351 C3804: Predefined segment '<segmentName>' used ................................................................................909

25.1.352 C3900: Return value too large ..................................................................................................................910

25.1.353 C4000: Condition always is TRUE ...........................................................................................................910

25.1.354 C4001: Condition always is FALSE .........................................................................................................912

25.1.355 C4002: Result not used .............................................................................................................................913

25.1.356 C4003: Shift count converted to unsigned char ........................................................................................913

25.1.357 C4004: BitSet/BitClr bit number converted to unsigned char ..................................................................914

25.1.358 C4006: Expression too complex ...............................................................................................................914

25.1.359 C4007: Pointer DREF is NOT allowed .....................................................................................................915

25.1.360 C4100: Converted bit field signed -1 to 1 in comparison .........................................................................916

25.1.361 C4101: Address of bitfield is illegal .........................................................................................................917

25.1.362 C4200: Other segment than in previous declaration .................................................................................918

25.1.363 C4201: pragma <name> was not handled .................................................................................................918

25.1.364 C4202: Invalid pragma OPTION, .............................................................................................................919

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 41

Page 42: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.365 C4203: Invalid pragma MESSAGE, <description> ..................................................................................920

25.1.366 C4204: Invalid pragma REALLOC_OBJ, ................................................................................................920

25.1.367 C4205: Invalid pragma LINK_INFO, <description> ...............................................................................921

25.1.368 C4206: pragma pop found without corresponding pragma push ..............................................................921

25.1.369 C4207: Invalid pragma pop, <description> ..............................................................................................921

25.1.370 C4208: Invalid pragma push, <description> .............................................................................................922

25.1.371 C4209: Usage: pragma align (on|off).........................................................................................................922

25.1.372 C4300: Call of an empty function removed ..............................................................................................922

25.1.373 C4301: Inline expansion done for function call ........................................................................................923

25.1.374 C4302: Could not generate inline expansion for this function call ...........................................................924

25.1.375 C4303: Illegal pragma <name> .................................................................................................................925

25.1.376 C4400: Comment not closed .....................................................................................................................926

25.1.377 C4401: Recursive comments not allowed .................................................................................................926

25.1.378 C4402: Redefinition of existing macro '<MacroName>' ..........................................................................927

25.1.379 C4403: Macro-buffer overflow .................................................................................................................928

25.1.380 C4404: Macro parents not closed ..............................................................................................................928

25.1.381 C4405: Include-directive followed by illegal symbol ...............................................................................929

25.1.382 C4406: Closing '>' missing .......................................................................................................................929

25.1.383 C4407: Illegal character in string or closing '>' missing ...........................................................................930

25.1.384 C4408: Filename too long .........................................................................................................................930

25.1.385 C4409: a ## b: the concatenation of a and b is not a legal symbol ...........................................................931

25.1.386 C4410: Unbalanced Parentheses ...............................................................................................................931

25.1.387 C4411: Maximum number of arguments for macro expansion reached ...................................................932

25.1.388 C4412: Maximum macro expansion level reached ...................................................................................932

25.1.389 C4413: Assertion: pos failed .....................................................................................................................933

25.1.390 C4414: Argument of macro expected .......................................................................................................933

25.1.391 C4415: ')' expected ....................................................................................................................................934

25.1.392 C4416: Comma expected ..........................................................................................................................935

25.1.393 C4417: Mismatch number of formal, number of actual parameters .........................................................935

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

42 Freescale Semiconductor, Inc.

Page 43: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.394 C4418: Illegal escape sequence ................................................................................................................936

25.1.395 C4419: Closing ì missing ..........................................................................................................................937

25.1.396 C4420: Illegal character in string or closing " missing .............................................................................938

25.1.397 C4421: String too long ..............................................................................................................................938

25.1.398 C4422: ' missing ........................................................................................................................................938

25.1.399 C4423: Number too long ...........................................................................................................................939

25.1.400 C4424: # in substitution list must be followed by name of formal parameter ..........................................939

25.1.401 C4425: ## in substitution list must be preceded and followed by a symbol .............................................940

25.1.402 C4426: Macro must be a name .................................................................................................................941

25.1.403 C4427: Parameter name expected .............................................................................................................941

25.1.404 C4428: Maximum macro arguments for declaration reached ...................................................................942

25.1.405 C4429: Macro name expected ...................................................................................................................942

25.1.406 C4430: Include macro does not expand to string ......................................................................................943

25.1.407 C4431: Include "filename" expected ........................................................................................................943

25.1.408 C4432: Macro expects '(' ...........................................................................................................................943

25.1.409 C4433: Defined <name> expected ............................................................................................................944

25.1.410 C4434: Closing ')' missing ........................................................................................................................944

25.1.411 C4435: Illegal expression in conditional expression ................................................................................945

25.1.412 C4436: Name expected .............................................................................................................................945

25.1.413 C4437: Error-directive found: <message> ................................................................................................946

25.1.414 C4438: Endif-directive missing ................................................................................................................946

25.1.415 C4439: Source file <file> not found .........................................................................................................947

25.1.416 C4440: Unknown directive: <directive> ...................................................................................................947

25.1.417 C4441: Preprocessor output file <file> could not be opened ....................................................................947

25.1.418 C4442: Endif-directive missing ................................................................................................................948

25.1.419 C4443: Undefined Macro 'MacroName' is taken as 0 ...............................................................................948

25.1.420 C4444: Line number for line directive must be > 0 and <= 32767 ...........................................................951

25.1.421 C4445: Line numberfor line directive expected .......................................................................................951

25.1.422 C4446: Missing macro argument(s) ..........................................................................................................952

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 43

Page 44: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.423 C4447: Unexpected tokens following preprocessor directive - expected a newline ................................953

25.1.424 C4448: Warning-directive found: <message> ..........................................................................................953

25.1.425 C4449: Exceeded preprocessor if level of 4092 .......................................................................................954

25.1.426 C4700: Illegal pragma TEST_ERROR .....................................................................................................954

25.1.427 C4701: pragma TEST_ERROR: Message <ErrorNumber> did not occur ...............................................955

25.1.428 C4800: Implicit cast in assignment ...........................................................................................................955

25.1.429 C4801: Too many initializers ....................................................................................................................955

25.1.430 C4802: String-initializer too large ............................................................................................................956

25.1.431 C4900: Function differs in return type only ..............................................................................................956

25.1.432 C5000: Following condition fails: sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <=

sizeof(long long) .......................................................................................................................................956

25.1.433 C5001: Following condition fails: sizeof(float) <= sizeof(double) <= sizeof(long double) <=

sizeof(long long double) ...........................................................................................................................957

25.1.434 C5002: Illegal type ....................................................................................................................................958

25.1.435 C5003: Unknown array-size .....................................................................................................................958

25.1.436 C5004: Unknown struct-union-size ..........................................................................................................958

25.1.437 C5005: PACE illegal type .........................................................................................................................958

25.1.438 C5006: Illegal type settings for HIWARE Object File Format ................................................................959

25.1.439 C5100: Code size too large .......................................................................................................................960

25.1.440 C5200: 'FileName' file not found ..............................................................................................................960

25.1.441 C5250: Error in type settings: <Msg> .......................................................................................................961

25.1.442 C5300: Limitation: code size '<actualSize>' > '<limitSize>' bytes ...........................................................961

25.1.443 C5302: Couldn't open the object file <Descr> ..........................................................................................961

25.1.444 C5320: Cannot open logfile '<FileName>' ...............................................................................................962

25.1.445 C5350: Wrong or invalid encrypted file '<File>' (<MagicValue>) ..........................................................962

25.1.446 C5351: Wrong encryption file version: '<File>' (<Version>) ..................................................................963

25.1.447 C5352: Cannot build encryption destination file: '<FileSpec>' ................................................................963

25.1.448 C5353: Cannot open encryption source file: '<File>' ...............................................................................964

25.1.449 C5354: Cannot open encryption destination file: '<File>' ........................................................................964

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

44 Freescale Semiconductor, Inc.

Page 45: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.450 C5355: Encryption source '<SrcFile>' and destination file '<DstFile>' are the same ...............................964

25.1.451 C5356: No valid license for encryption support .......................................................................................965

25.1.452 C5650: Too many locations, try to split up function.................................................................................965

25.1.453 C5651: Local variable <variable> may be not initialized..........................................................................965

25.1.454 C5661: Not all control paths return a value...............................................................................................967

25.1.455 C5662: Generic Inline Assembler Error <string>......................................................................................968

25.1.456 C5663: Instruction or runtime call <Instruction> produces <Size> bytes of code....................................968

25.1.457 C5664: Instruction or runtime call <Instruction> executes in <Cycles> cycles........................................968

25.1.458 C5680: HLI Error <Detail>........................................................................................................................969

25.1.459 C5681: Unexpected Token.........................................................................................................................969

25.1.460 C5682: Unknown fixup type......................................................................................................................969

25.1.461 C5683: Illegal directive <Ident> ignored...................................................................................................970

25.1.462 C5684: Instruction or label expected.........................................................................................................970

25.1.463 C5685: Comment or end of line expected.................................................................................................970

25.1.464 C5686: Undefined label <Ident>................................................................................................................970

25.1.465 C5687: Label <Ident> defined more than once.........................................................................................971

25.1.466 C5688: Illegal operand...............................................................................................................................971

25.1.467 C5689: Constant or object expected..........................................................................................................972

25.1.468 C5690: Illegal fixup for constant...............................................................................................................972

25.1.469 C5691: Instruction operand mismatc.........................................................................................................972

25.1.470 C5692: Illegal fixup...................................................................................................................................973

25.1.471 C5693: Cannot generate code for <Error>.................................................................................................973

25.1.472 C5700: Internal Error <ErrorNumber> in '<Module>', please report to <Producer> ...............................973

25.1.473 C5701: Internal Error #<ErrorNumber> in '<Module>' while compiling file '<File>, procedure

'<Function>', please report to <Producer> ................................................................................................974

25.1.474 C5702: Local variable '<Variable>' declared in function '<Function>' but not referenced ......................975

25.1.475 C5703: Parameter '<Parameter>' declared in function '<Function>' but not referenced ..........................975

25.1.476 C5800: User requested stop ......................................................................................................................976

25.1.477 C5900: Result is zero ................................................................................................................................976

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 45

Page 46: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.478 C5901: Result is one .................................................................................................................................977

25.1.479 C5902: Shift count is zero .........................................................................................................................977

25.1.480 C5903: Zero modulus ................................................................................................................................977

25.1.481 C5904: Division by one ............................................................................................................................978

25.1.482 C5905: Multiplication with one ................................................................................................................978

25.1.483 C5906: Subtraction with zero ...................................................................................................................979

25.1.484 C5907: Addition replaced with shift .........................................................................................................979

25.1.485 C5908: Constant switch expression ..........................................................................................................980

25.1.486 C5909: Assignment in condition ...............................................................................................................980

25.1.487 C5910: Label removed ..............................................................................................................................981

25.1.488 C5911: Division by zero at runtime ..........................................................................................................982

25.1.489 C5912: Code in 'if' and 'else' part are the same .........................................................................................982

25.1.490 C5913: Conditions of 'if' and 'else if' are the same ...................................................................................983

25.1.491 C5914: Conditions of 'if' and 'else if' are inverted ....................................................................................984

25.1.492 C5915: Nested 'if' with same conditions ...................................................................................................985

25.1.493 C5916: Nested 'if' with inverse conditions ................................................................................................986

25.1.494 C5917: Removed dead assignment ...........................................................................................................987

25.1.495 C5918: Removed dead goto ......................................................................................................................987

25.1.496 C5919: Conversion of floating to unsigned integral .................................................................................988

25.1.497 C5920: Optimize library function <function> ..........................................................................................989

25.1.498 C5921: Shift count out of range ................................................................................................................989

25.1.499 C6000: Creating Asm Include File <file> .................................................................................................990

25.1.500 C6001: Could not Open Asm Include File because of <reason> ..............................................................990

25.1.501 C6002: Illegal pragma CREATE_ASM_LISTING because of <reason> ................................................991

25.1.502 C10000: Nothing more expected...............................................................................................................991

25.1.503 C10010: Symbol reserved..........................................................................................................................992

25.1.504 C10011: ':' expected to delimit label..........................................................................................................992

25.1.505 C10012: Label multiply defined................................................................................................................993

25.1.506 C10013: Label '%s' is undefined................................................................................................................993

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

46 Freescale Semiconductor, Inc.

Page 47: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Section number Title Page

25.1.507 C10020: Illegal constant value...................................................................................................................994

25.1.508 C10021: ')' expected to close parenthesis...................................................................................................994

25.1.509 C10022: Constant expression expected.....................................................................................................995

25.1.510 C10023: '(' expected to open parenthesis...................................................................................................995

25.1.511 C10024: Size is not valid...........................................................................................................................995

25.1.512 C10025: Cast size is too large....................................................................................................................996

25.1.513 C10026: Undefined field............................................................................................................................996

25.1.514 C10027: Identifier expected.......................................................................................................................997

25.1.515 C10028: Corrupted array...........................................................................................................................997

25.1.516 C10029: ']' expected to close brackets.......................................................................................................998

25.1.517 C10030: Offset out of Object.....................................................................................................................998

25.1.518 C10031: C type is expected.......................................................................................................................999

25.1.519 C10032: Integer type is expected...............................................................................................................999

25.1.520 C10033: '*' expected to have generic pointer............................................................................................1000

25.1.521 C10034: C or user type expected...............................................................................................................1000

25.1.522 C10035: C object is expected.....................................................................................................................1001

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 47

Page 48: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

48 Freescale Semiconductor, Inc.

Page 49: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 1Overview

The RS08 Build Tools Reference Manual for Microcontrollers describes the ANSI-C/C++ Compiler used for the Freescale 8-bit MCU (Microcontroller Unit) chip series.

NOTEThe technical notes and application notes are available in thislocation, <CWInstallDir>\MCU\Help\PDF, where CWInstallDir isthe directory in which the CodeWarrior software is installed.

This document contains these major sections:

• Using Compiler : Describes how to run the Compiler• ANSI-C Library Reference : Describes how the Compiler uses the ANSI-C library• Appendices : Lists FAQs, Troubleshooting, and Technical Notes

1.1 Accompanying Documentation

The Documentation page describes the documentation included in the CodeWarriorDevelopment Studio for Microcontrollers v10.x. You can access the Documentation by:

• opening the START_HERE.html in <CWInstallDir>\MCU\Help folder,• selecting Help > Documentation from the IDE's menu bar, or selecting the Start >

Programs > Freescale CodeWarrior > CW for MCU v10.x > Documentationfrom the Windows taskbar.

NOTETo view the online help for the CodeWarrior tools, firstselect Help > Help Contents from the IDE's menu bar.Next, select required manual from the Contents list. Forgeneral information about the CodeWarrior IDE and

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 49

Page 50: CodeWarrior Development Studio for Microcontrollers V10.x RS08

debugger, refer to the CodeWarrior Common FeaturesGuide in this folder: <CWInstallDir>\MCU\Help\PDF

1.2 Additional Information Resources

Refer to the documentation listed below for details about programming languages.

• American National Standard for Programming Languages - C, ANSI/ISO 9899-1990(see ANSI X3.159-1989, X3J11)

• The C Programming Language, second edition, Prentice-Hall 1988• C: A Reference Manual, second edition, Prentice-Hall 1987, Harbison and Steele• C Traps and Pitfalls, Andrew Koenig, AT&T Bell Laboratories, Addison-Wesley

Publishing Company, Nov. 1988, ISBN 0-201-17928-8• Data Structures and C Programs, Van Wyk, Addison-Wesley 1988• How to Write Portable Programs in C, Horton, Prentice-Hall 1989• The UNIX Programming Environment, Kernighan and Pike, Prentice-Hall 1984• The C Puzzle Book, Feuer, Prentice-Hall 1982• C Programming Guidelines, Thomas Plum, Plum Hall Inc., Second Edition for

Standard C, 1989, ISBN 0-911537-07-4• DWARF Debugging Information Format, UNIX International, Programming

Languages SIG, Revision 1.1.0 (October 6, 1992), UNIX International, WaterviewCorporate Center, 20 Waterview Boulevard, Parsippany, NJ 07054

• DWARF Debugging Information Format, UNIX International, ProgrammingLanguages SIG, Revision 2.0.0 (July 27, 1993), UNIX International, WaterviewCorporate Center, 20 Waterview Boulevard, Parsippany, NJ 07054

• System V Application Binary Interface, UNIX System V, 1992, 1991 UNIX SystemsLaboratories, ISBN 0-13-880410-9

• Programming Microcontroller in C, Ted Van Sickle, ISBN 1878707140• C Programming for Embedded Systems, Kirk Zurell, ISBN 1929629044• Programming Embedded Systems in C and C ++, Michael Barr, ISBN 1565923545• Embedded C, Michael J. Pont, ISBN 020179523X

Additional Information Resources

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

50 Freescale Semiconductor, Inc.

Page 51: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 2Using Compiler

This section consists of the following chapters that describe the use and operation of thecompiler:

• Introduction : Describes the CodeWarrior Development Studio and the compiler.• Graphical User Interface : Describes the compiler's GUI.• Environment : Describes all the environment variables.• Files : Describes how the compiler processes input and output files.• Compiler Options : Describes the full set of compiler options.• Compiler Predefined Macros : Lists all macros predefined by the compiler.• Compiler Pragmas : Lists the available pragmas.• ANSI-C Frontend : Describes the ANSI-C implementation.• Generating Compact Code : Describes the programming guidelines for the developer

to produce compact and efficient code.• RS08 Backend : Describes the code generator and basic type implementation, also

information about hardware-oriented programming (optimizations, interrupt, andfunctions) specific for RS08.

• High-Level Inline Assembler for the Freescale RS08 : Describes the HLI Assemblerfor the RS08 compiler.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 51

Page 52: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

52 Freescale Semiconductor, Inc.

Page 53: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 3IntroductionThis chapter describes the RS08 Compiler that is part of the CodeWarrior DevelopmentStudio for Microcontrollers V10.x. The Compiler consists of a Frontend, which islanguage-dependent, and a Backend, which is hardware-dependent and generates objectcode specific to RS08. Chapters one and two describe the configuration and creation ofprojects that target RS08 microcontrollers. Subsequent chapters describe the Compiler ingreater detail.

This chapter consists of the following topics:

• Compiler Environment• Creating and Managing Project Using CodeWarrior IDE• Using Standalone Compiler• Build Tools (Application Programs)• Startup Command-Line Options• Highlights• CodeWarrior Integration of Build Tools• Integration into Microsoft Visual C++ 2008 Express Edition (Version 9.0 or later)• Object-File Formats

3.1 Compiler Environment

Use the Compiler alone or as a transparent, integral part of the CodeWarriorDevelopment Studio. Create and compile functional projects in minimal time using theEclipse Integrated Development Environment (IDE), or configure the compiler and use itas a standalone application in a suite of Build Tool utilities. The Build Tool utilitiesinclude the Linker, Assembler, ROM Burner, Simulator, and Debugger.

In general, a compiler t ranslates source code, such as C source code files ( *.c) andheader ( *.h) files, into object code ( *.obj and *.o) files for further processing by aLinker. The *.c files contain the programming code for the project's application. The *.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 53

Page 54: CodeWarrior Development Studio for Microcontrollers V10.x RS08

files either contain data specifically targeted to a particular microcontroller or arefunction-interface files. The Linker, under the command of a linker command file, usesthe object-code file to directly generate absolute ( *.abs) files. The Burner uses the *.absfiles to produce S-record ( *.s19 or *.sx) files for programming the ROM.

For information about mixing the assembly and C source code in a single project, refer tothe High-Level Inline Assembler for the Freescale RS08 chapter.

The typical configuration of the Compiler is its association with a Project Directory andan Editor. A project directory contains all of the environment files required to configureyour development environment and editor allows to write or modify your source files.

NOTEFor information about the other Build Tools, refer to the UserGuides located at, <CWInstallDir>\MCU\Helpwhere, CWInstallDir isthe directory in which the CodeWarrior software is installed.

3.1.1 Designing a Project

There are three methods of designing a project.

• Use CodeWarrior IDE to coordinate and manage the entire project ( Creating andManaging Project Using CodeWarrior IDE),

• Begin project construction with CodeWarrior IDE and use the standalone build toolsto complete the project ( Using Standalone Compiler),

• Start from scratch, make your project configuration ( *.ini) and layout files for usewith the Build Tools ( Build Tools (Application Programs)).

NOTEThe Build Tools (including Assembler, Compiler, Linker,Simulator/Debugger, and others) are a part of theCodeWarrior Suite and are located in the prog folder in theCodeWarrior installation directory. The default locationthis folder is: C:\Freescale\CW MCU V10.x\MCU\prog

3.2 Creating and Managing Project Using CodeWarrior IDE

You can create a Microcontrollers project and generate the basic project files using theNew Bareboard Project wizard in the CodeWarrior IDE.

Creating and Managing Project Using CodeWarrior IDE

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

54 Freescale Semiconductor, Inc.

Page 55: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can use the CodeWarrior Projects view in the CodeWarrior IDE to manage files inthe project.

3.2.1 Creating Project Using New Bareboard Project Wizard

The steps below create an example Microcontrollers project that uses C language for itssource code.

1. Select Start > Programs > Freescale CodeWarrior > CW for MCU v10.x >CodeWarrior.

The Workspace Launcher dialog box appears. The dialog box displays the defaultworkspace directory. For this example, the default workspace is workspace_MCU.

2. Click OK to accept the default location. To use a workspace different from thedefault, click Browse and specify the desired workspace.

The Microcontrollers V10.x launches.

3. Select File > New > Bareboard Project from the IDE menu bar.

The Create an MCU Bareboard Project page of the New Bareboard Projectwizard appears.

4. Specify a name for the new project. For example, enter the project name as Project1.5. Click Next.

The Devices page displaying the supported Microcontrollers appears.

6. Select the desired CPU derivative for the project. For this example, select RS08>RS08KA Family> MC9RS08KA1.

NOTEBased on the derivative selected in the Devices page, thestep numbering in the page title varies.

7. Click Next.

The Connections page appears.

8. Check the option(s) to specify the hardware probe that you want to use to connect theworkstation to the hardware target. By default, only the P&E USB MultiLinkUniversal [FX] / USB Multilink is selected.

9. Click Next.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 55

Page 56: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Languages page appears.

10. From the Languages options, check C. (This is the default setting).

NOTETo enable the Absolute Assembly checkbox, clear the Cand Relocatable Assembly checkboxes. This is becauseyou cannot mix the absolute and relocatable assembly codein a program. Since the C and C++ compilers generaterelocatable assembly, they must be cleared to allow the useof absolute assembly.

11. Click Next.

The Rapid Application Development page appears.

12. Select the appropriate rapid application development tool.13. Click Next.

The C/C++ Options page appears.

14. Select Small memory model for memory model, Nonefor the floating-point numbersformat, and ANSI startup code for the level of startup code.

NOTEThese three are the default selections and are the routineentries for an ANSI-C project. Floating point numbersimpose a severe performance penalty, so use the integernumber format whenever possible.

NOTEIf you intend to use the flexible type management option ( -T), choose minimal startup code instead of ANSI startupcode. The ANSI C-compliant startup code does not support8-bit int.

15. Click Finish.

The Project1 project appears in the CodeWarrior Projects view in the Workbenchwindow.

The wizard automatically generates the startup and initialization files for the specificmicrocontroller derivative, and assigns the entry point into your ANSI-C project (themain() function).

Creating and Managing Project Using CodeWarrior IDE

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

56 Freescale Semiconductor, Inc.

Page 57: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEFor detailed descriptions of the options available in the NewBareboard Project wizard pages, refer to the MicrocontrollersV10.x Targeting Manual.

By default, the project is not built. To do so, select Project > Build Project from the IDEmenu bar. Expand Project1 in the CodeWarrior Projects view to view its supportingdirectories and files.

NOTETo configure the IDE, so that it automatically builds the projectwhen a project is created, select Window > Preferences toopen the Preferences window. Expand the General node andselect Workspace. In the Workspace panel, check the Buildautomatically checkbox and click OK.

Figure 3-1. CodeWarrior Projects View - Displaying Project1

NOTEThe contents of the project directory vary depending upon theoptions selected while creating the project.

The view displays the logical arrangement of the files in the Project1 project directory. Atthis stage, you can safely close the project and reopen it later, if desired.

The following is the list of default groups and files displayed in the CodeWarriorProjects view.

• Binaries is a link to the generated binary ( .abs) files.• FLASH is the directory that contains all of the files used to build the application for

Project1. This includes the source, header, generated binary files, the makefiles thatmanage the build process, and the build settings.

• Lib is the directory that contains a C source code file that describes the chosen MCUderivative's registers and the symbols used to access them.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 57

Page 58: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Project_Headers is the directory that contains any Microcontrollers-specific headerfiles.

• Project_Settings group contains the Debugger folder, Linker_Files folder and theStartup_Code folder. The Debugger folder contains any initialization and memoryconfiguration files that prepare the hardware target for debugging. It also stores thelaunch configuration used for the debugging session. The Linker_Files folder storesthe linker command file ( .prm) and the burner command file ( .bbl). The Startup_Codefolder has a C file that initializes the Microcontrollers stack and critical registerswhen the program launches.

• Sources contains the source code files for the project. For this example, the wizard hascreated only main.c, which contains the main() function.

Examine the project folder that the IDE generates when you create the project. To do so,right-click on the project's name ( Project1 : FLASH) in the CodeWarriorProjects view,and select Show In Windows Explorer . Windows displays the Eclipse workspacefolder, along with the project folder, Project1, within it, as the following image shows:

Figure 3-2. Contents of Project1 Directory

These are the actual folders and files generated for your project. When working withstandalone tools, you may need to specify the paths to these files, so you should knowtheir locations.

There are some files, .cproject, .cwGeneratedFilesLog, and .project, that store criticalinformation about the project's state. The CodeWarrior Projects view does not displaythese files, but they should not be deleted.

Creating and Managing Project Using CodeWarrior IDE

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

58 Freescale Semiconductor, Inc.

Page 59: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.2.2 Analysis of Groups in CodeWarrior Projects View

In the CodeWarrior Projects view, the project files are distributed into five majorgroups, each with their own folder within the Project1 folder.

The default groups and their usual functions are:

• FLASH

The FLASH group contains all of the files that CodeWarrior uses to build the program.It also stores any files generated by the build process, such as any binaries ( .o, .obj,and .abs), and a map file ( .map). CodeWarrior uses this directory to manage the buildprocess, so you should not tamper with anything in this directory. This directory'sname is based on the build configuration, so if you switch to a different buildconfiguration, its name changes.

• Lib

The Lib group contains the C-source code file for the chosen Microcontrollersderivative. For this example, the MC9RS08KA1.C file supports the MC9RS08KA1 derivative.This file defines symbols that you use to access the Microcontrollers registers andbits within a register. It also defines symbols for any on-chip peripherals and theirregisters. After the first build, you can expand this file to see all of the symbols that itdefines.

• Project_Headers

The Project_Headers group contains the derivative-specific header files required by theMicrocontrollers derivative file in the Lib group.

• Project_Settings

The Project_Settings group consists of the following sub-folders:

• Debugger

This group contains the files used to manage a debugging session. These are thedebug launch configuration ( .launch), a memory configuration file ( .mem) for thetarget hardware, plus any Tcl script files ( .tcl).

• Linker_Files

This group contains the burner file ( .bbl), and the linker command file ( .prm).

• Startup_Code

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 59

Page 60: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This group contains the source code that manages the MCU's initialization andstartup functions. For RS08 derivatives, these functions appear in the source filestart08.c.

• Sources

This group contains the C source code files. The New Bareboard Project wizardgenerates a default main.c file for this group. You can add your own source files tothis folder. You can double-click on these files to open them in the IDE's editor. Youcan right-click on the source files and select Exclude from Build to prevent the buildtools from compiling them.

3.2.3 Analysis of Files in CodeWarrior Projects View

Expand the groups by clicking your mouse in the CodeWarrior Projects view to displayall the default files generated by the New Bareboard Project wizard.

The wizard generates following three C source c ode files, located in their respectivefolders in the project directory:

• main.c,

located in <project_directory>\ Sources

• start08.c, and

located in <project_directory>\ Project_Settings\Startup_Code

• mc9rs08ka1.c

located in <project_directory>\ Lib

At this time, the project should be configured correctly and the source code should befree of syntactical errors. If the project has been built earlier, you should see a link to theproject's binary files, and the FLASH folder present in the CodeWarrior Projects view.

To understand what the IDE does while building a project, clean the project and build theproject again:

1. Select Project > Clean from the IDE menu bar.

The Clean dialog box appears.

Creating and Managing Project Using CodeWarrior IDE

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

60 Freescale Semiconductor, Inc.

Page 61: CodeWarrior Development Studio for Microcontrollers V10.x RS08

2. Select the Clean projects selected below option and check the project you want tobuild again.

3. Clear the Start a build immediately checkbox, if you want to build the projectmanually after cleaning.

Figure 3-3. Clean Dialog Box4. Click OK.

The Binaries link disappears, and the FLASH folder is deleted.

5. To build the project, right-click the project and select Build Project.

The Console view displays the statements that direct the build tools to compile and linkthe project. The Binaries link appears, and so does the FLASH folder.

During a project build, the C source code is compiled, the object files are linked together,and the CPU derivative's ROM and RAM area are allocated by the linker according to thesettings in the linker command file. When the build is complete, the FLASH folder containsthe Project1.abs file.

The Linker Map file, Project1.map, file indicates the memory areas allocated for theprogram and contains other useful information.

To examine the source file, main.c, double click on the main.c file in the Sources group.

The IDE editor opens the default main.c file in the editor area.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 61

Page 62: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-4. Default main.c File

Use the integrated editor to write your C source files ( *.c and *.h) and add them to yourproject. During development, you can test your source code by building and simulating/debugging your application.

The Graphical User Interface chapter provides information about configuring the optionsfor the Compiler and other Build Tools, as well as information about feedback messages.

3.3 Using Standalone Compiler

You can use the RS08 compiler as a standalone compiler. This tutorial does not create anentire project with the Build Tools, but instead uses parts of a project already created bythe CodeWarrior New Bareboard Project wizard.

NOTEAlthough it is possible to create and configure a project fromscratch using the standalone Build Tools, it is easier and fasterto create, configure, and manage your project using theCodeWarrior Projects wizard.

3.3.1 Configuring Compiler

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

62 Freescale Semiconductor, Inc.

Page 63: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Build tools use a tool directory for configuring and locating its generated files. ForMicrocontrollers V10.x build tools, the tool directory is the prog folder, and is located inthe CWInstallDir\MCU folder, where CWInstallDir is the directory in which theCodeWarrior software is installed.

A build tool such as the Compiler requires information from configuration files. Thereare two types of configuration data:

• Global

Global data is common to all build tools and projects, and includes data for eachbuild tool, such as the directory path for recent project listings. All tools may storesome global data in a mcutools.ini file. Each tool looks for this file in the tooldirectory first, then in the Microsoft Windows installation directory (for example, C:\WINDOWS). The following listing lists the typical locations for a global configurationfile.

Listing: Typical Locations for a Global Configuration File

<CWInstalldir>\MCU\prog\mcutools.ini - #1 priority C:\WINDOWS\mcutools.ini - used if there is no mcutools.ini file above

The Compiler uses the initialization file in the prog folder if you start the tool fromthe prog folder. That is:

<CWInstallDir>MCU\prog\mcutools.ini

The compiler uses the initialization file in the Windows directory if the tool is startedoutside the prog folder. That is, the tool uses C:\WINDOWS\mcutools.ini.

For information about entries for the global configuration file, refer to the GlobalConfiguration File Entries topic in the Appendices.

• Local

Local data files can be used by any build tool for a particular project. These files aretypically stored in a project folder. For information about local configuration fileentries, refer to the Local Configuration File Entries topic in the Appendices.

To configure the Compiler, proceed as follows:

1. Double-click crs08.exe, which is located in the <CWInstallDir>\MCU\prog folder.2. The RS08 Compiler window appears.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 63

Page 64: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-5. RS08 Compiler Window3. Read the tips, if you want to, and then click Close.

The Tip of the Day dialog box closes.

4. Select File > New / Default Configuration from the RS08 Compiler window menubar.

NOTEYou can also use an existing configuration file if youdesire. Use File > Load Configuration to open and readthe configuration file.

5. Select File > Save Configuration (or Save Configuration As).

The Saving Configuration as dialog box appears.

6. Browse and select the folder where you want to save the configuration. In thisexample, folder X15 is used to save the configuration.

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

64 Freescale Semiconductor, Inc.

Page 65: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-6. Saving Configuration as Dialog Box7. Click Save.

The folder becomes the project directory. The project directory folder is oftenreferred to as the current directory.

Figure 3-7. Compiler's Current Directory Switches to your Project Directory

The project directory folder now contains the newly-created project.ini configurationfile. The project configuration file contains a copy of the [CRS08_Compiler] portion ofthe project.ini file in the build tools prog folder. If a build tool modifies any projectoption, the changes are specified in appropriate section of the project configurationfile.

NOTEOption changes made to the project.ini file in the progfolder apply to all projects. Recall that this file stores theglobal tool options.

8. Select Compiler > Options > Options from the RS08 Compiler window menu bar.

The compiler displays the RS08 Compiler Option Settings dialog box.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 65

Page 66: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-8. RS08 Compiler Option Settings Dialog Box9. Select the Output tab.

10. Check the Generate Listing Filecheckbox.11. Check the Object File Format checkbox and select the ELF/DWARF 2.0 option

which appears for the Object File Format checkbox.12. Click OK.

The RS08 Compiler Option Settings dialog box closes.

13. Save the changes to the configuration by either:• selecting File > Save Configuration (Ctrl + S) or• clicking Save on the toolbar.

The compiler is now configured with the selected settings.

NOTEFor more information about configuring the Compiler options,refer to the Graphical User Interface.

3.3.1.1 Selecting Input Files

The project does not contain any source code files at this point. Copy and paste the Csource code (*.c) and header (*.h) files from the previous project, Project1, to save time.

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

66 Freescale Semiconductor, Inc.

Page 67: CodeWarrior Development Studio for Microcontrollers V10.x RS08

1. Copy the Sources folder from the Project1 folder and paste it into the X15 project folder.2. Copy the Project_Headers folder from the Project1 folder and paste it into the X15

project folder.3. Copy and paste the Project1 project's Lib folder into the X15 project folder.4. In the X15 folder, create a new folder Project_Settings. Copy and paste the Startup_Code

folder from the Project1\Project_Settings folder into the X15\Project_Settings folder.

The X15 project folder have the required C source code ( *.c) and header ( *.h) files fromthe previous project.

Now there are five items in the X15 project folder, as shown in the figure below:

• the project.ini configuration file• the Sources folder, which contains the main.c source file• the Project_Headers folder, which contains:

• the derivative.h header file, and• the MC9RS08KA1.h header file

• the Lib folder, which contains the MC9RS08KA1.c source file• the Project_settings\Startup_Code folder, which contains the start up and initialization

file, start08.c.

Figure 3-9. Folders and Files in X15 Project Folder

3.3.1.2 Compiling C Source Code Files

Now compile the start08.c file.

1. Select File > Compile from the RS08 Compiler window menu bar.

The Select File to Compile dialog box appears.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 67

Page 68: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-10. Select File to Compile Dialog Box2. Browse to the Project_settings\Startup_Code folder in the project directory.3. Select the start08.c file.4. Click Open.

The start08.c file begins compiling. In this case, the file fails to compile.

Figure 3-11. Results of Compiling start08.c File

The RS08 Compiler window provides information about the compilation process andgenerates error messages if the compilation fails. In this case the C5200: `FileName'file not found error message appears twice, once for startrs08.h and once forstartrs08_init.c.

5. Right-click on the text above the error message.

A context menu appears.

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

68 Freescale Semiconductor, Inc.

Page 69: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-12. RS08 Compiler Window - Context Menu6. Select Help on "<FileName> file not found" from the context menu.

The C5200: `FileName' file not found error message appears.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 69

Page 70: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-13. C5200 Error Message Help

The Tips section in the help f or the C5200 error states that the correct paths and namesfor the source files must be specified.

The following folder contains the missing header file, startrs08.h:

<CWInstallDir> \ MCU\lib\rs08c\include

NOTEThe #include preprocessor directive for this header file appearson line 29 of start08.c.

The following folder contains the missing startrs08_init.c file.

CWInstallDir\MCU\lib\rs08c\src

To resolve the error, modify the compiler configuration so that it can locate any missingfiles.

1. Select File > Configuration from the RS08 Compiler window menu bar..

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

70 Freescale Semiconductor, Inc.

Page 71: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Configuration dialog box appears.

2. Select the Environment tab in the Configuration dialog box.3. Select Header File Path.

NOTEThe environment variable associated with the Header FilePath is the LIBPATH or LIBRARYPATH: `include <File>'Path variable. The Compiler uses a hierarchy to search forfiles ( File Processing).

4. Click "..." button.

The Browse for Folder dialog box appears.

5. In the Browse for Folder dialog box, navigate to the missing startrs08.h file in the<CWInstallDir>\MCU\lib\rs08c\include folder.

Figure 3-14. include Subfolder Containing startrs08.h6. Click OK.

The Configuration dialog box is now active.

7. Click the Add button.

The specified path appears in the lower panel.

8. Click " ... " button again.9. In the Browse for Folder dialog, navigate to \lib\hc08c\include subfolder in the

CodeWarrior installation folder.10. Click Add.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 71

Page 72: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The path to the header files <CWInstallDir>\MCU\lib\hc08c\include appears in the lowerpane.

11. Select General Path.12. Click " ... " button.13. In the Browse for Folder dialog, navigate to the missing startrs08_init.c file in the

rs08c\src subfolder in the CodeWarrior installation's lib folder.14. Click Add.

The path to the header files < CWInstallDir>\MCU\lib\rs08c\src appears in the lowerpanel.

15. Click OK.

An asterisk now appears in the RS08 Compiler window's title bar, indicating that theconfiguration file contains unsaved changes.

16. Click Save on the toolbar to save the configuration modifications. Alternatively,select File > Save Configuration from the RS08 Compiler window menu bar.

You have now saved the new paths to the missing files to compile the start08.c file.

NOTEIf you do not save the configuration, the compiler reverts to thelast-saved configuration when the program is relaunched. Theasterisk disappears when the file is saved.

Now that you have supplied the paths to the missing files, you can try again to compilethe start08.c file.

1. Select File > Compile from the RS08 Compiler window menu bar.2. Navigate to the Project_settings\Startup_Code folder in the project directory.3. Select start08.c.4. Click Open.

The Compiler indicates successful compilation for the start08.c file.

The compiler displays following results:

• The start08.c file involved the use of six header files.• The compiler generated an assembler listing file ( start08.lst) for the start08.c file.• The Compiler generated an object file ( start08.o) in the Sources folder, using the

ELF/DWARF 2.0 format.• The Code Size was 117 bytes.• The compiler created 11 global objects and the Data Size was 3 bytes in RAM, and 5

bytes in ROM.• There were 0 errors, 0 warnings, and 0 information messages.

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

72 Freescale Semiconductor, Inc.

Page 73: CodeWarrior Development Studio for Microcontrollers V10.x RS08

TipClear the Compiler window at any time by selecting View> Log > Clear Log.

Now compile the main.c file:

1. Navigate to the Sources folder.2. Select the main.c file.3. Click Open.

The C source code file, main.c, fails to compile, as the compiler can locate only three ofthe four header files required. It could not find the derivative.h header file and generatedanother C5200 error message.

The derivative.h file is in the Project_Headers folder in the X15 project folder, so addanother header path to resolve the error.

1. Select File > Configuration from the RS08 compiler window menu bar.

The Configuration dialog box appears.

2. Select the Environment tab.3. Select Header File Path.4. Click " ... " button.

The Browse for Folder dialog box appears.

5. In the Browse for Folder dialog box, browse for and select the Project_Headersfolder.

6. Click OK.

The Browse for Folder dialog box closes.

7. Click Add.

The selected path appears the lower pane.

8. Click OK.

If there is no other missing header file included in the derivative.h file, you are readyto compile the main.c file.

9. Select File > Compile from the RS08 Compiler window menu bar.10. Select main.c in the Sources folder. You can also select a previously compiled C source

code file.11. Click Open to compile the file.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 73

Page 74: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The message " *** 0 error(s)," indicates that main.c compiles without errors. Save thechanges in the project configuration.

The compiler places the object file in the Sources folder along with the C source code file,and generates output listing files into the project folder. The binary object files and theinput modules have identical names except for the extension used. Any assembly outputfiles generated for each C source code file is similarly named.

At this time, only two of the three C source code files have been compiled. Locate theremaining C source code file, MC9RS08KA1.c, in the Lib folder of the current directory, X15.

The compiler places the object-code files it generates in the same folder that contains theC source code files. However, you can also specify a different location for the object-code files.

To redirect the object-code file for the MC9RS08KA1.c file to another folder, modify thecompiler configuration so that when the MC9RS08KA1.c is compiled, the object code file goesinto a different folder. For more information, refer to the OBJPATH: Object File Path.

1. Using Windows Explorer, create a new folder in the current directory and name itObjectCode.

2. Select File > Configuration.3. Click the Environment tab and select Object Path.4. Navigate to the new object code folder, ObjectCode, in the project folder.5. Click OK.

Figure 3-15. Adding OBJPATH6. Click Add.

Using Standalone Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

74 Freescale Semiconductor, Inc.

Page 75: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The new object path appears in the lower panel.

7. Click OK.

The Configuration dialog box closes.

8. Press Ctrl + S to save the settings.9. Select File > Compile from the RS08 Compiler window menu bar.

The Select File to Compile dialog box appears.

10. Browse for the C source code file in the Lib subfolder of the project folder.

Figure 3-16. Compiling Source File in Lib Folder11. Click Open.

The selected file compiles.

The compiler log states that MC9RS08KA1.o, the object code file, was created in the ObjectCodefolder, as specified. Save the configuration again in case you wish to recompile any ofthe C source code files in the future.

TipMove the other two object code files to the ObjectCode folder sothat all object code files for the project are in the same place.This makes project management easier.

The haphazard builds of this project are intentionally designed to illustrate what happensif paths are not properly configured while compiling a project using the Compiler tool.The header files may be included by either C source or other header files. The lib folderin the CodeWarrior installation contains many derivative-specific header and other filesavailable for inclusion into your projects.

When you build another project with the Build Tool Utilities, make sure that the settingsfor the input and output files are done in advance.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 75

Page 76: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Now that the project's object code files are available, you can use the linker build tool,linker.exe, together with an appropriate *.prm file, to link these object-code files with thelibrary files and create an *.abs executable output file.

For more information, refer to the Linker section in the Build Tool UtilitiesManual.However, the project set up and configuration is faster and easier using the NewBareboard Project wizard.

3.4 Build Tools (Application Programs)

The standalone build tools (application programs) can be found in the \prog folder, whichis located within the folder where the CodeWarrior software is installed.

<CWInstallDir>\MCU\prog

where CWInstallDir is the directory in which the CodeWarrior software is installed.

The following table lists the build tools used for C programming and generating anexecutable program.

Table 3-1. Build Tools

Build Tool Description

ahc08.exe Freescale HC(S)08/RS08 assembler

burner.exe Batch and interactive burner application that generates S-records

crs08.exe Freescale RS08 compiler

decoder.exe Decoder tool to generate assembly listings

libmaker.exe Librarian tool to build libraries

linker.exe Link tool to build applications (absolute files)

maker.exe Make tool to rebuild the program automatically

piper.exe Utility to redirect messages to stdout

NOTEThere may be some additional tools in your /prog folder or youmay find some tools missing, depending on your licenseconfiguration.

3.5 Startup Command-Line Options

Build Tools (Application Programs)

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

76 Freescale Semiconductor, Inc.

Page 77: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Startup command-line options are special tool options that are specified at tool startup,that is while launching the tool. They cannot be specified interactively. Some of theseoptions open special dialog boxes, such as the Configuration and Message dialog boxes,for a build tool.

The following table lists the Startup command-line options and their description:

Table 3-2. Startup Command-line Options

Startup Command-line Option Description

-Prod Specifies the current project directory or file (as show in thelisting below). For more information, refer to the -Prod:Specify Project File at Startup.

ShowOptionDialog Opens the Option dialog box.

ShowMessageDialog Opens the message dialog box.

ShowConfigurationDialog Opens the File > Configuration dialog box.

ShowBurnerDialog Opens the Burner dialog box.

ShowSmartSliderDialog Opens the CompilerSmart Slider dialog box.

ShowAboutDialog Opens the About dialog box.

NOTEFor more information on the build tool dialog boxes, refer tothe Graphical User Interface chapter.

Listing: Example of a Startup Command-Line Option

C:\Freescale\CW MCU V10.x\MCU\prog>linker.exe -Prod=C:\Freescale\demo\myproject.pjt

Listing: Example of Storing Options in the Current Project Settings File

C:\Freescale\CW MCU V10.x\MCU\prog>linker.exe -ShowOptionDialog -Prod=C:\demos\myproject.pjt

3.6 Highlights

• Powerful User Interface• Online Help• Flexible Type Management• Flexible Message Management• 32-bit Application• Support for Encrypted Files• High-Performance Optimizations• Conforms to ANSI/ISO 9899-1990

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 77

Page 78: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.7 CodeWarrior Integration of Build Tools

All required CodeWarrior plug-ins are installed together with the Eclipse IDE. Theprogram that launches the IDE with the CodeWarrior tools, cwide.exe, is installed in theeclipse directory (usually C:\Freescale\CW MCU V10.x\eclipse). The plug-ins are installed inthe eclipse\plugins directory.

3.7.1 Combined or Separated Installations

The installation script enables you to install several CPUs along one single installationpath. This saves disk space and enables switching from one processor family to anotherwithout leaving the IDE.

NOTEIt is possible to have separate installations on one machine.There is only one point to consider: The IDE uses COM files,and for COM the IDE installation path is written into theWindows Registry. This registration is done in the installationsetup. However, if there is a problem with the COM registrationusing several installations on one machine, the COMregistration is done by starting a small batch file located in thebin (usually C:\Freescale\CW MCU V10.x\MCU\bin) directory. To dothis, start the regservers.bat batch file.

3.7.2 RS08 Compiler Build Settings Panels

The following sections describe the settings panels that configure the RS08 Compilerbuild properties. These panels are part of the project's build properties settings, which aremanaged in the Properties window. To access these panels, proceed as follows:

1. Select the project for which you want to set the build properties, in the CodeWarriorProjects view.

2. Select Project > Properties from the IDE menu bar.

The Properties for < project > dialog box appears.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

78 Freescale Semiconductor, Inc.

Page 79: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3. Expand the C/C++ Build tree control and select Settings.

The various settings for the build tools are displayed in the right panel. If not, click on theTool Settings tab.

The options are grouped by tool, such as Messages , Host , General , Disassembler,Linker, Burner, HCS08Compiler, HCS08 Assembler, and Preprocessor options.

Depending on the build properties you wish to configure, select the appropriate option inthe Tool Settings tab page.

NOTEFor information about other build properties panels, refer to theMicrocontrollers V10.x Targeting Manual.

The following table lists the build properties panels for the RS08 Compiler.

Table 3-3. Build Properties for RS08

Build Tool Build Properties Panels

RS08 Compiler RS08 Compiler > Output

RS08 Compiler > Output > Configure Listing File

RS08 Compiler > Output > Configuration for list of includedfiles in make format

RS08 Compiler > Input

RS08 Compiler > Language

RS08 Compiler > Language > CompactC++ features

RS08 Compiler > Host

RS08 Compiler > Code Generation

RS08 Compiler > MessagesRS08 Compiler > Messages >Disable user messages

RS08 Compiler > Preprocessor

RS08 Compiler > Type Sizes

RS08 Compiler > General

RS08 Compiler > Optimization

RS08 Compiler > Optimization > Mid level optimizations

RS08 Compiler > Optimization > Mid level branchoptimizations

RS08 Compiler > Optimization > Tree optimizer

RS08 Compiler > Optimization > Optimize Library Function

3.7.2.1 RS08 Compiler

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 79

Page 80: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use this panel to specify the command, options, and expert settings for the build toolcompiler. Additionally, the RS08 Compiler tree control includes the general, include filesearch path settings.

The following figure shows the RS08 Compiler settings.

Figure 3-17. Tool Settings - RS08 Compiler

The following table lists and describes the compiler options for RS08.

Table 3-4. Tool Settings - RS08 Compiler Options

Option Description

Command Shows the location of the compiler executable file.

Default value is : " ${HC08Tools}/crs08.exe".

You can specify additional command line options for thecompiler; type in custom flags that are not otherwise availablein the UI.

All options Shows the actual command line the compiler will be calledwith.

Expert Settings Shows the expert settings command line parameters; defaultis {COMMAND} ${FLAGS}${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}.

Command line pattern

3.7.2.2 RS08 Compiler > Output

Use this panel to control how the compiler generates the output file, as well as error andwarning messages. You can specify whether to allocate constant objects in ROM,generate debugging information, and strip file path information.

The following figure shows the Output panel.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

80 Freescale Semiconductor, Inc.

Page 81: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-18. Tool settings - RS08 Compiler > Output

The following table lists and describes the output options for RS08 compiler.

Table 3-5. Tool Settings - RS08 Compiler > Output Options

Option Description

Allocate CONST objects in ROM ( -Cc) Refer to the -Cc: Allocate Const Objects into ROM topic.

Encrypt FIle (e.g. %f.e%e) ( -Eencrypt) Refer to the -Eencrypt: Encrypt Files topic.

Encryption key ( -EKey) Refer to the -Ekey: Encryption Key topic.

Object File Format Refer to the -F (-F2, -F2o): Object File Format topic.

General Assembler Include File (e.g. %f.inc) ( -La) Refer to the -La: Generate Assembler Include File topic.

Generate Listing File (e.g. %n.lst) ( -Lasm) Refer to the -Lasm: Generate Listing File topic.

Log predefined defines to file (e.g. predef.h) ( -Ldf) Refer to the -Ldf: Log Predefined Defines to File topic.

List of included files to `.inc' file ( -Li) Refer to the -Li: List of Included Files to ".inc" File topic.

Write statistic output to file (e.g. logfile.txt) ( -Ll) Refer to the -Ll: Write Statistics Output to File topic.

List of included files in make format ( e.g. make.txt ) ( -Lm) Refer to the -Lm: List of Included Files in Make Format topic.

Append object file name to list ( e.g. obklist.txt ) ( -Lo) Refer to the -Lo: Append Object File Name to List (enter[<files>]) topic.

Preprocessor output ( e.g. %n.pre ) ( -Lp) Refer to the -Lp: Preprocessor Output topic.

Strip path information ( -NoPath) Refer to the -NoPath: Strip Path Info topic.

3.7.2.3 RS08 Compiler > Output > Configure Listing File

Use this panel to configure the listing files for the RS08 Compiler to generate output.

The following figure shows Output > ConfigureListing File panel.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 81

Page 82: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-19. Tool Settings - RS08 Compiler > Output > Configure Listing File

NOTEFor information about the description of the options available inthe Configure Listing File panel for RS08 compiler, refer tothe -Lasmc: Configure Listing File topic.

3.7.2.4 RS08 Compiler > Output > Configuration for list of includedfiles in make format

Use this panel to configure the list of included files in make format for the RS08Compiler to generate the output.

The following figure shows Configuration for list of included files in make format panel.

Figure 3-20. Tool Settings ? RS08 Compiler > Output > Configuration for List of IncludedFiles in Make Format

NOTEFor information about the description of the options available inthe Configuration for list of included files in make formatpanel for RS08 compiler, refer to the -LmCfg: Configurationfor List of Included Files in Make Format (option -Lm) topic.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

82 Freescale Semiconductor, Inc.

Page 83: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.7.2.5 RS08 Compiler > Input

Use this panel to specify file search paths and any additional include files the RS08Compiler should use. You can specify multiple search paths and the order in which youwant to perform the search.

The IDE first looks for an include file in the current directory, or the directory that youspecify in the INCLUDE directive. If the IDE does not find the file, it continues searching thepaths shown in this panel. The IDE keeps searching paths until it finds the #include file orfinishes searching the last path at the bottom of the Include File Search Paths list. TheIDE appends to each path the string that you specify in the INCLUDE directive.

NOTEThe IDE displays an error message if a header file is in adifferent directory from the referencing source file. Sometimes,the IDE also displays an error message if a header file is in thesame directory as the referencing source file.

For example, if you see the message Could not open source file myfile.h, you must add thepath for myfile.h to this panel.

The following figure shows the Input panel.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 83

Page 84: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-21. Tool Settings - RS08 Compiler > Input

The following table lists and describes the input options for RS08 Compiler.

Table 3-6. Tool Settings - RS08 Compiler > Input Options

Option Description

Filenames are clipped to DOS length ( -!) Refer to the -!: Filenames are Clipped to DOS Length topic.

Include File Path ( -I) Refer to the -I: Include File Path topic.

Recursive Include File Path (-Ir) Use this option to add the required file paths recursively.

Additional Include Files ( -AddIncl) Refer to the -AddIncl: Additional Include File topic.

Include files only once ( -Pio) Refer to the -Pio: Include Files Only Once topic.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

84 Freescale Semiconductor, Inc.

Page 85: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The following table lists and describes the toolbar buttons that help work with the filepaths.

Table 3-7. Include File Path (-I) Toolbar Buttons

Button Description

Add - Click to open the Add directory path dialog box andspecify location of the library you want to add.

Delete - Click to delete the selected library path. To confirmdeletion, click Yes in the Confirm Delete dialog box.

Edit - Click to open the Edit directory path dialog box andupdate the selected path.

Move up - Click to move the selected path one positionhigher in the list.

Move down - Click to move the selected path one positionlower in the list.

Figure 3-22. Tool Settings - RS08 Compiler > Input - Add directory path Dialog Box

Figure 3-23. Tool Settings - RS08 Compiler > Input - Edit directory path Dialog Box

The buttons in the Add directory path and Edit directory path dialog boxes help workwith the paths.

• OK - Click to confirm the action and exit the dialog box.• Cancel- Click to cancel the action and exit the dialog box.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 85

Page 86: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Workspace - Click to display the Folder Selection dialog box and specify the path.The resulting path, relative to the workspace, appears in the appropriate list.

• File system - Click to display the Browse For Folder dialog box and specify thepath. The resulting path appears in the appropriate list.

• Variables - Click to display the Select build variable dialog box. The resulting pathappears in the appropriate list.

• Relative To- Check this checkbox to enable the build variables drop-down list. Youcan select the desired variable for the existing settings.

The following table lists and describes the toolbar buttons that help work with the searchpaths.

Table 3-8. Additional Include Files (-AddIncl) Toolbar Buttons

Button Description

Add - Click to open the Add directory path dialog box andspecify location of the library you want to add.

Delete - Click to delete the selected library path. To confirmdeletion, click Yes in the Confirm Delete dialog box.

Edit - Click to open the Edit directory path dialog box andupdate the selected path.

Move up - Click to move the selected path one positionhigher in the list.

Move down - Click to move the selected path one positionlower in the list.

The following figure shows the Add file path dialog box.

Figure 3-24. Tool Settings - RS08 Compiler > Input - Add file path Dialog Box

The following figure shows the Edit file path dialog box.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

86 Freescale Semiconductor, Inc.

Page 87: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-25. Tool Settings - RS08 Compiler > Input - Edit file path Dialog Box

The buttons in the Add file pathand Edit file path dialog boxes help work with thepaths.

• OK - Click to confirm the action and exit the dialog box.• Cancel- Click to cancel the action and exit the dialog box.• Workspace - Click to display the Folder Selection dialog box and specify the path.

The resulting path, relative to the workspace, appears in the appropriate list.• File system - Click to display the Browse For Folder dialog box and specify the

path. The resulting path appears in the appropriate list.• Variables - Click to display the Select build variable dialog box. The resulting path

appears in the appropriate list.• Relative To- Check this checkbox to enable the build variables drop-down list. You

can select the desired variable for the existing settings.

3.7.2.6 RS08 Compiler > Language

Use this panel to specify code-generation and symbol-generation options for the RS08Compiler.

The following figure shows the Language panel.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 87

Page 88: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-26. Tool Settings - RS08 Compiler > Language

The following table lists and describes the language options for RS08.

Table 3-9. Tool Settings - RS08 Compiler > Language Options

Option Description

Strict ANSI ( -Ansi) Refer to the -Ansi: Strict ANSI topic.

C++ Refer to the -C++ (-C++f, -C++e, -C++c): C++ Support topic.

Cosmic compatibility mode for space modifiers @near, @far,and @tiny ( -Ccx)

Refer to the -Ccx: Cosmic Compatibility Mode for SpaceModifiers and Interrupt Handlers topic.

Bigraph and trigraph support ( -Ci) Refer to the -Ci: Bigraph and Trigraph Support topic.

C++ comments in ANSI-C ( -Cppc) Refer to the -Cppc: C++ Comments in ANSI-C topic.

Propagate const and volatile qualifiers for structs ( -Cq) Refer to the -Cq: Propagate const and volatile qualifiers forstructs topic.

Conversion from `const T*' to `T*' ( -Ec) Refer to the -Ec: Conversion from 'const T*' to 'T*' topic.

Do not pre-process escape sequences in strings withabsoluted DOS paths ( -Pe)

Refer to the -Pe: Do Not Preprocess Escape Sequences inStrings with Absolute DOS Paths topic.

3.7.2.7 RS08 Compiler > Language > CompactC++ features

Use the CompactC++ features panel to specify a compact C++ code for the RS08Compiler.

Figure 3-27. Tool Settings - RS08 Compiler > Language > CompactC++ Features

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

88 Freescale Semiconductor, Inc.

Page 89: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEFor information about the description of the options available inthe CompactC++ features panel for RS08 compiler, refer tothe -Cn: Disable compactC++ features topic.

3.7.2.8 RS08 Compiler > Host

Use this panel to specify the host options of RS08.

The following figure shows the Host panel.

Figure 3-28. Tool Settings - Host

The following table lists and describes the host options for RS08.

Table 3-10. Tool Settings - Host

Option Description

Set environment variable ( -Env) Refer to the -Env: Set Environment Variable topic.

Borrow license feature ( -LicBorrow) Refer to the -LicBorrow: Borrow License Feature topic.

Wait until a license is available from floating license server ( -LicWait)

Refer to the -LicWait: Wait until Floating License is Availablefrom Floating License Server topic.

Application Standard Occurrence Refer to the -View: Application Standard Occurrence topic.

3.7.2.9 RS08 Compiler > Code Generation

Use this panel to specify code- and symbol-generation options for the RS08 Compiler.

The following figure shows the Code Generation panel.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 89

Page 90: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-29. Tool Settings - RS08 Compiler > Code Generation

The following table lists and describes the code generation options for RS08 compiler.

Table 3-11. Tool Settings - RS08 Compiler > Code Generation Options

Option Description

Bit field byte allocation ( -BfaB[MS|LS]) Refer to the -BfaB: Bitfield Byte Allocation topic.

Bit field gap limits ( -BfaGapLimitBits) Refer to the -BfaGapLimitBits: Bitfield Gap Limit topic.

Bit field type size reduction Refer to the -BfaTSR: Bitfield Type-Size Reduction topic.

Maximum load factor for switch tables (0-100) ( -CswMaxLF) Refer to the -CswMaxLF: Maximum Load Factor for SwitchTables topic.

Minimum number of labels for switch tables ( -CswMinLB) Refer to the -CswMinLB: Minimum Number of Labels forSwitch Tables topic.

Minimum load factor for switch tables (0-100) ( -CswMinLF) Refer to the -CswMinLF: Minimum Load Factor for SwitchTables topic.

Minimum number of labels for switch search tables ( -CswMinSLB)

Refer to the -CswMinSLB: Minimum Number of Labels forSwitch Search Tables topic.

Switch off code generation ( -Cx) Refer to the -Cx: Switch Off Code Generation topic.

Do not use CLR for volatile variables in the direct page ( -NoClrVol)

Refer to the -NoClrVol: Do not use CLR for volatile variablesin the direct page topic.

Qualifier for virtual table pointers ( -Qvtp) Refer to the -Qvtp: Qualifier for Virtual Table Pointers topic.

Use IEEE32 for double Refer to the -Fd: Double is IEEE32 topic.

Specify the address of the Interrupt Exit address register ( -IEA)

Refer to the -IEA: Specify the address of the interrupt exitaddress register topic.

Specify the address of the System Interrupt Pending 2register ( -SIP2)

Refer to the -SIP2: Specify the address of the SystemInterrupt Pending 2 register topic.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

90 Freescale Semiconductor, Inc.

Page 91: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.7.2.10 RS08 Compiler > Messages

Use this panel to specify whether to generate symbolic information for debugging thebuild target

The following figure shows the Messages panel.

Figure 3-30. Tool Settings - RS08 Compiler > Messages

The following table lists and describes the messages options for RS08 compiler.

Table 3-12. Tool Settings - RS08 Compiler > Messages Options

Option Description

Don't print INFORMATION messages ( -W1) Refer to the -W1: Do Not Print Information Messages topic.

Don't print INFORMATION or WARNING messages ( -W2) Refer to the -W2: Do Not Print Information or WarningMessages topic.

Create err.log Error file Refer to the -WErrFile: Create "err.log" Error File topic.

Cut file names in Microsoft format to 8.3 ( -Wmsg8x3) Refer to the -Wmsg8x3: Cut File Names in Microsoft Formatto 8.3 topic.

Set message file format for batch mode Refer to the -WmsgFb (-WmsgFbi, -WmsgFbm): Set MessageFile Format for Batch Mode topic.

Message Format for batch mode (e.g. %"%f%e%"(%l): %K%d: %m) ( -WmsgFob)

Refer to the -WmsgFob: Message Format for Batch Modetopic.

Table continues on the next page...

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 91

Page 92: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 3-12. Tool Settings - RS08 Compiler > Messages Options (continued)

Option Description

Message Format for no file information (e.g. %K %d: %m) ( -WmsgFonf)

Refer to the -WmsgFonf: Message Format for no FileInformation topic.

Message Format for no position information (e.g. %"%f%e%":%K %d: %m) ( -WmsgFonp)

Refer to the -WmsgFonp: Message Format for no PositionInformation topic.

Create Error Listing File Refer to the -WOutFile: Create Error Listing File topic.

Maximum number of error messages ( -WmsgNe) Refer to the -WmsgNe: Maximum Number of Error Messagestopic.

Maximum number of information messages ( -WmsgNi) Refer to the -WmsgNi: Maximum Number of InformationMessages topic.

Maximum number of warning messages ( -WmsgNw) Refer to the -WmsgNw: Maximum Number of WarningMessages topic.

Error for implicit parameter declaration ( -Wpd) Refer to the -Wpd: Error for Implicit Parameter Declarationtopic.

Set messages to Disable Enter the messages which you want to disable.

Set messages to Error Enter the messages which you want to set as error.

Set messages to Information Enter the messages which you want to set as information.

Set messages to Warning Enter the messages which you want to set as warning.

3.7.2.11 RS08 Compiler > Messages > Disable user messages

Use this panel to specify the settings to disable the user messages for the RS08 compiler.

The following figure shows the Disable user messages panel.

Figure 3-31. Tool Settings - RS08 Compiler > Messages > Disable user messages

NOTEFor information about the description of the options available inthe Disable user messages panel for RS08 Compiler, refer tothe -WmsgNu: Disable User Messages topic.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

92 Freescale Semiconductor, Inc.

Page 93: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.7.2.12 RS08 Compiler > Preprocessor

Use this panel to specify preprocessor behavior and define macros.

The following figure shows the Preprocessor panel.

Figure 3-32. Tool Settings - RS08 Compiler > Preprocessor

The following table lists and describes the preprocessor options for RS08 Compiler.

Table 3-13. Tool Settings - RS08 Compiler > Preprocessor Options

Option Description

Define preprocessor macros ( -D) Define, delete, or rearrange preprocessor macros. You canspecify multiple macros and change the order in which theIDE uses the macros.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 93

Page 94: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 3-13. Tool Settings - RS08 Compiler > Preprocessor Options

Option Description

Define preprocessor macros and optionally assign theirvalues. This setting is equivalent to specifying the -Dname[=value] command-line option. To assign a value, usethe equal sign (=) with no white space.

For example, this syntax defines a preprocessor value namedEXTENDED_FEATURE and assigns ON as its value:EXTENDED_FEATURE=ON

Note that if you do not assign a value to the macro, the shellassigns a default value of 1.

The following table lists and describes the toolbar buttons that help work withpreprocessor macro definitions.

Table 3-14. Define Preprocessor Macros Toolbar Buttons

Button Description

Add - Click to open the Enter Value dialog box and specifythe path/macro.

Delete - Click to delete the selected path/macro. To confirmdeletion, click Yes in the Confirm Delete dialog box.

Edit - Click to open the Edit Dialog dialog box and updatethe selected path/macro.

Move up - Click to move the selected path/macro oneposition higher in the list.

Move down - Click to move the selected path/macro oneposition lower in the list

The following figure shows the Enter Value dialog box.

Figure 3-33. Tool Settings - RS08 Compiler > Preprocessor - Enter Value Dialog Box

The following figure shows the Edit Dialog dialog box.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

94 Freescale Semiconductor, Inc.

Page 95: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-34. Tool Settings - RS08 Compiler > Preprocessor - Edit Dialog Dialog Box

The buttons in the Enter Value and Edit Dialog , dialog boxes help work with thepreprocessor macros.

• OK - Click to confirm the action and exit the dialog box.• Cancel - Click to cancel the action and exit the dialog box.• Variables - Click to open the Select build variable dialog box to select the desired

build variable.• Relative To - Check this checkbox to enable the build variables drop-down list. You

can select the desired variable for the existing settings.

3.7.2.13 RS08 Compiler > Type Sizes

Use this panel to specify the available data type size options for the RS08 Compiler.

The following figure shows the Type Sizes panel.

Figure 3-35. Tool Settings - RS08 Compiler > Type Sizes

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 95

Page 96: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEFor information about the description of the options available inthe Type Sizes panel for RS08 compiler, refer to the -T:Flexible Type Management topic.

3.7.2.14 RS08 Compiler > General

Use this panel to specify other flags for the RS08 Compiler to use.

The following figure shows the General panel.

Figure 3-36. Tool Settings - RS08 Compiler > General

The following table lists and describes the General options for RS08 compiler.

Table 3-15. Tool Settings - RS08 Compiler > General Options

Option Description

Other flags Specify additional command line options for the compiler; typein custom flags that are not otherwise available in the UI.

3.7.2.15 RS08 Compiler > Optimization

Use this panel to control compiler optimizations. The compiler's optimizer can apply anyof its optimizations in either global or non-global optimization mode. You can applyglobal optimization at the end of the development cycle, after compiling and optimizingall source files individually or in groups.

The following figure shows the Optimization panel.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

96 Freescale Semiconductor, Inc.

Page 97: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-37. Tool Settings - RS08 Compiler > Optmization

The following table lists and describes the optimization options for RS08 compiler.

Table 3-16. Tool Settings - RS08 Compiler > Optimization Options

Option Description

No integral promotion on characters ( -Cni) Refer to the -Cni: No Integral Promotion topic.

Loop unrolling ( i[number]) ( -Cu) Refer to the -Cu: Loop Unrolling topic.

Main Optimize Target: Optimize for Refer to the -O (-Os, -Ot): Main Optimization Target topic.

Create sub-functions with common code Refer to the -O[nf|f]: Create Sub-Functions with CommonCode topic.

Alias analysis options Refer to the -Oa: Alias Analysis Options topic.

Generate always near calls ( -Obsr) Refer to the -Obsr: Generate Always Near Calls topic.

Dynamic options configuration for functions ( -OdocF) Refer to the -OdocF: Dynamic Option Configuration forFunctions topic.

Inlining ( C[n] or OFF) ( -Oi) Refer to the -Oi: Inlining topic.

Disable alias checking ( -Ona) Refer to the -Ona: Disable alias checking topic.

Disable branch optimizer ( -OnB) Refer to the -OnB: Disable Branch Optimizer topic.

Do generate copy down information for zero values ( -OnCopyDown)

Refer to the -OnCopyDown: Do Generate Copy DownInformation for Zero Values topic.

Disable CONST variable by constant replacement ( -OnCstVar)

Refer to the -OnCstVar: Disable CONST Variable by ConstantReplacement topic.

Disable peephole optimization ( -OnP) Refer to the -Onp: Disable Peephole Optimizer topic.

Disable code generation for NULL Pointer to Member check( -OnPMNC)

Refer to the -OnPMNC: Disable Code Generation for NULLPointer to Member Check topic.

Large return value type Refer to the -Rp[t|e]: Large return Value Type topic.

Table continues on the next page...

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 97

Page 98: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 3-16. Tool Settings - RS08 Compiler > Optimization Options (continued)

Option Description

Disable far to near call optimization Refer to the -Onbsr: Disable far to near call optimization topic.

Disable reload from register optimization Refer to the -Onr: Disable Reload from Register Optimizationtopic.

Disable tail call optimizations Refer to the -Ontc: Disable tail call optimization topic.

Reuse locals of stack frame Refer to the -Ostk: Reuse Locals of Stack Frame topic.

3.7.2.16 RS08 Compiler > Optimization > Mid level optimizations

Use this panel to configure the Mid level optimization options for the RS08 compiler.

The following figure shows the Mid level optimizations settings.

Figure 3-38. Tool Settings - RS08 Compiler > Optimization > Mid level optimizations

NOTEFor information about the description of the options available inthe Mid level optimizations panel for RS08 compiler, refer tothe -Od: Disable Mid-level Optimizations topic.

3.7.2.17 RS08 Compiler > Optimization > Mid level branchoptimizations

Use this panel to configure the Mid level branch optimization options for the RS08compiler.

The following figure shows the Mid level branch optimizations settings.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

98 Freescale Semiconductor, Inc.

Page 99: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-39. Tool Settings - RS08 Compiler > Optimization > Mid level branchoptimizations

NOTEFor information about the description of the options availablefor the Mid levelbranch optimizations compiler settings, referto the -Odb: Disable Mid-level Branch Optimizations topic.

3.7.2.18 RS08 Compiler > Optimization > Tree optimizer

Use this panel to configure the tree optimizer options for the RS08 compiler.

The following figure shows the Tree optimizer settings.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 99

Page 100: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-40. Tool Settings - RS08 Compiler > Optimization > Tree optimizer

NOTEFor information about the description of the options available inthe Tree optimizer panel for RS08 compiler, refer to the -Ont:Disable Tree Optimizer topic.

3.7.2.19 RS08 Compiler > Optimization > Optimize Library Function

Use this panel to configure the optimize library function options for the RS08 compiler.

The following figure shows the Optimize Library Function settings.

CodeWarrior Integration of Build Tools

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

100 Freescale Semiconductor, Inc.

Page 101: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 3-41. Tool Settings - RS08 Compiler > Optimization > Optimize Library Function

NOTEFor information about the description of the options availablefor the OptimizeLibrary Function panel for RS08 compiler,refer to the -OiLib: Optimize Library Functions topic.

3.7.3 CodeWarrior Tips and Tricks

If the Simulator or Debugger cannot be launched, check the settings in the project'slaunch configuration. For more information on launch configurations and their settings,refer to the Microcontrollers V10.x Targeting Manual.

NOTEThe project's launch configurations can be viewed and modifiedfrom the IDE's RunConfigurations or Debug Configurationsdialog boxes. To open these dialog boxes, select Run > RunConfigurations or Run > Debug Configurations.

If a file cannot be added to the project, its file extension may not be available in the FileTypes panel. To resolve the issue, add the file's extension to the list in the File Typespanel. To access the File Types panel, proceed as follows:

1. Right-click the desired project and select Properties.

The Properties for < project > window appears.

2. Expand C/C++ General and select File Types.3. Select the Use project settings option.4. Click the New button, enter the required file type, and click OK.5. Click OK.

The changes are saved and the properties dialog box closes.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 101

Page 102: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.8 Integration into Microsoft Visual C++ 2008 ExpressEdition (Version 9.0 or later)

Use the following procedure to integrate the CodeWarrior tools into the Microsoft VisualStudio (Visual C++) IDE.

3.8.1 Integration as External Tools

1. Start Visual C++ 2008 Expression Edition.2. Select Tools > External Tools.

The External Tools dialog box appears.

Figure 3-42. External Tools Dialog Box3. Add a new tool by clicking Add.4. In the Title text box, type in the name of the tool to display in the menu, for example,

RS08 Compiler.5. In the Command text box, either type the path of the piper tool or browse to Piper.exe

using the " ... " button. The location of Piper.exe is CWInstallDir\MCU\prog\piper.exe,where CWInstallDir is the directory in which the CodeWarrior software is installed.

Piper.exe redirects I/O so that the RS08 build tools can be operated from within theVisual Studio UI.

Integration into Microsoft Visual C++ 2008 Express Edition (Version 9.0 or later)

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

102 Freescale Semiconductor, Inc.

Page 103: CodeWarrior Development Studio for Microcontrollers V10.x RS08

6. In the Arguments text box, type the name of the tool to be launched. You can alsospecify any command line options, for example, -Cc, along with the $(ItemPath)Visualvariable.

You can use the pop-up menu to the right of the text box to enter other Visualvariables. The text box should look like this: CWInstallDir\MCU\prog\crs08.exe -Cc $(ItemPath).

7. In the Initial Directory text box, use the pop-up menu to choose $(ItemDir).8. Check the Use Output Window checkbox.9. Confirm that the Prompt for arguments checkbox is clear.

10. Click Apply to save your changes, then close the External Tools dialog box.

The new tool appears in the Tools menu.

Similarly, you can display other build tools in the Tools menu. Use Build Tools(Application Programs)Build Tools (Application Programs) to obtain the file names ofthe other build tools and specify the file names in the Arguments text box.

This arrangement allows the active (selected) file to be compiled or linked in the VisualEditor. Tool messages are reported in the Visual Output window. You can double-clickon the error message in this window and the offending source code statement is displayedin the editor.

Figure 3-43. Visual Output Window

3.8.2 Integration with Visual Studio Toolbar

1. Start Visual C++ 2008 Expression Edition.2. Make sure that all tools are integrated and appear as menu choices on the Tools

menu.3. Select Tools > Customize.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 103

Page 104: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Customize window appears.

4. Click the Toolbars tab.5. Select New and enter a name. For example, Freescale Tools.

A new empty toolbar named Freescale Tools appears on your screen, adjacent to theCustomize window.

6. Click the Commands tab.7. From the Category drop-down list box, select Tools.8. The right side of the window displays a list of commands. Search for the commands

labeled External Command x, where x represents a number. This number corresponds toan entry in the Menu contents field of the External Tools window. Count down thelist in the External Tools window until you reach the first external tool you defined.For this example, it is RS08 Compiler, and was the third choice on the menu.Therefore, the desired tool command would be External Command 3. Alternately, withTools selected in the Customize window's Commands tab, click on the Tools menuand it display the menu choices, with the external commands displayed.

9. Drag the desired command to the Freescale Tools toolbar.

A button labeled External Tool 3 appears on the Freescale Tools toolbar.

TipIf the button appears dimmed, you have chosen an inactiveexternal tool entry. Check your count value and try anotherexternal command entry.

10. Continue with this same sequence of steps to add the RS08 Linker and the RS08Assembler.

11. All of the default command names, such as External Command 3 , ExternalCommand 4 , and External Command 5 on the toolbar are undescriptive, making itdifficult to know which tool to launch. You must associate a name with them.

12. Right-click on a button in the Freescale Toolbar to open the button's context menu.13. Select Name in the context menu.14. Enter a descriptive name into the text field.15. Repeat this process for all of the tools that you want to appear in the toolbar.16. Click Close to close the Customize window.

This enables you to start the CodeWarrior tools from the toolbar.

Figure 3-44. CodeWarrior Tools in Custom Visual Studio Toolbar

Integration into Microsoft Visual C++ 2008 Express Edition (Version 9.0 or later)

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

104 Freescale Semiconductor, Inc.

Page 105: CodeWarrior Development Studio for Microcontrollers V10.x RS08

3.9 Object-File Formats

The compiler supports only the ELF/DWARF object-file format. The object-file formatspecifies the format of the object files ( *.o extension), the library files ( *.lib extension),and the absolute files ( *.abs extension).

3.9.1 ELF/DWARF Object-File Format

The ELF/DWARF object-file format originally comes from the UNIX world. This formatis very flexible and is able to support extensions.

Many chip vendors define this object-file format as the standard for tool vendorssupporting their devices. This standard allows inter-tool operability making it possible touse the compiler from one tool vendor, and the linker from another. The developer hasthe choice to select the best tool in the tool chain. In addition, other third parties (forexample, emulator vendors) only have to support this object file to support a wide rangeof tool vendors.

3.9.2 Mixing Object-File Formats

Mixing HIWARE and ELF object files is not possible. HIWARE object file formats arenot supported on the RS08. Mixing ELF object files with DWARF 1.1 and DWARF 2.0debug information is possible. However, the final generated application does not containany debug data.

NOTEBe careful when mixing object files made with the HCS08compiler, which can generate an alternate object file formatcalled HIWARE. Both HIWARE and the ELF/DWARF objectfiles use the same filename extensions. The HCS08 compilermust be configured to generate the ELF/DWARF object format.For information about how to do this, refer to theMicrocontrollers V10.x HC08 Build Tools ReferenceManual.

Chapter 3 Introduction

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 105

Page 106: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Object-File Formats

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

106 Freescale Semiconductor, Inc.

Page 107: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 4Graphical User Interface

Graphical User Interface (GUI) provides a simple yet powerful user interface for theCodeWarrior build tools. Following are the features of the CodeWarrior build tools GUI:

• An interactive mode for those who need an easy way to modify the tool settings• A batch mode that allows the tools to interoperate with a command-line interface

(CLI) and make files• Online Help• Error Feedback• Easy integration into other tools, for example, CodeWarrior IDE, CodeWright,

Microsoft Visual Studio, and WinEdit

This chapter describes the GUI and provides useful hints. Its major topics are:

• Launching Compiler• Compiler Main Window• Editor Settings Dialog Box• Save Configuration Dialog Box• Environment Configuration Dialog Box• Standard Types Settings Dialog Box• Option Settings Dialog Box• Smart Control Dialog Box• Message Settings Dialog Box• About Dialog Box• Specifying Input File

4.1 Launching Compiler

You can use either of the ways to launch the RS08 Compiler:

• Navigate to CWInstallDir\MCU\prog using Windows Explorer and double-click crs08.exe

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 107

Page 108: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Create a shortcut for crs08.exe on the desktop and double-click the shortcut• Create a shortcut for crs08.exe in the Start > Programs menu and select the shortcut• Use batch and com mand files• Use other to ols, such as Editor and Visual Studio

You can launch the compiler in either Interactive Mode or Batch Mode.

4.1.1 Interactive Mode

If you start the compiler with no options and no input files, the tool enters the interactivemode and the compiler GUI is displayed. This is usually the case if you start the compilerusing the Windows Explorer or an Desktop or Programs menu icon.

4.1.2 Batch Mode

If you are using the command prompt to start the compiler and specify arguments, suchas options and/or input files, the compiler starts in the batch mode. In the batch mode, thecompiler does not open a window or does not display GUI. The taskbar displays theprogress of the compilation processes, such as processing the input.

The following code presents a command to run the RS08 compiler and process twosource files, a.c and d.c, which appear as arguments:

C:\Freescale\CW MCU V10.x\MCU\prog>crs08.exe - F2 a.c d.c

The compiler redirects message output, stdout using the redirection operator, ` >'. Theredirection operation instructs the compiler to write the message output to a file. Thefollowing code redirects command-line message output to a file, myoutput.o:

C:\Freescale\CW MCU V10.x\MCU\prog>crs08.exe - F2 a.c d.c > myoutput.o

The command line process returns after the compiling process starts. It does not waituntil the previous process has terminated. To start a tool and wait for termination , forexample, to synchronize successive operations, use the start command in the Windows®2000, Windows XP, or Windows Vista™ operating systems, or use the /wait options(refer to the Windows Help `help start'). Using start/wait pairs, you can write perfectbatch files. The following code starts a compilation process but waits for the terminationof the prior activities before beginning:

Launching Compiler

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

108 Freescale Semiconductor, Inc.

Page 109: CodeWarrior Development Studio for Microcontrollers V10.x RS08

C:\Freescale\CW MCU V10.x\MCU\prog> start /wait crs08.exe -F2 a.c d.c

4.2 Compiler Main Window

If you do not specify a filename while starting the Compiler, the CompilerMainWindow is empty on startup.

The Compiler window consists of a window title, a menu bar, a toolbar, a content area,and a status bar.

Figure 4-1. Compiler Main Window

When the Compiler starts, the Tip of the Day dialog box displaying the latest tips,appears in the Compiler main window.

• The Next Tip button displays the next tip about the Compiler.• To disable the Tip of the Day dialog box from opening automatically when the

application starts, clear the Show Tips on StartUp checkbox.

NOTEThis configuration entry is stored in the local project file.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 109

Page 110: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• To enable automatic display of the Tip of the Day dialog box when the Compilerstarts, select Help > Tip of the Day. The Tip of the Day dialog box opens. Checkthe Show Tips on StartUp checkbox.

• Click Close to close the Tip of the Day window.

4.2.1 Window Title

The window title displays the Compiler name and the project name. If a project is notloaded, the Compiler displays Default Configuration in the window title. An asterisk( *) after the configuration name indicates that some settings have changed. The Compileradds an asterisk ( *) whenever an option, the editor configuration, or the windowappearance changes.

4.2.2 Content Area

The content area displays the logging information about the compilation process. Thislogging information consists of:

• the name of the file being compiled,• the whole name, including full path specifications, of the files processed, such as C

source code files and all of their included header files• the list of errors, warnings, and information messages• the size of the code generated during the compilation session

When you drag and drop a file into the Compiler window content area, the Compilereither loads it as a configuration file or compiles the file. It loads the file as configurationfile, if the file has the *.ini extension. Otherwise, the compiler processes the file using thecurrent option settings.

All of the text in the Compiler window content area can have context informationconsisting of two items:

• a filename, including a position inside of a file and• a message number

File context information is available for all source and include files, for output messagesthat concern a specific file, and for all output that is directed to a text file. If a file contextis available, double-clicking on the text or message opens this file in an editor, asspecified in the Editor Configuration. Also, a right-click in this area opens a context

Compiler Main Window

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

110 Freescale Semiconductor, Inc.

Page 111: CodeWarrior Development Studio for Microcontrollers V10.x RS08

menu. The context menu contains an Open entry if a file context is available. If a contextmenu entry is present but the file cannot be opened, refer to the Global Initialization File(mcutools.ini).

The message number is available for any message output. There are three ways to openthe corresponding entry in the help file.

• Select one line of the message and press F1.

If the selected line does not have a message number, the main help displays.

• PressShift-F1 and then click on the message text.

If the selected line does not have a message number, the main help displays.

• Right click the message text and select Help on .

This entry is available only if a message number is available in the RS08 CompilerMessage Settings Dialog Box .

Figure 4-2. RS08 Compiler Message Settings Dialog Box

4.2.3 Toolbar

The toolbar consists of an array of buttons and a content box, just above the content area.Starting from left to right, these elements are:

• The three left-most buttons in the toolbar, as shown in the figure below, correspondto the New, LoadConfiguration, and Save Configuration entries of the File menu.

• The Help button opens on-line help window.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 111

Page 112: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• The Context Help button, when clicked, has the cursor change its form and display aquestion mark beside the pointer. Clicking an item calls the help file. Click onmenus, toolbar buttons, or the window area to get information specific to that item.

NOTEYou can also access context help by typing the keyshortcut, Shift-F1.

Figure 4-3. Toolbar• The command line history text box is in the middle of the toolbar and displays the

command line history. It contains a list of the commands executed previously. Onceyou select a command or enter it in the history text box, clicking the Compile buttonto the right of the command line history executes the command. The F2 keyboardshortcut key jumps directly to the command line. In addition, a context menu isassociated with the command line as shown in the figure below.

• The Stop button stops the current process session.• The next four buttons open the Options, Smart Slider, Standard Types, and

Messages dialog boxes. These dialog boxes are used to modify the compiler'ssettings, such as language used, optimization levels, and size of various data types.The use of the dialog boxes are discussed later in the chapter.

• The right-most button clears the content area (Output Window).

Figure 4-4. Command line Context Menu

4.2.4 Status Bar

Compiler Main Window

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

112 Freescale Semiconductor, Inc.

Page 113: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The status bar displays the current status of the compiler when it processes a file.Whenthe compiler is idle, the message area displays a brief description of function of thebutton or menu entry when you place the cursor over an item on the toolbar.

Figure 4-5. Status Bar

4.2.5 Compiler Menu Bar

The following table lists and describes the menus available in the menu bar as shown inthe figure below:

Table 4-1. Menus in the Menu Bar

Menu Entry Description

File Menu Contains entries to manage application configuration files.

Compiler Menu Contains entries to set the application options.

View Menu Contains entries to customize the application window output.

Help Menu A standard Windows Help menu.

Figure 4-6. Menu Bar

4.2.6 File Menu

The File menu is used to save or load configuration files (Figure 4-7). A configurationfile contains the following information:

• Compiler option settings specified in the settings panels• Message Settings that specify which messages to display and which messages to treat

as error messages• List of the last command lines executed and the current command line being

executed• Window position information• Tip of the Day settings, including the current entry and enabled/disabled status

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 113

Page 114: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-7. File Menu

Configuration files are text files which use the standard extension *.ini. A developer candefine as many configuration files as required for a project. The developer can alsoswitch between the different configuration files using the File > Load Configurationand File > Save Configuration menu entries or the corresponding toolbar buttons.

The following table lists the File menu options:

Table 4-2. File Menu Options

Menu Option Description

Compile Displays the Select File to Compile dialog box. Browse tothe desired input file using the dialog box. Select the file andclick OK. The Compiler compiles the selected file.

New/Default Configuration Resets the Compiler option settings to their default values.The default Compiler options which are activated arespecified in the Compiler Options chapter.

Load Configuration Displays the Loading configuration dialog box. Select thedesired project configuration using the dialog box and clickOpen. The configuration data stored in the selected file isloaded and used in further compilation sessions.

Save Configuration Saves the current settings in the configuration file specified onthe title bar.

Save Configuration As Displays a standard Save As dialog box. Specify theconfiguration file in which you want to save the settings andclick OK.

Configuration Opens the Configuration dialog box to specify the editorused for error feedback and which parts to save with aconfiguration.

Refer to the Editor Settings Dialog Box and SaveConfiguration Dialog Box topics.

1... project.ini

2...

Recent project configuration files list. This list can be used toreopen a recently opened project configuration.

Exit Closes the Compiler.

Compiler Main Window

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

114 Freescale Semiconductor, Inc.

Page 115: CodeWarrior Development Studio for Microcontrollers V10.x RS08

4.2.7 Compiler Menu

Use the Compiler menu to customize the Compiler. It allows you to set certain compileroptions graphically, such as the optimization level. The following table lists theCompiler menu options.

Figure 4-8. Compiler Menu

Table 4-3. Compiler Menu Options

Menu Option Description

Options Allows you to customize the application. You can graphicallyset or reset options. The next three entries are available whenOptions is selected:

Standard Types Allows you to specify the size you want to associate with eachANSI C standard type. (Refer to the Standard Types SettingsDialog Box topic.)

Options Allows you to define the options which must be activatedwhen processing an input file. (See Option Settings DialogBox.).

Smart Slider Allows you to define the optimization level you want to reachwhen processing the input file. (See Smart Control DialogBox.)

Messages Opens a dialog box, where the different error, warning, orinformation messages are mapped to another message class.(See Message Settings Dialog Box.)

Stop Compile Immediately stops the current processing session.

4.2.8 View Menu

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 115

Page 116: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The View menu enables you to customize the application window. You can define thingssuch as displaying or hiding the status or toolbar. You can also define the font used in thewindow, or clear the window. The following image shows the View Menu options.

Figure 4-9. View Menu

The following table lists the View Menu options.

Table 4-4. View Menu Options

Menu Option Description

Toolbar Switches display from the toolbar in the application window.

Status Bar Switches display from the status bar in the applicationwindow.

Log Allows you to customize the output in the application windowcontent area. The following entries are available when Log isselected:

Change Font Opens a standard font selection box. The options selected inthe font dialog box are applied to the application windowcontent area.

Clear Log Allows you to clear the application window content area.

4.2.9 Help Menu

The Help Menu enables you to either display or hide the Tip of the Day dialog box atapplication startup. In addition, it provides a standard Windows Help entry and an entryto an About box. The following image shows the Help Menu.

Compiler Main Window

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

116 Freescale Semiconductor, Inc.

Page 117: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-10. Help Menu

The following table lists the Help Menu options.

Table 4-5. Help Menu Options

Menu Option Description

Tip of the Day Switches on or off the display of a Tip of the Day duringstartup.

Help Topics Standard Help topics.

About Displays an About box with some version and licenseinformation.

4.3 Editor Settings Dialog Box

The Editor Settings dialog box has a main selection entry. Depending on the main typeof editor selected, the content below changes.

These are the main entries for the Editor configuration:

• Global Editor (shared by all tools and projects)• Local Editor (shared by all tools)• Editor Started with Command Line• Editor Started with DDE• CodeWarrior (with COM)

4.3.1 Global Editor (shared by all tools and projects)

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 117

Page 118: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Global Editor is shared among all tools and projects on one work station. It is storedin the global initialization file mcutools.ini in the [Editor] section. Some Modifiers arespecified in the editor command line.

Figure 4-11. Global Editor Configuration Dialog Box

4.3.2 Local Editor (shared by all tools)

The Local Editor is shared among all tools using the same project file. When an entry ofthe Global or Local configuration is stored, the behavior of the other tools using the sameentry also changes when these tools are restarted.

Editor Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

118 Freescale Semiconductor, Inc.

Page 119: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-12. Local Editor configuration Dialog Box

4.3.3 Editor Started with Command Line

When this editor type, as shown in the figure below, is selected, a separate editor isassociated with the application for error feedback. The configured editor is not used forerror feedback.

Enter the command that starts the editor.

The format of the editor command depends on the syntax. Some Modifiers are specifiedin the editor command line to refer to a line number in the file. (For more information,refer to the Modifiers section of this manual.)

The format of the editor command depends upon the syntax that is used to start the editor.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 119

Page 120: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-13. Editor Started with Command Line

4.3.3.1 Examples:

For CodeWright V6.0 version, use (with an adapted path to the cw32.exe file): C:\CodeWright\cw32.exe %f -g%l

For the WinEdit 32-bit version, use (with an adapted path to the winedit.exe file): C:\WinEdit32\WinEdit.exe %f /#:%l

4.3.4 Editor Started with DDE

Enter the Service Name , Topic Name , and the Client Command for the DDEconnection to the editor (Microsoft Developer Studio [Figure 4-14 ] or UltraEdit-32[Figure 4-15 ]). The Topic Name and Client Command entries can have modifiers forthe filename, line number, and column number as explained in Modifiers.

Editor Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

120 Freescale Semiconductor, Inc.

Page 121: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-14. Editor Started with DDE (Microsoft Developer Studio)

For Microsoft Developer Studio, use the settings in the following listing.

Listing: .Microsoft Developer Studio configuration

Service Name : msdev Topic Name : system Client Command : [open(%f)]

UltraEdit-32 is a powerful shareware editor. It is available fromwww.idmcomp.comwww.idmcomp.comwww.idmcomp.com or www.ultraedit.com, [email protected]. For UltraEdit, use the following settings.

Listing: UltraEdit-32 editor settings.

Service Name : UEDIT32 Topic Name : system Client Command : [open("%f/%l/%c")]

NOTEThe DDE application (e.g., Microsoft Developer Studio orUltraEdit) must be started or the DDE communication fails.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 121

Page 122: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-15. Editor Started with DDE (UltraEdit-32)

4.3.5 CodeWarrior (with COM)

If CodeWarrior (with COM) is enabled, the CodeWarrior IDE (registered as COMserver by the installation script) is used as the editor.

Editor Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

122 Freescale Semiconductor, Inc.

Page 123: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-16. CodeWarrior (with COM)

4.3.6 Modifiers

The configuration must contain modifiers that instruct the editor which file to open and atwhich line.

• The %f modifier refers to the name of the file (including path) where the message hasbeen detected.

• The %l modifier refers to the line number where the message has been detected.• The %c modifier refers to the column number where the message has been detected.

NOTEThe %l modifier can only be used with an editor which isstarted with a line number as a parameter. This is not thecase for WinEdit version 3.1 or lower or for the Notepad.When working with such an editor, start it with thefilename as a parameter and then select the menu entry Goto to jump on the line where the message has been detected.In that case the editor command looks like, C:\WINAPPS\WINEDIT\Winedit.EXE %f Check the editor manual to definewhich command line to use to start the editor.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 123

Page 124: CodeWarrior Development Studio for Microcontrollers V10.x RS08

4.4 Save Configuration Dialog Box

Use the Save Configuration dialog box to configure which parts of your configurationyou want to save to the project file.

Figure 4-17. Save Configuration Dialog Box

The Save Configuration dialog box offers the following options:

• Options

Check this option to save the current option and message settings when aconfiguration is written. By disabling this option, the last saved content remainsvalid.

• Editor Configuration

Check this option to save the current editor setting when a configuration is written.By disabling this option, the last saved content remains valid.

• Appearance

Check this option to save items such as the window position (only loaded at startuptime) and the command line content and history. By disabling this option, the last-saved content remains valid.

Save Configuration Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

124 Freescale Semiconductor, Inc.

Page 125: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Environment Variables

Check this option to save the environment variable changes made in theEnvironment configuration dialog box.

NOTEBy disabling selective options only some parts of aconfiguration file are written. For example, clear theOptions checkbox when the best options are found.Subsequent future save commands will no longer modifythe options.

• Save on Exit

The application writes the configuration on exit. No question dialog box appears toconfirm this operation. If this option is not set, the application will not write theconfiguration at exit, even if options or another part of the configuration havechanged. No confirmation appears in either case when closing the application.

NOTEMost settings are stored in the configuration file only. Theonly exceptions are, the recently used configuration list,and all settings in this dialog box.

NOTEThe application configurations can (and in fact are intendedto) coexist in the same file as the project configuration ofUltraEdit-32. When an editor is configured by the shell, theapplication reads this content out of the project file, ifpresent. The project configuration file of the shell is namedproject.ini. This filename is also suggested (but notrequired) to be used by the application.

4.5 Environment Configuration Dialog Box

This Environment Configuration dialog box is used to configure the environment. Thedialog box's content is read from the [ Environment Variables] section of the actual projectfile.

The following environment variables are available:

Listing: Environment variables

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 125

Page 126: CodeWarrior Development Studio for Microcontrollers V10.x RS08

General Path: GENPATH Object Path: OBJPATH Text Path: TEXTPATH Absolute Path: ABSPATH Header File Path: LIBPATH Various Environment Variables: other variables not mentioned above.

Figure 4-18. Environment Configuration Dialog Box

The buttons available in this dialog box are listed in the following table:

Table 4-6. Environment Configuration Dialog Box Functions

Button Function

Add Adds a new line or entry

Change Changes a line or entry

Delete Deletes a line or entry

Up Moves a line or entry up

Down Moves a line or entry down

Note that the variables are written to the project file only if you press the Save button,select File -> Save Configuration or press CTRL-S. In addition, it can be specified inthe Save Configuration dialog box if the environment is written to the project file or not.

4.6 Standard Types Settings Dialog Box

Standard Types Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

126 Freescale Semiconductor, Inc.

Page 127: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Standard Types Settings dialog box (Standard Types Settings Dialog Box) enablesyou to define the size you want to associate to each ANSI-C standard type. You can alsouse the -T: Flexible Type Management compiler option to configure ANSI-C standardtype sizes.

NOTENot all formats may be available for a target. In addition, therehas to be at least one type for each size. For example, it isincorrect to specify all types to a size of 32 bits. There is notype for 8 bits and 16 bits available for the Compiler.

The following rules apply when you modify the size associated with an ANSI-C standardtype:

Listing: Size relationships for the ANSI-C standard types

sizeof(char) <= sizeof(short) sizeof(short) <= sizeof(int) sizeof(int) <= sizeof(long) sizeof(long) <= sizeof(long long) sizeof(float) <= sizeof(double) sizeof(double)<= sizeof(long double)

Enumerations must be smaller than or equal to int.

The signed check box enables you to specify whether the char type must be considered assigned or unsigned for your application.

The Default button resets the size of the ANSI C standard types to their default values.The ANSI C standard type default values depend on the target processor.

Figure 4-19. Standard Types Settings Dialog Box

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 127

Page 128: CodeWarrior Development Studio for Microcontrollers V10.x RS08

4.7 Option Settings Dialog Box

The Option Settings dialog box enables you to set or reset application options. Thepossible command line option is also displayed in the lower display area The availableoptions are arranged into different groups. A sheet is available for each of these groups.The content of the list box depends on the selected sheet (not all groups may beavailable). The following table lists the Option Settings dialog box selections.

Figure 4-20. Option Settings Dialog Box

Table 4-7. Option Settings Dialog Box Tabs

Tab Description

Optimizations Lists optimization options.

Output Lists options related to the output files generation (which kindof file to generate).

Input Lists options related to the input file.

Language Lists options related to the programming language (ANSI-C)

Target Lists options related to the target processor.

Host Lists options related to the host operating system.

Code Generation Lists options related to code generation (such as memorymodels or float format).

Messages Lists options controlling the generation of error messages.

Various Lists options not related to the above options.

Option Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

128 Freescale Semiconductor, Inc.

Page 129: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Checking the application option checkbox sets the option. To obtain more detailedinformation about a specific option, click once on the option text to select the option andpress the F1 key or click Help .

NOTEWhen options requiring additional parameters are selected, youcan open an edit box or an additional sub window where theadditional parameter is set. For example, for the option Writestatistic output to file available in the Output sheet.

4.8 Smart Control Dialog Box

The Compiler Smart Control Dialog Box enables you to define the optimization levelyou want to reach during compilation of the input file. Five sliders are available to definethe optimization level. Refer to the table Table 4-8.

Figure 4-21. Compiler Smart Control Dialog Box

Table 4-8. Compiler Smart Control Dialog Box Controls

Slider Description

Code Density Displays the code density level expected. A high valueindicates highest code efficiency (smallest code size).

Execution Speed Displays the execution speed level expected. A high valueindicates fastest execution of the code generated.

Table continues on the next page...

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 129

Page 130: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 4-8. Compiler Smart Control Dialog Box Controls (continued)

Slider Description

Debug Complexity Displays the debug complexity level expected. A high valueindicates complex debugging. For example, assembly codecorresponds directly to the high-level language code.

Compilation Time Displays the compilation time level expected. A higher valueindicates longer compilation time to produce the object file,e.g., due to high optimization.

Information Level Displays the level of information messages which aredisplayed during a Compiler session. A high value indicates averbose behavior of the Compiler. For example, it will informwith warnings and information messages.

There is a direct link between the first four sliders in this window. When you move oneslider, the positions of the other three are updated according to the modification.

The command line is automatically updated with the options set in accordance with thesettings of the different sliders.

4.9 Message Settings Dialog Box

The Message Settings dialog box enables you to map messages to a different messageclass.

Some buttons in the dialog box may be disabled. (For example, if an option cannot bemoved to an Information message, the ` Move to: Information ' button is disabled.)

The table below lists and describes the buttons available in the Message Settings dialogbox.

Message Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

130 Freescale Semiconductor, Inc.

Page 131: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 4-22. Message Settings Dialog Box

Table 4-9. Message Settings Dialog Box Buttons

Button Description

Move to: Disabled The selected messages are disabled. The message will notoccur any longer.

Move to: Information The selected messages are changed to informationmessages.

Move to: Warning The selected messages are changed to warning messages.

Move to: Error The selected messages are changed to error messages.

Move to: Default The selected messages are changed to their default messagetype.

Reset All Resets all messages to their default message kind.

OK Exits this dialog box and accepts the changes made.

Cancel Exits this dialog box without accepting the changes made.

Help Displays online help about this dialog box.

A panel is available for each error message class. The content of the list box depends onthe selected panel:.The following table lists the definitions for the message groups.

Table 4-10. Message Group Definitions

Message group Description

Disabled Lists all disabled messages. That means messages displayedin the list box will not be displayed by the application.

Information Lists all information messages. Information messages informabout action taken by the application.

Warning Lists all warning messages. When a warning message isgenerated, processing of the input file continues.

Error Lists all error messages. When an error message isgenerated, processing of the input file continues.

Table continues on the next page...

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 131

Page 132: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 4-10. Message Group Definitions (continued)

Message group Description

Fatal Lists all fatal error messages. When a fatal error message isgenerated, processing of the input file stops immediately.Fatal messages cannot be changed and are only listed to callcontext help.

Each message has its own prefix (e.g., `C' for Compiler messages, `A' for Assemblermessages, `L' for Linker messages, `M' for Maker messages, `LM' for Libmakermessages) followed by a 4- or 5-digit number. This number allows an easy search for themessage both in the manual or on-line help.

4.9.1 Changing the Class associated with a Message

You can configure your own mapping of messages in the different classes. For thatpurpose you can use one of the buttons located on the right hand of the dialog box. Eachbutton refers to a message class. To change the class associated with a message, you haveto select the message in the list box and then click the button associated with the classwhere you want to move the message:

1. Click the Warning panel to display the list of all warning messages in the list box.2. Click on the message you want to change in the list box to select the message.3. Click Error to define this message as an error message.

NOTEMessages cannot be moved to or from the fatal error class.

NOTEThe Move to buttons are active only when messages that can bemoved are selected. When one message is marked which cannotbe moved to a specific group, the corresponding Move to buttonis disabled (grayed).

If you want to validate the modification you have performed in the error messagemapping, close the Message Settings dialog box using the OK button. If you close it usingthe Cancel button, the previous message mapping remains valid.

4.9.2 Retrieving Information about an Error Message

Message Settings Dialog Box

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

132 Freescale Semiconductor, Inc.

Page 133: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can access information about each message displayed in the list box. Select themessage in the list box and then click Help or the F1 key. An information box is opened.The information box contains a more detailed description of the error message, as well asa small example of code that may have generated the error message. If several messagesare selected, a help for the first is shown. When no message is selected, pressing the F1key or the help button shows the help for this dialog box.

4.10 About Dialog Box

The About dialog box is opened by selecting Help>About. The About box containsinformation regarding your application. The current directory and the versions of subpartsof the application are also shown. The main version is displayed separately on top of thedialog box.

Use the Extended Information button to get license information about all softwarecomponents in the same directory as that of the executable file.

Click OK to close this dialog box.

NOTEDuring processing, the sub-versions of the application partscannot be requested. They are only displayed if the applicationis inactive.

4.11 Specifying Input File

There are different ways to specify the input file. During the compilation, the options areset according to the configuration established in the different dialog boxes.

Before starting to compile a file make sure you have associated a working directory withyour editor.

4.11.1 Compiling Using Command Line in Toolbar

The command line can be used to compile a new file and to open a file that has alreadybeen compiled.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 133

Page 134: CodeWarrior Development Studio for Microcontrollers V10.x RS08

4.11.1.1 Compiling New File

A new filename and additional Compiler options are entered in the command line. Thespecified file is compiled as soon as the Compile button in the toolbar is selected or theEnter key is pressed.

4.11.1.2 Compiling Already Compiled File

The previously executed command is displayed using the arrow on the right side of thecommand line. A command is selected by clicking on it. It appears in the command line.The specified file is compiled as soon as the Compile button in the toolbar is clicked.

4.11.1.3 Using File > Compile Menu Entry

When the menu entry File > Compile is selected, a standard open file box is displayed.Use this to locate the file you want to compile. The selected file is compiled as soon asthe standard open file box is closed using the Open button.

4.11.1.4 Using Drag and Drop

A filename is dragged from an external application (for example the File Manager/Explorer) and dropped into the Compiler window. The dropped file is compiled as soonas the mouse button is released in the Compiler window. If a file being dragged has the*.ini extension, it is considered to be a configuration and it is immediately loaded and notcompiled. To compile a C file with the *.ini extension, use one of the other methods.

4.11.2 Message/Error Feedback

There are several ways to check where different errors or warnings have been detectedafter compilation. The following listing lists the format of the error messages.

Listing: Format of an error message

Specifying Input File

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

134 Freescale Semiconductor, Inc.

Page 135: CodeWarrior Development Studio for Microcontrollers V10.x RS08

>> <FileName>, line <line number>, col <column number>, pos <absolute position in file> <Portion of code generating the problem> <message class><message number>: <Message string>

The following listing is a typical example of an error message.

Listing: Example of an error message

>> in "C:\DEMO\fibo.c", line 30, col 10, pos 428 EnableInterrupts WHILE (TRUE) { ( INFORMATION C4000: Condition always TRUE

See also the -WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for InteractiveMode and -WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Modecompiler options for different message formats.

4.11.3 Use Information from Compiler Window

Once a file has been compiled, the Compiler window content area displays the list of allthe errors or warnings that were detected.

Use your usual editor to open the source file and correct the errors.

4.11.4 Use User-Defined Editor

You must first configure the editor you want to use for message/error feedback in theConfiguration dialog box before you begin the compile process. Once a file has beencompiled, double-click on an error message. The selected editor is automaticallyactivated and points to the line containing the error.

Chapter 4 Graphical User Interface

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 135

Page 136: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Specifying Input File

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

136 Freescale Semiconductor, Inc.

Page 137: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 5Environment

This Chapter describes all the environment variables. Some environment variables arealso used by other tools (For example, Linker or Assembler). Consult the respectivemanual for more information.

Parameters are set in an environment using environment variables. There are three waysto specify your environment:

• The current project file with the [Environment Variables] section. This file may bespecified on Tool startup using the -Prod: Specify Project File at Startup option.

• An optional `default.env' file in the current directory. This file is supported forbackwards compatibility. The filename is specified using the ENVIRONMENT:Environment File Specification variable. Using the default.env file is notrecommended.

• Setting environment variables on system level (DOS level). This is notrecommended.

The syntax for setting an environment variable is ( Listing: Setting the GENPATHenvironment variable):

Parameter:

<KeyName>=<ParamDef>

NOTENormally no white space is allowed in the definition of anenvironment variable.

Listing: Setting the GENPATH environment variable

GENPATH=C:\INSTALL\LIB;D:\PROJECTS\TESTS;/usr/local/lib; /home/me/my_project

Parameters may be defined in several ways:

• Using system environment variables supported by your operating system.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 137

Page 138: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Putting the definitions into the actual project file in the section named [EnvironmentVariables].

• Putting the definitions in a file named default.env in the default directory.

NOTEThe maximum length of environment variable entries in thedefault.env file is 4096 characters.

• Putting the definitions in a file given by the value of the ENVIRONMENT systemenvironment variable.

NOTEThe default directory mentioned above is set using theDEFAULTDIR: Default Current Directory systemenvironment variable.

When looking for an environment variable, all programs first search the systemenvironment, then the default.env file, and finally the global environment file defined byENVIRONMENT. If no definition is found, a default value is assumed.

NOTEThe environment may also be changed using the -Env: SetEnvironment Variable option.

NOTEMake sure that there are no spaces at the end of anyenvironment variable declaration.

The major sections in this chapter are:

• Current Directory• Environment Macros• Global Initialization File (mcutools.ini)• Local Configuration File (usually project.ini)• Paths• Line Continuation• Environment Variable Details

5.1 Current Directory

Current Directory

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

138 Freescale Semiconductor, Inc.

Page 139: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The most important environment for all tools is the current directory. The currentdirectory is the base search directory where the tool starts to search for files (e.g., for thedefault.env file).

The current directory of a tool is determined by the operating system or by the programwhich launches another one.

• For the UNIX operating system, the current directory of an launched executable isalso the current directory from where the binary file has been started.

• For MS Windows based operating systems, the current directory definition is definedas follows:

• If the tool is launched using the File Manager or Explorer, the current directoryis the location of the launched executable.

• If the tool is launched using an Icon on the Desktop, the current directory is theone specified and associated with the Icon.

• If the tool is launched by another launching tool with its own current directoryspecification (e.g., an editor), the current directory is the one specified by thelaunching tool (e.g., current directory definition).

• For the tools, the current directory is where the local project file is located. Changingthe current project file also changes the current directory if the other project file is ina different directory. Note that browsing for a C file does not change the currentdirectory.

To overwrite this behavior, use the environment variable DEFAULTDIR: DefaultCurrent Directory.

The current directory is displayed, with other information, using the -V: Prints theCompiler Version compiler option and in the About dialog box.

5.2 Environment Macros

You can use macros in your environment settings, as listed in the following listing.

Listing: Using Macros for setting environment variables

MyVAR=C:\testTEXTPATH=$(MyVAR)\txt

OBJPATH=${MyVAR}\obj

In the example above, TEXTPATH is expanded to C:\test\txt and OBJPATH is expanded to C:\test\obj. You can use $() or ${}. However, the referenced variable must be defined.

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 139

Page 140: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Special variables are also allowed (special variables are always surrounded by {} and theyare case-sensitive). In addition, the variable content contains the directory separator `\'.The special variables are:

• {Compiler}

That is the path of the executable one directory level up if the executable is C:\Freescale\prog\linker.exe, and the variable is C:\Freescale\.

• {Project}

Path of the current project file. This is used if the current project file is C:\demo\project.ini, and the variable contains C:\demo\.

• {System}

This is the path where your Windows system is installed, e.g., C:\WINNT\.

5.3 Global Initialization File (mcutools.ini)

All tools store some global data into the file mcutools.ini. The tool first searches for themcutools.ini file in the directory of the tool itself (path of the executable). If there is nomcutools.ini file in this directory, the tool looks for an mcutools.ini file in the MSWindows installation directory (For example, C:\WINDOWS).

Listing: Typical Global Initialization File Locations

C:\WINDOWS\mcutools.ini CWInstallDir\MCU\prog\mcutools.ini

If a tool is started in the CWInstallDir\<MCU>\prog directory, the project file that is used islocated in the same directory as the tool ( CWInstallDir\MCU\prog\mcutools.ini).

If the tool is started outside the CWInstallDir\MCU\prog directory, the project file in theWindows directory is used ( C:\WINDOWS\mcutools.ini).

Global Configuration File Entries documents the sections and entries you can include inthe mcutools.ini file.

5.4 Local Configuration File (usually project.ini)

Global Initialization File (mcutools.ini)

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

140 Freescale Semiconductor, Inc.

Page 141: CodeWarrior Development Studio for Microcontrollers V10.x RS08

All the configuration properties are stored in the configuration file. The sameconfiguration file is used by different applications.

The shell uses the configuration file with the name project.ini in the current directoryonly. When the shell uses the same file as the compiler, the Editor Configuration iswritten and maintained by the shell and is used by the compiler. Apart from this, thecompiler can use any filename for the project file. The configuration file has the sameformat as the windows *.ini files. The compiler stores its own entries with the samesection name as those in the global mcutools.ini file. The compiler backend is encodedinto the section name, so that a different compiler backend can use the same file withoutany overlapping. Different versions of the same compiler use the same entries. This playsa role when options, only available in one version, must be stored in the configurationfile. In such situations, two files must be maintained for each different compiler version.If no incompatible options are enabled when the file is last saved, the same file may beused for both compiler versions.

The current directory is always the directory where the configuration file is located. If aconfiguration file in a different directory is loaded, the current directory also changes.When the current directory changes, the entire default.env file is reloaded. When aconfiguration file is loaded or stored, the options in the environment variable COMPOPTIONSare reloaded and added to the project options. This behavior is noticed when differentdefault.env files exist in different directories, each containing incompatible options in theCOMPOPTIONS variable.

When a project is loaded using the first default.env, its COMPOPTIONS are added to theconfiguration file. If this configuration is stored in a different directory where adefault.env exists with incompatible options, the compiler adds options and remarks theinconsistency. You can remove the option from the configuration file with the optionsettings dialog box. You can also remove the option from the default.env with the shell ora text editor, depending which options are used in the future.

At startup, there are two ways to load a configuration:

• Use the -Prod: Specify Project File at Startup command line option• The project.ini file in the current directory.

If the -Prod option is used, the current directory is the directory the project file is in. If the-Prod option is used with a directory, the project.ini file in this directory is loaded.

Local Configuration File Entries documents the sections and entries you can include in aproject.ini file.

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 141

Page 142: CodeWarrior Development Studio for Microcontrollers V10.x RS08

5.5 Paths

A path list is a list of directory names separated by semicolons. Path names are declaredusing the following EBNF syntax.

Listing: EBNF path syntax

PathList = DirSpec {";" DirSpec}.DirSpec = ["*"] DirectoryName.

Most environment variables contain path lists directing where to look for files.

Listing: Environment variable path list with four possible paths.

GENPATH=C:\INSTALL\LIB;D:\PROJECTS\TESTS;/usr/local/lib;/home/me/my_project

If a directory name is preceded by an asterisk ( * ), the program recursively searches thatentire directory tree for a file, not just the given directory itself. The directories aresearched in the order they appear in the path list.

Listing: Setting an environment variable using recursive searching

LIBPATH=*C:\INSTALL\LIB

NOTESome DOS environment variables (like GENPATH, LIBPATH, etc.) areused.

5.6 Line Continuation

It is possible to specify an environment variable in an environment file (default.env) overdifferent lines using the line continuation character `\' (refer to the following listing).

Listing: Specifying an environment variable using line continuation characters

OPTIONS=\ -W2 \

-Wpd

This is the same as:

OPTIONS=-W2 -Wpd

But this feature may not work well using it together with paths, e.g.:

Line Continuation

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

142 Freescale Semiconductor, Inc.

Page 143: CodeWarrior Development Studio for Microcontrollers V10.x RS08

GENPATH=.\TEXTFILE=.\txt

GENPATH=.TEXTFILE=.\txt

This results in:

To avoid such problems, use a semicolon ';' at the end of a path if there is a `\' at theend (refer to the following listing):

Listing: Using a semicolon to allow a multiline environment variable

GENPATH=.\;TEXTFILE=.\txt

5.7 Environment Variable Details

The remainder of this chapter describes each of the possible environment variables. Thefollowing table lists these description topics in their order of appearance for eachenvironment variable.

Table 5-1. Environment Variables - Documentation Topics

Topic Description

Tools Lists tools that use this variable.

Synonym A synonym exists for some environment variables. Thosesynonyms may be used for older releases of the Compilerand will be removed in the future. A synonym has lowerprecedence than the environment variable.

Syntax Specifies the syntax of the option in an EBNF format.

Arguments Describes and lists optional and required arguments for thevariable.

Default Shows the default setting for the variable or none.

Description Provides a detailed description of the option and how to useit.

Example Gives an example of usage, and the effects of the variablewhere possible. The example shows an entry in thedefault.env for a PC.

See also Names related sections.

5.7.1 COMPOPTIONS: Default Compiler Options

Tools

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 143

Page 144: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Compiler

Synonym

HICOMPOPTIONS

Syntax

COMPOPTIONS={<option>}

Arguments

<option>: Compiler command-line option

Default

None

Description

If this environment variable is set, the Compiler appends its contents to its command lineeach time a file is compiled. Use this variable to specify global options for everycompilation. This frees you from having to specify them for every compilation.

NOTEIt is not recommended to use this environment variable if theCompiler used is version 5.x, because the Compiler adds theoptions specified in the COMPOPTIONS variable to the options storedin the project.ini file.

Listing: Setting default values for environment variables (not recommended)

COMPOPTIONS=-W2 -Wpd

See also

Compiler Options

5.7.2 COPYRIGHT: Copyright entry in object file

Tools

Compiler, Assembler, Linker, or Librarian

Synonym

None

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

144 Freescale Semiconductor, Inc.

Page 145: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

COPYRIGHT=<copyright>

Arguments

< copyright>: copyright entry

Default

None

Description

Each object file contains an entry for a copyright string. This information is retrievedfrom the object files using the decoder.

Example

COPYRIGHT=Copyright by Freescale

See also

environmental variables :

• USERNAME: User Name in Object File• INCLUDETIME: Creation Time in Object File

5.7.3 DEFAULTDIR: Default Current Directory

Tools

Compiler, Assembler, Linker, Decoder, Debugger, Librarian, Maker, or Burner

Synonym

None

Syntax

DEFAULTDIR=<directory>

Arguments

< directory>: Directory to be the default current directory

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 145

Page 146: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Description

Specifies the default directory for all tools. All the tools indicated above will take thespecified directory as their current directory instead of the one defined by the operatingsystem or launching tool (e.g., editor).

NOTEThis is an environment variable on a system level (globalenvironment variable). It cannot be specified in a defaultenvironment file ( default.env).

Specifying the default directory for all tools in the CodeWarrior suite:

DEFAULTDIR=C:\INSTALL\PROJECT

See also

Current Directory

Global Initialization File (mcutools.ini)

5.7.4 ENVIRONMENT: Environment File Specification

Tools

Compiler, Linker, Decoder, Debugger, Librarian, Maker, or Burner

Synonym

HIENVIRONMENT

Syntax

ENVIRONMENT=<file>

Arguments

<file>: filename with path specification, without spaces

Default

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

146 Freescale Semiconductor, Inc.

Page 147: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Description

This variable is specified on a system level. The application looks in the current directoryfor an environment file named default.env. Using ENVIRONMENT (e.g., set in the autoexec.bat(DOS) or *.cshrc (UNIX)), a different filename may be specified.

NOTEThis is a system level environment variable (globalenvironment variable). It cannot be specified in a defaultenvironment file ( default.env).

Example

ENVIRONMENT=\Freescale\prog\global.env

5.7.5 ERRORFILE: Error filename Specification

Tools

Compiler, Assembler, Linker, or Burner

Synonym

None

Syntax

ERRORFILE=<filename>

Arguments

<filename>: filename with possible format specifiers

Description

The ERRORFILE environment variable specifies the name for the error file.

Possible format specifiers are:

• %n : Substitute with the filename, without the path.• %p : Substitute with the path of the source file.• %f : Substitute with the full filename, i.e., with the path and name (the same as %p%n).• A notification box is shown in the event of an improper error filename.

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 147

Page 148: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Examples

ERRORFILE=MyErrors.err

Lists all errors into the MyErrors.err file in the current directory.

ERRORFILE=\tmp\errors

Lists all errors into the errors file in the \tmp directory.

ERRORFILE=%f.err

Lists all errors into a file with the same name as the source file, but with the *.errextension, into the same directory as the source file. If you compile a file such as sources\test.c, an error list file, \sources\test.err, is generated.

ERRORFILE=\dir1\%n.err

For a source file such as test.c, an error list file with the name \dir1\test.err is generated.

ERRORFILE=%p\errors.txt

For a source file such as \dir1\dir2\test.c, an error list file with the name\dir1\dir2\errors.txt is generated.

If the ERRORFILE environment variable is not set, the errors are written to the EDOUT file inthe current directory.

5.7.6 GENPATH: #include "File" Path

Tools

Compiler, Linker, Decoder, Debugger, or Burner

Synonym

HIPATH

Syntax

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

148 Freescale Semiconductor, Inc.

Page 149: CodeWarrior Development Studio for Microcontrollers V10.x RS08

GENPATH={<path>}

Arguments

<path>: Paths separated by semicolons, without spaces

Default

Current directory

Description

If a header file is included with double quotes, the Compiler searches first in the currentdirectory, then in the directories listed by GENPATH, and finally in the directories listed byLIBRARYPATH.

NOTEIf a directory specification in this environment variable startswith an asterisk ( * ), the whole directory tree is searchedrecursively depth first, i.e., all subdirectories and theirsubdirectories and so on are searched. Search order of thesubdirectories is indeterminate within one level in the tree.

Example

GENPATH=\sources\include;..\..\headers;\usr\local\lib

See also

LIBRARYPATH: `include <File>' Path environment variable

5.7.7 INCLUDETIME: Creation Time in Object File

Tools

Compiler, Assembler, Linker, or Librarian

Synonym

None

Syntax

INCLUDETIME=(ON|OFF)

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 149

Page 150: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

ON: Include time information into object file

OFF: Do not include time information into object file

Default

ON

Description

Each object file contains a time stamp indicating the creation time and data as strings.Whenever a new file is created by one of the tools, the new file gets a new time stampentry.

This behavior may be undesired if (for Software Quality Assurance reasons) a binary filecompare has to be performed. Even if the information in two object files is the same, thefiles do not match exactly as the time stamps are not identical. To avoid such problems,set this variable to OFF. In this case, the time stamp strings in the object file for date andtime are "none" in the object file.

The time stamp is retrieved from the object files using the decoder.

Example

INCLUDETIME=OFF

See also

Environment variables :

• COPYRIGHT: Copyright entry in object file• USERNAME: User Name in Object File

5.7.8 LIBRARYPATH: `include <File>' Path

Tools

Compiler, ELF tools (Burner, Linker, or Decoder)

Synonym

LIBPATH

Syntax

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

150 Freescale Semiconductor, Inc.

Page 151: CodeWarrior Development Studio for Microcontrollers V10.x RS08

LIBRARYPATH={<path>}

Arguments

< path>: Paths separated by semicolons, without spaces

Default

Current directory

Description

If a header file is included with double quotes, the Compiler searches first in the currentdirectory, then in the directories given by GENPATH: #include "File" Path and finally inthe directories given by LIBRARYPATH.

NOTEIf a directory specification in this environment variable startswith an asterisk ( * ), the whole directory tree is searchedrecursively depth first, i.e., all subdirectories and theirsubdirectories and so on are searched. Search order of thesubdirectories is indeterminate within one level in the tree.

Example

LIBRARYPATH=\sources\include;.\.\headers;\usr\local\lib

See also

Environment variables :

• GENPATH: #include "File" Path• USELIBPATH: Using LIBPATH Environment Variable• Input Files

5.7.9 OBJPATH: Object File Path

Tools

Compiler, Linker, Decoder, Debugger, or Burner

Synonym

None

Syntax

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 151

Page 152: CodeWarrior Development Studio for Microcontrollers V10.x RS08

OBJPATH=<path>

Default

Current directory

Arguments

<path>: Path without spaces

Description

If the Compiler generates an object file, the object file is placed into the directoryspecified by OBJPATH. If this environment variable is empty or does not exist, the object fileis stored into the path where the source has been found.

If the Compiler tries to generate an object file specified in the path specified by thisenvironment variable but fails (e.g., because the file is locked), the Compiler issues anerror message.

If a tool (e.g., the Linker) looks for an object file, it first checks for an object filespecified by this environment variable, then in GENPATH: #include "File" Path, andfinally in HIPATH.

Example

OBJPATH=\sources\obj

See also

Output Files

5.7.10 TEXTPATH: Text File Path

Tools

Compiler, Linker, or Decoder

Synonym

None

Syntax

TEXTPATH=<path>

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

152 Freescale Semiconductor, Inc.

Page 153: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

<path>: Path without spaces

Default

Current directory

Description

If the Compiler generates a textual file, the file is placed into the directory specified byTEXTPATH. If this environment variable is empty or does not exist, the text file is stored intothe current directory.

Example

TEXTPATH=\sources\txt

See also

Output Files

Compiler options :

• -Li: List of Included Files to ".inc" File• -Lm: List of Included Files in Make Format• -Lo: Append Object File Name to List (enter [<files>])

5.7.11 TMP: Temporary Directory

Tools

Compiler, Assembler, Linker, Debugger, or Librarian

Synonym

None

Syntax

TMP=<directory>

Arguments

<directory>: Directory to be used for temporary files

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 153

Page 154: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Description

If a temporary file must be created, the ANSI function, tmpnam(), is used. This libraryfunction stores the temporary files created in the directory specified by this environmentvariable. If the variable is empty or does not exist, the current directory is used. Checkthis variable if you get the error message "Cannot create temporary file".

NOTEThis is an environment variable on a system level (globalenvironment variable). It cannot be specified in a defaultenvironment file ( default.env).

Example

TMP=C:\TEMP

See also

Current Directory

5.7.12 USELIBPATH: Using LIBPATH Environment Variable

Tools

Compiler, Linker, or Debugger

Synonym

None

Syntax

USELIBPATH=(OFF|ON|NO|YES)

Arguments

ON, YES: The environment variable LIBRARYPATH is used by the Compiler to look for systemheader files <*.h>.

NO, OFF: The environment variable LIBRARYPATH is not used by the Compiler.

Default

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

154 Freescale Semiconductor, Inc.

Page 155: CodeWarrior Development Studio for Microcontrollers V10.x RS08

ON

Description

This environment variable allows a flexible usage of the LIBRARYPATH environment variableas the LIBRARYPATH variable might be used by other software (e.g., version managementPVCS).

Example

USELIBPATH=ON

See also

LIBRARYPATH: `include <File>' Path environment variable

5.7.13 USERNAME: User Name in Object File

Tools

Compiler, Assembler, Linker, or, Librarian

Synonym

None

Syntax

USERNAME=<user>

Arguments

<user>: Name of user

Default

None

Description

Each object file contains an entry identifying the user who created the object file. Thisinformation is retrievable from the object files using the decoder.

Example

USERNAME=The Master

Chapter 5 Environment

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 155

Page 156: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

environment variables :

• COPYRIGHT: Copyright entry in object file• INCLUDETIME: Creation Time in Object File

Environment Variable Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

156 Freescale Semiconductor, Inc.

Page 157: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 6Files

This chapter describes input and output files and file processing.

• Input Files• Output Files• File Processing

6.1 Input Files

The following input files are described:

• Source Files• Include Files

6.1.1 Source Files

The frontend takes any file as input. It does not require the filename to have a specialextension. However, it is suggested that all your source filenames have the *.c extensionand that all header files use the *.h extension. Source files are searched first in theCurrent Directory and then in the GENPATH: #include "File" Path directory.

6.1.2 Include Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 157

Page 158: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The search for include files is governed by two environment variables: GENPATH: #include"File" Path and LIBRARYPATH: `include <File>' Path. Include files that are includedusing double quotes as in:

#include "test.h"

are searched first in the current directory, then in the directory specified by the -I: IncludeFile Path option, then in the directories given in the GENPATH: #include "File" Pathenvironment variable, and finally in those listed in the LIBPATH or LIBRARYPATH: `include<File>' Path environment variable. The current directory is set using the IDE, the ProgramManager, or the DEFAULTDIR: Default Current Directory environment variable.

Include files that are included using angular brackets as in

#include <stdio.h>

are searched for first in the current directory, then in the directory specified by the -Ioption, and then in the directories given in LIBPATH or LIBRARYPATH. The current directory isset using the IDE, the Program Manager, or the DEFAULTDIR environment variable.

6.2 Output Files

The following output files are described:

• Object Files• Error Listing

6.2.1 Object Files

After successful compilation, the Compiler generates an object file containing the targetcode as well as some debugging information. This file is written to the directory listed inthe OBJPATH: Object File Path environment variable. If that variable contains more thanone path, the object file is written in the first listed directory. If this variable is not set, theobject file is written in the directory the source file was found. Object files always get theextension *.o.

Output Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

158 Freescale Semiconductor, Inc.

Page 159: CodeWarrior Development Studio for Microcontrollers V10.x RS08

6.2.2 Error Listing

If the Compiler detects any errors, it does not create an object file. Rather, it creates anerror listing file named err.txt. This file is generated in the directory where the sourcefile was found (also see ERRORFILE: Error filename Specification).

If the Compiler's window is open, it displays the full path of all header files read. Aftersuccessful compilation the number of code bytes generated and the number of globalobjects written to the object file are also displayed.

If the Compiler is started from an IDE (with '%f' given on the command line) orCodeWright (with '%b%e' given on the command line), this error file is not produced.Instead, it writes the error messages in a special format in a file called EDOUT using theMicrosoft format by default. You may use the CodeWrights's Find Next Error commandto display both the error positions and the error messages.

6.2.2.1 Interactive Mode (Compiler Window Open)

If ERRORFILE is set, the Compiler creates a message file named as specified in thisenvironment variable.

If ERRORFILE is not set, a default file named err.txt is generated in the current directory.

6.2.2.2 Batch Mode (Compiler Window not Open)

If ERRORFILE is set, the Compiler creates a message file named as specified in thisenvironment variable.

If ERRORFILE is not set, a default file named EDOUT is generated in the current directory.

6.3 File Processing

The following figure shows how file processing occurs with the Compiler:

Chapter 6 Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 159

Page 160: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 6-1. Files used with the Compiler

File Processing

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

160 Freescale Semiconductor, Inc.

Page 161: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 7Compiler Options

The Compiler provides a number of Compiler options that control the Compiler'soperation. Options consist of a minus sign or dash ( -), followed by one or more letters ordigits. Anything not starting with a dash or minus sign is the name of a source file to becompiled. You can specify Compiler options on the command line or in the COMPOPTIONSvariable. Each Compiler option is specified only once per compilation.

Command line options are not case-sensitive, e.g., -Li is the same as -li.

NOTEIt is not possible to coalesce options in different groups, e.g., -Cc - Licannot be abbreviated by the terms - Cci or - CcLi.

Another way to set the compiler options is to use the RS08 Compiler Option Settingsdialog box.

NOTEDo not use the COMPOPTIONS environment variable if the GUI isused. The Compiler stores the options in the project.ini file, notin the default.env file.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 161

Page 162: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Figure 7-1. Option Settings Dialog Box

The RS08 Compiler Message Settings dialog box, shown in the following figure, mayalso be used to move messages ( -Wmsg options).

Figure 7-2. RS08 Compiler Message Settings Dialog Box

The major sections of this chapter are:

• Option Recommendation : Advice about the available compiler options.• Compiler Option Details : Description of the layout and format of the compiler

command-line options that are covered in the remainder of the chapter.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

162 Freescale Semiconductor, Inc.

Page 163: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.1 Option Recommendation

Depending on the compiled sources, each Compiler optimization may have its advantagesor disadvantages. The following are recommended:

• -Wpd: Error for Implicit Parameter Declaration

The default configuration enables most optimizations in the Compiler. If they causeproblems in your code (e.g., they make the code hard to debug), switch them off (theseoptions usually have the -On prefix). Candidates for such optimizations are peepholeoptimizations.

Some optimizations may produce more code for some functions than for others (e.g., -Oi:Inlining or -Cu: Loop Unrolling). Try those options to get the best result for each.

To acquire the best results for each function, compile each module with the -OdocF:Dynamic Option Configuration for Functions option. An example for this option is -OdocF="-Or".

For compilers with the ICG optimization engine, the following option combinationprovides the best results:

-Ona -OdocF="-Onca|-One|-Or"

7.2 Compiler Option Details

NOTENot all tools options have been defined for this release. Alldescriptions will be available in an upcoming release.

This topic describes:

• Option Groups• Option Scopes• Option Detail Description

7.2.1 Option Groups

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 163

Page 164: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Compiler options are grouped by:

• HOST• LANGUAGE• OPTIMIZATIONS• CODE GENERATION• OUTPUT• INPUT• MESSAGES• VARIOUS• STARTUP

A special group is the STARTUP group: The options in this group cannot be specifiedinteractively; they can only be specified on the command line to start the tool.

Refer to the following table:

Table 7-1. Compiler Option Groups

Group Description

HOST Lists options related to the host

LANGUAGE Lists options related to the programming language (e.g.,ANSI-C)

OPTIMIZATIONS Lists optimization options

OUTPUT Lists output file generation options (types of file generated)

INPUT Lists options related to the input file

CODE GENERATION Lists options related to code generation (memory models,float format, etc.)

MESSAGES Lists options controlling error message generation

VARIOUS Lists various options

STARTUP Options specified only on tool startup

The group corresponds to the property sheets of the graphical option settings.

NOTENot all command line options are accessible through theproperty sheets as they have a special graphical setting (e.g., theoption to set the type sizes).

7.2.2 Option Scopes

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

164 Freescale Semiconductor, Inc.

Page 165: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Each option has also a scope. Refer to the following table.

Table 7-2. Option Scopes

Scope Description

Application The option has to be set for all files (Compilation Units) of anapplication. A typical example is an option to set the memorymodel. Mixing object files will have unpredictable results.

Compilation Unit This option is set for each compilation unit for an applicationdifferently. Mixing objects in an application is possible.

Function The option may be set for each function differently. Such anoption may be used with the option: "-OdocF=""<option>".

None The option scope is not related to a specific code part. Atypical example are the options for the messagemanagement.

The available options are arranged into different groups. A sheet is available for each ofthese groups. The content of the list box depends on the selected sheets.

7.2.3 Option Detail Description

The remainder of this section describes each of the Compiler options available for theCompiler. The options are listed in alphabetical order. Each is divided into severalsections listed in the following table.

Table 7-3. Compiler Option - Documentation Topics

Topic Description

Group HOST, LANGUAGE, OPTIMIZATIONS, OUTPUT, INPUT,CODE GENERATION, MESSAGES, or VARIOUS.

Scope Application, Compilation Unit, Function, or None

Syntax Specifies the syntax of the option in an EBNF format

Arguments Describes and lists optional and required arguments for theoption

Default Shows the default setting for the option

Defines List of defines related to the compiler option

Pragma List of pragmas related to the compiler option

Description Provides a detailed description of the option and how to use it

Example Gives an example of usage, and effects of the option wherepossible. compiler settings, source code and Linker PRM filesare displayed where applicable. The example shows an entryin the default.env for a PC.

See also Names related options

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 165

Page 166: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.1 Using Special Modifiers

With some options, it is possible to use special modifiers. However, some modifiers maynot make sense for all options. This section describes those modifiers.

The following table lists the supported modifiers.

Table 7-4. Compiler Option Modifiers

Modifier Description

%p Path including file separator

%N Filename in strict 8.3 format

%n Filename without extension

%E Extension in strict 8.3 format

%e Extension

%f Path + filename without extension

%" A double quote (") if the filename, the path or the extensioncontains a space

%' A single quote (`) if the filename, the path or the extensioncontains a space

%(ENV) Replaces it with the contents of an environment variable

%% Generates a single `%'

7.2.3.1.1 Examples

For the following examples, the actual base filename for the modifiers is: C:\Freescale\mydemo\TheWholeThing.myExt.

%p gives the path only with a file separator:

C:\Freescale\my demo\

%N results in the filename in 8.3 format (that is, the name with only eight characters):

TheWhole

%n returns just the filename without extension:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

166 Freescale Semiconductor, Inc.

Page 167: CodeWarrior Development Studio for Microcontrollers V10.x RS08

TheWholeThing

%E gives the extension in 8.3 format (that is, the extension with only three characters)

myE

%e is used for the whole extension:

myExt

%f gives the path plus the filename:

C:\Freescale\my demo\TheWholeThing

Because the path contains a space, using %" or %' is recommended: Thus, %"%f%" results in:(using double quotes)

"C:\Freescale\my demo\TheWholeThing"

where %'%f%' results in: (using single quotes)

`C:\Freescale\my demo\TheWholeThing'

%(envVariable) uses an environment variable. A file separator following after %(envVariable) is ignored if the environment variable is empty or does not exist. In otherwords, if TEXTPATH is set to: TEXTPATH=C:\Freescale\txt, %(TEXTPATH)\myfile.txt is replacedwith:

C:\Freescale\txt\myfile.txt

But if TEXTPATH does not exist or is empty, %(TEXTPATH)\myfile.txt is set to:

myfile.txt

A %% may be used to print a percent sign. Using %e%% results in:

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 167

Page 168: CodeWarrior Development Studio for Microcontrollers V10.x RS08

myExt%

7.2.3.2 -!: Filenames are Clipped to DOS Length

Group

INPUT

Scope

Compilation Unit

Syntax

-!

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option, called cut, is very useful when compiling files copied from an MS-DOS filesystem. Filenames are clipped to DOS length (eight characters).

Listing: Example of the cut option, -!

The cut option truncates the following include directive: #include "mylongfilename.h" to: #include "mylongfi.h"

7.2.3.3 -AddIncl: Additional Include File

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

168 Freescale Semiconductor, Inc.

Page 169: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

INPUT

Scope

Compilation Unit

Syntax

-AddIncl"<fileName>"

Arguments

<fileName>: name of the included file

Default

None

Defines

None

Pragmas

None

Description

Includes the specified file at the beginning of the compilation unit. It has the same effectas if written at the beginning of the compilation unit using double quotes ("..."):

#include "my headerfile.h"

Example

See the following listing for the -AddIncl compiler option that includes the above headerfile.

Listing: -AddIncl example

-AddIncl"my headerfile.h"

See also

-I: Include File Path compiler option

7.2.3.4 -Ansi: Strict ANSI

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 169

Page 170: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

LANGUAGE

Scope

Function

Syntax

-Ansi

Arguments

None

Default

None

Defines

__STDC__

Pragmas

None

Description

The -Ansi option forces the Compiler to follow strict ANSI C language conversions.When -Ansi is specified, all non ANSI-compliant keywords (e.g., __asm, __far and __near)are not accepted by the Compiler, and the Compiler generates an error.

The ANSI-C compiler also does not allow C++ style comments (those started with //).To allow C++ comments, even with -Ansi set, the -Cppc: C++ Comments in ANSI-Ccompiler option must be set.

The asm keyword is also not allowed if -Ansi is set. To use inline assembly, even with -Ansi set, use __asm instead of asm.

The Compiler defines __STDC__ as 1 if this option is set, or as 0 if this option is not set.

7.2.3.5 -ArgFile: Specify a file from which additional command lineoptions will be read

Group

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

170 Freescale Semiconductor, Inc.

Page 171: CodeWarrior Development Studio for Microcontrollers V10.x RS08

HOST

Scope

Function

Syntax

-ArgFile<filename>

Arguments

<filename>: Specify the file containing the options to be passed in the command line.

Description

The options present in the file are appended to existing command line options.

Example

Considering that a file named option.txt is used and that it contains the "-Mt" option thencrs08.exe -ArgFileoption.txt command line will be equivalent to crs08.exe -Mt.

7.2.3.6 -BfaB: Bitfield Byte Allocation

Group

CODE GENERATION

Scope

Function

Syntax

-BfaB(MS|LS)

Arguments

MS: Most significant bit in byte first (left to right)

LS: Least significant bit in byte first (right to left)

Default

-BfaBLS

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 171

Page 172: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Defines

__BITFIELD_MSWORD_FIRST__

__BITFIELD_LSWORD_FIRST__

__BITFIELD_MSBYTE_FIRST__

__BITFIELD_LSBYTE_FIRST__

__BITFIELD_MSBIT_FIRST__

__BITFIELD_LSBIT_FIRST__

Pragmas

None

Description

Normally, bits in byte bitfields are allocated from the least significant bit to the mostsignificant bit. This produces less code overhead if a byte bitfield is allocated onlypartially.

Example

The following listing uses the default condition and uses the three least significant bits.

Listing: Example struct used for the next listing

struct {unsigned char b: 3; } B; // the default is using the 3 least significant bits

This allows just a mask operation without any shift to access the bitfield.

To change this allocation order, you can use the -BfaBMS or -BfaBLS options, shown in thethe following listing.

Listing: Examples of changing the bitfield allocation order

struct { char b1:1;

char b2:1;

char b3:1;

char b4:1;

char b5:1;

} myBitfield;

7 0

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

172 Freescale Semiconductor, Inc.

Page 173: CodeWarrior Development Studio for Microcontrollers V10.x RS08

--------------------

|b1|b2|b3|b4|b5|####| (-BfaBMS)

--------------------

7 0

--------------------

|####|b5|b4|b3|b2|b1| (-BfaBLS)

--------------------

See also

Bitfield Allocation

7.2.3.7 -BfaGapLimitBits: Bitfield Gap Limit

Group

CODE GENERATION

Scope

Function

Syntax

-BfaGapLimitBits<number>

Arguments

<number>: positive number specifying the maximum number of bits for a gap

Default

1

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 173

Page 174: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The bitfield allocation tries to avoid crossing a byte boundary whenever possible. Toachieve optimized accesses, the compiler may insert some padding or gap bits to reachthis. This option enables you to affect the maximum number of gap bits allowed.

Example

In the example in the following listing, assume that you have specified a 3-bit maximumgap, i.e., -BfaGapLimitBits3.

Listing: Bitfield allocation

struct { unsigned char a: 7;

unsigned char b: 5;

unsigned char c: 4;

} B;

The compiler allocates struct B with 3 bytes. First, the compiler allocates the 7 bits of a.Then the compiler tries to allocate the 5 bits of b, but this would cross a byte boundary.Because the gap of 1 bit is smaller than the specified gap of 3 bits, b is allocated in thenext byte. Then the allocation starts for c. After the allocation of b there are 3 bits left.Because the gap is 3 bits, c is allocated in the next byte. If the maximum gap size werespecified to zero, all 16 bits of B would be allocated in two bytes. Since the gap limit isset to 3, and the gap required for allocating c in the next byte is also 3, the compiler willuse a 16-bit word as the allocation unit. Both b and c will be allocated within this word.

Assuming we initialize an instance of B as below:

B s = {2, 7, 5},

we get the following memory layouts:

-BfaGapLimitBits1 : 53 82

-BfaGapLimitBits3 : 02 00 A7

-BfaGapLimitBits4 : 02 07 05 m

The following listing specifies a maximum size of two bits for a gap.

Listing: Example where the maximum number of gap bits is two

-BfaGapLimitBits2

See also

Bitfield Allocation

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

174 Freescale Semiconductor, Inc.

Page 175: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.8 -BfaTSR: Bitfield Type-Size Reduction

Group

CODE GENERATION

Scope

Function

Syntax

-BfaTSR[ON|OFF]

Arguments

ON: Bitfield Type Size Reduction enabled

OFF: Bitfield Type-Size Reduction disabled

Default

-BfaTSRON

Defines

__BITFIELD_TYPE_SIZE_REDUCTION__

__BITFIELD_NO_TYPE_SIZE_REDUCTION__

Pragmas

None

Description

This option is configurable whether or not the compiler uses type-size reduction forbitfields. Type-size reduction means that the compiler can reduce the type of an intbitfield to a char bitfield if it fits into a character. This allows the compiler to allocatememory only for one byte instead of for an integer.

Examples

The following listings demonstrate the effects of -BfaTSRoff and -BfaTSRon, respectively.

Listing: -BfaTSRoff

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 175

Page 176: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct{ long b1:4;

long b2:4;

} myBitfield;

31 7 3 0

--------------------------------

|########################|b2|b1| -BfaTSRoff

--------------------------------

Listing: -BfaTSRon

7 3 0----------

|b2 | b1 | -BfaTSRon

----------

Example

-BfaTSRon

See also

Bitfield Type Reduction

7.2.3.9 -C++ (-C++f, -C++e, -C++c): C++ Support

Group

LANGUAGE

Scope

Compilation Unit

Syntax

-C++ (f|e|c)

Arguments

f : Full ANSI Draft C++ support

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

176 Freescale Semiconductor, Inc.

Page 177: CodeWarrior Development Studio for Microcontrollers V10.x RS08

e : Embedded C++ support (EC++)

c : compactC++ support (cC++)

Default

None

Defines

__cplusplus

Pragmas

None

Description

With this option enabled, the Compiler behaves as a C++ Compiler. You can choosebetween three different types of C++:

• Full ANSI Draft C++ supports the whole C++ language.• Embedded C++ (EC++) supports a constant subset of the C++ language. EC++ does

not support inefficient things like templates, multiple inheritance, virtual base classesand exception handling.

• compactC++ (cC++) supports a configurable subset of the C++ language. You canconfigure this subset with the option -Cn.

If the option is not set, the Compiler behaves as an ANSI-C Compiler.

If the option is enabled and the source file name extension is *.c, the Compiler behaves asa C++ Compiler.

If the option is not set, but the source filename extension is .cpp or .cxx, the Compilerbehaves as if the -C++f option were set.

Example

COMPOPTIONS=-C++f

See Also

-Cn: Disable compactC++ features

7.2.3.10 -Cc: Allocate Const Objects into ROM

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 177

Page 178: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Cc

Arguments

None

Default

None

Defines

None

Pragmas

#pragma INTO_ROM: Put Next Variable Definition into ROM

Description

The Linker prepares no initialization for objects allocated into a read-only section. Thestartup code does not have to copy the constant data.

You may also put variables into the ROM_VAR segment by using the segment pragma (seethe Linker manual).

With #pragma CONST_SECTION for constant segment allocation, variables declared as constare allocated in this segment.

If the current data segment is not the default segment, const objects in that user-definedsegment are not allocated in the ROM_VAR segment but remain in the segment defined by theuser. If that data segment happens to contain onlyconst objects, it may be allocated in aROM memory section (for more information, refer to the Linker section of the BuildTools manual).

NOTEIn the ELF/DWARF object-file format, constants are allocatedinto the .rodata section.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

178 Freescale Semiconductor, Inc.

Page 179: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThe Compiler uses the default addressing mode for theconstants specified by the memory model.

Example

See also

Segmentation

Linker section in the Build Tools manual

-F (-F2, -F2o): Object File Format option

#pragma INTO_ROM: Put Next Variable Definition into ROM

7.2.3.11 -Ccx: Cosmic Compatibility Mode for Space Modifiers andInterrupt Handlers

Group

LANGUAGE

Scope

Compilation Unit

Syntax

-Ccx

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 179

Page 180: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This option allows Cosmic style @near, @far and @tiny space modifiers as well as@interruptin your C code. The -ANSI option must be switched off. It is not necessary toremove the Cosmic space modifiers from your application code. There is no need to placethe objects to sections addressable by the Cosmic space modifiers.

The following is done when a Cosmic modifier is parsed:

• The objects declared with the space modifier are always allocated in a specialCosmic compatibility (_CX) section (regardless of which section pragma is set)depending on the space modifier, on the const qualifier or if it is a function or avariable.

• Space modifiers on the left hand side of a pointer declaration specify the pointer typeand pointer size, depending on the target.

See the example in the Listing: Cosmic Space Modifiers for a prm file describing theplacement of sections mentioned in the following table.

Table 7-5. Cosmic Modifier Handling

Definition Placement to _CX section

@tiny int my_var _CX_DATA_TINY

@near int my_var _CX_DATA_NEAR

@far int my_var _CX_DATA_FAR

const @tiny int my_cvar _CX_CONST_TINY

const @near int my_cvar _CX_CONST_NEAR

const @far int my_cvar _CX_CONST_FAR

@tiny void my_fun(void) _CX_CODE_TINY

@near void my_fun(void) _CX_CODE_NEAR

@far void my_fun(void) _CX_CODE_FAR

@interrupt void my_fun(void) _CX_CODE_INTERRUPT

For further information about porting applications from Cosmic to the CodeWarrior IDE,refer to the technical note TN234. The following table indicates how space modifiers aremapped for the RS08.

Table 7-6. Cosmic Space modifier mapping for the RS08

Definition Keyword Mapping

@tiny ignored

@near ignored

@far ignored

Refer to the following listing for an example of the -Ccx compiler option.

Listing: Cosmic Space Modifiers

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

180 Freescale Semiconductor, Inc.

Page 181: CodeWarrior Development Studio for Microcontrollers V10.x RS08

volatile @tiny char tiny_ch; extern @far const int table[100]; static @tiny char * @near ptr_tab[10]; typedef @far int (*@far funptr)(void); funptr my_fun; /* banked and __far calling conv. */ char @tiny *tptr = &tiny_ch; char @far *fptr = (char @far *)&tiny_ch; Example for a prm file: (16- and 24-bit addressable ROM; 8-, 16- and 24-bit addressable RAM) SEGMENTS MY_ROM READ_ONLY 0x2000 TO 0x7FFF; MY_BANK READ_ONLY 0x508000 TO 0x50BFFF; MY_ZP READ_WRITE 0xC0 TO 0xFF; MY_RAM READ_WRITE 0xC000 TO 0xCFFF; MY_DBANK READ_WRITE 0x108000 TO 0x10BFFF; END PLACEMENT DEFAULT_ROM, ROM_VAR, _CX_CODE_NEAR, _CX_CODE_TINY, _CX_CONST_TINY, _CX_CONST_NEAR INTO MY_ROM; _CX_CODE_FAR, _CX_CONST_FAR INTO MY_BANK; DEFAULT_RAM, _CX_DATA_NEAR INTO MY_RAM; _CX_DATA_FAR INTO MY_DBANK; _ZEROPAGE, _CX_DATA_TINY INTO MY_ZP; END

See also

Cosmic Manuals, Linker Manual, TN234

7.2.3.12 -Ci: Bigraph and Trigraph Support

Group

LANGUAGE

Scope

Function

Syntax

-Ci

Arguments

None

Default

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 181

Page 182: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Defines

__TRIGRAPHS__

Pragmas

None

Description

If certain tokens are not available on your keyboard, they are replaced with keywords asshown in the following table.

Table 7-7. Keyword Alternatives for Unavailable Tokens

Bigraph Keyword Token Replaced TrigraphKeyword

Token Replaced AdditionalKeyword

Token Replaced

<% } ??= # and &&

%> } ??/ \ and_eq &=

<: [ ??' ^ bitand &

:> ] ??( [ bitor |

%: # ??) ] compl ~

%:%: ## ??! | not !

??< { or ||

??> } or_eq |=

??- ~ xor ^

xor_eq ^=

not_eq !=

NOTEAdditional keywords are not allowed as identifiers if this optionis enabled.

Example

-Ci

The example in the following listing shows the use of trigraphs, bigraphs, and theadditional keywords with the corresponding normal C source.

Listing: Trigraphs, Bigraphs, and Additional Keywords

int Trigraphs(int argc, char * argv??(??)) ??<

if (argc<1 ??!??! *argv??(1??)=='??/0') return 0;

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

182 Freescale Semiconductor, Inc.

Page 183: CodeWarrior Development Studio for Microcontrollers V10.x RS08

printf("Hello, %s??/n", argv??(1??));

??>

%:define TEST_NEW_THIS 5

%:define cat(a,b) a%:%:b

??=define arraycheck(a,b,c) a??(i??) ??!??! b??(i??)

int i;

int cat(a,b);

char a<:10:>;

char b<:10:>;

void Trigraph2(void) <%

if (i and ab) <%

i and_eq TEST_NEW_THIS;

i = i bitand 0x03;

i = i bitor 0x8;

i = compl i;

i = not i;

%> else if (ab or i) <%

i or_eq 0x5;

i = i xor 0x12;

i xor_eq 99;

%> else if (i not_eq 5) <%

cat(a,b) = 5;

if (a??(i??) || b[i])<%%>

if (arraycheck(a,b,i)) <%

i = 0;

%>

%>

%>

/* is the same as ... */

int Trigraphs(int argc, char * argv[]) {

if (argc<1 || *argv[1]=='\0') return 0;

printf("Hello, %s\n", argv[1]);

}

#define TEST_NEW_THIS 5

#define cat(a,b) a##b

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 183

Page 184: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#define arraycheck(a,b,c) a[i] || b[i]

int i;

int cat(a,b);

char a[10];

char b[10];

void Trigraph2(void){

if (i && ab) {

i &= TEST_NEW_THIS;

i = i & 0x03;

i = i | 0x8;

i = ~i;

i = !i;

} else if (ab || i) {

i |= 0x5;

i = i ^ 0x12;

i ^= 99;

} else if (i != 5) {

cat(a,b) = 5;

if (a[i] || b[i]){}

if (arraycheck(a,b,i)) {

i = 0;

}

}

}

7.2.3.13 -Cn: Disable compactC++ features

Group

LANGUAGE

Scope

Compilation Unit

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

184 Freescale Semiconductor, Inc.

Page 185: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Cn [= {Vf|Tpl|Ptm|Mih|Ctr|Cpr}]

Arguments

Vf: Do not allow virtual functions

Tpl: Do not allow templates

Ptm: Do not allow pointer to member

Mih: Do not allow multiple inheritance and virtual base classes

Ctr: Do not create compiler defined functions

Cpr: Do not allow class parameters and class returns

Default

None

Defines

None

Pragmas

None

Description

If the -C++c option is enabled, you can disable the following compactC++ features:

• Vf : Virtual functions are not allowed.

Avoid having virtual tables that consume a lot of memory.

• Tpl : Templates are not allowed.

Avoid having many generated functions perform similar operations.

• Ptm : Pointer to member not allowed.

Avoid having pointer-to-member objects that consume a lot of memory.

• Mih : Multiple inheritance is not allowed.

Avoid having complex class hierarchies. Because virtual base classes are logical onlywhen used with multiple inheritance, they are also not allowed.

• Ctr : The C++ Compiler can generate several kinds of functions, if necessary:• Default Constructor

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 185

Page 186: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Copy Constructor• Destructor• Assignment operator

With this option enabled, the Compiler does not create those functions. This isuseful when compiling C sources with the C++ Compiler, assuming you do notwant C structures to acquire member functions.

• Cpr : Class parameters and class returns are not allowed.

Avoid overhead with Copy Constructor and Destructor calls when passingparameters, and passing return values of class type.

Example

-C++c -Cn=Ctr

7.2.3.14 -Cni: No Integral Promotion

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Cni

Arguments

None

Default

None

Defines

__CNI__

Pragmas

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

186 Freescale Semiconductor, Inc.

Page 187: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Description

Enhances code density of character operations by omitting integral promotion. Thisoption enables a non ANSI-C compliant behavior.

In ANSI-C operations with data types, anything smaller than int must be promoted to int(integral promotion). With this rule, adding two unsigned character variables results in azero-extension of each character operand, and then adding them back in as int operands.If the result must be stored back into a character, this integral promotion is not necessary.When this option is set, promotion is avoided where possible.

The code size may be decreased if this option is set because operations may be performedon a character base instead of an integer base.

The -Cni option enhances character operation code density by omitting integralpromotion.

Consider the following:

• In most expressions, ANSI-C requires char type variables to be extended to the nextlarger type int, which is required to be at least 16-bit in size by the ANSI standard.

• The -Cni option suppresses this ANSI-C behavior and thus allows 'characters' and'character sized constants' to be used in expressions. This option does not conform toANSI standards. Code compiled with this option is not portable.

• The ANSI standard requires that 'old style declarations' of functions using the charparameter, as shown in the below listing, be extended to int. The -Cni option disablesthis extension and saves additional RAM.

Example

See the following listing for an example of "no integer promotion."

Listing: Definition of an `old style function' using a char parameter.

old_style_func (a, b, c) char a, b, c;

{

...

}

The space reserved for a, b, and c is just one byte each, instead of two.

For expressions containing different types of variables, the following conversion rulesapply:

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 187

Page 188: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• If both variables are of type signed char, the expression is evaluated signed.• If one of two variables is of type unsigned char, the expression is evaluated unsigned,

regardless of whether the other variable is of type signed or unsigned char.• If one operand is of another type than signed or unsigned char, the usual ANSI-C

arithmetic conversions are applied.• If constants are in the character range, they are treated as characters. Remember that

the char type is signed and applies to the constants -128 to 127. All constants greaterthan 127, (i.e., 128, 129, etc.) are treated as integer. If you want them treated ascharacters, they must be cast (refer to the following listing).Listing: Casting integers to signed char

signed char a, b;if (a > b * (signed char)129)

NOTEThis option is ignored with the -Ansi Compiler switchactive.

NOTEWith this option set, the code that is generated does notconform to the ANSI standard. In other words: the codegenerated is wrong if you apply the ANSI standard asreference. Using this option is not recommended in mostcases.

7.2.3.15 -Cppc: C++ Comments in ANSI-C

Group

LANGUAGE

Scope

Function

Syntax

-Cppc

Arguments

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

188 Freescale Semiconductor, Inc.

Page 189: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

By default, the Compiler does not allow C++ comments if the -Ansi: Strict ANSIcompiler option is set.

Defines

None

Pragmas

None

Description

The -Ansi option forces the compiler to conform to the ANSI-C standard. Because a strictANSI-C compiler rejects any C++ comments (started with //), this option may be used toallow C++ comments (refer to the following listing).

Listing: Using -Cppc to allow C++ comments

-Cppc/* This allows the code containing C++ comments to be compiled with the -Ansi option set */

void foo(void) // this is a C++ comment

See also

-Ansi: Strict ANSI

7.2.3.16 -Cq: Propagate const and volatile qualifiers for structs

Group

LANGUAGE

Scope

Application

Syntax

-Cq

Arguments

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 189

Page 190: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

This option propagates const and volatile qualifiers for structures. That means, if allmembers of a structure are constant, the structure itself is constant as well. The samehappens with the volatile qualifier. If the structure is declared as constant or volatile, allits members are constant or volatile, respectively. Consider the following example.

Example

The source code in the following listing declares two structs, each of which has a constmember.

Listing: Be careful to not write to a constant struct

struct { const field;

} s1, s2;

void foo(void) {

s1 = s2; // struct copy

s1.field = 3; // error: modifiable lvalue expected

}

In the above example, the field in the struct is constant, but not the struct itself. Thus thestruct copy s1 = s2 is legal, even if the field of the struct is constant. But, a write accessto the struct field causes an error message. Using the -Cq option propagates thequalification (const) of the fields to the whole struct or array. In the above example, thestruct copy causes an error message.

7.2.3.17 -CswMaxLF: Maximum Load Factor for Switch Tables

Group

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

190 Freescale Semiconductor, Inc.

Page 191: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CODE GENERATION

Scope

Function

Syntax

-CswMaxLF<number>

Arguments

<number>: a number in the range of 0 - 100 denoting the maximum load factor

Default

Backend-dependent

Defines

None

Pragmas

None

Description

Allows changing the default strategy of the Compiler to use tables for switch statements.

NOTEThis option is only available if the compiler supports switchtables.

Normally the Compiler uses a table for switches with more than about eight labels if thetable is filled between 80% (minimum load factor of 80) and 100% (maximum loadfactor of 100). If there are not enough labels for a table or the table is not filled, a branchtree is generated (tree of if-else-if-else). This branch tree is like an `unrolled' binarysearch in a table which quickly evaluates the associated label for a switch expression.

Using a branch tree instead of a table improves code execution speed, but may increasecode size. In addition, because the branch tree itself uses no special runtime routine forswitch expression evaluation, debugging may be more seamless.

Specifying a load factor means that tables are generated in specific `fuel' status:

The table in the following listing is filled to 90% (labels for `0' to `9', except for `5').

Listing: Load factor example

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 191

Page 192: CodeWarrior Development Studio for Microcontrollers V10.x RS08

switch(i) { case 0: ... case 1: ... case 2: ... case 3: ... case 4: ... // case 5: ... case 6: ... case 7: ... case 8: ... case 9: ... default }

Assumed that the minimum load factor is set to 50% and setting the maximum load factorfor the above case to 80%, a branch tree is generated instead a table. But setting themaximum load factor to 95% produces a table.

To guarantee that tables are generated for switches with full tables only, set the tableminimum and maximum load factors to 100:

-CswMinLF100 -CswMaxLF100.

See also

Compiler options:

• -CswMinLB: Minimum Number of Labels for Switch Tables• -CswMinSLB: Minimum Number of Labels for Switch Search Tables• -CswMinLF: Minimum Load Factor for Switch Tables

7.2.3.18 -CswMinLB: Minimum Number of Labels for Switch Tables

Group

CODE GENERATION

Scope

Function

Syntax

-CswMinLB<number>

Arguments

<number>: a positive number denoting the number of labels.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

192 Freescale Semiconductor, Inc.

Page 193: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

Backend-dependent

Defines

None

Pragmas

None

Description

This option allows changing the default strategy of the Compiler using tables for switchstatements.

NOTEThis option is only available if the compiler supports switchtables.

Normally the Compiler uses a table for switches with more than about 8 labels (caseentries) (actually this number is highly backend-dependent). If there are not enoughlabels for a table, a branch tree is generated (tree of if-else-if-else). This branch tree islike an `unrolled' binary search in a table which evaluates very fast the associated labelfor a switch expression.

Using a branch tree instead of a table may increases the code execution speed, but itprobably increases the code size. In addition, because the branch tree itself uses nospecial runtime routine for switch expression evaluation, debugging may be much easier.

To disable any tables for switch statements, just set the minimum number of labelsneeded for a table to a high value (e.g., 9999):

-CswMinLB9999 -CswMinSLB9999.

When disabling simple tables it usually makes sense also to disable search tables with the-CswMinSLB option.

See also

Compiler options :

• -CswMinLF: Minimum Load Factor for Switch Tables• -CswMinSLB: Minimum Number of Labels for Switch Search Tables• -CswMaxLF: Maximum Load Factor for Switch Tables

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 193

Page 194: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.19 -CswMinLF: Minimum Load Factor for Switch Tables

Group

CODE GENERATION

Scope

Function

Syntax

-CswMinLF<number>

Arguments

<number>: a number in the range of 0 - 100 denoting the minimum load factor

Default

Backend-dependent

Defines

None

Pragmas

None

Description

Allows the Compiler to use tables for switch statements.

NOTEThis option is only available if the compiler supports switchtables.

Normally the Compiler uses a table for switches with more than about 8 labels and if thetable is filled between 80% (minimum load factor of 80) and 100% (maximum loadfactor of 100). If there are not enough labels for a table or the table is not filled, a branchtree is generated (tree of if-else-if-else). This branch tree is like an `unrolled' binarysearch in a table which quickly evaluates the associated label for a switch expression.

Using a branch tree instead of a table improves code execution speed, but may increasecode size. In addition, because the branch tree itself uses no special runtime routine forswitch expression evaluation, debugging is more seamless.

Specifying a load factor means that tables are generated in specific `fuel' status:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

194 Freescale Semiconductor, Inc.

Page 195: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The table in the following listing is filled to 90% (labels for `0' to `9', except for `5').

Listing: Load factor example

switch(i) { case 0: ... case 1: ... case 2: ... case 3: ... case 4: ... // case 5: ... case 6: ... case 7: ... case 8: ... case 9: ... default }

Assuming that the maximum load factor is set to 100% and the minimum load factor forthe above case is set to 90%, this still generates a table. But setting the minimum loadfactor to 95% produces a branch tree.

To guarantee that tables are generated for switches with full tables only, set the minimumand maximum table load factors to 100:

-CswMinLF100-CswMaxLF100.

See also

Compiler options :

• -CswMinLB: Minimum Number of Labels for Switch Tables• -CswMinSLB: Minimum Number of Labels for Switch Search Tables• -CswMaxLF: Maximum Load Factor for Switch Tables

7.2.3.20 -CswMinSLB: Minimum Number of Labels for Switch SearchTables

Group

CODE GENERATION

Scope

Function

Syntax

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 195

Page 196: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-CswMinSLB<number>

Arguments

<number>: a positive number denoting the number of labels

Default

Backend-dependent

Defines

None

Pragmas

None

Description

Allows the Compiler to use tables for switch statements.

NOTEThis option is only available if the compiler supports searchtables.

Switch tables are implemented in different ways. When almost all case entries in somerange are given, a table containing only branch targets is used. Using such a dense table isefficient because only the correct entry is accessed. When large holes exist in some areas,a table form can still be used.

But now the case entry and its corresponding branch target are encoded in the table. Thisis called a search table. A complex runtime routine must be used to access a search table.This routine checks all entries until it finds the matching one. Search tables executeslowly.

Using a search table improves code density, but the execution time increases. Every timean entry in a search table must be found, all previous entries must be checked first. For adense table, the right offset is computed and accessed. In addition, note that all backendsimplement search tables (if at all) by using a complex runtime routine. This may makedebugging more complex.

To disable search tables for switch statements, set the minimum number of labels neededfor a table to a high value (e.g., 9999): -CswMinSLB9999.

See also

Compiler options :

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

196 Freescale Semiconductor, Inc.

Page 197: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• -CswMinLB: Minimum Number of Labels for Switch Tables• -CswMinLF: Minimum Load Factor for Switch Tables• -CswMaxLF: Maximum Load Factor for Switch Tables

7.2.3.21 -Cu: Loop Unrolling

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Cu[=i<number>]

Arguments

<number>: number of iterations for unrolling, between 0 and 1024

Default

None

Defines

None

Pragmas

#pragma LOOP_UNROLL: Force Loop Unrolling

#pragma NO_LOOP_UNROLL: Disable Loop Unrolling

Description

Enables loop unrolling with the following restrictions:

• Only simple for statements are unrolled, e.g.,

for (i=0; i<10; i++)

• Initialization and test of the loop counter must be done with a constant.• Only <, >, <=, >= are permitted in a condition.• Only ++ or -- are allowed for the loop variable increment or decrement.• The loop counter must be integral.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 197

Page 198: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• No change of the loop counter is allowed within the loop.• The loop counter must not be used on the left side of an assignment.• No address operator (&) is allowed on the loop counter within the loop.• Only small loops are unrolled:• Loops with few statements within the loop.• Loops with fewer than 16 increments or decrements of the loop counter. The bound

may be changed with the optional argument =i<number>. The -Cu=i20 option unrollsloops with a maximum of 20 iterations.

ExamplesListing: for Loop

-Cu int i, j; j = 0; for (i=0; i<3; i++) { j += i; }

When the -Cu compiler option is used, the Compiler issues an information messageUnrolling loop and transforms this loop as shown in the following listing:

Listing: Transformation of the for Loop

j += 1; j += 2; i = 3;

The Compiler also transforms some special loops, i.e., loops with a constant condition orloops with only one pass:

Listing: Example for a loop with a constant condition

for (i=1; i>3; i++) { j += i; }

The Compiler issues an information message Constant condition found, removing loopand transforms the loop into a simple assignment, because the loop body is neverexecuted:

i=1;

Listing: Example for a loop with only one pass

for (i=1; i<2; i++) { j += i; }

The Compiler issues a warning 'Unrolling loop' and transforms the for loop into

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

198 Freescale Semiconductor, Inc.

Page 199: CodeWarrior Development Studio for Microcontrollers V10.x RS08

j += 1;

i = 2;

because the loop body is executed only once.

7.2.3.22 -Cx: Switch Off Code Generation

Group

CODE GENERATION

Scope

Compilation Unit

Syntax

-Cx

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

The -Cx compiler option disables the code generation process of the Compiler. No objectcode is generated, though the Compiler performs a syntactical check of the source code.This allows a quick test if the Compiler accepts the source without errors.

7.2.3.23 -D: Macro Definition

Group

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 199

Page 200: CodeWarrior Development Studio for Microcontrollers V10.x RS08

LANGUAGE

Scope

Compilation Unit

Syntax

-D<identifier>[=<value>]

Arguments

<identifier>: identifier to be defined

<value>: value for <identifier>, anything except - and <a blank>

Default

None

Defines

None

Pragmas

None

Description

The Compiler allows the definition of a macro on the command line. The effect is thesame as having a # define directive at the very beginning of the source file.

-DDEBUG=0

This is the same as writing:

#define DEBUG 0

in the source file.

If you need strings with blanks in your macro definition, there are two ways. Either useescape sequences or double quotes:

-dPath="Path\40with\40spaces"

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

200 Freescale Semiconductor, Inc.

Page 201: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-d"Path=""Path with spaces"""

NOTEBlanks are not allowed after the -D option; the first blankterminates this option. Also, macro parameters are notsupported.

7.2.3.24 -Ec: Conversion from 'const T*' to 'T*'

Group

LANGUAGE

Scope

Function

Syntax

-Ec

Arguments

None

Default

None

Description

If this non-ANSI compliant extension is enabled, a pointer to a constant type is treatedlike a pointer to the non-constant equivalent of the type. Earlier Compilers did not checka store to a constant object through a pointer. This option is useful if some older sourcehas to be compiled.

Defines

None

Pragmas

None

Examples

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 201

Page 202: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See the following listings for examples using -Ec conversions.

Listing: Conversion from 'const T*' to 'T*

void f() { int *i;

const int *j;

i=j; /* C++ illegal, but OK with -Ec! */

}

struct A {

int i;

};

void g() {

const struct A *a;

a->i=3; /* ANSI C/C++ illegal, but OK with -Ec! */

}

void h() {

const int *i;

*i=23; /* ANSI-C/C++ illegal, but OK with -Ec! */

}

Listing: Assigning a value to a "constant" pointer

-Ecvoid foo(const int *p){

*p = 0; // Some Compilers do not issue an error.

7.2.3.25 -Eencrypt: Encrypt Files

Group

OUTPUT

Scope

Compilation Unit

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

202 Freescale Semiconductor, Inc.

Page 203: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Eencrypt[=<filename>]

Arguments

<filename>: The name of the file to be generated

It may contain special modifiers (for more information, refer to the Using SpecialModifiers topic).

Default

The default filename is %f.e%e. A file named fun.c creates an encrypted file named fun.ec.

Description

All files passed together with this option are encrypted using the given key with the -Ekey: Encryption Key option.

NOTEThis option is only available or operative with a license for thefollowing feature: HIxxxx30, where xxxx is the feature numberof the compiler for a specific target.

Defines

None

Pragmas

None

Example

fun.c fun.h -Ekey1234567 -Eencrypt=%n.e%e

This encrypts the fun.c file using the 1234567 key to the fun.ec file, and the fun.h file to thefun.eh file.

The encrypted fun.ec and fun.eh files may be passed to a client. The client is able tocompile the encrypted files without the key by compiling the following file:

fun.ec

See also

-Ekey: Encryption Key

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 203

Page 204: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.26 -Ekey: Encryption Key

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Ekey<keyNumber>

Arguments

<keyNumber>

Default

The default encryption key is 0. Using this default is not recommended.

Description

This option is used to encrypt files with the given key number ( -Eencrypt option).

NOTEThis option is only available or operative with a license for thefollowing feature: HIxxxx30 where xxxx is the feature numberof the compiler for a specific target.

Defines

None

Pragmas

None

Example

fun.c -Ekey1234567 -Eencrypt=%n.e%e

This encrypts the fun.' file using the 1234567 key.

See also

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

204 Freescale Semiconductor, Inc.

Page 205: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Eencrypt: Encrypt Files

7.2.3.27 -Env: Set Environment Variable

Group

HOST

Scope

Compilation Unit

Syntax

-Env<Environment Variable>=<Variable Setting>

Arguments

<Environment Variable>: Environment variable to be set

<Variable Setting>: Setting of the environment variable

Default

None

Description

This option sets an environment variable. This environment variable may be used in themaker, or used to overwrite system environment variables.

Defines

None

Pragmas

None

Example

-EnvOBJPATH=\sources\obj

This is the same as:

OBJPATH=\sources\obj

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 205

Page 206: CodeWarrior Development Studio for Microcontrollers V10.x RS08

in the default.env file.

Use the following syntax to use an environment variable using filenames with spaces:

-Env"OBJPATH=\program files"

See also

Environment

7.2.3.28 -F (-F2, -F2o): Object File Format

Group

OUTPUT

Scope

Application

Syntax

-F(2|2o)

Arguments

2: ELF/DWARF 2.0 object-file format

2o: compatible ELF/DWARF 2.0 object-file format

NOTENot all object-file formats may be available for a target.

Default

-F2

Defines

__ELF_OBJECT_FILE_FORMAT__

Pragmas

None

Description

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

206 Freescale Semiconductor, Inc.

Page 207: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler writes the code and debugging info after compilation into an object file.The Compiler produces an ELF/DWARF object file when the -F2 option is set. Thisobject-file format may also be supported by other Compiler vendors.

In the Compiler ELF/DWARF 2.0 output, some constructs written in previous versionswere not conforming to the ELF standard because the standard was not clear enough inthis area. Because old versions of the simulator or debugger (V5.2 or earlier) are not ableto load the corrected new format, the old behavior can still be produced by using -f2oinstead of -f2. Some old versions of the debugger (simulator or debugger V5.2 or earlier)generate a GPF when a new absolute file is loaded. If you want to use the older versions,use -f2o instead of -f2. New versions of the debugger are able to load both formatscorrectly. Also, some older ELF/DWARF object file loaders from emulator vendors mayrequire you to set the -F2o option.

Note that it is recommended to use the ELF/DWARF 2.0 format instead of the ELF/DWARF 1.1. The 2.0 format is much more generic. In addition, it supports multipleinclude files plus modifications of the basic generic types (e.g., floating point format).Debug information is also more robust.

7.2.3.29 -Fd: Double is IEEE32

Group

CODE GENERATION

Scope

Application

Syntax

-Fd

Arguments

None

Default

None

Defines

See -T: Flexible Type Management

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 207

Page 208: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Pragmas

See -T

Description

Allows you to change the float or double format. By default, float is IEEE32 and doublesare IEEE64.

When you set this option, all doubles are in IEEE32 instead of IEEE64.

Floating point formats may be also changed with the -T option.

7.2.3.30 -H: Short Help

Group

VARIOUS

Scope

None

Syntax

-H

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

The -H option causes the Compiler to display a short list (i.e., help list) of availableoptions within the Compiler window. Options are grouped into HOST, LANGUAGE,OPTIMIZATIONS, OUTPUT, INPUT, CODE GENERATION, MESSAGES, andVARIOUS.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

208 Freescale Semiconductor, Inc.

Page 209: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Do not specify any other option or source file when you invoke the -H option.

Example

The following listing lists the short list options.

Listing: Short Help options

-H may produce the following list:INPUT:

-! Filenames are clipped to DOS length

-I Include file path

VARIOUS:

-H Prints this list of options

-V Prints the Compiler version

7.2.3.31 -I: Include File Path

Group

INPUT

Scope

Compilation Unit

Syntax

-I<path>

Arguments

<path>: path, terminated by a space or end-of-line

Default

None

Defines

None

Pragmas

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 209

Page 210: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

Allows you to set include paths in addition to the LIBPATH, LIBRARYPATH: `include<File>' Path and GENPATH: #include "File" Path environment variables. Paths specifiedwith this option have precedence over includes in the current directory, and pathsspecified in GENPATH, LIBPATH, and LIBRARYPATH.

Example

-I. -I..\h -I\src\include

This directs the Compiler to search for header files first in the current directory (.), thenrelative from the current directory in '..\h', and then in '\src\include'. If the file is notfound, the search continues with GENPATH, LIBPATH, and LIBRARYPATH for header files in doublequotes ( #include"headerfile.h"), and with LIBPATH and LIBRARYPATH for header files in angularbrackets ( #include <stdio.h>).

See also

Input Files

-AddIncl: Additional Include File

LIBRARYPATH: `include <File>' Path

7.2.3.32 -IEA: Specify the address of the interrupt exit addressregister

Specifies the address of the interrupt exit address register. By default, it is 0x200.

Group

CODE GENERATION

Scope

Compilation Unit

7.2.3.33 -La: Generate Assembler Include File

Group

OUTPUT

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

210 Freescale Semiconductor, Inc.

Page 211: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Scope

Function

Syntax

-La[=<filename>]

Arguments

<filename>: The name of the file to be generated

It may contain special modifiers (see Using Special Modifiers)

Default

No file created

Defines

None

Pragmas

None

Description

The -La option causes the Compiler to generate an assembler include file when theCREATE_ASM_LISTING pragma occurs. The name of the created file is specified by this option.If no name is specified, a default of %f.inc is taken. To put the file into the directoryspecified by the TEXTPATH: Text File Path environment variable, use the option -la=%n.inc. The %f option already contains the path of the source file. When %f is used, thegenerated file is in the same directory as the source file.

The content of all modifiers refers to the main input file and not to the actual header file.The main input file is the one specified on the command line.

Example

-La=asm.inc

See also

#pragma CREATE_ASM_LISTING: Create an Assembler Include File Listing

-La: Generate Assembler Include File

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 211

Page 212: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.34 -Lasm: Generate Listing File

Group

OUTPUT

Scope

Function

Syntax

-Lasm[=<filename>]

Arguments

<filename>: The name of the file to be generated.

It may contain special modifiers (see Using Special Modifiers).

Default

No file created.

Defines

None

Pragmas

None

Description

The -Lasm option causes the Compiler to generate an assembler listing file directly. Allassembler generated instructions are also printed to this file. The name of the file isspecified by this option. If no name is specified, a default of %n.lst is taken. TheTEXTPATH: Text File Path environment variable is used if the resulting filenamecontains no path information.

The syntax does not always conform with the inline assembler or the assembler syntax.Therefore, this option can only be used to review the generated code. It can not currentlybe used to generate a file for assembly.

Example

-Lasm=asm.lst

See also

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

212 Freescale Semiconductor, Inc.

Page 213: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Lasmc: Configure Listing File

7.2.3.35 -Lasmc: Configure Listing File

Group

OUTPUT

Scope

Function

Syntax

-Lasmc[={a|c|i|s|h|p|e|v|y}]

Arguments

a: Do not write the address

c: Do not write the code

i: Do not write the instruction

s: Do not write the source code

h: Do not write the function header

p: Do not write the source prolog

e: Do not write the source epilog

v: Do not write the compiler version

y: Do not write cycle information

Default

All printed together with the source

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 213

Page 214: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The -Lasmc option configures the output format of the listing file generated with the -Lasm: Generate Listing File option. The addresses, the hex bytes, and the instructions areselectively switched off.

The format of the listing file has the layout shown in the following listing. The letters inbrackets ([]) indicate which suboption may be used to switch it off:

Listing: -Lasm configuration options

[v] ANSI-C/cC++ Compiler V-5.0.1[v]

[p] 1:

[p] 2: void foo(void) {

[h]

[h] Function: foo

[h] Source : C:\Freescale\test.c

[h] Options : -Lasm=%n.lst

[h]

[s] 3: }

[a] 0000 [c] 3d [i] RTS

[e] 4:

[e] 5: // comments

[e] 6:

Example

-Lasmc=ac

7.2.3.36 -Ldf: Log Predefined Defines to File

Group

OUTPUT

Scope

Compilation Unit

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

214 Freescale Semiconductor, Inc.

Page 215: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Ldf[="<file>"]

Arguments

<file>: filename for the log file, default is predef.h.

Default

default <file> is predef.h.

Defines

None

Pragmas

None

Description

The -Ldf option causes the Compiler to generate a text file that contains a list of thecompiler-defined #define. The default filename is predef.h, but may be changed (e.g., -Ldf="myfile.h"). The file is generated in the directory specified by the TEXTPATH: TextFile Path environment variable. The defines written to this file depend on the actualCompiler option settings (e.g., type size settings or ANSI compliance).

NOTEThe defines specified by the command line (-D: MacroDefinition option) are not included.

This option may be very useful for SQA. With this option it is possible to documentevery #define which was used to compile all sources.

NOTEThis option only has an effect if a file is compiled. This optionis unusable if you are not compiling a file.

Example

The following listing is an example which lists the contents of a file containing definedirectives.

Listing: Displays the contents of a file where define directives are present

-Ldf This generates the predef.h filewith the following content: /* resolved by preprocessor: __LINE__ */ /* resolved by preprocessor: __FILE__ */ /* resolved by preprocessor: __DATE__ */ /* resolved by preprocessor: __TIME__ */ #define __STDC__ 0 #define __VERSION__ 5004

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 215

Page 216: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#define __VERSION_STR__ "V-5.0.4" #define __SMALL__ #define __PTR_SIZE_2__ #define __BITFIELD_LSBIT_FIRST__ #define __BITFIELD_MSBYTE_FIRST__ ...

See also

-D: Macro Definition

7.2.3.37 -Li: List of Included Files to ".inc" File

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Li

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

The -Li option causes the Compiler to generate a text file which contains a list of the#include files specified in the source. This text file shares the same name as the source filebut with the extension, *.inc. The files are stored in the path specified by theTEXTPATH: Text File Path environment variable. The generated file may be used inmake files.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

216 Freescale Semiconductor, Inc.

Page 217: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

The following listing is an example where the -Li compiler option can be used to displaya file's contents when that file contains an included directive.

Listing: Display contents of a file when include directives are present

If the source file is: D:\Compile\Sources\main.c: /*D:\Compile\Sources\main.c*/ #include <hidef.h> #include "derivative.h" Then the generated file is:

D:\Compile\Sources\main.c : \

"C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\hidef.h" \ "C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\stddef.h" \ "C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\stdtypes.h" \ D:\Compile\Sources\derivative.h \ D:\Compile\Sources\MC9S08GT32.h

See also

-Lm: List of Included Files in Make Format

7.2.3.38 -Lic: License Information

Group

VARIOUS

Scope

None

Syntax

-Lic

Arguments

None

Default

None

Defines

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 217

Page 218: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

The -Lic option prints the current license information (e.g., if it is a demo version or a fullversion). This information is also displayed in the about box.

Example

-Lic

See also

Compiler options :

• -LicA: License Information about every Feature in Directory• -LicBorrow: Borrow License Feature• -LicWait: Wait until Floating License is Available from Floating License Server

7.2.3.39 -LicA: License Information about every Feature in Directory

Group

VARIOUS

Scope

None

Syntax

-LicA

Arguments

None

Default

None

Defines

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

218 Freescale Semiconductor, Inc.

Page 219: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

The -LicA option prints the license information (e.g., if the tool or feature is a demoversion or a full version) of every tool or *.dll in the directory where the executable islocated. Each file in the directory is analyzed.

Example

-LicA

See also

Compiler options:

• -Lic: License Information• -LicBorrow: Borrow License Feature• -LicWait: Wait until Floating License is Available from Floating License Server

7.2.3.40 -LicBorrow: Borrow License Feature

Group

HOST

Scope

None

Syntax

-LicBorrow<feature>[;<version>]:<date>

Arguments

<feature>: the feature name to be borrowed (e.g., HI100100).

<version>: optional version of the feature to be borrowed (e.g., 3.000).

<date>: date with optional time until when the feature shall be borrowed (e.g., 15-Mar-2005:18:35).

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 219

Page 220: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

This option allows to borrow a license feature until a given date or time. Borrowingallows you to use a floating license even if disconnected from the floating license server.

You need to specify the feature name and the date until you want to borrow the feature. Ifthe feature you want to borrow is a feature belonging to the tool where you use thisoption, then you do not need to specify the version of the feature (because the tool knowsthe version). However, if you want to borrow any feature, you need to specify as well thefeature version of it.

You can check the status of currently borrowed features in the tool about box.

NOTEYou only can borrow features, if you have a floating licenseand if your floating license is enabled for borrowing. See aswell the provided FLEXlm documentation about details onborrowing.

Example

-LicBorrowHI100100;3.000:12-Mar-2005:18:25

See also

Compiler options:

• -LicA: License Information about every Feature in Directory• -Lic: License Information• -LicWait: Wait until Floating License is Available from Floating License Server

7.2.3.41 -LicWait: Wait until Floating License is Available fromFloating License Server

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

220 Freescale Semiconductor, Inc.

Page 221: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

HOST

Scope

None

Syntax

-LicWait

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

By default, if a license is not available from the floating license server, then theapplication will immediately return. With -LicWait set, the application will wait (blocking)until a license is available from the floating license server.

Example

-LicWait

See also• -Lic: License Information• -LicA: License Information about every Feature in Directory• -LicBorrow: Borrow License Feature

7.2.3.42 -Ll: Write Statistics Output to File

Group

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 221

Page 222: CodeWarrior Development Studio for Microcontrollers V10.x RS08

OUTPUT

Scope

Compilation Unit

Syntax

-Ll[=<filename>]

Arguments

<filename>: file to be used for the output

Default

The default output filename is logfile.txt

Defines

None

Pragmas

None

Description

The -Ll option causes the Compiler to append statistical information about thecompilation session to the specified file. Compiler options, code size (in bytes), memoryusage (in bytes) and compilation time (in seconds) are given for each procedure of thecompiled file. The information is appended to the specified filename (or the file make.txt,if no argument given). If the TEXTPATH: Text File Path environment variable is set, thefile is stored into the path specified by the environment variable. Otherwise it is stored inthe current directory.

Example

The following listing is an example where the use of the -L1 compiler options allowsstatistical information to be added to the end of an output listing file.

Listing: Statistical information appended to an assembler listing

-Ll=mylog.txt /* fun.c */ int Func1(int b) { int a = b+3; return a+2; } void Func2(void) { }

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

222 Freescale Semiconductor, Inc.

Page 223: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Appends the following two lines into mylog.txt:

fun.c Func1 -Ll=mylog.txt 11 4 0.055000

fun.c Func2 -Ll=mylog.txt 1 0 0.001000

7.2.3.43 -Lm: List of Included Files in Make Format

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Lm[=<filename>]

Arguments

<filename>: file to be used for the output

Default

The default filename is Make.txt

Defines

None

Pragmas

None

Description

The -Lm option causes the Compiler to generate a text file which contains a list of the#include files specified in the source. The generated list is in a make format. The -Lmoption is useful when creating make files. The output from several source files may becopied and grouped into one make file. The generated list is in the make format. Thefilename does not include the path. After each entry, an empty line is added. Theinformation is appended to the specified filename (or the make.txt file, if no argument isgiven). If the TEXTPATH: Text File Path environment variable is set, the file is storedinto the path specified by the environment variable. Otherwise it is stored in the currentdirectory.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 223

Page 224: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

The following listing is an example where the -Lm option generates a make file containinginclude directives.

Listing: Make file construction

COMPOTIONS=-Lm=mymake.txt Compiling the following sources 'foo.c' and 'second.c': /* foo.c */ #include <stddef.h> #include "myheader.h" ... /* second.c */ #include "inc.h" #include "header.h" ... This adds the following entries in the 'mymake.txt': foo.o : foo.c stddef.h myheader.h second.o : second.c inc.h header.h

See also

-Li: List of Included Files to ".inc" File

-Lo: Append Object File Name to List (enter [<files>])

7.2.3.44 -LmCfg: Configuration for List of Included Files in MakeFormat (option -Lm)

Group

OUTPUT

Scope

Compilation Unit

Syntax

-LmCfg[={i|l|m|n|o|u|q}]

Arguments

i: Write path of included files

l: Use line continuation

m: Write path of main file

o: Write path of object file

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

224 Freescale Semiconductor, Inc.

Page 225: CodeWarrior Development Studio for Microcontrollers V10.x RS08

u: Update information

x: Unix style paths

Default

None

Defines

None

Pragmas

None

Description

This option is used when configuring the -Lm: List of Included Files in Make Formatoption. The -LmCfg option is operative only if the -Lm option is also used. The -Lm optionproduces the `dependency' information for a make file. Each dependency informationgrouping is structured as shown in the following listing:

Listing: Dependency information grouping

<main object file>: <main source file> {<included file>}

Example

If you compile a file named b.c, which includes `stdio.h', the output of -Lm may be:

b.o: b.c stdio.h stddef.h stdarg.h string.h

The l suboption uses line continuation for each single entry in the dependency list. Thisimproves readability as shown in the following listing:

Listing: l suboption

b.o: \ b.c \ stdio.h \ stddef.h \ stdarg.h \ string.h

With the m suboption, the full path of the main file is written. The main file is the actualcompilation unit (file to be compiled). This is necessary if there are files with the samename in different directories:

b.o: C:\test\b.c stdio.h stddef.h stdarg.h string.h

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 225

Page 226: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The o suboption has the same effect as m, but writes the full name of the target object file:

C:\test\obj\b.o: b.c stdio.h stddef.h stdarg.h string.h

The i suboption writes the full path of all included files in the dependency list (refer tothe following listing):

Listing: i suboption

main.o: main.c "C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\hidef.h" "C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\stddef.h" "C:\Freescale\CW MCU V10.x\MCU\lib\hc08c\include\stdtypes.h" D:\Compile\Sources\derivative.h D:\Compile\Sources\MC9S08GT32.h

The u suboption updates the information in the output file. If the file does not exist, thefile is created. If the file exists and the current information is not yet in the file, theinformation is appended to the file. If the information is already present, it is updated.This allows you to specify this suboption for each compilation ensuring that the makedependency file is always up to date.

Example

COMPOTIONS=-LmCfg=u

See also

Compiler options :

• -Li: List of Included Files to ".inc" File• -Lo: Append Object File Name to List (enter [<files>])• -Lm: List of Included Files in Make Format

7.2.3.45 -Lo: Append Object File Name to List (enter [<files>])

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Lo[=<filename>]

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

226 Freescale Semiconductor, Inc.

Page 227: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

<filename>: file to be used for the output

Default

The default filename is objlist.txt

Defines

None

Pragmas

None

Description

The -Lo option causes the Compiler to append the object filename to the list in thespecified file.The information is appended to the specified filename (or the file make.txtfile, if no argument given). If the TEXTPATH: Text File Path is set, the file is stored intothe path specified by the environment variable. Otherwise, it is stored in the currentdirectory.

See also

Compiler options:

• -Li: List of Included Files to ".inc" File• -Lm: List of Included Files in Make Format

7.2.3.46 -Lp: Preprocessor Output

Group

OUTPUT

Scope

Compilation Unit

Syntax

-Lp[=<filename>]

Arguments

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 227

Page 228: CodeWarrior Development Studio for Microcontrollers V10.x RS08

<filename>: The name of the file to be generated.

It may contain special modifiers (see Using Special Modifiers).

Default

No file created

Defines

None

Pragmas

None

Description

The -Lp option causes the Compiler to generate a text file which contains thepreprocessor's output. If no filename is specified, the text file shares the same name as thesource file but with the extension, * .PRE ( %n.pre). The TEXTPATH environment variable isused to store the preprocessor file.

The resultant file is a form of the source file. All preprocessor commands (i.e., #include,#define, #ifdef, etc.) have been resolved. Only source code is listed with line numbers.

See also

-LpX: Stop after Preprocessor

-LpCfg: Preprocessor Output Configuration

7.2.3.47 -LpCfg: Preprocessor Output Configuration

Group

OUTPUT

Scope

Compilation Unit

Syntax

-LpCfg[={c|e|f|l|m|n|q|s}]

Arguments

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

228 Freescale Semiconductor, Inc.

Page 229: CodeWarrior Development Studio for Microcontrollers V10.x RS08

s: Reconstruct spaces

q: Handle single quote ['] as normal token

n: No string concatenation

m: Do not emit file names

l: Emit #line directives in preprocessor output

f: Filenames with path

e: Emit empty lines

c: Do not emit line comments

NOTEIt is necessary to use q option when invoking the preprocessoron linker parameter files ( .prm), because such files may containlinear address specifiers, for example 0x014000'F.

Default

If -LpCfg is specified, all suboptions (arguments) are enabled

Defines

None

Pragmas

None

Description

The -LpCfg option specifies how source file and -line information is formatted in thepreprocessor output. Switching -LpCfg off means that the output is formatted as in formercompiler versions. The effects of the arguments are listed in the following table.

Table 7-8. Effects of Source and Line Information Format Control Arguments

Argument on off

c typedef unsigned intsize_t ;typedef signed intptrdiff_t ;

/* 22 */ typedef unsigned intsize_t ;/* 35 */ typedefsigned int ptrdiff_t ;

e int j;int i; int j;int i;

f /**** FILE '<CWInstallDir>\MCU\lib\hc08c\include\hidef.'*/

/**** FILE 'hidef.h' */

l #line 1 "hidef.h" /**** FILE 'hidef.h' */

n /* 9 */ foo ( "abc" "def" ) ; /* 9 */ foo ( "abcdef" ) ;

Table continues on the next page...

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 229

Page 230: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 7-8. Effects of Source and Line Information Format Control Arguments (continued)

Argument on off

m /**** FILE 'hidef.h' */

s /* 22 */ typedef unsigned intsize_t;/* 35 */ typedef signedint ptrdiff_t;/* 44 */ typedefunsigned char wchar_t;

/* 22 */ typedef unsigned intsize_t ;/* 35 */ typedefsigned int ptrdiff_t ;/* 44 */typedef unsigned charwchar_t ;

all #line 1 "<CWInstallDir>\MCU\lib\hc08c\include\hidef.h"

/**** FILE 'hidef.h' *//* 20*/

NOTECWInstallDir is the directory in which the CodeWarriorsoftware is installed.

Example

-Lpcfg

-Lpcfg=lfs

See also

-Lp: Preprocessor Output

7.2.3.48 -LpX: Stop after Preprocessor

Group

OUTPUT

Scope

Compilation Unit

Syntax

-LpX

Arguments

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

230 Freescale Semiconductor, Inc.

Page 231: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

Without this option, the compiler always translates the preprocessor output as C code. Todo only preprocessing, use this option together with the -Lp option. No object file isgenerated.

Example

-LpX

See also

-Lp: Preprocessor Output

7.2.3.49 -M (-Mb, -Ms): Memory Model

Group

CODE GENERATION

Scope

Application

Syntax

-M(b|s)

Arguments

b: BANKED memory model

s: SMALL memory model

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 231

Page 232: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

-Ms

Defines

__BANKED__

__SMALL__

Pragmas

None

Description

See Memory Models for details.

Example

-Ms

7.2.3.50 -N: Show Notification Box in Case of Errors

Group

MESSAGES

Scope

Function

Syntax

-N

Arguments

None

Default

None

Defines

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

232 Freescale Semiconductor, Inc.

Page 233: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

Makes the Compiler display an alert box if there was an error during compilation. This isuseful when running a make file (see Make Utility) because the Compiler waits for you toacknowledge the message, thus suspending make file processing. The N stands for"Notify".

This feature is useful for halting and aborting a build using the Make Utility.

Example

-N

If an error occurs during compilation, a dialog box appears.

7.2.3.51 -NoBeep: No Beep in Case of an Error

Group

MESSAGES

Scope

Function

Syntax

-NoBeep

Arguments

None

Default

None

Defines

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 233

Page 234: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

There is a beep notification at the end of processing if an error was generated. Toimplement a silent error, this beep may be switched off using this option.

Example

-NoBeep

7.2.3.52 -NoClrVol: Do not use CLR for volatile variables in the directpage

Group

CODE GENERATION

Syntax

-NoClrVol

Arguments

None

Description

Inhibits the use of CLR for volatile variables in the direct page. The CLR instruction onRS08 has a read cycle. This may lead to unwanted lateral effects (e.g. if the variable ismapped over a hardware register).

7.2.3.53 -NoDebugInfo: Do Not Generate Debug Information

Group

OUTPUT

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

234 Freescale Semiconductor, Inc.

Page 235: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Scope

None

Syntax

-NoDebugInfo

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

The compiler generates debug information by default. When this option is used, thecompiler does not generate debug information.

NOTETo generate an application without debug information in ELF,the linker provides an option to strip the debug information. Bycalling the linker twice, you can generate two versions of theapplication: one with and one without debug information. Thiscompiler option has to be used only if object files or librariesare to be distributed without debug info.

NOTEThis option does not affect the generated code. Only the debuginformation is excluded.

See also

Compiler options:

• -F (-F2, -F2o): Object File Format• -NoPath: Strip Path Info

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 235

Page 236: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.54 -NoPath: Strip Path Info

Group

OUTPUT

Scope

Compilation Unit

Syntax

-NoPath

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

With this option set, it is possible to avoid any path information in object files. This isuseful if you want to move object files to another file location, or to hide your pathstructure.

See also

-NoDebugInfo: Do Not Generate Debug Information

7.2.3.55 -Oa: Alias Analysis Options

Group

OPTIMIZATIONS

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

236 Freescale Semiconductor, Inc.

Page 237: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Scope

Function

Syntax

-Oa (addr|ANSI|type|none)

Arguments

addr: All objects in same address area may overlap (safe mode, default)

ANSI: use ANSI99 rules

type: only objects in same address area with same type may overlap

none: assume no objects do overlap

Default

addr

Defines

None

Pragmas

None

Description

These four different options allow the programmer to control the alias behavior of thecompiler. The option -oaaddr is the default because it is safe for all C programs. Useoption -oaansi if the source code follows the ANSI C99 alias rules. If objects withdifferent types never overlap in your program, use option -oatype. If your program doesn'thave aliases at all, use option -oanone (or the ICG option -ona, which is supported forcompatibility reasons).

Examples

-oaANSI

7.2.3.56 -O (-Os, -Ot): Main Optimization Target

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 237

Page 238: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

OPTIMIZATIONS

Scope

Function

Syntax

-O(s|t)

Arguments

s: Optimize for code size (default)

t: Optimize for execution speed

Default

-Os

Defines

__OPTIMIZE_FOR_SIZE__

__OPTIMIZE_FOR_TIME__

Pragmas

None

Description

There are vario us points where the Compiler has to choose between two possibilities: itcan either generate fast, but large code, or small but slower code.

The Compiler generally optimizes on code size. It often has to decide between a runtimeroutine or an expanded code. The programmer can decide whether to choose between theslower and shorter or the faster and longer code sequence by setting a command lineswitch.

The -Os option directs the Compiler to optimize the code for smaller code size. TheCompiler trades faster-larger code for slower-smaller code.

The -Ot option directs the Compiler to optimize the code for faster execution time. TheCompiler replaces slower/smaller code with faster/larger code.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

238 Freescale Semiconductor, Inc.

Page 239: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThis option only affects some special code sequences. Thisoption has to be set together with other optimization options(e.g., register optimization) to get best results.

Example

-Os

7.2.3.57 -O[nf|f]: Create Sub-Functions with Common Code

Group

OPTIMIZATIONS

Description

Performs the reverse of inlining. It detects common code parts in the generated code. TheCompiler moves the common code to a different place and replaces all occurrences with aJSR to the moved code. At the end of the common code, the Compiler inserts an RTSinstruction. The Compiler increases all SP uses by an address size. This optimizationtakes care of stack allocation, control flow, and of functions having arguments on thestack.

7.2.3.58 -ObjN: Object File Name Specification

Group

OUTPUT

Scope

Compilation Unit

Syntax

-ObjN=<file>

Arguments

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 239

Page 240: CodeWarrior Development Studio for Microcontrollers V10.x RS08

<file>: Object filename

Default

-ObjN=%(OBJPATH)\%n.o

Defines

None

Pragmas

None

Description

The object file has the same name as the processed source file, but with the *.o extension.This option allows a flexible way to define the object filename. It may contain specialmodifiers (see Using Special Modifiers). If <file> in the option contains a path (absoluteor relative), the OBJPATH environment variable is ignored.

Example

-ObjN=a.out

The resulting object file is a.out. If the OBJPATH environment variable is set to \src\obj, theobject file is \src\obj\a.out. fibo.c -ObjN=%n.obj

The resulting object file is fibo.obj.

myfile.c -ObjN=..\objects\_%n.obj

The object file is named relative to the current directory to ..\objects\_myfile.obj. TheOBJPATH environment variable is ignored because the <file> contains a path.

See also

OBJPATH: Object File Path

7.2.3.59 -Obsr: Generate Always Near Calls

Group

OPTIMIZATIONS

Scope

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

240 Freescale Semiconductor, Inc.

Page 241: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Function

Syntax

-Obsr

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option forces the compiler to always generate near calls, i.e. use BSR instructioninstead of a JSR in order to reduce code size. Without this option the compiler checks therange of the call to determine if a BSR can be generated instead of a JSR.

Example

extern int f(void);

int g(void) {

return f();

The following listing shows an example without -Obsr:

Listing: Example - Without -obsr

0000 b700 STA __OVL_g_p0 0002 45 SHA

0003 b700 STA __OVL_g_14__PSID_75300004

0005 42 SLA

0006 b701 STA __OVL_g_14__PSID_75300004:1

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 241

Page 242: CodeWarrior Development Studio for Microcontrollers V10.x RS08

4: return f();

0008 a600 LDA #__OVL_g_14__PSID_75300001

000a bd0000 JSR %FIX16(f)

000d 4e000f LDX __OVL_g_p0

0010 4e000e MOV __OVL_g_14__PSID_75300001,D[X]

0013 2f INCX

0014 4e010e MOV __OVL_g_14__PSID_75300001:1,D[X]

0017 b600 LDA __OVL_g_14__PSID_75300004

0019 45 SHA

001a b601 LDA __OVL_g_14__PSID_75300004:1

001c 42 SLA

5: }

001d be RTS

The following listing shows an example with -Obsr:

Listing: Example - Without -obsr

0000 b700 STA __OVL_g_p0

0002 45 SHA

0003 b700 STA __OVL_g_14__PSID_75300004

0005 42 SLA

0006 b701 STA __OVL_g_14__PSID_75300004:1

4: return f();

0008 a600 LDA #__OVL_g_14__PSID_75300001

000a ad00 BSR PART_0_7(f)

000c 4e000f LDX __OVL_g_p0

000f 4e000e MOV __OVL_g_14__PSID_75300001,D[X]

0012 2f INCX

0013 4e010e MOV __OVL_g_14__PSID_75300001:1,D[X]

0016 b600 LDA __OVL_g_14__PSID_75300004

0018 45 SHA

0019 b601 LDA __OVL_g_14__PSID_75300004:1

001b 42 SLA

5: }

001c be RTS

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

242 Freescale Semiconductor, Inc.

Page 243: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.60 -Od: Disable Mid-level Optimizations

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Od [= <option Char> {<option Char>}]

Arguments

<option Char> is one of the following:

a : Disable mid level copy propagation

b : Disable mid level constant propagation

c : Disable mid level common subexpression elimination (CSE)

d : Disable mid level removing dead assignments

e : Disable mid level instruction combination

f : Disable mid level code motion

g : Disable mid level loop induction variable elimination

Default

None

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 243

Page 244: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The backend of this compiler is based on the second generation intermediate codegenerator (SICG). All intermediate language and processor independent optimizations(cf. NULLSTONE) are performed by the SICG optimizer using the powerful static singleassignment form (SSA form). The optimizations are switched off using -od. Currentlyfour optimizations are implemented.

Examples

-Od disables all mid-level optimizations

-Od=d disables removing dead assignments only

-Od=cd disables removing dead assignments and CSE

See also

None

7.2.3.61 -Odb: Disable Mid-level Branch Optimizations

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Odb [= <option Char> {<option Char>}]

Arguments

<option Char> is one of the following:

a: Disable mid level label rearranging

b: Disable mid level branch tail merging

c: Disable mid level loop hoisting

Default

None

Defines

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

244 Freescale Semiconductor, Inc.

Page 245: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

This option disables branch optimizations on the SSA form based on control flows. Labelrearranging sorts all labels of the control flow to generate a minimum amount ofbranches.

Branch tail merging places common code into joining labels, as shown:

void fun(void) {void fun(void) {

if(cond) {if(cond) {

...

a = 0;} else {

} else {...

...}

a = 0;a = 0;

}}

}

Examples

-Odb disables all mid-level branch optimizations

-Odb=b disables only branch tail merging

See also

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 245

Page 246: CodeWarrior Development Studio for Microcontrollers V10.x RS08

7.2.3.62 -OdocF: Dynamic Option Configuration for Functions

Group

OPTIMIZATIONS

Scope

Function

Syntax

-OdocF=<option>

Arguments

<option>: Set of options, separated by `|' to be evaluated for each single function.

Default

None

Defines

None

Pragmas

None

Description

Normally, you must set a specific set of Compiler switches for each compilation unit (fileto be compiled). For some files, a specific set of options may decrease the code size, butfor other files, the same set of Compiler options may produce more code depending onthe sources.

Some optimizations may reduce the code size for some functions, but may increase thecode size for other functions in the same compilation unit. Normally it is impossible tovary options over different functions, or to find the best combination of options.

This option solves this problem by allowing the Compiler to choose from a set of optionsto reach the smallest code size for every function. Without this feature, you must setsome Compiler switches, which are fixed, over the whole compilation unit. With thisfeature, the Compiler is free to find the best option combination from a user-defined setfor every function.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

246 Freescale Semiconductor, Inc.

Page 247: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Standard merging rules applies also for this new option, e.g.,

-Or -OdocF="-Ocu|-Cu"

is the same as

-OrDOCF="-Ouc|-Cu"

The Compiler attempts to find the best option combination (of those specified) andevaluates all possible combinations of all specified sets, e.g., for the option shown in thefollowing listing:

Listing: Example of dynamic option configuration

-W2 -OdocF="-Or|-Cni -Cu|-Oc"

The code sizes for following option combinations are evaluated:

1. -W2

2. -W2 -Or

3. -W2 -Cni -Cu

4. -W2 -Or -Cni -Cu

5. -W2 -Oc

6. -W2 -Or -Oc

7. -W2 -Cni -Cu -Oc

8. -W2 -Or -Cni -Cu -Oc

Thus, if the more sets are specified, the longer the Compiler has to evaluate allcombinations, e.g., for 5 sets 32 evaluations.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 247

Page 248: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEDo not use this option to specify options with scopeApplication or Compilation Unit (such as memory model, floator double format, or object-file format) or options for the wholecompilation unit (like inlining or macro definition). Thegenerated functions may be incompatible for linking andexecuting.

Limitations:

• The maximum set of options set is limited to five, e.g., -OdocF="-Or -Ou|-Cni|-Cu|-Oic2|-W2 -Ob"

• The maximum length of the option is 64 characters.• The feature is available only for functions and options compatible with functions.

Future extensions will also provide this option for compilation units.

Example

-Odocf="-Or|-Cni"

7.2.3.63 -Oi: Inlining

Group

OPTIMIZATIONS

Scope

Compilation unit

Syntax

-Oi[=(c<code Size>|OFF)]

Arguments

< code Size>: Limit for inlining in code size

OFF: switching off inlining

Default

None. If no < code Size> is specified, the compiler uses a default code size of 40 bytes

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

248 Freescale Semiconductor, Inc.

Page 249: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Defines

None

Pragmas

#pragma INLINE

Description

This option enables inline expansion. If there is a #pragma INLINE before a functiondefinition, all calls of this function are replaced by the code of this function, if possible.

Using the -Oi=c0 option switches off inlining. Functions marked with the #pragmaINLINE are still inlined. To disable inlining, use the -Oi=OFF option.

Example

-Oi

#pragma INLINE

static void f(int i) {

/* all calls of function f() are inlined */

/* ... */

}

The option extension [ =c<n>] signifies that all functions with a size smaller than <n> areinlined. For example, compiling with the option -oi=c100 enables inline expansion for allfunctions with a size smaller than 100 bytes.

Restrictions

The following functions are not inlined:

• functions with default arguments• functions with labels inside

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 249

Page 250: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• functions with an open parameter list ( void f(int i,...);)• functions with inline assembly statements• functions using local static objects

7.2.3.64 -Ona: Disable alias checking

Group

OPTIMIZATIONS

Description

Prevents the Compiler from redefining these variables, which allows you to reusealready-loaded variables or equivalent constants. Use this option only when you are sureno real writes of aliases to a variable memory location will occur.

7.2.3.65 -OiLib: Optimize Library Functions

Group

OPTIMIZATIONS

Scope

Function

Syntax

-OiLib[=<arguments>]

Arguments

<arguments> are one or multiple of following suboptions:

b: inline calls to the strlen() function

d: inline calls to the fabs() or fabsf() functions

e: inline calls to the memset() function

f: inline calls to the memcpy() function

g: replace shifts left of 1 by array lookup

Default

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

250 Freescale Semiconductor, Inc.

Page 251: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Defines

None

Pragmas

None

Description

This option enables the compiler to optimize specific known library functions to reduceexecution time. The Compiler frequently uses small functions such as strcpy(), strcmp(),and so forth. The following functions are optimized:

• strcpy() (only available for ICG-based backends)• strlen() (e.g., strlen("abc"))• abs() or fabs() (e.g., `f = fabs(f);')• memset() is optimized only if:

• the result is not used• memset() is used to zero out• the size for the zero out is in the range 1 - 0xff• the ANSI library header file <string.h> is included

An example for this is:

(void)memset(&buf, 0, 50);

In this case, the call to memset() is replaced with a call to _memset_clear_8bitCountpresent in the ANSI library (string.c).

• memcpy() is optimized only if:• the result is not used,• the size for the copy out is in the range 0 to 0xff,• the ANSI library header file <string.h> is included.

An example for this is:

(void)memcpy(&buf, &buf2, 30);

In this case the call to memcpy() is replaced with a call to _memcpy_8bitCount presentin the ANSI library (string.c).

• (char)1 << val is replaced by _PowOfTwo_8[val] if _PowOfTwo_8 is known at compile time.Similarly, for 16-bit and 32-bit shifts, the arrays _PowOfTwo_16 and _PowOfTwo_32 are

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 251

Page 252: CodeWarrior Development Studio for Microcontrollers V10.x RS08

used. These constant arrays contain the values 1, 2, 4, 8, etc. They are declared inhidef.h. This optimization is performed only when optimizing for time.

• -Oilib without arguments: optimize calls to all supported library functions.

Example

Compiling the f() function with the -Oilib=a compiler option (only available for ICG-based backends):

void f(void) {

char *s = strcpy(s, ct);

}

This translates in a similar fashion to the following function:

void g(void) {

s2 = s;

while(*s2++ = *ct++);

}

See also

-Oi: Inlining

7.2.3.66 -OnB: Disable Branch Optimizer

Group

OPTIMIZATIONS

Scope

Function

Syntax

-OnB

Arguments

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

252 Freescale Semiconductor, Inc.

Page 253: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Default

None

Defines

None

Pragmas

None

Description

With this option, all low-level branch optimizations are disabled.

Example

-OnB

See Also

None

7.2.3.67 -Onbsr: Disable far to near call optimization

Group

OPTIMIZATIONS

Description

Disables the JSR to BSR optimization. The compiler checks the range of the call todetermine if a BSR can be generated instead of a JSR. If -Onbsr is used this optimizationwill be disabled.

7.2.3.68 -OnCopyDown: Do Generate Copy Down Information forZero Values

Group

OPTIMIZATIONS

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 253

Page 254: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Scope

Compilation unit

Syntax

-OnCopyDown

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

With usual startup code, all global variables are first set to 0 (zero out). If the definitioncontained an initialization value, this initialization value is copied to the variable (copydown). Because of this, it is not necessary to copy zero values unless the usual startupcode is modified. If a modified startup code contains a copy down but not a zero out, usethis option to prevent the compiler from removing the initialization.

NOTEThe case of a copy down without a zero out is normally notused. Because the copy down needs much more space than thezero out, it usually contains copy down and zero out, zero outalone, or none of them.

In the ELF format, the object-file format permits optimization only if the whole array orstructure is initialized with 0.

NOTEThis option controls the optimizations done in the compiler.However, the linker itself might further optimize the copy downor the zero out.

Example

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

254 Freescale Semiconductor, Inc.

Page 255: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int i=0;

int arr[10]={1,0,0,0,0,0,0,0,0,0};

If this option is present, no copy down is generated for i.

For the arr array, it is not possible to separate initialization with 0 from initialization with1.

7.2.3.69 -OnCstVar: Disable CONST Variable by ConstantReplacement

Group

OPTIMIZATIONS

Scope

Compilation Unit

Syntax

-OnCstVar

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 255

Page 256: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This option provides you with a way to switch OFF the replacement of CONST variableby the constant value.

Example

const int MyConst = 5;

int i;

void foo(void) {

i = MyConst;

}

If the -OnStVar option is not set, the compiler replaces each occurrence of MyConst with itsconstant value 5; that is i = MyConst is transformed into i = 5;. The Memory or ROMneeded for the MyConst constant variable is optimized as well. With the -OnCstVar optionset, this optimization is avoided. This is logical only if you want unoptimized code.

7.2.3.70 -Onp: Disable Peephole Optimizer

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Onp

Arguments

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

256 Freescale Semiconductor, Inc.

Page 257: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

If -OnP is specified, the whole peephole optimizer is disabled. The peephole optimizerremoves useless loads and stores and applies pre and post increment addressing ifpossible.

Example

-Onp

SeeAlso

None

7.2.3.71 -OnPMNC: Disable Code Generation for NULL Pointer toMember Check

Group

OPTIMIZATIONS

Scope

Compilation Unit

Syntax

-OnPMNC

Arguments

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 257

Page 258: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

Before assigning a pointer to a member in C++, you must ensure that the pointer to themember is not NULL in order to generate correct and safe code. In embedded systemsdevelopment, the problem is to generate the denser code while avoiding overheadwhenever possible (this NULL check code is a good example). If you can ensure this pointerto a member will never be NULL, then this NULL check is useless. This option enables you toswitch off the code generation for the NULL check.

Example

-OnPMNC

7.2.3.72 -Onr: Disable Reload from Register Optimization

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Onr

Arguments

None

Default

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

258 Freescale Semiconductor, Inc.

Page 259: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Defines

None

Pragmas

None

Description

This option disables the low level register trace optimizations. If you use the option thecode becomes more readable, but less optimal.

Example

-Onr

See Also

None

7.2.3.73 -Ont: Disable Tree Optimizer

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Ont[={%|&|*|+|-|/|0|1|7|8|9|?|^|a|b|c|d|e|

f|g|h|i|l|m|n|o|p|q|r|s|t|u|v|w|||~}]

Arguments

%: Disable mod optimization

&: Disable bit and optimization

*: Disable mul optimization

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 259

Page 260: CodeWarrior Development Studio for Microcontrollers V10.x RS08

+: Disable plus optimization

-: Disable minus optimization

/: Disable div optimization

0: Disable and optimization

1: Disable or optimization

7: Disable extend optimization

8: Disable switch optimization

9: Disable assign optimization

?: Disable test optimization

^: Disable xor optimization

a: Disable statement optimization

b: Disable constant folding optimization

c: Disable compare optimization

d: Disable binary operation optimization

e: Disable constant swap optimization

f: Disable condition optimization

g: Disable compare size optimization

h: Disable unary minus optimization

i: Disable address optimization

j: Disable transformations for inlining

l: Disable label optimization

m: Disable left shift optimization

n: Disable right shift optimization

o: Disable cast optimization

p: Disable cut optimization

q: Disable 16-32 compare optimization

r: Disable 16-32 relative optimization

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

260 Freescale Semiconductor, Inc.

Page 261: CodeWarrior Development Studio for Microcontrollers V10.x RS08

s: Disable indirect optimization

t: Disable for optimization

u: Disable while optimization

v: Disable do optimization

w: Disable if optimization

|: Disable bit or optimization

~: Disable bit neg optimization

Default

If -Ont is specified, all optimizations are disabled

Defines

None

Pragmas

None

Description

The Compiler contains a special optimizer which optimizes the internal tree datastructure. This tree data structure holds the semantic of the program and represents theparsed statements and expressions.

This option disables the tree optimizer. This may be useful for debugging and for forcingthe Compiler to produce `straightforward' code. Note that the optimizations below arejust examples for the classes of optimizations.

If this option is set, the Compiler will not perform the following optimizations:

-Ont=~

Disable optimization of ` ~~i' into ` i'

-Ont=|

Disable optimization of ` i|0xffff' into ` 0xffff'

-Ont=w

Disable optimization of ` if (1) i = 0;' into ` i = 0;'

-Ont=v

Disable optimization of ` do ... while(0) into `...'

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 261

Page 262: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Ont=u

Disable optimization of ‘while (cond) break;' into ‘cond;', provided there are no labelswithin the 'while' statement list.

-Ont=t

Disable optimization of ` for(;;) ...' into ` while(1) ...'

-Ont=s

Disable optimization of ` *&i' into ` i'

-Ont=r

Disable optimization of ` L<=4' into 16-bit compares if 16-bit compares are better

-Ont=q

Reduction of long compares into int compares if int compares are better: ( -Ont=q todisable it)

if (uL == 0)

is optimized into

if ((int)(uL>>16) == 0 && (int)uL == 0)

-Ont=p

Disable optimization of ` (char)(long)i' into ` (char)i'

-Ont=o

Disable optimization of ` (short)(int)L' into ` (short)L' if short and int have the same size

-Ont=n,-Ont=m:

Optimization of shift optimizations (<<, >>, -Ont=n or -Ont=m to disable it): Reduction ofshift counts to unsigned char:

uL = uL1 >> uL2;

is optimized into:

uL = uL1 >> (unsigned char)uL2;

Optimization of zero shift counts:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

262 Freescale Semiconductor, Inc.

Page 263: CodeWarrior Development Studio for Microcontrollers V10.x RS08

uL = uL1 >> 0;

is optimized into:

uL = uL1;

Optimization of shift counts greater than the object to be shifted:

uL = uL1 >> 40;

is optimized into:

uL = 0L;

Strength reduction for operations followed by a cut operation:

ch = uL1 * uL2;

is optimized into:

ch = (char)uL1 * (char)uL2;

Replacing shift operations by load or store

i = uL >> 16;

is optimized into:

i = *(int *)(&uL);

Shift count reductions:

ch = uL >> 17;

is optimized into:

ch = (*(char *)(&uL)+1)>>1;

Optimization of shift combined with binary and:

ch = (uL >> 25) & 0x10;

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 263

Page 264: CodeWarrior Development Studio for Microcontrollers V10.x RS08

is optimized into:

ch = ((*(char *)(&uL))>>1) & 0x10;

-Ont=l

Disable optimization removal of labels if not used

-Ont=i

Disable optimization of ` &*p' into ` p'

-Ont=j

This optimization transforms the syntax tree into an equivalent form in which moreinlining cases can be done. This option only has an effect when inlining is enabled.

-Ont=h

Disable optimization of ` -(-i)' into ` i'

-Ont=f

Disable optimization of ` (a==0)' into ` (!a)'

-Ont=e

Disable optimization of ` 2*i' into ` i*2'

-Ont=d

Disable optimization of ` us & ui' into ` us & (unsigned short)ui'

-Ont=c

Disable optimization of ` if ((long)i)' into ` if (i)'

-Ont=b

Disable optimization of ` 3+7' into ` 10'

-Ont=a

Disable optimization of last statement in function if result is not used

-Ont=^

Disable optimization of ` i^0' into ` i'

-Ont=?

Disable optimization of ` i = (int)(cond ? L1:L2);' into ` i = cond ? (int)L1:(int)L2;'

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

264 Freescale Semiconductor, Inc.

Page 265: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-Ont=9

Disable optimization of ` i=i;'

-Ont=8

Disable optimization of empty switch statement

-Ont=7

Disable optimization of ` (long)(char)L' into ` L'

-Ont=1

Disable optimization of ` a || 0' into ` a'

-Ont=0

Disable optimization of ` a && 1' into ` a'

-Ont=/

Disable optimization of ` a/1' into ` a'

-Ont=-

Disable optimization of ` a-0' into ` a'

-Ont=+

Disable optimization of ` a+0' into ` a'

-Ont=*

Disable optimization of ` a*1' into ` a'

-Ont=&

Disable optimization of ` a&0' into ` 0'

-Ont=%

Disable optimization of ` a%1' into ` 0'

Example

fibo.c -Ont

7.2.3.74 -Ontc: Disable tail call optimization

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 265

Page 266: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Ontc

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

By default, the compiler replaces trailing calls (JSR/BSR) with JMP instructions if thefunction does not contain any other function calls. This allows the compiler to remove allthe entry and exit code from the current function.

Example

void f1() {

i++;

}

void f2() {

f1();

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

266 Freescale Semiconductor, Inc.

Page 267: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

The following listing shows an example without -Ontc:

Listing: Example - Without -Ontc

Function: f1

Source : d:\junk\rs08\test.c

Options : -Lasm=%n.lst

7: i++;

0000 3c01 INC i:1

0002 3602 BNE L6

0004 3c00 INC i

0006 L6:

8: }

0006 be RTS

9:

10: void f2() {

Function: f2

Source : d:\junk\rs08\test.c

Options : -Lasm=%n.lst

11: f1();

0000 3000 BRA PART_0_7(f1)

12: }

The following listing shows an example with -Ontc:

Listing: Example - With -Ontc

Function: f1

Source : d:\junk\rs08\test.c

Options : -Lasm=%n.lst -Ontc

7: i++;

0000 3c01 INC i:1

0002 3602 BNE L6

0004 3c00 INC i

0006 L6:

8: }

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 267

Page 268: CodeWarrior Development Studio for Microcontrollers V10.x RS08

0006 be RTS

9:

10: void f2() {

Function: f2

Source : d:\junk\rs08\test.c

Options : -Lasm=%n.lst -Ontc

0000 45 SHA

0001 b700 STA __OVL_f2_14__PSID_75300003

0003 42 SLA

0004 b701 STA __OVL_f2_14__PSID_75300003:1

11: f1();

0006 ad00 BSR PART_0_7(f1)

0008 b600 LDA __OVL_f2_14__PSID_75300003

000a 45 SHA

000b b601 LDA __OVL_f2_14__PSID_75300003:1

000d 42 SLA

12: }

000e be RTS

13:

7.2.3.75 -Ostk: Reuse Locals of Stack Frame

Group

OPTIMIZATIONS

Scope

Function

Syntax

-Ostk

Arguments

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

268 Freescale Semiconductor, Inc.

Page 269: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Defines

None

Pragmas

None

Description

This option instructs the compiler to reuse the location of local variables/temporarieswhenever possible. When used, the compiler analyzes which local variables are alivesimultaneously. Based on that analysis the compiler chooses the best memory layout forfor variables. Two or more variables may end up sharing the same memory location.

Example

TBD

7.2.3.76 -Pe: Do Not Preprocess Escape Sequences in Strings withAbsolute DOS Paths

Group

LANGUAGE

Scope

Compilation Unit

Syntax

-Pe

Arguments

None

Default

None

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 269

Page 270: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Defines

None

Pragmas

None

Description

If escape sequences are used in macros, they are handled in an include directive similar tothe way they are handled in a printf() instruction:

#define STRING "C:\myfile.h"

#include STRING

produces an error:

>> Illegal escape sequence

but used in:

printf(STRING);

produces a carriage return with line feed:

C:

myfile

If the -Pe option is used, escape sequences are ignored in strings that contain a DOS driveletter ('a - 'z', 'A' - 'Z') followed by a colon ' :' and a backslash ' \'.

When the -Pe option is enabled, the Compiler handles strings in include directivesdifferently from other strings. Escape sequences in include directive strings are notevaluated.

The following example:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

270 Freescale Semiconductor, Inc.

Page 271: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include "C:\names.h"

results in exactly the same include filename as in the source file (" C:\names.h"). If thefilename appears in a macro, the Compiler does not distinguish between filename usageand normal string usage with escape sequence. This occurs because the STRING macro hasto be the same for both the include and the printf() call, as shown below:

#define STRING "C:\n.h"

#include STRING /* means: "C:\n.h" *

void main(void) {

printf(STRING);/* means: "C:", new line and ".h" */

}

This option may be used to use macros for include files. This prevents escape sequencescanning in strings if the string starts with a DOS drive letter ( a through z or A through Z)followed by a colon ':' and a backslash '\'. With the option set, the above exampleincludes the C:\n.h file and calls printf() with "C:\n.h").

Example

-Pe

7.2.3.77 -Pio: Include Files Only Once

Group

INPUT

Scope

Compilation Unit

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 271

Page 272: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

-Pio

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Includes every header file only once. Whenever the compiler reaches an #includedirective, it checks if this file to be included was already read. If so, the compiler ignoresthe #include directive. It is common practice to protect header files from multipleinclusion by conditional compilation, as shown in the following listing:

Listing: Conditional compilation

/* Header file myfile.h */

#ifndef _MY_FILE_H_

#define _MY_FILE_H_

/* ... content ... */

#endif /* _MY_FILE_H_ */

When the #ifndef and #define directives are issued, any header file content is read onlyonce even when the header file is included several times. This solves many problems asC-language protocol does not allow you to define structures (such as enums or typedefs)more than once.

When all header files are protected in this manner, this option can safely accelerate thecompilation.

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

272 Freescale Semiconductor, Inc.

Page 273: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This option must not be used when a header file must be included twice, e.g., the filecontains macros which are set differently at the different inclusion times. In thoseinstances, #pragma ONCE: Include Once is used to accelerate the inclusion of safeheader files that do not contain macros of that nature.

Example

-Pio

7.2.3.78 -Prod: Specify Project File at Startup

Group

Startup - This option cannot be specified interactively.

Scope

None

Syntax

-Prod=<file>

Arguments

<file>: name of a project or project directory

Default

None

Defines

None

Pragmas

None

Description

This option can only be specified at the command line while starting the application. Itcannot be specified in any other circumstances, including the default.env file, thecommand line or whatever. When this option is given, the application opens the file as aconfiguration file. When <file> names only a directory instead of a file, the default nameproject.ini is appended. When the loading fails, a message box appears.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 273

Page 274: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

compiler.exe -prod=project.ini

NOTEUse the compiler executable name instead of "compiler".

See also

Local Configuration File (usually project.ini)

7.2.3.79 -Qvtp: Qualifier for Virtual Table Pointers

Group

CODE GENERATION

Scope

Application

Syntax

-Qvtp(none|far|near|paged)

Arguments

None

Default

-Qvptnone

Defines

None

Pragmas

None

Description

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

274 Freescale Semiconductor, Inc.

Page 275: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Using a virtual function in C++ requires an additional pointer to virtual function tables.This pointer is not accessible and is generated by the compiler in every class object whenvirtual function tables are associated.

NOTESpecifying an unsupported qualifier has no effect, e.g., using afar qualifier if the Backend or CPU does not support any __fardata accesses.

Example

-QvtpFar

This sets the qualifier for virtual table pointers to __far enabling the virtual tables to beplaced into a __FAR_SEG segment (if the Backend or CPU supports __FAR_SEG segments).

7.2.3.80 -Rp[t|e]: Large return Value Type

Group

OPTIMIZATIONS

Description

Compiler supports this option even though returning a 'large' return value may be not asefficient as using an additional pointer. The Compiler introduces an additional parameterfor the return value if the return value cannot be passed in registers. Options are: Default,Large return value pointer, always with temporary (-Rpt), and Large return value pointerand temporary elimination (-Rpe).

7.2.3.81 -SIP2: Specify the address of the System Interrupt Pending 2register

Specifies the address of the System Interrupt Pending 2 register. By default, it is set

to 0x1D.

Group

CODE GENERATION

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 275

Page 276: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Scope

Compilation Unit

7.2.3.82 -T: Flexible Type Management

Group

LANGUAGE.

Scope

Application

Syntax

-T<Type Format>

Arguments

<Type Format>: See below

Default

Depends on target, see the Backend chapter

Defines

To deal with different type sizes, one of the following define groups in the followinglisting is predefined by the Compiler:

Listing: Predefined define groups

__CHAR_IS_SIGNED__

__CHAR_IS_UNSIGNED__

__CHAR_IS_8BIT__

__CHAR_IS_16BIT__

__CHAR_IS_32BIT__

__CHAR_IS_64BIT__

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

276 Freescale Semiconductor, Inc.

Page 277: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__SHORT_IS_8BIT__

__SHORT_IS_16BIT__

__SHORT_IS_32BIT__

__SHORT_IS_64BIT__

__INT_IS_8BIT__

__INT_IS_16BIT__

__INT_IS_32BIT__

__INT_IS_64BIT__

__ENUM_IS_8BIT__

__ENUM_IS_16BIT__

__ENUM_IS_32BIT__

__ENUM_IS_64BIT__

__ENUM_IS_SIGNED__

__ENUM_IS_UNSIGNED__

__PLAIN_BITFIELD_IS_SIGNED__

__PLAIN_BITFIELD_IS_UNSIGNED__

__LONG_IS_8BIT__

__LONG_IS_16BIT__

__LONG_IS_32BIT__

__LONG_IS_64BIT__

__LONG_LONG_IS_8BIT__

__LONG_LONG_IS_16BIT__

__LONG_LONG_IS_32BIT__

__LONG_LONG_IS_64BIT__

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 277

Page 278: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__FLOAT_IS_IEEE32__

__FLOAT_IS_DSP__

__DOUBLE_IS_IEEE32__

__DOUBLE_IS_DSP__

__LONG_DOUBLE_IS_IEEE32__

__LONG_DOUBLE_IS_DSP__

__LONG_LONG_DOUBLE_IS_IEEE32__

__LONG_LONG_DOUBLE_DSP__

__VTAB_DELTA_IS_8BIT__

__VTAB_DELTA_IS_16BIT__

__VTAB_DELTA_IS_32BIT__

__VTAB_DELTA_IS_64BIT__

__PTRMBR_OFFSET_IS_8BIT__

__PTRMBR_OFFSET_IS_16BIT__

__PTRMBR_OFFSET_IS_32BIT__

__PTRMBR_OFFSET_IS_64BIT__

Pragmas

None

Description

This option allows configurable type settings. The option syntax is:

-T{<type><format>}

For <type>, one of the keys listed in the following table may be specified:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

278 Freescale Semiconductor, Inc.

Page 279: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 7-9. Data Type Keys

Type Key

char c

short s

int i

long L

long long LL

float f

double d

long double Ld

long long double LLd

enum e

sign plain bitfield b

virtual table delta size vtd

pointer to member offset size pmo

NOTEKeys are not case-sensitive, e.g., both f or F may be used for thetype float.

The sign of the type char or of the enumeration type may be changed with a prefix placedbefore the key for the char key. Refer to the following table:

Table 7-10. Keys for Signed and Unsigned Prefixes

Sign Prefix Key

signed s

unsigned u

The sign of the type plain bitfield type is changed with the options shown in thefollowing table. Plain bitfields are bitfields defined or declared without an explicit signedor unsigned qualifier, e.g., int field:3. Using this option, you can specify if the int in theprevious example is handled as signed int or as unsigned int. Note that this option may notbe available on all targets. Also the default setting may vary. For more information, referto the Sign of Plain Bitfields.

Table 7-11. Keys for Signed and Unsigned Bitfield Prefixes

Sign prefix Key

plain signed bitfield bs

plain unsigned bitfield bu

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 279

Page 280: CodeWarrior Development Studio for Microcontrollers V10.x RS08

For <format>, one of the keys in the following table can be specified.

Table 7-12. Data Format Specifier Keys

Format Key

8-bit integral 1

16-bit integral 2

24-bit integral 3

32-bit integral 4

64-bit integral 8

IEEE32 floating 2

DSP (32-bit) 0

Not all formats may be available for a target. See RS08 Backend for supported formats.

NOTEAt least one type for each basic size (1, 2, 4 bytes) has to beavailable. It is illegal if no type of any sort is not set to at least asize of one. See RS08 Backend for default settings.

NOTEEnumeration types have the type signed int by default forANSI-C compliance.

The -Tpmo option allows you to change the pointer to a member offset value type. Thedefault setting is 16 bits. The pointer to the member offset is used for C++ pointer tomembers only.

Examples

-Tsc sets ´char´ to ´signed char´

and

-Tuc sets ´char´ to ´unsigned char´

Listing: -Tsc1s2i2L4LL4f2e2 denotes:

signed char with 8 bits (sc1) short and int with 16 bits (s2i2)

long, long long with 32 bits (L4LL4)

float with IEEE32 (f2)

enum with 16 bits (signed) (e2)

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

280 Freescale Semiconductor, Inc.

Page 281: CodeWarrior Development Studio for Microcontrollers V10.x RS08

For integrity and compliance to ANSI, the following two rules must be true:

Listing: Restrictions

sizeof(char) <= sizeof(short) sizeof(short) <= sizeof(int)

sizeof(int) <= sizeof(long)

sizeof(long) <= sizeof(long long)

sizeof(float) <= sizeof(double)

sizeof(double) <= sizeof(long double)

sizeof(long double) <= sizeof(long long double)

NOTEIt is not permitted to set char to 16 bits and int to 8 bits.

Be careful if you change type sizes. Type sizes must be consistent over the wholeapplication. The libraries delivered with the Compiler are compiled with the standardtype settings.

Also be careful if you change the type sizes for under or overflows, e.g., assigning avalue too large to an object which is smaller now, as shown in the following example:

int i; /* -Ti1 int has been set to 8 bits! */

i = 0x1234; /* i will set to 0x34! */

Examples

Setting the size of char to 16 bits:

-Tc2

Setting the size of char to 16 bits and plain char is signed:

-Tsc2

Setting char to 8 bits and unsigned, int to 32 bits and long long to 32 bits:

-Tuc1i4LL4

Setting float to IEEE32:

-Tf2

The -Tvtd option allows you to change the delta value type inside virtual function tables.The default setting is 16-bit.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 281

Page 282: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Another way to set this option is using the dialog box in the Graphical User Interface:

Figure 7-3. Standard Types Settings Dialog Box

See also

Sign of Plain Bitfields

7.2.3.83 -V: Prints the Compiler Version

Group

VARIOUS

Scope

None

Syntax

-V

Arguments

None

Default

None

Defines

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

282 Freescale Semiconductor, Inc.

Page 283: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Pragmas

None

Description

Prints the internal subversion numbers of the component parts of the Compiler and thelocation of current directory.

NOTEThis option can determine the current directory of theCompiler.

Example

-V produces the following list:

Directory: \software\sources\c

ANSI-C Front End, V5.0.1, Date Jan 01 2005

Tree CSE Optimizer, V5.0.1, Date Jan 01 2005

Back End V5.0.1, Date Jan 01 2005

7.2.3.84 -View: Application Standard Occurrence

Group

HOST

Scope

Compilation Unit

Syntax

-View<kind>

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 283

Page 284: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

<kind> is one of:

• Window: Application window has default window size• Min: Application window is minimized• Max: Application window is maximized• Hidden: Application window is not visible (only if arguments)

Default

Application started with arguments: Minimized

Application started without arguments: Window

Defines

None

Pragmas

None

Description

The application starts as a normal window if no arguments are given. If the application isstarted with arguments (e.g., from the maker to compile or link a file), then theapplication runs minimized to allow batch processing.

You can specify the behavior of the application using this option:

• Using -ViewWindow, the application is visible with its normal window.• Using -ViewMin, the application is visible iconified (in the task bar).• Using -ViewMax, the application is visible maximized (filling the whole screen).• Using -ViewHidden, the application processes arguments (e.g., files to be compiled or

linked) completely invisible in the background (no window or icon visible in the taskbar). However, if you are using the -N: Show Notification Box in Case of Errorsoption, a dialog box is still possible.

Example

C:\Freescale\linker.exe -ViewHidden fibo.prm

7.2.3.85 -WErrFile: Create "err.log" Error File

Group

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

284 Freescale Semiconductor, Inc.

Page 285: CodeWarrior Development Studio for Microcontrollers V10.x RS08

MESSAGES

Scope

Compilation Unit

Syntax

-WErrFile(On|Off)

Arguments

None

Default

err.log is created or deleted

Defines

None

Pragmas

None

Description

The error feedback to the tools that are called is done with a return code. In 16-bitwindow environments, this was not possible. In the error case, an err.log file, with thenumbers of errors written into it, was used to signal an error. To state no error, the err.logfile was deleted. Using UNIX or WIN32, there is now a return code available. The err.logfile is no longer needed when only UNIX or WIN32 applications are involved.

NOTEThe error file must be created in order to signal any errors ifyou use a 16-bit maker with this tool.

Example

-WErrFileOn

The err.log file is created or deleted when the application is finished.

-WErrFileOff

The existing err.log file is not modified.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 285

Page 286: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

-WStdout: Write to Standard Output

-WOutFile: Create Error Listing File

7.2.3.86 -Wmsg8x3: Cut File Names in Microsoft Format to 8.3

Group

MESSAGES

Scope

Compilation Unit

Syntax

-Wmsg8x3

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Some editors (e.g., early versions of WinEdit) expect the filename in the Microsoftmessage format (8.3 format). That means the filename can have, at most, eight characterswith not more than a three-character extension. Longer filenames are possible when youuse later versions of Windows. This option truncates the filename to the 8.3 format.

Example

x:\mysourcefile.c(3): INFORMATION C2901: Unrolling loop

With the -Wmsg8x3 option set, the above message is:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

286 Freescale Semiconductor, Inc.

Page 287: CodeWarrior Development Studio for Microcontrollers V10.x RS08

x:\mysource.c(3): INFORMATION C2901: Unrolling loop

See also

-WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode

-WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode

7.2.3.87 -WmsgCE: RGB Color for Error Messages

Group

MESSAGES

Scope

Function

Syntax

-WmsgCE< RGB>

Arguments

<RGB>: 24-bit RGB (red green blue) value

Default

-WmsgCE16711680 (rFF g00 b00, red)

Defines

None

Pragmas

None

Description

This option changes the error message color. The specified value must be an RGB (Red-Green-Blue) value and must also be specified in decimal.

Example

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 287

Page 288: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgCE255 changes the error messages to blue

7.2.3.88 -WmsgCF: RGB Color for Fatal Messages

Group

MESSAGES

Scope

Function

Syntax

-WmsgCF< RGB>

Arguments

<RGB>: 24-bit RGB (red green blue) value

Default

-WmsgCF8388608 (r80 g00 b00, dark red)

Defines

None

Pragmas

None

Description

This option changes the color of a fatal message. The specified value must be an RGB(Red-Green-Blue) value and must also be specified in decimal.

Example

-WmsgCF255 changes the fatal messages to blue

7.2.3.89 -WmsgCI: RGB Color for Information Messages

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

288 Freescale Semiconductor, Inc.

Page 289: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Group

MESSAGES

Scope

Function

Syntax

-WmsgCI< RGB>

Arguments

<RGB>: 24-bit RGB (red green blue) value

Default

-WmsgCI32768 (r00 g80 b00, green)

Defines

None

Pragmas

None

Description

This option changes the color of an information message. The specified value must be anRGB (Red-Green-Blue) value and must also be specified in decimal.

Example

-WmsgCI255 changes the information messages to blue

7.2.3.90 -WmsgCU: RGB Color for User Messages

Group

MESSAGES

Scope

Function

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 289

Page 290: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

-WmsgCU< RGB>

Arguments

<RGB>: 24-bit RGB (red green blue) value

Default

-WmsgCU0 (r00 g00 b00, black)

Defines

None

Pragmas

None

Description

This option changes the color of a user message. The specified value must be an RGB(Red-Green-Blue) value and must also be specified in decimal.

Example

-WmsgCU255 changes the user messages to blue

7.2.3.91 -WmsgCW: RGB Color for Warning Messages

Group

MESSAGES

Scope

Function

Syntax

-WmsgCW< RGB>

Arguments

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

290 Freescale Semiconductor, Inc.

Page 291: CodeWarrior Development Studio for Microcontrollers V10.x RS08

<RGB>: 24-bit RGB (red green blue) value

Default

-WmsgCW255 (r00 g00 bFF, blue)

Defines

None

Pragmas

None

Description

This option changes the color of a warning message. The specified value must be an RGB(Red-Green-Blue) value and must also be specified in decimal.

Example

-WmsgCW0 changes the warning messages to black

7.2.3.92 -WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Formatfor Batch Mode

Group

MESSAGES

Scope

Compilation Unit

Syntax

-WmsgFb[v|m]

Arguments

v: Verbose format

m: Microsoft format

Default

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 291

Page 292: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgFbm

Defines

None

Pragmas

None

Description

You can start the Compiler with additional arguments (e.g., files to be compiled togetherwith Compiler options). If the Compiler has been started with arguments (e.g., from theMake Tool or with the appropriate argument from an external editor), the Compilercompiles the files in a batch mode. No Compiler window is visible and the Compilerterminates after job completion.

If the Compiler is in batch mode, the Compiler messages are written to a file instead of tothe screen. This file contains only the compiler messages (see the examples in Listing:Message file formats (batch mode)).

The Compiler uses a Microsoft message format to write the Compiler messages (errors,warnings, information messages) if the compiler is in batch mode.

This option changes the default format from the Microsoft format (only line information)to a more verbose error format with line, column, and source information.

NOTEUsing the verbose message format may slow down thecompilation because the compiler has to write more informationinto the message file.

Example

See the following listing for examples showing the differing message formats.

Listing: Message file formats (batch mode)

void foo(void) { int i, j; for (i=0;i<1;i++); } The Compiler may produce the following file if it is running in batch mode (e.g., started from the Make tool): X:\C.C(3): INFORMATION C2901: Unrolling loop X:\C.C(2): INFORMATION C5702: j: declared in function foo but not referenced Setting the format to verbose, more information is stored in the file: -WmsgFbv >> in "X:\C.C", line 3, col 2, pos 33 int i, j;

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

292 Freescale Semiconductor, Inc.

Page 293: CodeWarrior Development Studio for Microcontrollers V10.x RS08

for (i=0;i<1;i++); ^ INFORMATION C2901: Unrolling loop >> in "X:\C.C", line 2, col 10, pos 28 void foo(void) { int i, j; ^ INFORMATION C5702: j: declared in function foo but not referenced

See also

ERRORFILE: Error filename Specification environment variable

-WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode

7.2.3.93 -WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format forInteractive Mode

Group

MESSAGES

Scope

Compilation Unit

Syntax

-WmsgFi[v|m]

Arguments

v: Verbose format

m: Microsoft format

Default

-WmsgFiv

Defines

None

Pragmas

None

Description

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 293

Page 294: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler operates in the interactive mode (that is, a window is visible) if it is startedwithout additional arguments (e.g., files to be compiled together with Compiler options).

The Compiler uses the verbose error file format to write the Compiler messages (errors,warnings, information messages).

This option changes the default format from the verbose format (with source, line andcolumn information) to the Microsoft format (only line information).

NOTEUsing the Microsoft format may speed up the compilationbecause the compiler has to write less information to the screen.

Example

See the following listing for examples showing the differing message formats.

Listing: Message file formats (interactive mode)

void foo(void) { int i, j; for(i=0;i<1;i++); } The Compiler may produce the following error output in the Compiler window if it is running in interactive mode: Top: X:\C.C Object File: X:\C.O >> in "X:\C.C", line 3, col 2, pos 33 int i, j; for(i=0;i<1;i++); ^ INFORMATION C2901: Unrolling loop Setting the format to Microsoft, less information is displayed: -WmsgFim Top: X:\C.C Object File: X:\C.O X:\C.C(3): INFORMATION C2901: Unrolling loop

See also

ERRORFILE: Error filename Specification

-WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode

7.2.3.94 -WmsgFob: Message Format for Batch Mode

Group

MESSAGES

Scope

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

294 Freescale Semiconductor, Inc.

Page 295: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Function

Syntax

-WmsgFob<string>

Arguments

<string>: format string (see below).

Default

-WmsgFob"%"%f%e%"(%l): %K %d: %m\n"

Defines

None

Pragmas

None

Description

This option modifies the default message format in batch mode. The formats listed in thefollowing table are supported (assuming that the source file is X:\Freescale\mysourcefile.cpph):

Table 7-13. Message Format Specifiers

Format Description Example

%s Source Extract

%p Path X:\Freescale\

%f Path and name X:\Freescale\mysourcefile

%n filename mysourcefile

%e Extension .cpph

%N File (8 chars) mysource

%E Extension (3 chars) .cpp

%l Line 3

%c Column 47

%o Pos 1234

%K Uppercase kind ERROR

%k Lowercase kind error

%d Number C1815

%m Message text

%% Percent %

Table continues on the next page...

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 295

Page 296: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 7-13. Message Format Specifiers (continued)

Format Description Example

\n New line

%" A " if the filename, path, or extensioncontains a space

%' A ' if the filename, path, or extensioncontains a space

Example

-WmsgFob"%f%e(%l): %k %d: %m\n"

Produces a message in the following format:

X:\C.C(3): information C2901: Unrolling loop

See also

ERRORFILE: Error filename Specification

-WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode

-WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode

-WmsgFonp: Message Format for no Position Information

-WmsgFoi: Message Format for Interactive Mode

7.2.3.95 -WmsgFoi: Message Format for Interactive Mode

Group

MESSAGES

Scope

Function

Syntax

-WmsgFoi<string>

Arguments

<string>: format string (See below.)

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

296 Freescale Semiconductor, Inc.

Page 297: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

-WmsgFoi"\\n>> in \"%f%e\", line %l, col >>%c, pos %o\n%s\n%K %d: %m\n"

Defines

None

Pragmas

None

Description

This option modifies the default message format in interactive mode. The formats listedin the following table are supported (assuming that the source file is X:\Freescale\mysourcefile.cpph):

Table 7-14. Message Format Specifiers

Format Description Example

%s Source Extract

%p Path X:\sources\

%f Path and name X:\sources\mysourcefile

%n filename mysourcefile

%e Extension .cpph

%N File (8 chars) mysource

%E Extension (3 chars) .cpp

%l Line 3

%c Column 47

%o Pos 1234

%K Uppercase kind ERROR

%k Lowercase kind error

%d Number C1815

%m Message text

%% Percent %

\n New line

%" A " if the filename, path, or extensioncontains a space.

%' A ' if the filename, path, or extensioncontains a space

Example

-WmsgFoi"%f%e(%l): %k %d: %m\n"

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 297

Page 298: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Produces a message in following format:

X:\C.C(3): information C2901: Unrolling loop

See also

ERRORFILE: Error filename Specification

-WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode

-WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode

-WmsgFonp: Message Format for no Position Information

-WmsgFob: Message Format for Batch Mode

7.2.3.96 -WmsgFonf: Message Format for no File Information

Group

MESSAGES

Scope

Function

Syntax

-WmsgFonf<string>

Arguments

<string>: format string (See below.)

Default

-WmsgFonf"%K %d: %m\n"

Defines

None

Pragmas

None

Description

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

298 Freescale Semiconductor, Inc.

Page 299: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Sometimes there is no file information available for a message (e.g., if a message notrelated to a specific file). Then the message format string defined by <string> is used. Thefollowing table lists the supported formats.

Table 7-15. Message Format Specifiers

Format Description Example

%K Uppercase kind ERROR

%k Lowercase kind error

%d Number C1815

%m Message text

%% Percent %

\n New line

%" A " if the filename, if the path or theextension contains a space

%' A ' if the filename, the path or theextension contains a space

Example

-WmsgFonf"%k %d: %m\n"

Produces a message in following format:

information L10324: Linking successful

See also

ERRORFILE: Error filename Specification

Compiler options :

• -WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode• -WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode• -WmsgFonp: Message Format for no Position Information• -WmsgFoi: Message Format for Interactive Mode

7.2.3.97 -WmsgFonp: Message Format for no Position Information

Group

MESSAGES

Scope

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 299

Page 300: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Function

Syntax

-WmsgFonp<string>

Arguments

<string>: format string (see below)

Default

-WmsgFonp"%"%f%e%": %K %d: %m\n"

Defines

None

Pragmas

None

Description

Sometimes there is no position information available for a message (e.g., if a message notrelated to a certain position). Then the message format string defined by <string> is used.The following table lists the supported formats.

Table 7-16. Message Format Specifiers

Format Description Example

%K Uppercase kind ERROR

%k Lowercase kind error

%d Number C1815

%m Message text

%% Percent %

\n New line

%" A " if the filename, if the path or theextension contains a space

%' A ' if the filename, the path, or theextension contains a space

Example

-WmsgFonf"%k %d: %m\n"

Produces a message in following format:

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

300 Freescale Semiconductor, Inc.

Page 301: CodeWarrior Development Studio for Microcontrollers V10.x RS08

information L10324: Linking successful

Seealso

ERRORFILE: Error filename Specification

Compiler options:

• -WmsgFb (-WmsgFbi, -WmsgFbm): Set Message File Format for Batch Mode• -WmsgFi (-WmsgFiv, -WmsgFim): Set Message Format for Interactive Mode• -WmsgFonp: Message Format for no Position Information• -WmsgFoi: Message Format for Interactive Mode

7.2.3.98 -WmsgNe: Maximum Number of Error Messages

Group

MESSAGES

Scope

Compilation Unit

Syntax

-WmsgNe<number>

Arguments

<number>: Maximum number of error messages

Default

50

Defines

None

Pragmas

None

Description

This option sets the number of error messages that are to be displayed while the Compileris processing.

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 301

Page 302: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTESubsequent error messages which depend upon a previous errormessage may not process correctly.

Example

-WmsgNe2

Stops compilation after two error messages

See also

-WmsgNi: Maximum Number of Information Messages

-WmsgNw: Maximum Number of Warning Messages

7.2.3.99 -WmsgNi: Maximum Number of Information Messages

Group

MESSAGES

Scope

Compilation Unit

Syntax

-WmsgNi<number>

Arguments

<number>: Maximum number of information messages

Default

50

Defines

None

Pragmas

None

Description

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

302 Freescale Semiconductor, Inc.

Page 303: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This option sets the amount of information messages that are logged.

Example

-WmsgNi10

Ten information messages logged

See also

Compiler options :

• -WmsgNe: Maximum Number of Error Messages• -WmsgNw: Maximum Number of Warning Messages

7.2.3.100 -WmsgNu: Disable User Messages

Group

MESSAGES

Scope

None

Syntax

-WmsgNu[={a|b|c|d}]

Arguments

a: Disable messages about include files

b: Disable messages about reading files

c: Disable messages about generated files

d: Disable messages about processing statistics

e: Disable informal messages

t: Display type of messages

Default

None

Defines

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 303

Page 304: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

The application produces messages that are not in the following normal messagecategories: WARNING, INFORMATION, ERROR, or FATAL. This option disablesmessages that are not in the normal message category by reducing the amount ofmessages, and simplifying the error parsing of other tools.

a: Disables the application from generating information about all included files.

b: Disables messages about reading files (e.g., the files used as input) are disabled.

c: Disables messages informing about generated files.

d: Disables information about statistics (e.g., code size, RAM, or ROM usage).

e: Disables informal messages (e.g., memory model, floating point format).

t: Displays type of messages.

NOTEDepending on the application, the Compiler may not recognizeall suboptions. In this case they are ignored for compatibility.

Example

-WmsgNu=c

7.2.3.101 -WmsgNw: Maximum Number of Warning Messages

Group

MESSAGES

Scope

Compilation Unit

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

304 Freescale Semiconductor, Inc.

Page 305: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgNw<number>

Arguments

<number>: Maximum number of warning messages

Default

50

Defines

None

Pragmas

None

Description

This option sets the number of warning messages.

Example

-WmsgNw15

Fifteen warning messages logged

See also

Compiler options:

• -WmsgNe: Maximum Number of Error Messages• -WmsgNi: Maximum Number of Information Messages

7.2.3.102 -WmsgSd: Setting a Message to Disable

Group

MESSAGES

Scope

Function

Syntax

-WmsgSd<number>

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 305

Page 306: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

<number>: Message number to be disabled, e.g., 1801

Default

None

Defines

None

Pragmas

None

Description

This option disables message from appearing in the error output. This option cannot beused in #pragma OPTION: Additional Options. Use this option only with #pragmaMESSAGE: Message Setting.

Example

-WmsgSd1801

Disables message for implicit parameter declaration

See also

-WmsgSe: Setting a Message to Error

-WmsgSi: Setting a Message to Information

-WmsgSw: Setting a Message to Warning

7.2.3.103 -WmsgSe: Setting a Message to Error

Group

MESSAGES

Scope

Function

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

306 Freescale Semiconductor, Inc.

Page 307: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgSe<number>

Arguments

<number>: Message number to be an error, e.g., 1853

Default

None

Defines

None

Pragmas

None

Description

This option changes a message to an error message. This option cannot be used in#pragma OPTION: Additional Options. Use this option only with #pragma MESSAGE:Message Setting.

Example

COMPOTIONS=-WmsgSe1853

See also

-WmsgSd: Setting a Message to Disable

-WmsgSi: Setting a Message to Information

-WmsgSw: Setting a Message to Warning

7.2.3.104 -WmsgSi: Setting a Message to Information

Group

MESSAGES

Scope

Function

Syntax

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 307

Page 308: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgSi<number>

Arguments

<number>: Message number to be an information, e.g., 1853

Default

None

Defines

None

Pragmas

None

Description

This option sets a message to an information message. This option cannot be used with#pragma OPTION: Additional Options. Use this option only with #pragma MESSAGE:Message Setting.

Example

-WmsgSi1853

See also

-WmsgSd: Setting a Message to Disable

-WmsgSe: Setting a Message to Error

-WmsgSw: Setting a Message to Warning

7.2.3.105 -WmsgSw: Setting a Message to Warning

Group

MESSAGES

Scope

Function

Syntax

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

308 Freescale Semiconductor, Inc.

Page 309: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WmsgSw<number>

Arguments

<number>: Error number to be a warning, e.g., 2901

Default

None

Defines

None

Pragmas

None

Description

This option sets a message to a warning message.

This option cannot be used with #pragma OPTION: Additional Options. Use this optiononly with #pragma MESSAGE: Message Setting.

Example

-WmsgSw2901

See also

-WmsgSd: Setting a Message to Disable

-WmsgSe: Setting a Message to Error

-WmsgSi: Setting a Message to Information

7.2.3.106 -WOutFile: Create Error Listing File

Group

MESSAGES

Scope

Compilation Unit

Syntax

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 309

Page 310: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-WOutFile(On|Off)

Arguments

None

Default

Error listing file is created

Defines

None

Pragmas

None

Description

This option controls whether to create an error listing file. The error listing file contains alist of all messages and errors that are created during processing. It is possible to obtainthis feedback without an explicit file because the text error feedback can now also behandled with pipes to the calling application. The name of the listing file is controlled bythe environment variable ERRORFILE: Error filename Specification.

Example

-WOutFileOn

Error file is created as specified with ERRORFILE

-WOutFileOff

No error file created

See also

-WErrFile: Create "err.log" Error File

-WStdout: Write to Standard Output

7.2.3.107 -Wpd: Error for Implicit Parameter Declaration

Group

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

310 Freescale Semiconductor, Inc.

Page 311: CodeWarrior Development Studio for Microcontrollers V10.x RS08

MESSAGES

Scope

Function

Syntax

-Wpd

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option prompts the Compiler to issues an ERROR message instead of a WARNINGmessage when an implicit declaration is encountered. This occurs if the Compiler doesnot have a prototype for the called function.

This option helps to prevent parameter-passing errors, which can only be detected atruntime. It requires that each function that is called is prototyped before use. The correctANSI behavior is to assume that parameters are correct for the stated call.

This option is the same as using -WmsgSe1801.

Example

-Wpd

main() {

char a, b;

func(a, b); // <- Error here - only two parameters

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 311

Page 312: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

func(a, b, c)

char a, b, c;

{

...

}

See also

-WmsgSe: Setting a Message to Error

7.2.3.108 -WStdout: Write to Standard Output

Group

MESSAGES

Scope

Compilation Unit

Syntax

-WStdout(On|Off)

Arguments

None

Default

Output is written to stdout

Defines

None

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

312 Freescale Semiconductor, Inc.

Page 313: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Pragmas

None

Description

The usual standard streams are available with Windows applications. Text written intothem does not appear anywhere unless explicitly requested by the calling application.This option determines if error file text to the error file is also written into the stdout file.

Example

-WStdoutOn: All messages written to stdout

-WErrFileOff: Nothing written to stdout

See also

-WErrFile: Create "err.log" Error File

-WOutFile: Create Error Listing File

7.2.3.109 -W1: Do Not Print Information Messages

Group

MESSAGES

Scope

Function

Syntax

-W1

Arguments

None

Default

None

Defines

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 313

Page 314: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Pragmas

None

Description

Inhibits printing INFORMATION messages. Only WARNINGs and ERROR messagesare generated.

Example

-W1

See also

-WmsgNi: Maximum Number of Information Messages

7.2.3.110 -W2: Do Not Print Information or Warning Messages

Group

MESSAGES

Scope

Function

Syntax

-W2

Arguments

None

Default

None

Defines

None

Pragmas

None

Description

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

314 Freescale Semiconductor, Inc.

Page 315: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Suppresses all messages of type INFORMATION and WARNING. Only ERRORs aregenerated.

Example

-W2

See also

-WmsgNi: Maximum Number of Information Messages

-WmsgNw: Maximum Number of Warning Messages

Chapter 7 Compiler Options

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 315

Page 316: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Compiler Option Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

316 Freescale Semiconductor, Inc.

Page 317: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 8Compiler Predefined Macros

The ANSI standard for the C language requires the Compiler to predefine a couple ofmacros. The Compiler provides the predefined macros listed in the following table.

Table 8-1. Macros defined by the Compiler

Macro Description

__LINE__ Line number in the current source file

__FILE__ Name of the source file where it appears

__DATE__ The date of compilation as a string

__TIME__ The time of compilation as a string

__STDC__ Set to 1 if the -Ansi: Strict ANSI compiler option has beengiven. Otherwise, additional keywords are accepted (not inthe ANSI standard).

The following tables lists all Compiler defines with their associated names and options.

It is also possible to log all Compiler predefined defines to a file using the -Ldf: LogPredefined Defines to File compiler option.

8.1 Compiler Vendor Defines

The following table shows the defines identifying the Compiler vendor. Compilers in theUSA may also be sold by ARCHIMEDES.

Table 8-2. Compiler Vendor Identification Defines

Name Defined

__HIWARE__ always

__MWERKS__ always, set to 1

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 317

Page 318: CodeWarrior Development Studio for Microcontrollers V10.x RS08

8.2 Product Defines

The following table shows the Defines identifying the Compiler. The Compiler is a HI-CROSS+ Compiler (V5.0.x).

Table 8-3. Compiler Identification Defines

Name Defined

__PRODUCT_HICROSS_PLUS__ defined for V5.0 Compilers

__DEMO_MODE__ defined if the Compiler is running in demo mode

__VERSION__ defined and contains the version number, e.g., it is set to5013 for a Compiler V5.0.13, or set to 3140 for a CompilerV3.1.40

8.3 Data Allocation Defines

The Compiler provides two macros that define how data is organized in memory: LittleEndian (least significant byte first in memory) or Big Endian (most significant byte firstin memory).

The Compiler provides the "endian" macros listed in the following table.

Table 8-4. Compiler macros for defining "endianness"

Name Defined

__LITTLE_ENDIAN__ defined if the Compiler allocates in Little Endian order

__BIG_ENDIAN__ defined if the Compiler allocates in Big Endian order

The following example illustrates the differences between little endian and big endian(refer to the following listing).

Listing: Little vs. big endian

unsigned long L = 0x87654321;unsigned short s = *(unsiged short*)&L; // BE: 0x8765,LE: 0x4321

unsigned char c = *(unsinged char*)&L; // BE: 0x87, LE: 0x21

Product Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

318 Freescale Semiconductor, Inc.

Page 319: CodeWarrior Development Studio for Microcontrollers V10.x RS08

8.4 Various Defines for Compiler Option Settings

The following table lists Defines for miscellaneous compiler option settings.

Table 8-5. Defines for Miscellaneous Compiler Option Settings

Name Defined

__STDC__ -Ansi

__TRIGRAPHS__ -Ci

__CNI__ -Cni

__OPTIMIZE_FOR_TIME__ -Ot

__OPTIMIZE_FOR_SIZE__ -Os

8.5 Option Checking in C Code

You can also check the source to determine if an option is active. The EBNF syntax is:

OptionActive = " __OPTION_ACTIVE__" "(" string ")".

The above is used in the preprocessor and in C code, as shown:

Listing: Using __OPTION__ to check for active options.

#if __OPTION_ACTIVE__("-W2")

// option -W2 is set

#endif

void main(void) {

int i;

if (__OPTION_ACTIVE__("-or")) {

i=2;

}

}

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 319

Page 320: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can check all preprocessor-valid options (e.g., options given at the command line,via the default.env or project.ini files, but not options added with the #pragma OPTION:Additional Options). You perform the same check in C code using -Odocf and #pragmaOPTIONs.

As a parameter, only the option itself is tested and not a specific argument of an option.

For example:

#if __OPTION_ACTIVE__("-D") /* true if any -d option given */

#if __OPTION_ACTIVE__("-DABS") /* not allowed */

To check for a specific define use:

#if defined(ABS)

If the specified option cannot be checked to determine if it is active (i.e., options that nolonger exist), the message "C1439: illegal pragma __OPTION_ACTIVE__" is issued.

8.6 ANSI-C Standard Types 'size_t', 'wchar_t' and 'ptrdiff_t'Defines

ANSI provides some standard defines in stddef.h to deal with the implementation ofdefined object sizes.

The following listing shows the part of the contents of stdtypes.h (included from stddef.h).

Listing: Type Definitions of ANSI-C Standard Types

/* size_t: defines the maximum object size type */ #if defined(__SIZE_T_IS_UCHAR__) typedef unsigned char size_t; #elif defined(__SIZE_T_IS_USHORT__) typedef unsigned short size_t; #elif defined(__SIZE_T_IS_UINT__) typedef unsigned int size_t; #elif defined(__SIZE_T_IS_ULONG__) typedef unsigned long size_t; #else #error "illegal size_t type" #endif /* ptrdiff_t: defines the maximum pointer difference type */ #if defined(__PTRDIFF_T_IS_CHAR__)

ANSI-C Standard Types 'size_t', 'wchar_t' and 'ptrdiff_t' Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

320 Freescale Semiconductor, Inc.

Page 321: CodeWarrior Development Studio for Microcontrollers V10.x RS08

typedef signed char ptrdiff_t; #elif defined(__PTRDIFF_T_IS_SHORT__) typedef signed short ptrdiff_t; #elif defined(__PTRDIFF_T_IS_INT__) typedef signed int ptrdiff_t; #elif defined(__PTRDIFF_T_IS_LONG__) typedef signed long ptrdiff_t; #else #error "illegal ptrdiff_t type" #endif /* wchar_t: defines the type of wide character */ #if defined(__WCHAR_T_IS_UCHAR__) typedef unsigned char wchar_t; #elif defined(__WCHAR_T_IS_USHORT__) typedef unsigned short wchar_t; #elif defined(__WCHAR_T_IS_UINT__) typedef unsigned int wchar_t; #elif defined(__WCHAR_T_IS_ULONG__) typedef unsigned long wchar_t; #else #error "illegal wchar_t type" #endif

The following table lists defines that deal with other possible implementations:

Table 8-6. Defines for Other Implementations

Macro Description

__SIZE_T_IS_UCHAR__ Defined if the Compiler expects size_t in stddef.h to beunsigned char.

__SIZE_T_IS_USHORT__ Defined if the Compiler expects size_t in stddef.h to beunsigned short.

__SIZE_T_IS_UINT__ Defined if the Compiler expects size_t in stddef.h to beunsigned int.

__SIZE_T_IS_ULONG__ Defined if the Compiler expects size_t in stddef.h to beunsigned long.

__WCHAR_T_IS_UCHAR__ Defined if the Compiler expects wchar_t in stddef.h to beunsigned char.

__WCHAR_T_IS_USHORT__ Defined if the Compiler expects wchar_t in stddef.h to beunsigned short.

__WCHAR_T_IS_UINT__ Defined if the Compiler expects wchar_t in stddef.h to beunsignedint.

__WCHAR_T_IS_ULONG__ Defined if the Compiler expects wchar_t in stddef.h to beunsigned long.

__PTRDIFF_T_IS_CHAR__ Defined if the Compiler expects ptrdiff_t in stddef.h tobe char.

__PTRDIFF_T_IS_SHORT__ Defined if the Compiler expects ptrdiff_t in stddef.h tobe short.

__PTRDIFF_T_IS_INT__ Defined if the Compiler expects ptrdiff_t in stddef.h tobe int.

__PTRDIFF_T_IS_LONG__ Defined if the Compiler expects ptrdiff_t in stddef.h tobe long.

The following tables show the default settings of the ANSI-C Compiler size_t andptrdiff_t standard types.

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 321

Page 322: CodeWarrior Development Studio for Microcontrollers V10.x RS08

8.6.1 Macros for RS08

The following table shows the settings for the RS08 target:

Table 8-7. RS08 Compiler Defines

size_t Macro Defined

__SIZE_T_IS_UCHAR__ always

__SIZE_T_IS_USHORT__ never

__SIZE_T_IS_UINT__ never

__SIZE_T_IS_ULONG__ never

Table 8-8. RS08 Compiler Pointer Difference Macros

ptrdiff_t Macro Defined

__PTRDIFF_T_IS_CHAR__ always

__PTRDIFF_T_IS_SHORT__ never

__PTRDIFF_T_IS_INT__ never

__PTRDIFF_T_IS_LONG__ never

8.7 Division and Modulus

To ensure that the results of the "/" and "%" operators are defined correctly for signedarithmetic operations, both operands must be defined positive. (for more information,refer to the backend chapter.) It is implementation-defined if the result is negative orpositive when one of the operands is defined negative. This is illustrated in the followinglisting.

Listing: Effect of polarity upon division and modulus arithmetic.

#ifdef __MODULO_IS_POSITIV__ 22 / 7 == 3; 22 % 7 == 1

22 /-7 == -3; 22 % -7 == 1

-22 / 7 == -4; -22 % 7 == 6

-22 /-7 == 4; -22 % -7 == 6

#else

22 / 7 == 3; 22 % 7 == +1

Division and Modulus

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

322 Freescale Semiconductor, Inc.

Page 323: CodeWarrior Development Studio for Microcontrollers V10.x RS08

22 /-7 == -3; 22 % -7 == +1

-22 / 7 == -3; -22 % 7 == -1

-22 /-7 == 3; -22 % -7 == -1

#endif

The following sections show how it is implemented in a backend.

8.7.1 Macros for RS08

Table 8-9. RS08 Compiler Modulo Operator Macros

Name Defined

__MODULO_IS_POSITIV__ never

8.8 Object-File Format Defines

The Compiler defines some macros to identify the format (mainly used in the startupcode if it is object file specific), depending on the specified object-file format option. Thefollowing table lists these defines.

Table 8-10. Object-file Format Defines

Name Defined

__ELF_OBJECT_FILE_FORMAT__ -F2

8.9 Bitfield Defines

This section describes the defines and define groups available for the RS08 compiler.

8.9.1 Bitfield Allocation

The Compiler provides six predefined macros to distinguish between the differentallocations:

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 323

Page 324: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Predefined Macros

__BITFIELD_MSBIT_FIRST__ /* defined if bitfield allocation starts with MSBit */ __BITFIELD_LSBIT_FIRST__ /* defined if bitfield allocation starts with LSBit */

__BITFIELD_MSBYTE_FIRST__ /* allocation of bytes starts with MSByte */

__BITFIELD_LSBYTE_FIRST__ /* allocation of bytes starts with LSByte */

__BITFIELD_MSWORD_FIRST__ /* defined if bitfield allocation starts with MSWord */

__BITFIELD_LSWORD_FIRST__ /* defined if bitfield allocation starts with LSWord */

Using the above-listed defines, you can write compatible code over different Compilervendors even if the bitfield allocation differs. Note that the allocation order of bitfields isimportant (refer to the following listing).

Listing: Compatible bitfield allocation

struct { /* Memory layout of I/O port:

MSB LSB

name: BITA | CCR | DIR | DATA | DDR2

size: 1 1 1 4 1

*/

#ifdef __BITFIELD_MSBIT_FIRST__

unsigned int BITA:1;

unsigned int CCR :1;

unsigned int DIR :1;

unsigned int DATA:4;

unsigned int DDR2:1;

#elif defined(__BITFIELD_LSBIT_FIRST__)

unsigned int DDR2:1;

unsigned int DATA:4;

unsigned int DIR :1;

unsigned int CCR :1;

Bitfield Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

324 Freescale Semiconductor, Inc.

Page 325: CodeWarrior Development Studio for Microcontrollers V10.x RS08

unsigned int BITA:1;

#else

#error "undefined bitfield allocation strategy!"

#endif

} MyIOport;

If the basic allocation unit for bitfields in the Compiler is a byte, the allocation ofmemory for bitfields is always from the most significant BYTE to the least significantBYTE. For example, __BITFIELD_MSBYTE_FIRST__ is defined as shown in the followinglisting:

Listing: __BITFIELD_MSBYTE_FIRST__ definition

/* example for __BITFIELD_MSBYTE_FIRST__ */struct {

unsigned char a:8;

unsigned char b:3;

unsigned char c:5;

} MyIOport2;

/* LSBIT_FIRST */ /* MSBIT_FIRST */

/* MSByte LSByte */ /* MSByte LSByte */

/* aaaaaaaa cccccbbb */ /* aaaaaaaa bbbccccc */

NOTEThere is no standard way to allocate bitfields. Allocation mayvary from compiler to compiler even for the same target. Usingbitfields for I/O register access to is non-portable and, for themasking involved in unpacking individual fields, inefficient. Itis recommended to use regular bit-and (&) and bit-or (|)operations for I/O port access.

8.9.2 Bitfield Type Reduction

The Compiler provides two predefined macros for enabled/disabled type size reduction.With type size reduction enabled, the Compiler is free to reduce the type of a bitfield. Forexample, if the size of a bitfield is 3, the Compiler uses the char type.

__BITFIELD_TYPE_SIZE_REDUCTION__ /* defined if Type Size Reduction is enabled */

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 325

Page 326: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__BITFIELD_NO_TYPE_SIZE_REDUCTION__ /* defined if Type Size Reduction is disabled */

It is possible to write compatible code over different Compiler vendors and to getoptimized bitfields (refer to the following listing):

Listing: Compatible optimized bitfields

struct{ long b1:4;

long b2:4;

} myBitfield;

31 7 3 0

--------------------------------

|########################|b2|b1| -BfaTSRoff

--------------------------------

7 3 0

--------------

| b2 | b1 | -BfaTSRon

--------------

8.9.3 Sign of Plain Bitfields

For some architectures, the sign of a plain bitfield does not follow standard rules.Normally in the following (refer to the following listing):

Listing: Plain bitfield

struct _bits {int myBits:3;} bits;

myBits is signed, because plain int is also signed. To implement it as an unsigned bitfield,use the following code (refer to the following listing):

Listing: Unsigned bitfield

struct _bits {unsigned int myBits:3;} bits;

Bitfield Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

326 Freescale Semiconductor, Inc.

Page 327: CodeWarrior Development Studio for Microcontrollers V10.x RS08

However, some architectures need to overwrite this behavior to be compliant to theirEABI (Embedded Application Binary Interface). Under those circumstances, the -T:Flexible Type Management (if supported) is used. The option affects the followingdefines:

Listing: Affected Define Groups

define group__PLAIN_BITFIELD_IS_SIGNED__ /* defined if plain bitfield is signed*/__PLAIN_BITFIELD_IS_UNSIGNED__ /* defined if plain bitfield is unsigned */

8.9.3.1 Macros for RS08

The following table identifies the implementation in the Backend.

Table 8-11. RS08 Compiler-Backend Macros

Name Defined

__BITFIELD_MSBIT_FIRST__ -BfaBMS

__BITFIELD_LSBIT_FIRST__ -BfaBLS

__BITFIELD_MSBYTE_FIRST__ always

__BITFIELD_LSBYTE_FIRST__ never

__BITFIELD_MSWORD_FIRST__ always

__BITFIELD_LSWORD_FIRST__ never

__BITFIELD_TYPE_SIZE_REDUCTION__ -BfaTSRon

__BITFIELD_NO_TYPE_SIZE_REDUCTION__ -BfaTSRoff

__PLAIN_BITFIELD_IS_SIGNED__ always

__PLAIN_BITFIELD_IS_UNSIGNED__ never

8.9.4 Type Information Defines

The Flexible Type Management sets the defines to identify the type sizes. The followingtable lists these defines.

Table 8-12. Type Information Defines

Name Defined

__CHAR_IS_SIGNED__ see -T option or Backend

__CHAR_IS_UNSIGNED__ see -T option or Backend

__CHAR_IS_8BIT__ see -T option or Backend

__CHAR_IS_16BIT__ see -T option or Backend

Table continues on the next page...

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 327

Page 328: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 8-12. Type Information Defines (continued)

Name Defined

__CHAR_IS_32BIT__ see -T option or Backend

__CHAR_IS_64BIT__ see -T option or Backend

__SHORT_IS_8BIT__ see -T option or Backend

__SHORT_IS_16BIT__ see -T option or Backend

__SHORT_IS_32BIT__ see -T option or Backend

__SHORT_IS_64BIT__ see -T option or Backend

__INT_IS_8BIT__ see -T option or Backend

__INT_IS_16BIT__ see -T option or Backend

__INT_IS_32BIT__ see -T option or Backend

__INT_IS_64BIT__ see -T option or Backend

__ENUM_IS_8BIT__ see -T option or Backend

__ENUM_IS_SIGNED__ see -T option or Backend

__ENUM_IS_UNSIGNED__ see -T option or Backend

__ENUM_IS_16BIT__ see -T option or Backend

__ENUM_IS_32BIT__ see -T option or Backend

__ENUM_IS_64BIT__ see -T option or Backend

__LONG_IS_8BIT__ see -T option or Backend

__LONG_IS_16BIT__ see -T option or Backend

__LONG_IS_32BIT__ see -T option or Backend

__LONG_IS_64BIT__ see -T option or Backend

__LONG_LONG_IS_8BIT__ see -T option or Backend

__LONG_LONG_IS_16BIT__ see -T option or Backend

__LONG_LONG_IS_32BIT__ see -T option or Backend

__LONG_LONG_IS_64BIT__ see -T option or Backend

__FLOAT_IS_IEEE32__ see -T option or Backend

__FLOAT_IS_DSP__ see -T option or Backend

__DOUBLE_IS_IEEE32__ see -T option or Backend

__DOUBLE_IS_DSP__ see -T option or Backend

__LONG_DOUBLE_IS_IEEE32__ see -T option or Backend

__LONG_DOUBLE_IS_DSP__ see -T option or Backend

__LONG_LONG_DOUBLE_IS_IEEE32__ see -T option or Backend

__LONG_LONG_DOUBLE_IS_DSP__ see -T option or Backend

__VTAB_DELTA_IS_8BIT__ see -T option

__VTAB_DELTA_IS_16BIT__ see -T option

__VTAB_DELTA_IS_32BIT__ see -T option

__VTAB_DELTA_IS_64BIT__ see -T option

__PLAIN_BITFIELD_IS_SIGNED__ see option -T or Backend

__PLAIN_BITFIELD_IS_UNSIGNED__ see option -T or Backend

Bitfield Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

328 Freescale Semiconductor, Inc.

Page 329: CodeWarrior Development Studio for Microcontrollers V10.x RS08

8.9.5 Freescale RS08-Specific Defines

The following table identifies implementations specific to the Backend.

Table 8-13. RS08 Back End Defines

Name Defined

__RS08__ always

__NO_RECURSION__ always

__PTR_SIZE_1__ for small memory model

__PTR_SIZE_2__ for banked memory model

__PTR_SIZE_3__ never

__PTR_SIZE_4__ never

Chapter 8 Compiler Predefined Macros

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 329

Page 330: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Bitfield Defines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

330 Freescale Semiconductor, Inc.

Page 331: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 9Compiler Pragmas

A pragma, as shown in the below listing, defines how information is passed from theCompiler Frontend to the Compiler Backend, without affecting the parser. In theCompiler, the effect of a pragma on code generation starts at the point of its definitionand ends with the end of the next function. Exceptions to this rule are thepragmas#pragma ONCE: Include Once and #pragma NO_STRING_CONSTR: No StringConcatenation during preprocessing, which are valid for one file.

Listing: Pragma syntax

#pragma pragma_name [optional_arguments]

The value for optional_arguments depends on the pragma that you use. Some pragmas donot take arguments.

NOTEA pragma directive accepts a single pragma with optionalarguments. Do not place more than one pragma name in apragma directive. The following example uses incorrect syntax:#pragma ONCE NO_STRING_CONSTR This is an invalid directive becausetwo pragma names were combined into one pragma directive.

The following section describes all of the pragmas that affect the Frontend. All otherpragmas affect only the code generation process and are described in the Backendsection.

9.1 Pragma Details

This section describes each Compiler-available pragma. The pragmas are listed inalphabetical order and are divided into separate tables. The following table lists anddefines the topics that appear in the description of each pragma.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 331

Page 332: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 9-1. Pragma documentation topics

Topic Description

Scope Scope of pragma where it is valid. (See below.)

Syntax Specifies the syntax of the pragma in an EBNF format.

Synonym Lists a synonym for the pragma or none, if a synonym doesnot exist.

Arguments Describes and lists optional and required arguments for thepragma.

Default Shows the default setting for the pragma or none.

Description Provides a detailed description of the pragma and how to useit.

Example Gives an example of usage and effects of the pragma.

See also Names related sections.

The following table is a description of the different scopes for pragmas.

Table 9-2. Definition of items that can appear in a pragma's scope topic

Scope Description

File The pragma is valid from the current position until the end ofthe source file. For example, if the pragma is in a header fileincluded from a source file, the pragma is not valid in thesource file.

Compilation Unit The pragma is valid from the current position until the end ofthe whole compilation unit. For example, if the pragma is in aheader file included from a source file, it is valid in the sourcefile too.

Data Definition The pragma affects only the next data definition. Ensure thatyou always use a data definition behind this pragma in aheader file. If not, the pragma is used for the first datasegment in the next header file or in the main file.

Function Definition The pragma affects only the next function definition. Ensurethat you use this pragma in a header file: The pragma is validfor the first function in each source file where such a headerfile is included if there is no function definition in the headerfile.

Next pragma with same name The pragma is used until the same pragma appears again. Ifno such pragma follows this one, it is valid until the end of thefile.

9.1.1 #pragma CONST_SEG: Constant Data Segment Definition

Scope

Until the next CONST_SEG pragma

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

332 Freescale Semiconductor, Inc.

Page 333: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#pragma CONST_SEG (<Modif> <Name>|DEFAULT)

Synonym

CONST_SECTION

ArgumentsListing: Some strings which may be used for <Modif>

__FAR_SEG (compatibility alias: FAR) __PAGED_SEG

NOTEDo not use a compatibility alias in new code. It only exists forbackwards compatibility. Some of the compatibility alias namesconflict with defines found in certain header files. Therefore,using them can cause hard to detect problems. Avoid usingcompatibility alias names.

The segment modifiers are backend-dependent. The __FAR_SEG and __PAGED_SEGmodifier specifies a segment which is accessed with 16-bit addresses (RS08 addressesuse up to 14 bits). The difference between the two is that objects defined in a segmentmarked by __PAGED_SEG are assumed not to cross page boundary. It is the user'sresponsibility to ensure this.

<Name>: The name of the segment. This name must be used in the link parameter file on theleft side of the assignment in the PLACEMENT part. For more information, refer to theLinker section in Build Tools Utilities manual.

Default

DEFAULT

Description

This pragma allocates constant variables into a segment. The segment is then allocated inthe link parameter file to specific addresses. The CONST_SEG pragma sets the current constsegment. All constant data declarations are placed in this segment. The default segment isset with:

#pragma CONST_SEG DEFAULT

With the -Cc option set, constants are always allocated in constant segments in the ELFobject-file format and after the first #pragma CONST_SEG (see -Cc: Allocate Const Objectsinto ROM).

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 333

Page 334: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The CONST_SEG pragma also affects constant data declarations as well as definitions. Ensurethat all constant data declarations and definitions are in the same const segment.

Some compiler optimizations assume that objects having the same segment are placedtogether. Backends supporting banked data, for example, may set the page register onlyonce for two accesses to two different variables in the same segment. This is also the casefor the DEFAULT segment. When using a paged access to variables, place one segment onone page in the link parameter file.

When #pragma INTO_ROM: Put Next Variable Definition into ROM is active, thecurrent const segment is not used.

The CONST_SECTION synonym has exactly the same meaning as CONST_SEG.

Examples

The following listing shows code that uses the CONST_SEG pragma.

Listing: Examples of the CONST_SEG pragma

/* Use the pragmas in a header file */ #pragma CONST_SEG __SHORT_SEG SHORT_CONST_MEMORY extern const int i_short; #pragma CONST_SEG CUSTOM_CONST_MEMORY extern const int j_custom; #pragma CONST_SEG DEFAULT /* Some C file, which includes the above header file code */ void main(void) { int k = i; /* may use short access */ k= j; } /* in the C file defining the constants : */ #pragma CONST_SEG __SHORT_SEG SHORT_CONST_MEMORY extern const int i_short=7 #pragma CONST_SEG CUSTOM_CONST_MEMORY extern const int j_custom=8; #pragma CONST_SEG DEFAULT

The following listing shows code that uses the CONST_SEG pragma improperly.

Listing: Improper use of the CONST_SEG pragma

#pragma DATA_SEG CONST1 #pragma CONST_SEG CONST1 /* error: same segment name has different types!*/ #pragma CONST_SEG C2 #pragma CONST_SEG __SHORT_SEG C2 // error: segment name has modifiers! #pragma CONST_SEG CONST1 extern int i; #pragma CONST_SEG DEFAULT int i; /* error: i is declared in different segments */ #pragma CONST_SEG __SHORT_SEG DEFAULT /* error: no modifiers for the DEFAULT segment are allowed

See also

RS08 Backend

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

334 Freescale Semiconductor, Inc.

Page 335: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Linker section of the Build Tools manual

#pragma DATA_SEG: Data Segment Definition

#pragma STRING_SEG: String Segment Definition

#pragma INTO_ROM: Put Next Variable Definition into ROM

-Cc: Allocate Const Objects into ROM

9.1.2 #pragma CREATE_ASM_LISTING: Create an AssemblerInclude File Listing

Scope

Until the next CREATE_ASM_LISTING pragma

Syntax

#pragma CREATE_ASM_LISTING (ON|OFF)

Synonym

None

Arguments

ON: All following defines or objects are generated

OFF: All following defines or objects are not generated

Default

OFF

Description

This pragma determines if the following defines or objects are printed into the assemblerinclude file.

A new file is generated only when the -La compiler option is specified together with aheader file containing #pragma CREATE_ASM_LISTING ON.

Listing: Example

#pragma CREATE_ASM_LISTING ONextern int i; /* i is accessible from the asm code */

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 335

Page 336: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma CREATE_ASM_LISTING OFF

extern int j; /* j is only accessible from the C code */

See also

Generating Assembler Include Files (-La Compiler Option)

9.1.3 #pragma DATA_SEG: Data Segment Definition

Scope

Until the next DATA_SEG pragma

Syntax

#pragma DATA_SEG (<Modif> <Name>|DEFAULT)

Synonym

DATA_SECTION

ArgumentsListing: Some of the strings which may be used for <Modif>

__TINY_SEG __SHORT_SEG (compatibility alias: SHORT) __DIRECT_SEG (compatibility alias: DIRECT) __PAGED_SEG __FAR_SEG (compatibility alias: FAR)

NOTEDo not use a compatibility alias in new code. It only exists forbackwards compatibility. Some of the compatibility alias namesconflict with defines found in certain header files. Therefore,using them can cause problems which may be hard to detect. Soavoid using compatibility alias names.

__TINY_SEG: specifies an operand that can be encoded on four bits (between 0x0 and 0xF).Use this modifier for frequently accessed global variables.

__SHORT_SEG: specifies an operand that can be encoded on five bits (between 0x0 and0x1F). Use this modifier to access IO registers in the lower RS08 register bank.

__DIRECT_SEG: specifies an operand that can be encoded within the range 0x00 and 0xBF.Use this modifier to access global variables. If the operand does not fit into either fourbits (__TINY_SEG) or five bits (__SHORT_SEG) then direct (8 bit) addressing is used.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

336 Freescale Semiconductor, Inc.

Page 337: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__PAGED_SEG: specifies an operand that can be encoded within the range 0x100 and 0x3FFfor read/write registers and within the range 0x00 and 0x3FFF for global read-only data.Use this modifier to access IO registers in the high RS08 register bank (read/write) or toaccess constant data. Objects allocated using __PAGED_SEG must not cross page boundaries.

__FAR_SEG: specifies an operand that can be encoded within the range 0x00 to 0x3FFF. Usethis modifier to access large constant (read-only) data. Allocate FAR sections to multiplepages.

<Name>: The name of the segment. This name must be used in the link parameter file on theleft side of the assignment in the PLACEMENT part. For more information, refer to the linkermanual.

Default

DEFAULT

Description

The DATA_SEG pragma allocates variables into the current data segment. This segment isused to place all variable declarations. Use this pragma to impose tiny or short addressingmode when accessing variables in the relevant sections. Set the default segment with:

#pragma DATA_SEG DEFAULT

When using the -Cc: Allocate Const Objects into ROM compiler option and the ELFobject-file format, constants are not allocated in the data segment.

The DATA_SEG pragma also affects data declarations, as well as definitions. Ensure that allvariable declarations and definitions are in the same segment.

The RS08 compiler automatically allocates non-static local data into an OVERLAP section.The OVERLAP section uses the same address range as __DIRECT_SEG (0x00 - 0xBF).

Some instructions support tiny and short addressing. These instructions are encoded onone byte only rather than two bytes.

Some compiler optimizations assume that objects having the same segment are together.Backends supporting banked data, for example, may set the page register only once if twoaccesses to different variables in the same segment are done. This is also the case for theDEFAULT segment. When using a paged access to constant variables, put one segment onone page in the link parameter file.

When #pragma INTO_ROM: Put Next Variable Definition into ROM is active, thecurrent data segment is not used.

The synonym DATA_SECTION means exactly same as DATA_SEG.

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 337

Page 338: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

The following listing shows source code that uses the DATA_SEG pragma.

Listing: Using the DATA_SEG pragma

/* in a header file */ #pragma DATA_SEG __TINY_SEG MyTinySection char status; #pragma DATA_SEG __ SHORT_SEG MyShortSection unsigned char IOReg; #pragma DATA_SEG DEFAULT char temp; #pragma DATA_SEG __ PAGED_SEG MyShortSection unsigned char IOReg; unsigned char *__paged io_ptr = &IOREG; #pragma DATA_SEG __ PAGED_SEG MyPagedSection const char table[10]; unsigned char *__paged tblptr = table; #pragma DATA_SEG __ FAR_SEG MyFarSection const char table[1000]; unsigned char *__far tblptr = table;

See also

RS08 Backend

Linker section of the Build Tools manual

#pragma CONST_SEG: Constant Data Segment Definition

#pragma STRING_SEG: String Segment Definition

#pragma INTO_ROM: Put Next Variable Definition into ROM

-Cc: Allocate Const Objects into ROM

9.1.4 #pragma INLINE: Inline Next Function Definition

Scope

Function Definition

Syntax

#pragma INLINE

Synonym

None

Arguments

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

338 Freescale Semiconductor, Inc.

Page 339: CodeWarrior Development Studio for Microcontrollers V10.x RS08

None

Default

None

Description

This pragma directs the Compiler to inline the next function in the source.

The pragma is the same as using the -Oi compiler option.

Listing: Using an INLINE pragma to inline a function

int i; #pragma INLINE static void fun(void) { i = 12; } void main(void) { fun(); // results in inlining `i = 12;' }

See also

#pragma NO_INLINE: Do not Inline next function definition

-Oi: Inlining

9.1.5 #pragma INTO_ROM: Put Next Variable Definition into ROM

Scope

Data Definition

Syntax

#pragma INTO_ROM

Synonym

None

Arguments

None

Default

None

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 339

Page 340: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

This pragma forces the next (non-constant) variable definition to be const (together withthe -Cc compiler option).

The pragma is active only for the next single variable definition. A subsequent segmentpragma (CONST_SEG, DATA_SEG, CODE_SEG) disables the pragma.

NOTEThis pragma is only useful for the HIWARE object-file format(but not for ELF/DWARF).

NOTEThis pragma is to force a non-constant (meaning a normal`variable') object to be recognized as `const' by the compiler. Ifthe variable already is declared as `const' in the source, thispragma is not needed. This pragma was introduced to cheat theconstant handling of the compiler and shall not be used anylonger. It is supported for legacy reasons only.

Example

The following listing presents some examples which use the INTO_ROM pragma.

Listing: Using the INTO_ROM pragma

#pragma INTO_ROMchar *const B[] = {"hello", "world"};

#pragma INTO_ROM

int constVariable; /* put into ROM_VAR, .rodata */

int other; /* put into default segment */

#pragma INTO_ROM

#pragma DATA_SEG MySeg /* INTO_ROM overwritten! */

int other2; /* put into MySeg */

See also

-Cc: Allocate Const Objects into ROM

9.1.6 #pragma LINK_INFO: Pass Information to the Linker

Scope

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

340 Freescale Semiconductor, Inc.

Page 341: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Function

Syntax

#pragma LINK_INFO NAME "CONTENT"

Synonym

None

Arguments

NAME: Identifier specific to the purpose of this LINK_INFO.

CONTENT: C-style string containing only printable ASCII characters.

Default

None

Description

This pragma instructs the compiler to put the passed name content pair into the ELF file.For the compiler, the name that is used and its content have no meaning other than eachname can contain only one content string. However, multiple pragmas with different NAMEsare legal.

For the Linker or for the Debugger, however, NAME might trigger some specialfunctionality with CONTENT as an argument.

The Linker collects the CONTENT for every NAME from different object files and issues amessage if CONTENT differs in different object files.

NOTEThis pragma only works with the ELF object-file format.

Example

Apart from extended functionality implemented in the Linker or Debugger, this featurecan also be used for user-defined link-time consistency checks.

Using the code shown in the following listing in a header file used by all compilationunits, the Linker issues a message if the object files built with _DEBUG are linked withobject files built without it.

Listing: Using pragmas to assist in debugging

#ifdef _DEBUG #pragma LINK_INFO MY_BUILD_ENV DEBUG

#else

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 341

Page 342: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma LINK_INFO MY_BUILD_ENV NO_DEBUG

#endif

9.1.7 #pragma LOOP_UNROLL: Force Loop Unrolling

Scope

Function

Syntax

#pragma LOOP_UNROLL

Synonym

None

Arguments

None

Default

None

Description

If this pragma is present, loop unrolling is performed for the next function. This is thesame as setting the -Cu option for the following single function.

Listing: Using a LOOP_UNROLL pragma to unroll the for loop

#pragma LOOP_UNROLLvoid F(void) {

for (i=0; i<5; i++) { // unrolling this loop

...

See also

#pragma NO_LOOP_UNROLL: Disable Loop Unrolling

-Cu: Loop Unrolling

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

342 Freescale Semiconductor, Inc.

Page 343: CodeWarrior Development Studio for Microcontrollers V10.x RS08

9.1.8 #pragma mark: Entry in CodeWarrior IDE Function List

Scope

Line

Syntax

#pragma mark {any text - no quote marks needed}

Synonym

None

Arguments

None

Default

None

Description

This pragma adds an entry into the function list of the CodeWarrior IDE. It also helps tointroduce faster code lookups by providing a menu entry which directly jumps to a codeposition. With the special #pragma mark -, a separator line is inserted.

NOTEThe compiler does not actually handle this pragma. Thecompiler ignores this pragma. The CodeWarrior IDE scansopened source files for this pragma. It is not necessary torecompile a file when this pragma is changed. The IDE updatesits menus instantly.

Example

For the example in the following listing the pragma accesses declarations and definitions.

Listing: Using the MARK pragma

#pragma mark local function declarationsstatic void inc_counter(void);

static void inc_ref(void);

#pragma mark local variable definitions

static int counter;

static int ref;

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 343

Page 344: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma mark -

static void inc_counter(void) {

counter++;

}

static void inc_ref(void) {

ref++;

}

9.1.9 #pragma MESSAGE: Message Setting

Scope

Compilation Unit or until the next MESSAGE pragma

Syntax

#pragma MESSAGE {(WARNING|ERROR|INFORMATION|DISABLE|DEFAULT){<CNUM>}}

Synonym

None

Arguments

<CNUM>: Number of messages to be set in the C1234 format

Default

None

Description

Messages are selectively set to an information message, a warning message, a disablemessage, or an error message.

NOTEThis pragma has no effect for messages which are producedduring preprocessing. The reason is that the pragma parsing hasto be done during normal source parsing but not duringpreprocessing.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

344 Freescale Semiconductor, Inc.

Page 345: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThis pragma (as other pragmas) has to be specified outside ofthe function's scope. For example, it is not possible to change amessage inside a function or for a part of a function.

Example

In the example shown in the following listing, parentheses ( ) were omitted.

Listing: Using the MESSAGE Pragma

/* treat C1412: Not a function call, *//* address of a function, as error */

#pragma MESSAGE ERROR C1412

void f(void);

void main(void) {

f; /* () is missing, but still legal in C */

/* ERROR because of pragma MESSAGE */

}

See also

Compiler options :

• -WmsgSd: Setting a Message to Disable• -WmsgSe: Setting a Message to Error• -WmsgSi: Setting a Message to Information• -WmsgSw: Setting a Message to Warning

9.1.10 #pragma NO_ENTRY: No Entry Code

Scope

Function

Syntax

#pragma NO_ENTRY

Synonym

None

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 345

Page 346: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

None

Default

None

Description

This pragma suppresses the generation of entry code and is useful for inline assemblerfunctions. The entry code prepares subsequent C code to run properly. It usually consistsof pushing register arguments on the stack (if necessary), and allocating the stack spaceused for local variables and temporaries and storing callee saved registers according tothe calling convention.

The main purpose of this pragma is for functions which contain only High-Level Inline(HLI) assembler code to suppress the compiler generated entry code.

One use of this pragma is in the startup function _Startup. At the start of this function thestack pointer is not yet defined. It has to be loaded by custom HLI code first.

NOTEC code inside of a function compiled with #pragma NO_ENTRYgenerates independently of this pragma. The resulting C codemay not work since it could access unallocated variables inmemory.

This pragma is safe in functions with only HLI code. In functions that contain C code,using this pragma is a very advanced topic. Usually this pragma is used together with thepragma NO_FRAME.

TipUse a #pragma NO_ENTRY and a #pragma NO_EXIT with HLI-onlyfunctions to avoid generation of any additional frameinstructions by the compiler.

The code generated in a function with #pragma NO_ENTRY may be unreliable. It is assumedthat the user ensures correct memory use.

NOTENot all backends support this pragma. Some may still generateentry code even if this pragma is specified.

Example

The following listing shows how to use the NO_ENTRY pragma (along with others) to avoidany generated code by the compiler. All code is written in inline assembler.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

346 Freescale Semiconductor, Inc.

Page 347: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Blocking compiler-generated function-management instructions

#pragma NO_ENTRY #pragma NO_EXIT #pragma NO_FRAME #pragma NO_RETURN void Func0(void) { __asm {/* No code should be written by the compiler.*/ ... } }

See also

#pragma NO_EXIT: No Exit Code

#pragma NO_FRAME: No Frame Code

#pragma NO_RETURN: No Return Instruction

9.1.11 #pragma NO_EXIT: No Exit Code

Scope

Function

Syntax

#pragma NO_EXIT

Synonym

None

Arguments

None

Default

None

Description

This pragma suppresses generation of the exit code and is useful for inline assemblerfunctions. The two pragmas NO_ENTRY and NO_EXIT together avoid generation of any exit/entry code. Functions written in High-Level Inline (HLI) assembler can therefore be usedas custom entry and exit code.

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 347

Page 348: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The compiler can often deduce if a function does not return, but sometimes this is notpossible. This pragma can then be used to avoid the generation of exit code.

TipUse a #pragma NO_ENTRY and a #pragma NO_EXIT with HLI-onlyfunctions to avoid generation of any additional frameinstructions by the compiler.

The code generated in a function with #pragma NO_EXIT may not be safe. It is assumed thatthe user ensures correct memory usage.

NOTENot all backends support this pragma. Some may still generateexit code even if this pragma is specified.

Example

The following listing shows how to use the NO_EXIT pragma (along with others) to avoidany generated code by the compiler. All code is written in inline assembler.

Listing: Blocking Compiler-generated function management instructions

#pragma NO_ENTRY #pragma NO_EXIT #pragma NO_FRAME #pragma NO_RETURN void Func0(void) { __asm {/* No code should be written by the compiler.*/ ... } }

See also

#pragma NO_ENTRY: No Entry Code

#pragma NO_FRAME: No Frame Code

#pragma NO_RETURN: No Return Instruction

9.1.12 #pragma NO_FRAME: No Frame Code

Scope

Function

Syntax

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

348 Freescale Semiconductor, Inc.

Page 349: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma NO_FRAME

Synonym

None

Arguments

None

Default

None

Description

This pragma is accepted for compatibility only. It is replaced by the #pragma NO_ENTRY and#pragma NO_EXIT pragmas.

For some compilers, using this pragma does not affect the generated code. Use the twopragmas NO_ENTRY and NO_EXIT instead (or in addition). When the compiler does considerthis pragma, see the #pragma NO_ENTRY and #pragma NO_EXIT for restrictions that apply.

This pragma suppresses the generation of frame code and is useful for inline assemblerfunctions.

The code generated in a function with #pragma NO_FRAME may be unreliable. It is assumedthat the user ensures correct memory usage.

NOTENot all backends support this pragma. Some may still generateframe code even if this pragma is specified.

Example

The following listing shows how to use the NO_FRAME pragma (along with others) to avoidany generated code by the compiler. All code is written in inline assembler.

Listing: Blocking compiler-generated function management instructions

#pragma NO_ENTRY#pragma NO_EXIT

#pragma NO_FRAME

#pragma NO_RETURN

void Func0(void) {

__asm {/* No code should be written by the compiler.*/

...

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 349

Page 350: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

}

See also

#pragma NO_ENTRY: No Entry Code

#pragma NO_EXIT: No Exit Code

#pragma NO_RETURN: No Return Instruction

9.1.13 #pragma NO_INLINE: Do not Inline next function definition

Scope

Function

Syntax

#pragma NO_INLINE

Synonym

None

Arguments

None

Default

None

Description

This pragma prevents the Compiler from inlining the next function in the source. Thepragma is used to avoid inlining a function which would be inlined because of the -Oicompiler option.

Listing: Use of #pragma NO_INLINE to prevent inlining a function.

// (With the -Oi option) int i; #pragma NO_INLINE static void foo(void) { i = 12; } void main(void) { foo(); // call is not inlined }

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

350 Freescale Semiconductor, Inc.

Page 351: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

#pragma INLINE: Inline Next Function Definition

-Oi: Inlining

9.1.14 #pragma NO_LOOP_UNROLL: Disable Loop Unrolling

Scope

Function

Syntax

#pragma NO_LOOP_UNROLL

Synonym

None

Arguments

None

Default

None

Description

If this pragma is present, no loop unrolling is performed for the next function definition,even if the -Cu command line option is given.

ExampleListing: Using the NO_LOOP_UNROLL pragma to temporarily halt loop unrolling

#pragma NO_LOOP_UNROLLvoid F(void) {

for (i=0; i<5; i++) { // loop is NOT unrolled

...

See also

#pragma LOOP_UNROLL: Force Loop Unrolling

-Cu: Loop Unrolling

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 351

Page 352: CodeWarrior Development Studio for Microcontrollers V10.x RS08

9.1.15 #pragma NO_RETURN: No Return Instruction

Scope

Function

Syntax

#pragma NO_RETURN

Synonym

None

Arguments

None

Default

None

Description

This pragma suppresses the generation of the return instruction (return from a subroutineor return from an interrupt). This may be useful if you care about the return instructionitself or if the code has to fall through to the first instruction of the next function.

This pragma does not suppress the generation of the exit code at all (e.g., deallocation oflocal variables or compiler generated local variables). The pragma suppresses thegeneration of the return instruction.

NOTEIf this feature is used to fall through to the next function, smartlinking has to be switched off in the Linker, because the nextfunction may be not referenced from somewhere else. Inaddition, be careful that both functions are in a linear segment.To be on the safe side, allocate both functions into a segmentthat only has a linear memory area.

Example

The example in the following listing places some functions into a special named segment.All functions in this special code segment have to be called from an operating systemevery 2 seconds after each other. With the pragma some functions do not return. They falldirectly to the next function to be called, saving code size and execution time.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

352 Freescale Semiconductor, Inc.

Page 353: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Blocking compiler-generated function return instructions

#pragma CODE_SEG CallEvery2Secs #pragma NO_RETURN void Func0(void) { /* first function, called from OS */ ... } /* fall through!!!! */ #pragma NO_RETURN void Func1(void) { ... } /* fall through */ ... /* last function has to return, no pragma is used! */ void FuncLast(void) { ... }

See also

#pragma NO_ENTRY: No Entry Code

#pragma NO_EXIT: No Exit Code

#pragma NO_FRAME: No Frame Code

9.1.16 #pragma NO_STRING_CONSTR: No String Concatenationduring preprocessing

Scope

Compilation Unit

Syntax

#pragma NO_STRING_CONSTR

Synonym

None

Arguments

None

Default

None

Description

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 353

Page 354: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This pragma is valid for the rest of the file in which it appears. It switches off the specialhandling of # as a string constructor. This is useful if a macro contains inline assemblerstatements using this character, e.g., for IMMEDIATE values.

Example

The following pseudo assembly-code macro shows the use of the pragma. Without thepragma, # is handled as a string constructor, which is not the desired behavior.

Listing: Using a NO_STRING_CONSTR pragma in order to alter the meaning of #

#pragma NO_STRING_CONSTR #define HALT(x) __asm { \ LOAD Reg,#3 \ HALT x, #255\ }

See also

Using the Immediate-Addressing Mode in HLI Assembler Macros

9.1.17 #pragma ONCE: Include Once

Scope

File

Syntax

#pragma ONCE

Synonym

None

Arguments

None

Default

None

Description

If this pragma appears in a header file, the file is opened and read only once. Thisincreases compilation speed.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

354 Freescale Semiconductor, Inc.

Page 355: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

#pragma ONCE

See also

-Pio: Include Files Only Once

9.1.18 #pragma OPTION: Additional Options

Scope

Compilation Unit or until the nextOPTIONpragma

Syntax

#pragma OPTION ADD [<Handle>] "<Option>"

#pragma OPTION DEL <Handle>

#pragma OPTION DEL ALL

Synonym

None

Arguments

<Handle>: An identifier - added options can selectively be deleted.

<Option>: A valid option string

Default

None

Description

Options are added inside of the source code while compiling a file.

The options given on the command line or in a configuration file cannot be changed inany way.

Additional options are added to the current ones with the ADD command. A handle may begiven optionally.

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 355

Page 356: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The DEL command either removes all options with a specific handle. It also uses the ALLkeyword to remove all added options regardless if they have a handle or not. Note thatyou only can remove options which were added previously with the OPTION ADD pragma.

All keywords and the handle are case-sensitive.

Restrictions :

• The -D: Macro Definition (preprocessor definition) compiler option is not allowed.Use a #define preprocessor directive instead.

• The -OdocF: Dynamic Option Configuration for Functions compiler option is notallowed. Specify this option on the command line or in a configuration file instead.

• These Message Setting compiler options have no effect:• -WmsgSd: Setting a Message to Disable,• -WmsgSe: Setting a Message to Error,• -WmsgSi: Setting a Message to Information, and• -WmsgSw: Setting a Message to Warning.

Use #pragma MESSAGE: Message Setting instead.

• Only options concerning tasks during code generation are used. Options controllingthe preprocessor, for example, have no effect.

• No macros are defined for specific options.• Only options having function scope may be used.• The given options must not specify a conflict to any other given option.• The pragma is not allowed inside of declarations or definitions.

Example

The example in the following listing shows how to compile only a single function withthe additional -Or option.

Listing: Using the OPTION Pragma

#pragma OPTION ADD function_main_handle "-Or" int sum(int max) { /* compiled with -or */ int i, sum=0; for (i = 0; i < max; i++) { sum += i; } return sum; } #pragma OPTION DEL function_main_handle /* Now the same options as before #pragma OPTION ADD */ /* are active again. */

The examples in the following listing show improper uses of the OPTION pragma.

Listing: Improper uses of the OPTION pragma

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

356 Freescale Semiconductor, Inc.

Page 357: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma OPTION ADD -Or /* ERROR, quotes missing; use "-Or" */ #pragma OPTION "-Or" /* ERROR, needs also the ADD keyword */ #pragma OPTION ADD "-Odocf=\"-Or\"" /* ERROR, "-Odocf" not allowed in this pragma */ void f(void) { #pragma OPTION ADD "-Or" /* ERROR, pragma not allowed inside of declarations */ }; #pragma OPTION ADD "-Cni" #ifdef __CNI__ /* ERROR, macros are not defined for options */ /* added with the pragma */ #endif

9.1.19 #pragma REALLOC_OBJ: Object Reallocation

Scope

Compilation Unit

Syntax

#pragma REALLOC_OBJ "segment" ["objfile"] object qualifier

Arguments

segment: Name of an already existing segment. This name must have been previously usedby a segment pragma ( DATA_SEG, CODE_SEG, CONST_SEG, or STRING_SEG).

objfile: Name of a object file. If specified, the object is assumed to have static linkageand to be defined in objfile. The name must be specified without alteration by thequalifier __namemangle.

object: Name of the object to be reallocated. Here the name as known to the Linker has tobe specified.

qualifier: One of the following:

• __near,• __far,• __paged, or• __namemangle.

Some of the qualifiers are only allowed to backends not supporting a specified qualifiergenerating this message. With the special __namemangle qualifier, the link name is changedso that the name of the reallocated object does not match the usual name. This featuredetects when a REALLOC_OBJ pragma is not applied to all uses of one object.

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 357

Page 358: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Default

None

Description

This pragma reallocates an object (e.g., affecting its calling convention). This is used bythe linker if the linker has to distribute objects over banks or segments in an automaticway (code distribution). The linker is able to generate an include file containing #pragmaREALLOC_OBJ to tell the compiler how to change calling conventions for each object. See theLinker manual for details.

Example

The following listing uses the REALLOC_OBJ pragma to reallocate the evaluate.o object file.

Listing: Using the REALLOC_OBJ pragma to reallocate an object

#pragma REALLOC_OBJ "DISTRIBUTE1" ("evaluate.o") Eval_Plus __near __namemangle

See also

Message C420 in the Online Help

Linker section of the Build Tools manual

9.1.20 #pragma STRING_SEG: String Segment Definition

Scope

Until the next STRING_SEG pragma

Syntax

#pragma STRING_SEG (<Modif><Name>|DEFAULT)

Synonym

STRING_SECTION

ArgumentsListing: Some of the strings which may be used for <Modif>

__FAR_SEG (compatibility alias: FAR) __PAGED_SEG

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

358 Freescale Semiconductor, Inc.

Page 359: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEDo not use a compatibility alias in new code. It only exists forbackwards compatibility. Some of the compatibility alias namesconflict with defines found in certain header files. So avoidusing compatibility alias names.

The __SHORT_SEG modifier specifies a segment that accesses using 8-bit addresses. Thedefinitions of these segment modifiers are backend-dependent.

<Name>: The name of the segment. This name must be used in the link parameter file on theleft side of the assignment in the PLACEMENT part. For information, refer to the linkermanual.

Default

DEFAULT.

Description

This pragma allocates strings into a segment. Strings are allocated in the linker segmentSTRINGS. This pragma allocates strings in special segments. String segments also may havemodifiers. This instructs the Compiler to access them in a special way when necessary.

Segments defined with the pragma STRING_SEG are treated by the linker like constantsegments defined with #pragma CONST_SEG, so they are allocated in ROM areas.

The pragma STRING_SEG sets the current string segment. This segment is used to place allnewly occurring strings.

NOTEThe linker may support a overlapping allocation of strings. e.g.,the allocation of CDE inside of the string ABCDE, so that bothstrings together need only six bytes. When putting strings intouser-defined segments, the linker may no longer do thisoptimization. Only use a user-defined string segment whennecessary.

The synonym STRING_SECTION has exactly the same meaning as STRING_SEG.

Example

The following listing is an example of the STRING_SEG pragma allocating strings into asegment with the name, STRING_MEMORY.

Listing: Using a STRING_SEG pragma to allocate a segment for strings

#pragma STRING_SEG __FAR_SEG STRING_MEMORY char * __far p="String1";

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 359

Page 360: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f(char * __far ); void main(void) { f("String2"); } #pragma STRING_SEG DEFAULT

See also

RS08 Backend

Linker section of the Build Tools manual

#pragma CONST_SEG: Constant Data Segment Definition

#pragma DATA_SEG: Data Segment Definition

9.1.21 #pragma TEST_CODE: Check Generated Code

Scope

Function Definition

Syntax

#pragma TEST_CODE CompareOperator <Size> [<HashCode>]

CompareOperator: ==|!=|<|>|<=|>=

Arguments

<Size>: Size of the function to be used in a compare operation

<HashCode>: optional value specifying one specific code pattern.

Default

None

Description

This pragma checks the generated code. If the check fails, the message C3601 is issued.

The following parts are tested:

• Size of the function

The compare operator and the size given as arguments are compared with the size ofthe function.

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

360 Freescale Semiconductor, Inc.

Page 361: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This feature checks that the compiler generates less code than a given boundary. Or,to be sure that certain code it can also be checked that the compiler produces morecode than specified. To only check the hashcode, use a condition which is alwaysTRUE, such as != 0.

• Hashcode

The compiler produces a 16-bit hashcode from the produced code of the nextfunction. This hashcode considers:

• The code bytes of the generated functions• The type, offset, and addend of any fixup.

To get the hashcode of a certain function, compile the function with an active#pragma TEST_CODE which will intentionally fail. Then copy the computedhashcode out of the body of the message C3601.

NOTEThe code generated by the compiler may change. If thetest fails, it is often not certain that the topic chosen tobe checked was wrong.

Examples

The following listing and Listing: Using a Test_Code pragma with the hashcode optionpresent two examples of the TEST_CODE pragma.

Listing: Using TEST_CODE to check the size of generated object code

/* check that an empty function is smaller */ /* than 10 bytes */ #pragma TEST_CODE < 10 void main(void) { }

You can also use the TEST_CODE pragma to detect when a different code is generated (referto the following listing).

Listing: Using a Test_Code pragma with the hashcode option

/* If the following pragma fails, check the code. */ /* If the code is OK, add the hashcode to the */ /* list of allowed codes : */ #pragma TEST_CODE != 0 25645 37594 /* check code patterns : */ /* 25645 : shift for *2 */ /* 37594 : mult for *2 */ void main(void) { f(2*i); }

Chapter 9 Compiler Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 361

Page 362: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

Message C3601 in the Online Help

9.1.22 #pragma TRAP_PROC: Mark function as interrupt function

Scope

Function Definition

Syntax

#pragma TRAP_PROC

Arguments

See Backend

Default

None

Description

This pragma marks a function to be an interrupt function. Because interrupt functionsmay need some special entry and exit code, this pragma has to be used for interruptfunctions.

Do not use this pragma for declarations (e.g., in header files) because the pragma is validfor the next definition.

See the RS08 Backend chapter for details.

Example

The following listing marks the MyInterrupt() function as an interrupt function.

Listing: Using the TRAP_PROC pragma to mark an interrupt function

#pragma TRAP_PROC void MyInterrupt(void) { ... }

See also

interrupt keyword

Pragma Details

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

362 Freescale Semiconductor, Inc.

Page 363: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 10ANSI-C Frontend

The Compiler Frontend reads the source files, does all the syntactic and semanticchecking, and produces intermediate representation of the program which then is passedon to the Backend to generate code.

This chapter discusses features, restrictions, and further properties of the ANSI-CCompiler Frontend.

• Implementation Features• ANSI-C Standard• Floating-Type Formats• Volatile Objects and Absolute Variables• Bitfields• Segmentation• Optimizations• Using Qualifiers for Pointers• Defining C Macros Containing HLI Assembler Code

10.1 Implementation Features

The Compiler provides a series of pragmas instead of introducing additions to thelanguage to support features such as interrupt procedures. The Compiler implementsANSI-C according to the X3J11 standard. The reference document is "American NationalStandard for Programming Languages - C", ANSI/ISO 9899-1990.

10.1.1 Keywords

See the following listing for the complete list of ANCSI-C keywords.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 363

Page 364: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: ANSI-C keywords

auto break case char

const continue default do

double else enum extern

float for goto if

int long register return

short signed sizeof static

struct switch typedef union

unsigned void volatile while

10.1.2 Preprocessor Directives

The Compiler supports the full set of preprocessor directives as required by the ANSIstandard (refer to the following listing).

Listing: ANSI-C preprocessor directives

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

364 Freescale Semiconductor, Inc.

Page 365: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#if, #ifdef, #ifndef, #else, #elif, #endif

#define, #undef

#include

#pragma

#error, #line

The preprocessor operators defined, #, and ## are also supported. There is a special non-ANSI directive #warning which is the same as #error, but issues only a warning message.

10.1.3 Language Extensions

There is a language extension in the Compiler for ANSI-C. You can use keywords toqualify pointers in order to distinguish them, or to mark interrupt routines.

The Compiler supports the following non-ANSI compliant keywords (see Backend ifthey are supported and for their semantics):

10.1.3.1 Pointer Qualifiers

Pointer qualifiers can be used to distinguish between different pointer types (e.g., forpaging). Some of them are also used to specify the calling convention to be used (e.g., ifbanking is available).

Listing: Pointer qualifiers

__far (alias far)

__near (alias near)

__paged

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 365

Page 366: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Far pointers contain a real RS08 address, that is, a linear address between 0 and 0x3FFF.A paged pointer is a 16-bit data entity containing a page number in the high byte and anaddress in the low byte. The address lies within the paging window, so no additionaloverhead is required to compute the value. Paged pointers cannot be used to access dataacross page boundaries. Use paged pointers whenever possible.

To allow portable programming between different CPUs (or if the target CPU does notsupport an additional keyword), you can include the defines listed below in the hidef.hheader file.

Listing: far and near can be defined in the hidef.h file

#define far /* no far keyword supported */

#define near /* no near keyword supported */

10.1.3.2 Special Keywords

ANSI-C was not designed with embedded controllers in mind. The listed keywords in thefollowing listing do not conform to ANSI standards. However, they enable you toachieve good results from code used for embedded applications.

Listing: Special (non-ANSI) keywords

__alignof__

__va_sizeof__

__interrupt (alias interrupt)

__asm (aliases _asm and asm)

You can use the __interrupt keyword to mark functions as interrupt functions, and to linkthe function to a specified interrupt vector number (not supported by all backends).

10.1.3.3 Binary Constants (0b)

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

366 Freescale Semiconductor, Inc.

Page 367: CodeWarrior Development Studio for Microcontrollers V10.x RS08

It is as well possible to use the binary notation for constants instead of hexadecimalconstants or normal constants. Note that binary constants are not allowed if the -Ansi:Strict ANSI compiler option is switched on. Binary constants start with the 0b prefix,followed by a sequence of zeros or ones.

Listing: Demonstration of a binary constant

#define myBinaryConst 0b01011

int i;

void main(void) {

i = myBinaryConst;

}

10.1.3.4 Hexadecimal constants ($)

It is possible to use Hexadecimal constants inside HLI (High-Level Inline) Assembly. Forexample, instead of 0x1234 you can use $1234. Note that this is valid only for inlineassembly.

10.1.3.5 #warning directive

The #warning directive, as shown in the following listing is used as it is similar to the#error directive.

Listing: #warning directive

#ifndef MY_MACRO #warning "MY_MACRO set to default"

#define MY_MACRO 1234

#endif

10.1.3.6 Global Variable Address Modifier (@address)

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 367

Page 368: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can assign global variables to specific addresses with the global variable addressmodifier. These variables are called absolute variables. They are useful for accessingmemory mapped I/O ports and have the following syntax:

Declaration = <TypeSpec> <Declarator> [@<Address>|@"<Section>"] [= <Initializer>];

where:

• <TypeSpec> is the type specifier, e.g., int, char• <Declarator> is the identifier of the global object, e.g., i, glob• <Address> is the absolute address of the object, e.g., 0xff04, 0x00+8• <Initializer> is the value to which the global variable is initialized.

A segment is created for each global object specified with an absolute address. Thisaddress must not be inside any address range in the SECTIONS entries of the link parameterfile. Otherwise, there would be a linker error (overlapping segments). If the specifiedaddress has a size greater than that used for addressing the default data page, pointerspointing to this global variable must be __far. An alternate way to assign global variablesto specific addresses is setting the PLACEMENT section in the Linker parameter file (see thefollowing listing).

Listing: Assigning global variables to specific addresses

#pragma DATA_SEG [__SHORT_SEG] <segment_name>

An older method of accomplishing this is shown in the following listing.

Listing: Another means of assigning global variables to specific addresses

<segment_name> INTO READ_ONLY <Address> ;

The following listing is an example using correctly and incorrectly the global variableaddress modifier and the following listing is a possible PRM file that corresponds withthe example Listing.

Listing: Using the global variable address modifier

int glob @0x0500 = 10; // OK, global variable "glob" is // at 0x0500, initialized with 10

void g() @0x40c0; // error (the object is a function)

void f() {

int i @0x40cc; // error (the object is a local variable)

}

Listing: Corresponding Linker parameter file settings (prm file)

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

368 Freescale Semiconductor, Inc.

Page 369: CodeWarrior Development Studio for Microcontrollers V10.x RS08

/* the address 0x0500 of "glob" must not be in any address range of the SECTIONS entries */

SECTIONS

MY_RAM = READ_WRITE 0x0800 TO 0x1BFF;

MY_ROM = READ_ONLY 0x2000 TO 0xFEFF;

MY_STACK = READ_WRITE 0x1C00 TO 0x1FFF;

MY_IO_SEG = READ_WRITE 0x0400 TO 0x4ff;

END

PLACEMENT

IO_SEG INTO MY_IO_SEG;

DEFAULT_ROM INTO MY_ROM;

DEFAULT_RAM INTO MY_RAM;

SSTACK INTO MY_STACK;

END

10.1.3.7 Variable Allocation using @"SegmentName"

Sometimes it is useful to have the variable directly allocated in a named segment insteadof using a #pragma. The following listing is an example of how to do this.

Listing: Allocation of variables in named segments

#pragma DATA_SEG __SHORT_SEG tiny #pragma DATA_SEG not_tiny #pragma DATA_SEG __SHORT_SEG tiny_b #pragma DATA_SEG DEFAULT int i@"tiny"; int j@"not_tiny"; int k@"tiny_b";

So with some pragmas in a common header file and with another definition for themacro, it is possible to allocate variables depending on a macro.

Declaration = <TypeSpec> <Declarator> [@"<Section>"][=<Initializer>];

Variables declared and defined with the @"section" syntax behave exactly like variablesdeclared after their respective pragmas.

• <TypeSpec> is the type specifier, e.g., int or char• <Declarator> is the identifier of your global object, e.g., i, glob• <Section> is the section name. Define it in the link parameter file as well (e.g.,

MyDataSection).• <Initializer> is the value to which the global variable is initialized.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 369

Page 370: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The section name used has to be known at the declaration time by a previous sectionpragma.

Listing: Examples of section pragmas

#pragma DATA_SEC __SHORT_SEG MY_SHORT_DATA_SEC #pragma DATA_SEC MY_DATA_SEC #pragma CONST_SEC MY_CONST_SEC #pragma DATA_SEC DEFAULT // not necessary, // but good practice #pragma CONST_SEC DEFAULT // not necessary, // but good practice int short_var @"MY_SHORT_DATA_SEC"; // OK, accesses are // short int ext_var @"MY_DATA_SEC" = 10; // OK, goes into // MY_DATA_SECT int def_var; / OK, goes into DEFAULT_RAM const int cst_var @"MY_CONST_SEC" = 10; // OK, goes into // MY_CONST_SECT

Listing: Corresponding Link Parameter File Settings (prm-file)

SECTIONS MY_ZRAM = READ_WRITE 0x00F0 TO 0x00FF; MY_RAM = READ_WRITE 0x0100 TO 0x01FF; MY_ROM = READ_ONLY 0x2000 TO 0xFEFF; MY_STACK = READ_WRITE 0x0200 TO 0x03FF; END PLACEMENT MY_CONST_SEC,DEFAULT_ROM INTO MY_ROM; MY_SHORT_DATA_SEC INTO MY_ZRAM; MY_DATA_SEC, DEFAULT_RAM INTO MY_RAM; SSTACK INTO MY_STACK END

10.1.3.7.1 Absolute Functions

Sometimes it is useful to call an absolute function (e.g., a special function in ROM). Thefollowing listing is a simple example of calling an absolute function using normal ANSI-C.

Listing: Absolute function

#define erase ((void(*)(void))(0xfc06))

void main(void) {

erase(); /* call function at address 0xfc06 */

}

10.1.3.7.2 Absolute Variables and Linking

Special attention is needed if absolute variables are involved in the linker's link process.

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

370 Freescale Semiconductor, Inc.

Page 371: CodeWarrior Development Studio for Microcontrollers V10.x RS08

If an absolute object is not referenced by the application, it is always linked using theELF/DWARF format. To force linking, switch off smart linking in the Linker, or usingthe ENTRIES command in the linker parameter file.

NOTEInterrupt vector entries are always linked.

The example in the following listing shows how the linker handles different absolutevariables.

Listing: Linker handling of absolute variables

char i; /* zero out */ char j = 1; /* zero out, copy-down */

const char k = 2; /* download */

char I@0x10; /* no zero out! */

char J@0x11 = 1;/* copy down */

const char K@0x12 = 2;/* ELF: download! */

static char L@0x13; /* no zero out! */

static char M@0x14 = 3; /* copy down */

static const char N@0x15 = 4; /* ELF: download */

void interrupt 2 MyISRfct(void) {} /* download, always linked! */

/* vector number two is downloaded with &MyISRfct */

void foo(char *p) {} /* download */

void main(void) { /* download */

foo(&i); foo(&j); foo(&k);

foo(&I); foo(&J); foo(&K);

foo(&L); foo(&M); foo(&N);

}

Zero out means that the default startup code initializes the variables during startup. Copydown means that the variable is initialized during the default startup. To download meansthat the memory is initialized while downloading the application.

10.1.3.8 The __far Keyword

The keyword far is a synonym for __far, which is not allowed when the -Ansi: StrictANSI compiler option is present.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 371

Page 372: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A __far pointer allows access to the whole memory range supported by the processor, notjust to the default data page. You can use it to access memory mapped I/O registers thatare not on the data page. You can also use it to allocate constant strings in a ROM not onthe data page.

The __far keyword defines the calling convention for a function. Some backends supportspecial calling conventions which also set a page register when a function is called. Thisenables you to use more code than the address space can usually accommodate. Thespecial allocation of such functions is not done automatically.

10.1.3.8.1 Using the __far Keyword for Pointers

The keyword __far is a type qualifier like const and is valid only in the context of pointertypes and functions.The __far keyword ( for pointers) always affects the last * to its left ina type definition. The declaration of a __far pointer to a __ far pointer to a character is:

char *__far *__far p;

The following is a declaration of a normal (short) pointer to a __far pointer to a character:

char *__far * p;

NOTETo declare a __far pointer, place the __ far keyword after theasterisk: char *__far p; not char __far *p; The second choicewill not work.

10.1.3.8.2 __far and Arrays

The __far keyword does not appear in the context of the * type constructor in thedeclaration of an array parameter, as shown:

void my_func (char a[37]);

Such a declaration specifies a pointer argument. This is equal to:

void my_func (char *a);

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

372 Freescale Semiconductor, Inc.

Page 373: CodeWarrior Development Studio for Microcontrollers V10.x RS08

There are two possible uses when declaring such an argument to a __far pointer:

void my_func (char a[37] __far);

or alternately

void my_func (char *__far a);

In the context of the [ ] type constructor in a direct parameter declaration, the __farkeyword always affects the first dimension of the array to its left. In the followingdeclaration, parameter a has type " __far pointer to array of 5 __far pointers to char":

void my_func (char *__far a[][5] __far);

10.1.3.8.3 __far and typedef Names

If the array type has been defi ned as a typedef name, as in:

typedef int ARRAY[10];

then a __far parameter declaration is:

void my_func (ARRAY __far a);

The parameter is a __far pointer to the first element of the array. This is equal to:

void my_func (int *__far a);

It is also equal to the following direct declaration:

void my_func (int a[10] __far);

It is not the same as specifying a __far pointer to the array:

void my_func (ARRAY *__far a);

because a has type " __far pointer to ARRAY" instead of " __far pointer to int".

10.1.3.8.4 __far and Global Variables

The __far keyword can also be used for global variables:

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 373

Page 374: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int __far i; // OK for global variables

int __far *i; // OK for global variables

int __far *__far i; // OK for global variables

This forces the Compiler to perform the same addressing mode for this variable as if ithas been declared in a __FAR_SEG segment. Note that for the above variable declarations ordefinitions, the variables are in the DEFAULT_DATA segment if no other data segment isactive. Be careful if you mix __far declarations or definitions within a non-__FAR_SEG datasegment. Assuming that __FAR_SEG segments have extended addressing mode and normalsegments have direct addressing mode, the following listing and the following listingclarify this behavior:

Listing: OK - consistent declarations

#pragma DATA_SEG MyDirectSeg /* use direct addressing mode */

int i; // direct, segment MyDirectSeg

int j; // direct, segment MyDirectSeg

#pragma DATA_SEG __FAR_SEG MyFarSeg

/* use extended addressing mode */

int k; // extended, segment MyFarSeg

int l; // extended, segment MyFarSeg

int __far m; // extended, segment MyFarSeg

Listing: Mixing extended addressing and direct addressing modes

// caution: not consistent!!!!#pragma DATA_SEG MyDirectSeg

/* use direct-addressing mode */

int i; // direct, segment MyDirectSeg

int j; // direct, segment MyDirectSeg

int __far k; // extended, segment MyDirectSet

int __far l; // extended, segment MyDirectSeg

int __far m // extended, segment MyDirectSeg

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

374 Freescale Semiconductor, Inc.

Page 375: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThe __far keyword global variables only affect the variableaddressing mode and NOT the allocation.

10.1.3.8.5 __far and C++ Classes

If a member function gets the modifier __far, the this pointer is a __far pointer in thecontext of a call to that function. This is useful, for instance, if the owner class of thefunction is not allocated on the default data page. See the following listing.

Listing: __far member functions

class A {public:

void f_far(void) __far {

/* __far version of member function A::f() */

}

void f(void) {

/* normal version of member function A::f() */

}

};

#pragma DATA_SEG MyDirectSeg // use direct addressing mode

A a_normal; // normal instance

#pragma DATA_SEG __FAR_SEG MyFarSeg // use extended addressing mode

A __far a_far; // __far instance

void main(void) {

a_normal.f(); // call normal version of A::f() for normal instance

a_far.f_far(); // call __far version of A::f() for __far instance

}

With inheritance, it no longer suffices to use __far with member functions only. Instead,the whole class should be qualified with the __far modifier. Thus, the compiler isinstructed to handle 'this' as a far pointer in all the contexts related to the declaration anddefinition of that class, for example vptr initialization, assignment operator generationetc. See the following listing.

Listing: _far modifier - Inheritance

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 375

Page 376: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class B __ far{ ... }

class A __far : B

{ ... }

#pragma push

#pragma DATA_SEG __FAR_SEG MY_FAR_RAM

A a_far;

#pragma pop

NOTEIn case of inheritance, one should qualify both the derived andthe base class. If the modifier has been used for the derivedclass only, the compiler will report the followingwarning:C1145: Class '<class_name>', qualified withmodifier__far, inherits from non-qualified baseclass'<class_name>'

10.1.3.8.6 __far and C++ References

You can apply the __far modifier to references. Use this option when the reference is toan object outside of the default data page. See the following listing.

Listing: _far Modifier Applied to References

int j; // object j allocated outside the default data page

// (must be specified in the link parameter file)

void f(void) {

int &__far i = j;

};

10.1.3.8.7 Using the __far Keyword for Functions

A special calling convention is specified for the __far keyword. The __far keyword isspecified in front of the function identifier:

void __far f(void);

If the function returns a pointer, the __far keyword must be written in front of the firstasterisk ( *).

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

376 Freescale Semiconductor, Inc.

Page 377: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int __far *f(void);

It must, however, be after the int and not before it.

For function pointers, many backends assume that the __far function pointer is pointing tofunctions with the __far calling convention, even if the calling convention was notspecified. Moreover, most backends do not support different function pointer sizes in onecompilation unit. The function pointer size is then dependent only upon the memorymodel.

Table 10-1. Interpretation of the __far Keyword

Declaration Allowed Type Description

int __far f(); OK __far function returning an int

__far int f(); error

__far f(); OK __far function returning an int

int __far *f(); OK __far function returning a pointer toint

int * __far f(); OK function returning a __far pointer toint

__far int * f(); error

int __far * __far f(); OK __far function returning a __farpointer to int

int __far i; OK global __far object

int __far *i; OK pointer to a __far object

int * __far i; OK __far pointer to int

int __far * __far i; OK __far pointer to a __far object

__far int *i; OK pointer to a __far integer

int *__far (* __far f)(void) OK __far pointer to function returning a__far pointer to int

void * __far (* f)(void) OK pointer to function returning a __farpointer to void

void __far * (* f)(void) OK pointer to __far function returning apointer to void

10.1.3.9 __near Keyword

The near keyword is a synonym for __near. The near keyword is only allowed when the -Ansi: Strict ANSI compiler option is present.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 377

Page 378: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The __near keyword can be used instead of the __far keyword. Use it in situations wherenon-qualified pointers are __far and you want to specify an explicit __near access or whenyou must explicitly specify the __near calling convention.

The __near keyword uses two semantic variations. Either it specifies a small size of afunction or data pointers or it specifies the __near calling convention.

Table 10-2. Interpretation of the __near Keyword

Declaration Allowed Type Description

int __near f(); OK __near function returning an int

int __near __far f(); error

__near f(); OK __near function returning an int

int __near * __far f(); OK __near function returning a __farpointer to int

int __far *i; error

int * __near i; OK __far pointer to int

int * __far* __near i; OK __near pointer to __far pointer to int

int *__far (* __near f)(void) OK __near pointer to function returning a__far pointer to int

void * __near (* f)(void) OK pointer to function returning a __nearpointer to void

void __far *__near (*__near f)(void)

OK __near pointer to __far functionreturning a __far pointer to void

10.1.3.10 Compatibility

__far pointers and normal po inters are compatible. If necessary, the normal pointer isextended to a __far pointer (subtraction of two pointers or assignment to a __far pointer).In the other case, the __far pointer is clipped to a normal pointer (i.e., the page part isdiscarded).

10.1.3.11 __alignof__ keyword

Some processors align objects according to their type. The unary operator, __alignof__,determines the alignment of a specific type. By providing any type, this operator returnsits alignment. This operator behaves in the same way as sizeof(type-name) operator. Seethe target backend section to check which alignment corresponds to which fundamentaldata type (if any is required) or to which aggregate type (structure, array).

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

378 Freescale Semiconductor, Inc.

Page 379: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This macro may be useful for the va_arg macro in stdarg.h, e.g., to differentiate thealignment of a structure containing four objects of four bytes from that of a structurecontaining two objects of eight bytes. In both cases, the size of the structure is 16 bytes,but the alignment may differ, as shown in the following listing:

Listing: va_arg macro

#define va_arg(ap,type) \ (((__alignof__(type)>=8) ? \ ((ap) = (char *)(((int)(ap) \ + __alignof__(type) - 1) & (~(__alignof__(type) - 1)))) \ : 0), \ ((ap) += __va_rounded_size(type)),\ (((type *) (ap))[-1]))

10.1.3.12 __va_sizeof__ keyword

According to the ANSI-C specification, you must promote character arguments in openparameter lists to int. The use of char in the va_arg macro to access this parameter may notwork as per the ANSI-C specification.

Listing: Inappropriate use of char with the va_arg macro

int f(int n, ...) { int res;

va_list l= va_start(n, int);

res= va_arg(l, char); /* should be va_arg(l, int) */

va_end(l);

return res;

}

void main(void) {

char c=2;

int res=f(1,c);

}

With the __va_sizeof__ operator, the va_arg macro is written the way that f() returns 2.

A safe implementation of the f function is to use va_arg(l, int) instead of va_arg(l, char).

The __va_sizeof__ unary operator, which is used exactly as the sizeof keyword, returns thesize of its argument after promotion as in an open parameter list.

Listing: __va_sizeof__ examples

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 379

Page 380: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__va_sizeof__(char) == sizeof (int)__va_sizeof__(float) == sizeof (double)

struct A { char a; };

__va_sizeof__(struct A) >= 1 (1 if the target needs no padding bytes)

NOTEIt is not possible in ANSI-C to distinguish a 1-byte structurewithout alignment or padding from a character variable in ava_arg macro. These need a different space on the openparameter calls stack for some processors.

10.1.3.13 interrupt keyword

The __interrupt keyword is a synonym for interrupt, which is allowed when the -Ansi:Strict ANSI compiler option is present.

NOTENot all Backends support this keyword. See the Non-ANSIKeywords section in RS08 Backend.

One of two ways can be used to specify a function as an interrupt routine:

• Use #pragma TRAP_PROC: Mark function as interrupt function and adapt theLinker parameter file.

• Use the nonstandard interrupt keyword.

Use the nonstandard interrupt keyword like any other type qualifier. It specifies afunction to be an interrupt routine. It is followed by a number specifying the entry in theinterrupt vector that contains the address of the interrupt routine. If it is not followed byany number, the interrupt keyword has the same effect as the TRAP_PROC pragma. Itspecifies a function to be an interrupt routine. However, the number of the interruptvector must be associated with the name of the interrupt function by using the Linker'sVECTOR directive in the Linker parameter file.

Listing: Examples of the interrupt keyword

interrupt void f(); // OK // same as #pragma TRAP_PROC, // please set the entry number in the prm-file interrupt 2 int g(); // The 2nd entry (number 2) gets the address of func g(). interrupt 3 int g(); // OK // third entry in vector points to g() interrupt int l; // error: not a function

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

380 Freescale Semiconductor, Inc.

Page 381: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.1.3.14 __asm Keyword

The Compiler supports target processor instructions inside of C functions.

The asm keyword is a synonym for __asm, which is allowed when the -Ansi: Strict ANSIcompiler option is not present.

Listing: Examples of the __asm keyword

__asm { nop

nop ; comment

}

asm ("nop; nop");

__asm("nop\n nop");

__asm "nop";

__asm nop;

#asm

nop

nop

#endasm

10.1.4 Implementation-Defined Behavior

The ANSI standard contains a couple of places where the behavior of a particularCompiler is left undefined. It is possible for different Compilers to implement certainfeatures in different ways, even if they all comply with the ANSI-C standard.Subsequently, the following discuss those points and the behavior implemented by theCompiler.

10.1.4.1 Right Shifts

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 381

Page 382: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The result of E1 >> E2 is implementation-defined for a right shift of an object with asigned type having a negative value if E1 has a signed type and a negative value.

In this implementation, an arithmetic right shift is performed.

10.1.4.2 Initialization of Aggregates with non Constants

The initialization of aggregates with non-constants is not allowed in the ANSI-Cspecification. The Compiler allows it if the -Ansi: Strict ANSI compiler option is not set(see the following listing).

Listing: Initialization using a non constant

void main() {

struct A {

struct A *n;

} v={&v}; /* the address of v is not constant */

}

10.1.4.3 Sign of char

The ANSI-C standard leaves it open, whether the data type char is signed or unsigned.

10.1.4.4 Division and Modulus

The results of the "/" and "%" operators are also not properly defined for signed arithmeticoperations unless both operands are positive.

NOTEThe way a Compiler implements "/" and "%" for negativeoperands is determined by the hardware implementation of thetarget's division instructions.

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

382 Freescale Semiconductor, Inc.

Page 383: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.1.5 Translation Limitations

This section describes the internal limitations of the Compiler. Some limitations dependon the operating system used. For example, in some operating systems, limits depend onwhether the compiler is a 32-bit compiler running on a 32-bit platform, or if it is a 16-bitCompiler running on a 16-bit platform (e.g., Windows for Workgroups).

The ANSI-C column in the table below describes the recommended limitations of ANSI-C (5.2.4.1 in ISO/IEC 9899:1990 (E)) standard. These quantities are only guidelines anddo not determine compliance. The `Implementation' column shows the actualimplementation value and the possible message number. `-' means that there is noinformation available for this topic and `n/a' denotes that this topic is not available.

Table 10-3. Translation Limitations (ANSI)

Limitation Implementation ANSI-C

Nesting levels of compound statements,iteration control structures, and selectioncontrol structures

256 (C1808) 15

Nesting levels of conditional inclusion - 8

Pointer, array, and function decorators(in any combination) modifying anarithmetic, structure, union, orincomplete type in a declaration

- 12

Nesting levels of parenthesizedexpressions within a full expression

32 (C4006) 32

Number of initial characters in aninternal identifier or macro name

32,767 31

Number of initial characters in anexternal identifier

32,767 6

External identifiers in one translation unit - 511

Identifiers with block scope declared inone block

- 127

Macro identifiers simultaneously definedin one translation unit

655,360,000 (C4403) 1024

Parameters in one function definition - 31

Arguments in one function call - 31

Parameters in one macro definition 1024 (C4428) 31

Arguments in one macro invocation 2048 (C4411) 31

Characters in one logical source line 2^31 509

Characters in a character string literal orwide string literal (after concatenation)

8196 (C3301, C4408, C4421) 509

Size of an object 32,767 32,767

Nesting levels for #include files 512 (C3000) 8

Table continues on the next page...

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 383

Page 384: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 10-3. Translation Limitations (ANSI) (continued)

Limitation Implementation ANSI-C

Case labels for a switch statement(excluding those for any nested switchstatements)

1000 257

Data members in a single class,structure, or union

- 127

Enumeration constants in a singleenumeration

- 127

Levels of nested class, structure, orunion definitions in a single structdeclaration list

32 15

Functions registered by atexit() - n/a

Direct and indirect base classes - n/a

Direct base classes for a single class - n/a

Members declared in a single class - n/a

Final overriding virtual functions in aclass, accessible or not

- n/a

Direct and indirect virtual bases of aclass

- n/a

Static members of a class - n/a

Friend declarations in a class - n/a

Access control declarations in a class - n/a

Member initializers in a constructordefinition

- n/a

Scope qualifications of one identifier - n/a

Nested external specifications - n/a

Template arguments in a templatedeclaration

- n/a

Recursively nested templateinstantiations

- n/a

Handlers per try block - n/a

Throw specifications on a single functiondeclaration

- n/a

The table below shows other limitations which are not mentioned in an ANSI standard:

Table 10-4. Translation Limitations (non-ANSI)

Limitation Description

Type Declarations Derived types must not contain more than 100 components.

Labels There may be at most 16 other labels within one procedure.

Macro Expansion Expansion of recursive macros is limited to 70 (16-bit OS) or2048 (32-bit OS) recursive expansions (C4412).

Include Files The total number of include files is limited to 8196 for a singlecompilation unit.

Table continues on the next page...

Implementation Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

384 Freescale Semiconductor, Inc.

Page 385: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 10-4. Translation Limitations (non-ANSI) (continued)

Limitation Description

Numbers Maximum of 655,360,000 different numbers for a singlecompilation unit (C2700, C3302).

Goto M68k only: Maximum of 512 Gotos for a single function(C15300).

Parsing Recursion Maximum of 1024 parsing recursions (C2803).

Lexical Tokens Limited by memory only (C3200).

Internal IDs Maximum of 16,777,216 internal IDs for a single compilationunit (C3304). Internal IDs are used for additional local orglobal variables created by the Compiler (e.g., by using CSE).

Code Size Code size is limited to 32KB for each single function.

filenames Maximum length for filenames (including path) are 128characters for 16-bit applications or 256 for Win32applications. UNIX versions support filenames without path of64 characters in length and 256 in the path. Paths may be 96characters on 16-bit PC versions, 192 on UNIX versions or256 on 32-bit PC versions.

10.2 ANSI-C Standard

This section provides a short overview about the implementation (see also ANSIStandard 6.2) of the ANSI-C conversion rules.

10.2.1 Integral Promotions

You may use a char, a short int, or an int bitfield, or their signed or unsigned varieties, oran enum type, in an expression wherever an int or unsigned int is used. If an int representsall values of the original type, the value is converted to an int; otherwise, it is convertedto an unsigned int. Integral promotions preserve value including sign.

10.2.2 Signed and Unsigned Integers

Promoting a signed integer type to another signed integer type of greater size requires"sign extension": In two's-complement representation, the bit pattern is unchanged, exceptfor filling the high order bits with copies of the sign bit.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 385

Page 386: CodeWarrior Development Studio for Microcontrollers V10.x RS08

When converting a signed integer type to an unsigned inter type, if the destination hasequal or greater size, the first signed extension of the signed integer type is performed. Ifthe destination has a smaller size, the result is the remainder on division by a number, onegreater than the largest unsigned number, that is represented in the type with the smallersize.

10.2.3 Arithmetic Conversions

The operands of binary operators do implicit conversions:

• If either operand has type long double, the other operand is converted to long double.• If either operand has type double, the other operand is converted to double.• If either operand has type float, the other operand is converted to float.• The integral promotions are performed on both operands.

Then the following rules are applied:

• If either operand has type unsigned long int, the other operand is converted to unsignedlong int.

• If one operand has type long int and the other has type unsigned int, if a long int canrepresent all values of an unsigned int, the operand of type unsigned int is converted tolong int; if a long int cannot represent all the values of an unsigned int, both operandsare converted to unsigned long int.

• If either operand has type long int, the other operand is converted to long int.• If either operand has type unsigned int, the other operand is converted to unsigned int.• Both operands have type int.

10.2.4 Order of Operand Evaluation

The priority order of operators and their associativity is listed in the following listing.

Listing: Operator precedence

Operators Associativity () [] -> . left to right ! ~ ++ -- + - * & (type) sizeof right to left & / % left to right + - left to right << >> left to right < <= > >= left to right == != left to right & left to right ^ left to right

ANSI-C Standard

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

386 Freescale Semiconductor, Inc.

Page 387: CodeWarrior Development Studio for Microcontrollers V10.x RS08

| left to right && left to right || left to right ? : right to left = += -= *= /= %= &= ^= |= <<= >>= right to left , left to right

Unary +,- and * have higher precedence than the binary forms.

10.2.4.1 Examples of operator precedence

if (a&3 == 2)

`==' has higher precedence than `&'. Thus it is evaluated as:

if (a & (3==2)

which is the same as:

if (a&0)

Furthermore, is the same as:

if (0) => Therefore, the if condition is always `false'.

Hint: use brackets if you are not sure about associativity!

10.2.5 Rules for Standard-Type Sizes

In ANSI-C, enumerations have the type of int. In this implementation they have to besmaller than or equal to int.

Listing: Size relationships among the integer types

sizeof(char) <= sizeof(short) sizeof(short) <= sizeof(int) sizeof(int) <= sizeof(long) sizeof(long) <= sizeof(long long) sizeof(float) <= sizeof(double) sizeof(double)<= sizeof(long double)

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 387

Page 388: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.3 Floating-Type Formats

The RS08 compiler supports only the IEEE32 floating point format. The figure belowshows this format.

Floats are implemented as IEEE32. This may vary for a specific Backend, or possibly,both formats may not be supported.

Figure 10-1. Floating-point formats

10.3.1 Floating-Point Representation of 500.0 for IEEE

First, convert 500.0 from the decimal representation to a representation with base 2:

value = (-1)^s * m*2^exp

where: s, sign is 0 or 1,

2 > m >= 1 for IEEE,

and exp is a integral number.

For 500, this gives:

sign (500.0) = 1,

m, mant (500.0, IEEE) = 1.953125, and

exp (500.0, IEEE) = 8

Floating-Type Formats

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

388 Freescale Semiconductor, Inc.

Page 389: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThe number 0 (zero) cannot be represented this way. So for 0,IEEE defines a special bit pattern consisting of 0 bits only.

Next, convert the mantissa into its binary representation.

mant (500.0, IEEE) = 1.953125

= 1*2^(0) + 1*2^(-1) + 1*2^(-2) + 1*2^(-3) + 1*2^(-4)

+ 0*2^(-5) + 1*2^(-6) + 0*...

= 1.111101000... (binary)

Because this number is converted to be larger or equal to 1 and smaller than 2, there isalways a 1 in front of the decimal point. For the remaining steps, this constant (1) is leftout in order to save space.

mant (500.0, IEEE, cut) = .111101000...

The exponent must also be converted to binary format:

exp (500.0, IEEE) = 8 == 08 (hex) == 1000 (binary)

For the IEEE formats, the sign is encoded as a separate bit (sign magnituderepresentation)

10.3.2 Representation of 500.0 in IEEE32 Format

The exponent in IEEE32 has a fixed offset of 127 to always have positive values:

exp (500.0,IEEE32) = 8+127 == 87 (hex) == 10000111 (bin)

The fields must be put together as shown the following listing:

Listing: Representation of decimal 500.0 in IEEE32

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 389

Page 390: CodeWarrior Development Studio for Microcontrollers V10.x RS08

500.0 (dec) = 0 (sign) 10000111 (exponent)

11110100000000000000000 (mantissa) (IEEE32 as bin)

0100 0011 1111 1010 0000 0000 0000 0000 (IEEE32 as bin)

43 fa 00 00 (IEEE32 as hex)

The IEEE32 representation of decimal -500 is shown in the following listing.

Listing: Representation of decimal -500.0 in IEEE32

-500.0 (dec) =

1 (sign) 10000111 (exponent)

11111010000000000000000 (mantissa) (IEEE32 as bin)

1100 0011 1111 1010 0000 0000 0000 0000 (IEEE32 as bin)

C3 fa 00 00 (IEEE32 as hex)

NOTEThe IEEE formats recognize several special bit patterns forspecial values. The number 0 (zero) is encoded by the bitpattern consisting of zero bits only. Other special values such as"Not a number", "infinity", -0 (minus zero) and denormalizednumbers do exist. For more information, refer to the IEEEstandard documentation. Except for the 0 (zero) and -0 (minuszero) special formats, not all special formats may be supportedfor specific backends.

10.4 Volatile Objects and Absolute Variables

The Compiler does not do register- and constant tracing on volatile or absolute globalobjects. Accesses to volatile or absolute global objects are not eliminated. See thefollowing listing for one reason to use a volatile declaration.

Listing: Using volatile to avoid an adverse side effect

volatile int x; void main(void) { x = 0; ... if (x == 0) { // without volatile attribute, the // comparison may be optimized away! Error(); // Error() is called without compare! } }

Volatile Objects and Absolute Variables

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

390 Freescale Semiconductor, Inc.

Page 391: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.5 Bitfields

There is no standard way to allocate bitfields. Bitfield allocation varies from Compiler toCompiler, even for the same target. Using bitfields for access to I/O registers is non-portable and inefficient for the masking involved in unpacking individual fields. It isrecommended that you use regular bit-and (&) and bit-or (|) operations for I/O portaccess.

The maximum width of bitfields is Backend-dependent (see RS08 Backend for details),in that plain int bitfields are signed. A bitfield never crosses a word (2 bytes) boundary.As stated in Kernighan and Ritchie's The C Programming Language, 2nd ed., the use ofbitfields is equivalent to using bit masks to which the operators &, |, ~, |= or &= areapplied. In fact, the Compiler translates bitfield operations to bit mask operations.

10.5.1 Signed Bitfields

A common mistake is to use signed bitfields, but testing them as if they were unsigned.Signed bitfields have a value of -1 or 0. Consider the following example shown in thefollowing listing).

Listing: Testing a signed bitfield as being unsigned

typedef struct _B { signed int b0: 1;} B; B b; if (b.b0 == 1) ...

The Compiler issues a warning and replaces the 1 with -1 because the condition (b.b0 ==1) is always false. The test (b.b0 == -1) is performed as expected. This substitution is notANSI compatible and will not be performed when the -Ansi: Strict ANSI compiler optionis active.

The correct way to specify this is with an unsigned bitfield. Unsigned bitfields have thevalues 0 or 1.

Listing: Using unsigned bitfields

typedef struct _B { unsigned b0: 1; } B; B b; if (b.b0 == 1) ...

Because b0 is an unsigned bitfield having the values 0 or 1, the test (b.b0 == 1) is correct.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 391

Page 392: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.5.1.1 Recommendations

In order to save memory, it is recommended to implement globally accessible booleanflags as unsigned bitfields of width 1. However, using bitfields for other purposes is notrecommended because:

• Using bitfields to describe a bit pattern in memory is not portable betweenCompilers, even on the same target, as different Compilers may allocate bitfieldsdifferently.

10.6 Segmentation

The Linker supports the concept of segments in that the memory space may bepartitioned into several segments. The Compiler allows attributing a certain segmentname to certain global variables or functions which then are allocated into that segmentby the Linker. Where that segment actually lies is determined by an entry in the Linkerparameter file.

Listing: Syntax for the segment-specification pragma

SegDef = #pragma SegmentType ({SegmentMod} SegmentName | DEFAULT).

SegmentType: CODE_SEG|CODE_SECTION|

DATA_SEG|DATA_SECTION|

CONST_SEG|CONST_SECTION|

STRING_SEG|STRING_SECTION

SegmentMod: __DIRECT_SEG|__NEAR_SEG|__CODE_SEG|

__FAR_SEG|__BIT_SEG|__Y_BASED_SEG|

__Z_BASED_SEG|__DPAGE_SEG|__PPAGE_SEG|

__EPAGE_SEG|__RPAGE_SEG|__GPAGE_SEG|

__PIC_SEG|CompatSegmentMod

CompatSegmentMod: DIRECT|NEAR|CODE|FAR|BIT|

Y_BASED|Z_BASED|DPAGE|PPAGE|

EPAGE|RPAGE|GPAGE|PIC

Segmentation

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

392 Freescale Semiconductor, Inc.

Page 393: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Because there are two basic types of segments, code and data segments, there are alsotwo pragmas to specify segments:

#pragma CODE_SEG <segment_name>

#pragma DATA_SEG <segment_name>

In addition there are pragmas for constant data and for strings:

#pragma CONST_SEG <segment_name>

#pragma STRING_SEG <segment_name>

All four pragmas are valid until the next pragma of the same kind is encountered.

In the ELF object file format, constants are always put into a constant segment.

Strings are put into the segment STRINGS until a pragma STRING_SEG is specified.After this pragma, all strings are allocated into this constant segment. The linker thentreats this segment like any other constant segment.

If no segment is specified, the Compiler assumes two default segments named DEFAULT_ROM(the default code segment) and DEFAULT_RAM (the default data segment). Use the segmentname DEFAULT to explicitly make these default segments the current segments:

#pragma CODE_SEG DEFAULT

#pragma DATA_SEG DEFAULT

#pragma CONST_SEG DEFAULT

#pragma STRING_SEG DEFAULT

Segments may also be declared as __SHORT_SEG by inserting the keyword __SHORT_SEG justbefore the segment name (with the exception of the predefined segment DEFAULT - thissegment cannot be qualified with __SHORT_SEG). This makes the Compiler use short (i.e., 8

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 393

Page 394: CodeWarrior Development Studio for Microcontrollers V10.x RS08

bits or 16 bits, depending on the Backend) absolute addresses to access global objects, orto call functions. It is the programmer's responsibility to allocate __SHORT_SEG segments inthe proper memory area.

NOTEThe default code and data segments may not be declared as__SHORT_SEG.

The meaning of the other segment modifiers, such as __NEAR_SEG and __FAR_SEG, arebackend-specific. Modifiers that are not supported by the backend are ignored.

The segment pragmas also have an effect on static local variables. Static local variablesare local variables with the `static' flag set. They are in fact normal global variables butwith scope only to the function in which they are defined:

#pragma DATA_SEG MySeg

static char foo(void) {

static char i = 0; /* place this variable into MySeg */

return i++;

}

#pragma DATA_SEG DEFAULT

NOTEUsing the ELF/DWARF object file format ( -F1 or -F2compiler option), all constants are placed into thesection .rodata by default unless #pragma CONST_SEG is used.

NOTEThere are aliases to satisfy the ELF naming convention for allsegment names: Use CODE_SECTION instead of CODE_SEG, UseDATA_SECTION instead of DATA_SEG, Use CONST_SECTION instead ofCONST_SEG, Use STRING_SECTION instead of STRING_SEG. Thesealiases behave exactly as do the XXX_SEG name versions.

Listing: Example of Segmentation without the -Cc Compiler Option

Segmentation

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

394 Freescale Semiconductor, Inc.

Page 395: CodeWarrior Development Studio for Microcontrollers V10.x RS08

/* Placed into Segment: */static int a; /* DEFAULT_RAM(-1) */

static const int c0 = 10; /* DEFAULT_RAM(-1) */

#pragma DATA_SEG MyVarSeg

static int b; /* MyVarSeg(0) */

static const int c1 = 11; /* MyVarSeg(0) */

#pragma DATA_SEG DEFAULT

static int c; /* DEFAULT_RAM(-1) */

static const int c2 = 12; /* DEFAULT_RAM(-1) */

#pragma DATA_SEG MyVarSeg

#pragma CONST_SEG MyConstSeg

static int d; /* MyVarSeg(0) */

static const int c3 = 13; /* MyConstSeg(1) */

#pragma DATA_SEG DEFAULT

static int e; /* DEFAULT_RAM(-1) */

static const int c4 = 14; /* MyConstSeg(1) */

#pragma CONST_SEG DEFAULT

static int f; /* DEFAULT_RAM(-1) */

static const int c5 = 15; /* DEFAULT_RAM(-1) */

Listing: Example of Segmentation with the -Cc Compiler Option

/* Placed into Segment: */static int a; /* DEFAULT_RAM(-1) */

static const int c0 = 10; /* ROM_VAR(-2) */

#pragma DATA_SEG MyVarSeg

static int b; /* MyVarSeg(0) */

static const int c1 = 11; /* MyVarSeg(0) */

#pragma DATA_SEG DEFAULT

static int c; /* DEFAULT_RAM(-1) */

static const int c2 = 12; /* ROM_VAR(-2) */

#pragma DATA_SEG MyVarSeg

#pragma CONST_SEG MyConstSeg

static int d; /* MyVarSeg(0) */

static const int c3 = 13; /* MyConstSeg(1) */

#pragma DATA_SEG DEFAULT

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 395

Page 396: CodeWarrior Development Studio for Microcontrollers V10.x RS08

static int e; /* DEFAULT_RAM(-1) */

static const int c4 = 14; /* MyConstSeg(1) */

#pragma CONST_SEG DEFAULT

static int f; /* DEFAULT_RAM(-1) */

static const int c5 = 15; /* ROM_VAR(-2) */

10.7 Optimizations

The Compiler applies a variety of code-improving techniques called optimizations. Thissection provides a short overview about the most important optimizations.

10.7.1 Peephole Optimizer

A peephole optimizer is a simple optimizer in a Compiler. A peephole optimizer tries tooptimize specific code patterns on speed or code size. After recognizing these specificpatterns, they are replaced by other optimized patterns.

After code is generated by the backend of an optimizing Compiler, it is still possible thatcode patterns may result that are still capable of being optimized. The optimizations ofthe peephole optimizer are highly backend-dependent because the peephole optimizerwas implemented with characteristic code patterns of the backend in mind.

Certain peephole optimizations only make sense in conjunction with other optimizations,or together with some code patterns. These patterns may have been generated by doingother optimizations. There are optimizations (e.g., removing of a branch to the nextinstructions) that are removed by the peephole optimizer, though they could have beenremoved by the branch optimizer as well. Such simple branch optimizations areperformed in the peephole optimizer to reach new optimizable states.

10.7.2 Strength Reduction

Strength reduction is an optimization that strives to replace expensive operations bycheaper ones, where the cost factor is either execution time or code size. Examples arethe replacement of multiplication and division by constant powers of two with left orright shifts.

Optimizations

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

396 Freescale Semiconductor, Inc.

Page 397: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThe compiler can only replace a division by two using a shiftoperation if either the target division is implemented the waythat -1/2 == -1, or if the value to be divided is unsigned. Theresult is different for negative values. To give the compiler thepossibility to use a shift, ensure that the C source code alreadycontains a shift, or that the value to be shifted is unsigned.

10.7.3 Shift Optimizations

Shifting a byte variable by a constant number of bits is intensively analyzed. TheCompiler always tries to implement such shifts in the most efficient way.

10.7.4 Branch Optimizations

This optimization tries to minimize the span of branch instructions. The Compiler willnever generate a long branch where a short branch would have sufficed. Also, branches tobranches may be resolved into two branches to the same target. Redundant branches (e.g.,a branch to the instruction immediately following it) may be removed.

10.7.5 Dead-Code Elimination

The Compiler removes dead assignments while generating code. In some programs itmay find additional cases of expressions that are not used.

10.7.6 Constant-Variable Optimization

If a constant non-volatile variable is used in any expression, the Compiler replaces it bythe constant value it holds. This needs less code than taking the object itself.

The constant non-volatile object itself is removed if there is no expression taking theaddress of it (take note of ci in the following listing). This results in using less memoryspace.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 397

Page 398: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Example demonstrating constant-variable optimization

void f(void) {

const int ci = 100; // ci removed (no address taken)

const int ci2 = 200; // ci2 not removed (address taken below)

const volatile int ci3 = 300; // ci3 not removed (volatile)

int i;

int *p;

i = ci; // replaced by i = 100;

i = ci2; // no replacement

p = &ci2; // address taken

}

Global constant non-volatile variables are not removed. Their use in expressions arereplaced by the constant value they hold.

Constant non-volatile arrays are also optimized (take note of array[] in the followinglisting).

Listing: Example demonstrating the optimization of a constant, non-volatile array

void g(void) {

const int array[] = {1,2,3,4};

int i;

i = array[2]; // replaced by i=3;

}

10.7.7 Tree Rewriting

The structure of the intermediate code between Frontend and Backend allows theCompiler to perform some optimizations on a higher level. Examples are shown in thefollowing sections.

10.7.7.1 Switch Statements

Optimizations

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

398 Freescale Semiconductor, Inc.

Page 399: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Efficient translation of switch statements is mandatory for any C Compiler. The Compilerapplies different strategies, i.e., branch trees, jump tables, and a mixed strategy,depending on the case label values and their numbers. The following table describes howthe Compiler implements these strategies.

Table 10-5. Switch Implementations

Method Description

Branch Sequence For small switches with scattered case label values, theCompiler generates an if...elsif...elsif...else...sequence if the Compiler switch -Os is active.

Branch Tree For small switches with scattered case label values, theCompiler generates a branch tree. This is the equivalent tounrolling a binary search loop of a sorted jump table andtherefore is very fast. However, there is a point at which thismethod is not feasible simply because it uses too muchmemory.

Jump Table In such cases, the Compiler creates a table plus a call of aswitch processor. There are two different switch processors. Ifthere are a lot of labels with more or less consecutive values,a direct jump table is used. If the label values are scattered, abinary search table is used.

Mixed Strategy Finally, there may be switches having clusters of label valuesseparated by other labels with scattered values. In this case,a mixed strategy is applied, generating branch trees or searchtables for the scattered labels and direct jump tables for theclusters.

10.7.7.2 Absolute Values

Another example for optimization on a higher level is the calculation of absolute values.In C, the programmer has to write something on the order of:

float x, y;

x = (y < 0.0) ? -y : y;

This results in lengthy and inefficient code. The Compiler recognizes cases like this andtreats them specially in order to generate the most efficient code. Only the mostsignificant bit has to be cleared.

10.7.7.3 Combined Assignments

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 399

Page 400: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler can also recognize the equivalence between the three following statements:

x = x + 1;

x += 1;

x++;

and between:

x = x / y;

x /= y;

Therefore, the Compiler generates equally efficient code for either case.

10.8 Using Qualifiers for Pointers

This section provides some examples for the use of const or volatile because const andvolatile are very common for Embedded Programming.

Consider the following example:

int i; const int ci;

The above definitions are: a `normal' variable i and a constant variable ci. Each areplaced into ROM. Note that for C++, the constant ci must be initialized.

int *ip; const int *cip;

ip is a pointer to an int, where cip is a pointer to a const int.

Using Qualifiers for Pointers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

400 Freescale Semiconductor, Inc.

Page 401: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int *const icp; const int *const cicp;

icp is a const pointer to an int, where cicp is a const pointer to a const int.

It helps if you know that the qualifier for such pointers is always on the right side of the *.Another way is to read the source from right to left.

You can express this rule in the same way to volatile. Consider the following example ofan `array of five constant pointers to volatile integers':

volatile int *const arr[5];

arr is an array of five constant pointers pointing to volatile integers. Because the arrayitself is constant, it is put into ROM. It does not matter if the array is constant or notregarding where the pointers point to. Consider the next example:

const char *const *buf[] = {&a, &b};

Because the array of pointers is initialized, the array is not constant. `buf' is a (non-constant) array of two pointers to constant pointers which points to constant characters.Thus `buf' cannot be placed into ROM by the Compiler or Linker.

Consider a constant array of five ordinary function pointers. Assuming that:

void (*fp)(void);

is a function pointer `fp' returning void and having void as parameter, you can define itwith:

void (*fparr[5])(void);

It is also possible to use a typedef to separate the function pointer type and the array:

typedef void (*Func)(void); Func fp; Func fparr[5];

You can write a constant function pointer as:

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 401

Page 402: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void (*const cfp) (void);

Consider a constant function pointer having a constant int pointer as a parameterreturning void:

void (*const cfp2) (int *const);

Or a const function pointer returning a pointer to a volatile double having two constantintegers as parameter:

volatile double *(*const fp3) (const int, const int);

And an additional one:

void (*const fp[3])(void);

This is an array of three constant function pointers, having void as parameter andreturning void. `fp' is allocated in ROM because the `fp' array is constant.

Consider an example using function pointers:

int (* (** func0(int (*f) (void))) (int (*) (void))) (int (*) (void)) { return 0; }

It is actually a function called func. This func has one function pointer argument called f.The return value is more complicated in this example. It is actually a function pointer of acomplex type. Here we do not explain where to put a const so that the destination of thereturned pointer cannot be modified. Alternately, the same function is written moresimply using typedefs:

typedef int (*funcType1) (void);

typedef int (* funcType2) (funcType1);

typedef funcType2 (* funcType3) (funcType1);

Using Qualifiers for Pointers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

402 Freescale Semiconductor, Inc.

Page 403: CodeWarrior Development Studio for Microcontrollers V10.x RS08

funcType3* func0(funcType1 f) {

return 0;

}

Now, the places of the const becomes obvious. Just behind the * in funcType3:

typedef funcType2 (* const constFuncType3) (funcType1);

constFuncType3* func1(funcType1 f) {

return 0;

}

By the way, also in the first version here is the place where to put the const:

int (* (*const * func1(int (*f) (void))) (int (*) (void)))

(int (*) (void)) {

return 0;

}

10.9 Defining C Macros Containing HLI Assembler Code

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 403

Page 404: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can define some ANSI C macros that contain HLI assembler statements when youare working with the HLI assembler. Because the HLI assembler is heavily Backend-dependent, the following example uses a pseudo Assembler Language:

Listing: Example - Pseudo Assembler Language

CLR Reg0 ; Clear Register zero CLR Reg1 ; Clear Register one CLR var ; Clear variable `var' in memory LOAD var,Reg0 ; Load the variable `var' into Register 0 LOAD #0, Reg0 ; Load immediate value zero into Register 0 LOAD @var,Reg1 ; Load address of variable `var' into Reg1 STORE Reg0,var ; Store Register 0 into variable `var'

The HLI instructions are only used as a possible example. For real applications, you mustreplace the above pseudo HLI instructions with the HLI instructions for your target.

10.9.1 Defining a Macro

An HLI assembler macro is defined by using the define preprocessor directive.

For example, a macro could be defined to clear the R0 register.

Listing: Defining the ClearR0 macro.

/* The following macro clears R0. */#define ClearR0 {__asm CLR R0;}

The source code invokes the ClearR0 macro in the following manner.

Listing: Invoking the ClearR0 macro.

ClearR0;

And then the preprocessor expands the macro.

Listing: Preprocessor expansion of ClearR0.

{ __asm CLR R0 ; } ;

An HLI assembler macro can contain one or several HLI assembler instructions. As theANSI-C preprocessor expands a macro on a single line, you cannot define an HLIassembler block in a macro. You can, however, define a list of HLI assemblerinstructions.

Listing: Defining two macros on the same line of source code.

/* The following macro clears R0 and R1. */#define ClearR0and1 {__asm CLR R0; __asm CLR R1; }

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

404 Freescale Semiconductor, Inc.

Page 405: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The macro is invoked in the following way in the source code:

ClearR0and1;

The preprocessor expands the macro:

{ __asm CLR R0 ; __asm CLR R1 ; } ;

You can define an HLI assembler macro on several lines using the line separator `\'.

NOTEThis may enhance the readability of your source file. However,the ANSI-C preprocessor still expands the macro on a singleline.

Listing: Defining a macro on more than one line of source code

/* The following macro clears R0 and R1. */#define ClearR0andR1 {__asm CLR R0; \

__asm CLR R1;}

The macro is invoked in the following way in the source code.

Listing: Calling the ClearR0andR1 macro

ClearR0andR1;

The preprocessor expands the macro.

Listing: Preprocessor expansion of the ClearR0andR1 macro.

{__asm CLR R0; __asm CLR R1; };

10.9.2 Using Macro Parameters

An HLI assembler macro may have some parameters which are referenced in the macrocode. The following listing defines the Clear1 macro that uses the var parameter.

Listing: Clear1 macro definition.

/* This macro initializes the specified variable to 0.*/#define Clear1(var) {__asm CLR var;}

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 405

Page 406: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Invoking the Clear1 macro in the source code

Clear1(var1);

Listing: The preprocessor expands the Clear1 macro

{__asm CLR var1 ; };

10.9.3 Using the Immediate-Addressing Mode in HLI AssemblerMacros

There may be one ambiguity if you are using the immediate addressing mode inside of amacro.

For the ANSI-C preprocessor, the symbol # inside of a macro has a specific meaning(string constructor).

Using #pragma NO_STRING_CONSTR: No String Concatenation during preprocessing,instructs the Compiler that in all the macros defined afterward, the instructions remainunchanged wherever the symbol # is specified. This macro is valid for the rest of the filein which it is specified.

Listing: Definition of the Clear2 macro

/* This macro initializes the specified variable to 0.*/#pragma NO_STRING_CONSTR

#define Clear2(var){__asm LOAD #0,Reg0;__asm STORE Reg0,var;}

Listing: Invoking the Clear2 macro in the source code

Clear2(var1);

Listing: The preprocessor expands the Clear2 macro

{ __asm LOAD #0,Reg0;__asm STORE Reg0,var1; };

10.9.4 Generating Unique Labels in HLI Assembler Macros

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

406 Freescale Semiconductor, Inc.

Page 407: CodeWarrior Development Studio for Microcontrollers V10.x RS08

When some labels are defined in HLI Assembler Macros, if you invoke the same macrotwice in the same function, the ANSI C preprocessor generates the same label twice(once in each macro expansion). Use the special string concatenation operator of theANSI-C preprocessor (` ##') in order to generate unique labels. See the following listing.

Listing: Using the ANSI-C preprocessor string concatenation operator

/* The following macro copies the string pointed to by 'src' into the string pointed to by 'dest'.

'src' and 'dest' must be valid arrays of characters.

'inst' is the instance number of the macro call. This

parameter must be different for each invocation of the

macro to allow the generation of unique labels. */

#pragma NO_STRING_CONSTR

#define copyMacro2(src, dest, inst) { \

__asm LOAD @src,Reg0; /* load src addr */ \

__asm LOAD @dest,Reg1; /* load dst addr */ \

__asm CLR Reg2; /* clear index reg */ \

__asm lp##inst: LOADB (Reg2, Reg0); /* load byte reg indir */ \

__asm STOREB (Reg2, Reg1); /* store byte reg indir */ \

__asm ADD #1,Reg2; /* increment index register */ \

__asm TST Reg2; /* test if not zero */ \

__asm BNE lp##inst; }

Listing: Invoking the copyMacro2 macro in the source code

copyMacro2(source2, destination2, 1); copyMacro2(source2, destination3, 2);

During expansion of the first macro, the preprocessor generates an lp1 label. Duringexpansion of the second macro, an lp2 label is created.

10.9.5 Generating Assembler Include Files (-La Compiler Option)

In many projects it often makes sense to use both a C compiler and an assembler. Bothhave different advantages. The compiler uses portable and readable code, while theassembler provides full control for time-critical applications or for direct accessing of thehardware.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 407

Page 408: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The compiler cannot read the include files of the assembler, and the assembler cannotread the header files of the compiler.

The assembler's include file output of the compiler lets both tools use one single source toshare constants, variables or labels, and even structure fields.

The compiler writes an output file in the format of the assembler which contains allinformation needed of a C header file.

The current implementation supports the following mappings:

• Macros

C defines are translated to assembler EQU directives.

• enum values

C enum values are translated to EQU directives.

• C types

The size of any type and the offset of structure fields is generated for all typedefs. Forbitfield structure fields, the bit offset and the bit size are also generated.

• Functions

For each function an XREF entry is generated.

• Variables

C Variables are generated with an XREF. In addition, for structures or unions all fieldsare defined with an EQU directive.

• Comments

C style comments ( /* ... */) are included as assembler comments ( ;...).

10.9.5.1 General

A header file must be specially prepared to generate the assembler include file.

Listing: A pragma anywhere in the header file can enable assembler output

#pragma CREATE_ASM_LISTING ON

Only macro definitions and declarations behind this pragma are generated. The compilerstops generating future elements when #pragma CREATE_ASM_LISTING: Create anAssembler Include File Listing occurs with an OFF parameter.

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

408 Freescale Semiconductor, Inc.

Page 409: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma CREATE_ASM_LISTING OFF

Not all entries generate legal assembler constructs. Care must be taken for macros. Thecompiler does not check for legal assembler syntax when translating macros. Put macroscontaining elements not supported by the assembler in a section controlled by #pragmaCREATE_ASM_LISTING OFF.

The compiler only creates an output file when the -La option is specified and thecompiled sources contain #pragma CREATE_ASM_LISTING ON.

10.9.5.1.1 Example

Listing: Header file: a.h

#pragma CREATE_ASM_LISTING ONtypedef struct {

short i;

short j;

} Struct;

Struct Var;

void f(void);

#pragma CREATE_ASM_LISTING OFF

When the compiler reads this header file with the -La=a.inc a.h option, it generates thefollowing:

Listing: a.inc file

Struct_SIZE EQU $4Struct_i EQU $0

Struct_j EQU $2

XREF Var

Var_i EQU Var + $0

Var_j EQU Var + $2

XREF f

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 409

Page 410: CodeWarrior Development Studio for Microcontrollers V10.x RS08

You can now use the assembler INCLUDE directive to include this file into any assemblerfile. The content of the C variable, Var_i, can also be accessed from the assembler withoutany uncertain assumptions about the alignment used by the compiler. Also, whenever afield is added to the structure Struct, the assembler code must not be altered. You must,however, regenerate the a.inc file with a make tool.

Usually the assembler include file is not created every time the compiler reads the headerfile. It is only created in a separate pass when the header file has changed significantly.The -La option is only specified when the compiler must generate a.inc. If -La is alwayspresent, a.inc is always generated. A make tool will always restart the assembler becausethe assembler files depend on a.inc. Such a makefile might be similar to:

Listing: Sample makefile

a.inc : a.h $(CC) -La=a.inc a.h

a_c.o : a_c.c a.h

$(CC) a_c.c

a_asm.o : a_asm.asm a.inc

$(ASM) a_asm.asm

The order of elements in the header file is the same as the order of the elements in thecreated file, except that comments may be inside of elements in the C file. In this case,the comments may be before or after the whole element.

The order of defines does not matter for the compiler. The order of EQU directives mattersfor the assembler. If the assembler has problems with the order of EQU directives in agenerated file, the corresponding header file must be changed accordingly.

10.9.5.2 Macros

The translation of defines is done lexically and not semantically, so the compiler does notcheck the accuracy of the define.

The following example shows some uses of this feature:

Listing: Example source code

#pragma CREATE_ASM_LISTING ON int i; #define UseI i #define Constant 1 #define Sum Constant+0X1000+01234

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

410 Freescale Semiconductor, Inc.

Page 411: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The source code in the above listing produces the following output:

Listing: Assembler Code for above Listing

XREF i UseI EQU i Constant EQU 1 Sum EQU Constant + $1000 + @234

The hexadecimal C constant 0x1000 was translated to $1000 while the octal 01234 wastranslated to @1234. In addition, the compiler has inserted one space between every twotokens. These are the only changes the compiler makes in the assembler listing fordefines.

Macros with parameters, predefined macros, and macros with no defined value are notgenerated.

The following defines do not work or are not generated:

Listing: Improper defines

#pragma CREATE_ASM_LISTING ON int i; #define AddressOfI &i #define ConstantInt ((int)1) #define Mul7(a) a*7 #define Nothing #define useUndef UndefFkt*6 #define Anything § § / % & % / & + * % ç 65467568756 86

The source code in the above listing produces the following output:

Listing: Assembler Code for Above Listing

XREF i AddressOfI EQU & i ConstantInt EQU ( ( int ) 1 ) useUndef EQU UndefFkt * 6 Anything EQU § § / % & % / & + * % ç 65467568756 86

The AddressOfI macro does not assemble because the assembler does not know to interpretthe & C address operator. Also, other C-specific operators such as dereferenciation (*ptr)must not be used. The compiler generates them into the assembler listing file without anytranslation.

The ConstantInt macro does not work because the assembler does not know the castsyntax and the types.

Macros with parameters are not written to the listing. Therefore, Mul7 does not occur inthe listing. Also, macros defined as Nothing, with no actual value, are not generated.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 411

Page 412: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The C preprocessor does not care about the syntactical content of the macro, though theassembler EQU directive does. Therefore, the compiler has no problems with the useUndefmacro using the undefined object UndefFkt. The assembler EQU directive requires that allused objects are defined.

The Anything macro shows that the compiler does not care about the content of a macro.The assembler, of course, cannot treat these random characters.

These types of macros are in a header file used to generate the assembler include file.They must only be in a region started with #pragma CREATE_ASM_LISTING OFF so that thecompiler will not generate anything for them.

10.9.5.3 enums

enums in C have a unique name and a defined value. They are simply generated by thecompiler as an EQU directive.

Listing: enum

#pragma CREATE_ASM_LISTING ON enum {

E1=4,

E2=47,

E3=-1*7

};

The enum code in the following listing results in the following EQUs:

Listing: Resultant EQUs from enums

E1 EQU $4E2 EQU $2F

E3 EQU $FFFFFFF9

NOTENegative values are generated as 32-bit hex numbers.

10.9.5.4 Types

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

412 Freescale Semiconductor, Inc.

Page 413: CodeWarrior Development Studio for Microcontrollers V10.x RS08

As it does not make sense to generate the size of any occurring type, only typedefs areconsidered.

The size of the newly defined type is specified for all typedefs. For the name of the size ofa typedef, an additional term _SIZE is appended to the end of the name. For structures, theoffset of all structure fields is generated relative to the structure's start. The names of thestructure offsets are generated by appending the structure field's name after an underline( _) to the typedef's name.

Listing: typedef and struct

#pragma CREATE_ASM_LISTING ON

typedef long LONG;

struct tagA {

char a;

short b;

};

typedef struct {

long d;

struct tagA e;

int f:2;

int g:1;

} str;

Creates:

Listing: Resultant EQUs

LONG_SIZE EQU $4

str_SIZE EQU $8

str_d EQU $0

str_e EQU $4

str_e_a EQU $4

str_e_b EQU $5

str_f EQU $7

str_f_BIT_WIDTH EQU $2

str_f_BIT_OFFSET EQU $0

str_g EQU $7

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 413

Page 414: CodeWarrior Development Studio for Microcontrollers V10.x RS08

str_g_BIT_WIDTH EQU $1

str_g_BIT_OFFSET EQU $2

All structure fields inside of another structure are contained within that structure. Thegenerated name contains all the names for all fields listed in the path. If any element ofthe path does not have a name (e.g., an anonymous union), this element is not generated.

The width and the offset are also generated for all bitfield members. The offset 0specifies the least significant bit, which is accessed with a 0x1 mask. The offset 2specifies the most significant bit, which is accessed with a 0x4 mask. The width specifiesthe number of bits.

The offsets, bit widths and bit offsets, given here are examples. Different compilers maygenerate different values. In C, the structure alignment and the bitfield allocation isdetermined by the compiler which specifies the correct values.

10.9.5.5 Functions

Declared functions are generated by the XREF directive. This enables them to be used withthe assembler. Do not generate the function to be called from C, but defined in assembler,into the output file as the assembler does not allow the redefinition of labels declaredwith XREF. Such function prototypes are placed in an area started with#pragma CREATE_ASM_LISTING OFF, as shown in the following listing.

Listing: Function prototypes

#pragma CREATE_ASM_LISTING ON void main(void);

void f_C(int i, long l);

#pragma CREATE_ASM_LISTING OFF

void f_asm(void);

Creates:

Listing: Functions defined in assembler

XREF main XREF f_C

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

414 Freescale Semiconductor, Inc.

Page 415: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.9.5.6 Variables

Variables are declared with XREF. In addition, for structures, every field is defined with anEQU directive. For bitfields, the bit offset and bit size are also defined.

Variables in the __SHORT_SEG segment are defined with XREF.B to inform the assembler aboutthe direct access. Fields in structures in __SHORT_SEG segments, are defined with a EQU.Bdirective.

Listing: struct and variable

#pragma CREATE_ASM_LISTING ON

struct A {

char a;

int i:2;

};

struct A VarA;

#pragma DATA_SEG __SHORT_SEG ShortSeg

int VarInt;

Creates:

Listing: Resultant XREFs and EQUs

XREF VarA

VarA_a EQU VarA + $0

VarA_i EQU VarA + $1

VarA_i_BIT_WIDTH EQU $2

VarA_i_BIT_OFFSET EQU $0

XREF.B VarInt

The variable size is not explicitly written. To generate the variable size, use a typedef withthe variable type.

The offsets, bit widths, and bit offsets given here are examples. Different compilers maygenerate different values. In C, the structure alignment and the bitfield allocation isdetermined by the compiler which specifies the correct values.

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 415

Page 416: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.9.5.7 Comments

Comments inside a region generated with #pragma CREATE_ASM_LISTING ON are also written ona single line in the assembler include file.

Comments inside of a typedef, a structure, or a variable declaration are placed eitherbefore or after the declaration. They are never placed inside the declaration, even if thedeclaration contains multiple lines. Therefore, a comment after a structure field in atypedef is written before or after the whole typedef, not just after the type field. Everycomment is on a single line. An empty comment (/* */) inserts an empty line into thecreated file.

See the following listing for an example of how C source code with its comments isconverted into assembly.

Listing: C source code conversion to assembly

#pragma CREATE_ASM_LISTING ON/*

The main() function is called by the startup code.

This function is written in C. Its purpose is

to initialize the application. */

void main(void);

/*

The SIZEOF_INT macro specified the size of an integer type

in the compiler. */

typedef int SIZEOF_INT;

#pragma CREATE_ASM_LISTING OFF

Creates:

; The function main is called by the startup code.

; The function is written in C. Its purpose is

; to initialize the application.

XREF main

;

; The SIZEOF_INT macro specified the size of an integer type

; in the compiler.

SIZEOF_INT_SIZE EQU $2

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

416 Freescale Semiconductor, Inc.

Page 417: CodeWarrior Development Studio for Microcontrollers V10.x RS08

10.9.5.8 Guidelines

The -La option translates specified parts of header files into an include file to importlabels and defines into an assembler source. Because the -La compiler option is verypowerful, its incorrect use must be avoided using the following guidelines implementedin a real project. This section describes how the programmer uses this option to combineC and assembler sources, both using common header files.

The following general implementation recommendations help to avoid problems whenwriting software using the common header file technique.

• All interface memory reservations or definitions must be made in C source files.Memory areas, only accessed from assembler files, can still be defined in thecommon assembler manner.

• Compile only C header files (and not the C source files) with the -La option to avoidmultiple defines and other problems. The project-related makefile must contain aninference rules section that defines the C header files-dependent include files to becreated.

• Use #pragma CREATE_ASM_LISTING ON/OFF only in C header files. This #pragma selects theobjects to translate to the assembler include file. The created assembler include filethen holds the corresponding assembler directives.

• Do not use the -La option as part of the command line options used for allcompilations. Use this option in combination with the -Cx (no Code Generation)compiler option. Without this option, the compiler creates an object file which couldaccidently overwrite a C source object file.

• Remember to extend the list of dependencies for assembler sources in your make file.• Check if the compiler-created assembler include file is included into your assembler

source.

NOTEIn case of a zero-page declared object (if this is supportedby the target), the compiler translates it into an XREF.Bdirective for the base address of a variable or constant. Thecompiler translates structure fields in the zero page into anEQU.B directive in order to access them. Explicit zero-pageaddressing syntax may be necessary as some assemblersuse extended addresses to EQU.B defined labels. Project-defined data types must be declared in the C header file byincluding a global project header (e.g., global.h). This is

Chapter 10 ANSI-C Frontend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 417

Page 418: CodeWarrior Development Studio for Microcontrollers V10.x RS08

necessary as the header file is compiled in a standalonefashion.

Defining C Macros Containing HLI Assembler Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

418 Freescale Semiconductor, Inc.

Page 419: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 11Generating Compact Code

The Compiler tries whenever possible to generate compact and efficient code. But noteverything is handled directly by the Compiler. With a little help from the programmer, itis possible to reach denser code. Some Compiler options, or using __SHORT_SEG segments(if available), help to generate compact code.

11.1 Compiler Options

Using the following compiler options helps to reduce the size of the code generated. Notethat not all options may be available for each target.

11.1.1 -Oi: Inline Functions

Use the inline keyword or the command line option -Oi for C/C++ functions. Thefollowing listing defines a function before it is used helps the Compiler to inline it:

Listing: Example - Defining a Function

/* OK */ /* better! */

void fun(void); void fun(void) {

void main(void) { // ...

fun(); }

} void main(void) {

void fun(void) { fun();

// ... }

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 419

Page 420: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

This also helps the compiler to use a relative branch instruction instead of an absolutebranch instruction.

11.2 Relocatable Data

The limited RAM size of the RS08 requires careful data allocation. Access global read/write data using tiny, short, direct, or paged addressing. Access global read-only datausing paged or far addressing. RS08 non-static local data must be allocated into anOVERLAP section. The compiler does this allocation automatically, using the sameaddress range as is used for direct addressing (0x00 to 0xBF).

• Use tiny addressing (__TINY_SEG) for frequently accessed global variables when theoperand can be encoded on four bits. The address range for these variables is 0x00 -0x0F.

• Use short addressing (__SHORT_SEG) to access IO registers in the lower RS08 registerbank, when the operand can be encoded on five bits. The address range for thesevariables is 0x00 - 0x1F.

• Use direct (8-bit) addressing (DEFAULT) to access global variables when the operand isgreater than four or five bits. The address range for these variables is 0x00 to 0xBF.

• Use paged addressing (__PAGED_SEG) to access IO registers in the upper RS08 registerbank. The address range for these variables is 0x100 to 0x3FF.

• Use paged addressing (__PAGED_SEG) to access global read-only (constant) data. Objectsallocated in PAGED sections must not cross page boundaries. The address range forthese constants is 0x00 to 0x3FFF.

• Use far addressing (__FAR_SEG) to access large constant data. Allocate far sections tomore than one page. The address range for these constants is 0x00 to 0x3FFF.

See the following listing for examples using the different addressing modes.

Listing: Allocating variables on the RS08

/* in a header file */ #pragma DATA_SEG __TINY_SEG MyTinySection char status; #pragma DATA_SEG __ SHORT_SEG MyShortSection unsigned char IOReg; #pragma DATA_SEG DEFAULT char temp; #pragma DATA_SEG __ PAGED_SEG MyShortSection unsigned char IOReg; unsigned char *__paged io_ptr = &IOREG; #pragma DATA_SEG __ PAGED_SEG MyPagedSection const char table[10]; unsigned char *__paged tblptr = table; #pragma DATA_SEG __ FAR_SEG MyFarSection

Relocatable Data

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

420 Freescale Semiconductor, Inc.

Page 421: CodeWarrior Development Studio for Microcontrollers V10.x RS08

const char table[1000]; unsigned char *__far tblptr = table;

The segment must be placed on the direct page in the PRM file.

Listing: Linker parameter file

LINK test.abs NAMES test.o startup.o ansi.lib END SECTIONS Z_RAM = READ_WRITE 0x0080 TO 0x00FF; MY_RAM = READ_WRITE 0x0100 TO 0x01FF; MY_ROM = READ_ONLY 0xF000 TO 0xFEFF; PLACEMENT DEFAULT_ROM INTO MY_ROM; DEFAULT_RAM INTO MY_RAM; _ZEROPAGE, myShortSegment INTO Z_RAM; END VECTOR 0 _Startup /* set reset vector on _Startup */

NOTEThe linker is case-sensitive. The segment name must beidentical in the C and PRM files.

11.2.1 Using -Ostk

When you use the -Ostk option, the compiler analyzes which local variables are alivesimultaneously. Based on that analysis the compiler chooses the best memory layout forfor variables. When using -Ostk, two or more variables may end up sharing the samememory location.

11.3 Programming Guidelines

Following a few programming guidelines helps to reduce code size. Many things areoptimized by the Compiler. However, if the programming style is very complex or if itforces the Compiler to perform special code sequences, code efficiency is not would beexpected from a typical optimization.

11.3.1 Constant Function at a Specific Address

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 421

Page 422: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Sometimes functions are placed at a specific address, but the sources or informationregarding them are not available. The programmer knows that the function starts ataddress 0x1234 and wants to call it. Without having the definition of the function, theprogram runs into a linker error due to the lack of the target function code. The solution isto use a constant function pointer:

void (*const fktPtr)(void) = (void(*)(void))0x1234;

void main(void) {

fktPtr();

}

This gives you efficient code and no linker errors. However, it is necessary that thefunction at 0x1234 really exists.

Even a better way (without the need for a function pointer):

#define erase ((void(*)(void))(0xfc06))

void main(void) {

erase(); /* call function at address 0xfc06 */

}

11.3.2 HLI Assembly

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

422 Freescale Semiconductor, Inc.

Page 423: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Do not mix High-level Inline (HLI) Assembly with C declarations and statements (seethe following listing). Using HLI assembly may affect the register trace of the compiler.The Compiler cannot touch HLI Assembly, and thus it is out of range for anyoptimizations except branch optimization.

Listing: Mixing HLI Assembly with C Statements (not recommended).

void foo(void) {

/* some local variable declarations */

/* some C/C++ statements */

__asm {

/* some HLI statements */

}

/* maybe other C/C++ statements */

}

The Compiler in the worst case has to assume that everything has changed. It cannot holdvariables into registers over HLI statements. Normally it is better to place special HLIcode sequences into separate functions. However, there is the drawback of an additionalcall or return. Placing HLI instructions into separate functions (and module) simplifiesporting the software to another target.

Listing: HLI Statements are not mixed with C Statements (recommended).

/* hardware.c */

void special_hli(void) {

__asm {

/* some HLI statements */

}

}

/* foo.c */

void foo(void) {

/* some local variable declarations */

/* some C/C++ statements */

special_hli();

/* maybe other C/C++ statements */

}

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 423

Page 424: CodeWarrior Development Studio for Microcontrollers V10.x RS08

11.3.3 Post- and Pre-Operators in Complex Expressions

Writing a complex program results in complex code. In general it is the job of thecompiler to optimize complex functions. Some rules may help the compiler to generateefficient code.

If the target does not support powerful postincrement or postdecrement and preincrementor predecrement instructions, it is not recommended to use the `++' and `--' operator incomplex expressions. Especially postincrement or postdecrement may result in additionalcode:

a[i++] = b[--j];

Write the above statement as:

j--; a[i] = b[j]; i++;

Using it in simple expressions as:

i++;

Avoid assignments in parameter passing or side effects (as ++ and --). The evaluationorder of parameters is undefined (ANSI-C standard 6.3.2.2) and may vary from Compilerto Compiler, and even from one release to another:

11.3.3.1 Example

i = 3;

fun(i++, --i);

In the above example, fun() is called either with fun(3,3) or with fun(2,2).

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

424 Freescale Semiconductor, Inc.

Page 425: CodeWarrior Development Studio for Microcontrollers V10.x RS08

11.3.4 Boolean Types

In C, the boolean type of an expression is an `int'. A variable or expression evaluating to0 (zero) is FALSE and everything else (!= 0) is TRUE. Instead of using an int (usually 16or 32 bits), it may be better to use an 8-bit type to hold a boolean result. For ANSI-Ccompliance, the basic boolean types are declared in stdtypes.h:

typedef int Bool;

#define TRUE 1

#define FALSE 0

Using typedef Byte Bool_8 from stdtypes.h ( Byte is an unsigned 8-bit data type alsodeclared in stdtypes.h) reduces memory usage and improves code density.

11.3.5 printf() and scanf()

The printf or scanf code in the ANSI library can be reduced if no floating point support(%f) is used. Refer to the ANSI library reference and printf.c or scanf.c in your libraryfor details on how to save code (not using float or doubles in printf may result in half thecode).

11.3.6 Bitfields

Using bitfields to save memory may be a bad idea as bitfields produce a lot of additionalcode. For ANSI-C compliance, bitfields have a type of signed int, thus a bitfield of size 1is either -1 or 0. This could force the compiler to sign extend operations:

struct {

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 425

Page 426: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int b:0; /* -1 or 0 */

} B;

int i = B.b; /* load the bit, sign extend it to -1 or 0 */

Sign extensions are normally time- and code-inefficient operations.

11.3.7 Struct Returns

Normally the compiler must first allocate space for the return value (1) and then to callthe function (2). In phase (3) the return value is copied to the variable s. In the callee fun,during the return sequence, the Compiler must copy the return value ( 4, struct copy).

Depending on the size of the struct, this may be done inline. After return, the caller mainmust copy the result back into s. Depending on the Compiler or Target, it is possible tooptimize some sequences, avoiding some copy operations. However, returning a struct byvalue may increase execution time, and increase code size and memory usage.

Listing: Returning a struct can force the Compiler to produce lengthy code.

struct S fun(void)

/* ... */

return s; // (4)

}

void main(void) {

struct S s;

/* ... */

s = fun(); // (1), (2), (3)

/* ... */

}

With the example in the following listing, the Compiler just has to pass the destinationaddress and to call fun (2). On the callee side, the callee copies the result indirectly intothe destination (4). This approach reduces memory usage, avoids copying structs, and

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

426 Freescale Semiconductor, Inc.

Page 427: CodeWarrior Development Studio for Microcontrollers V10.x RS08

results in denser code. Note that the Compiler may also inline the above sequence (ifsupported). But for rare cases the above sequence may not be exactly the same asreturning the struct by value (e.g., if the destination struct is modified in the callee).

Listing: A better way is to pass only a pointer to the callee for the return value.

void fun(struct S *sp) {

/* ... */

*sp = s; // (4)

}

void main(void) {

S s;

/* ... */

fun(&s); // (2)

/* ... */

}

11.3.8 Local Variables

Using local variables instead of global variable results in better manageability of theapplication as side effects are reduced or totally avoided. Using local variables orparameters reduces global memory usage but increases local memory usage.

Memory access capabilities of the target influences the code quality. Depending on thetarget capabilities, access efficiency to local variables may vary. Allocating a hugeamount of local variables may be inefficient because the Compiler has to generate acomplex sequence to allocate the memory in the beginning of the function and todeallocate it in the end:

Listing: Good candidate for global variables

void fun(void) {

/* huge amount of local variables: allocate space! */

/* ... */

/* deallocate huge amount of local variables */

}

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 427

Page 428: CodeWarrior Development Studio for Microcontrollers V10.x RS08

If the target provides special entry or exit instructions for such cases, allocation of manylocal variables is not a problem. A solution is to use global or static local variables. Thisdeteriorates maintainability and also may waste global address space.

The RS08 Compiler overlaps parameter or local variables using a technique calledoverlapping. The Compiler allocates local variables or parameters as global, and thelinker overlaps them depending on their use. Since the RS08 has no stack, this is the onlysolution. However this solution makes the code non-reentrant (no recursion is allowed).

11.3.9 Parameter Passing

Avoid parameters which exceed the data passed through registers (see Backend).

11.3.10 Unsigned Data Types

Using unsigned data types is acceptable as signed operations are much more complexthan unsigned ones (e.g., shifts, divisions and bitfield operations). But it is a bad idea touse unsigned types just because a value is always larger or equal to zero, and because thetype can hold a larger positive number.

11.3.11 abs() and labs()

Use the corresponding macro M_ABS defined in stdlib.h instead of calling abs() and absl()in the stdlib:

/* extract

/* macro definitions of abs() and labs() */

#define M_ABS(j) (((j) >= 0) ? (j) : -(j))

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

428 Freescale Semiconductor, Inc.

Page 429: CodeWarrior Development Studio for Microcontrollers V10.x RS08

extern int abs (int j);

extern long int labs (long int j);

But be careful as M_ABS() is a macro,

i = M_ABS(j++);

and is not the same as:

i = abs(j++);

11.3.11.1 abs() and labs()

Use the corresponding macro M_ABS defined in stdlib.h instead of calling abs() and absl()in the stdlib:

/* extract

/* macro definitions of abs() and labs() */

#define M_ABS(j) (((j) >= 0) ? (j) : -(j))

extern int abs (int j);

extern long int labs (long int j);

But be careful as M_ABS() is a macro,

i = M_ABS(j++);

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 429

Page 430: CodeWarrior Development Studio for Microcontrollers V10.x RS08

and is not the same as:

i = abs(j++);

11.3.11.2 memcpy() and memcpy2()

ANSI-C requires that the memcpy() library function in strings.h returns a pointer of thedestination and handles and is able to also handle a count of zero:

Listing: Excerpts from the string.h and string.c files relating to memcpy()

/* extract of string.h *

extern void * memcpy(void *dest, const void * source, size_t count);

extern void memcpy2(void *dest, const void * source, size_t count);

/* this function does not return dest and assumes count > 0 */

/* extract of string.c */

void * memcpy(void *dest, const void *source, size_t count) {

uchar *sd = dest;

uchar *ss = source;

while (count--)

*sd++ = *ss++;

return (dest);

}

If the function does not have to return the destination and it has to handle a count of zero,the memcpy2() function in the following listing is much simpler and faster:

Listing: Excerpts from the string.c File relating to memcpy2()

/* extract of string.c */

void

memcpy2(void *dest, const void* source, size_t count) {

/* this func does not return dest and assumes count > 0 */

do {

*((uchar *)dest)++ = *((uchar*)source)++;

} while(count--);

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

430 Freescale Semiconductor, Inc.

Page 431: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Replacing calls to memcpy() with calls to memcpy2() saves runtime and code size.

11.3.12 Data Types

Do not use larger data types than necessary. Use IEEE32 floating point format both forfloat and doubles if possible. Set the enum type to a smaller type than int using the -Toption. Avoid data types larger than registers.

11.3.13 Tiny or Short Segments

Whenever possible, place frequently used global variables into a __TINY_SEG or __SHORT_SEGsegment using:

#pragma DATA_SEG __SHORT_SEG MySeg

or

#pragma DATA_SEG __TINY_SEG MySeg

11.3.14 Qualifiers

Use the const qualifier to help the compiler. The const objects are placed into ROM for theFreescale object-file format if the -Cc compiler option is given.

Chapter 11 Generating Compact Code

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 431

Page 432: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Programming Guidelines

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

432 Freescale Semiconductor, Inc.

Page 433: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 12RS08 Backend

The Backend is the target-dependent part of a Compiler, containing the code generator.This section discusses the technical details of the Backend for the RS08 family.

12.1 Non-ANSI Keywords

The following table gives an overview about the supported non-ANSI keywords:

Table 12-1. Supported Non-ANSI Keywords

Keyword Data Pointer Supported for FunctionPointer

Function

__far yes no no

__near yes no no

interrupt no no yes

__paged yes no no

12.2 Memory Models

This section describes the following memory models:

• SMALL Memory Model• BANKED Memory Model

12.2.1 SMALL Memory Model

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 433

Page 434: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This is the default memory model for the RS08 compiler. It uses 8-bit accesses for dataand 16-bit accesses (extended addressing) for functions.

12.2.2 BANKED Memory Model

The RS08 core does not support extended addressing for data access beyond the first 256bytes. Therefore, a paging scheme has been implemented, that segments the full 16-Kbyte address map into 256 pages of 64 bytes each. The BANKED memory model isidentical to the SMALL memory model in terms of function access, but uses this pagingscheme to access data. The compiler accesses all data as __paged (that is, using 16-bitaccesses with the page number in the high byte, and the offset in the low byte). Thispaging mechanism no longer works if the object crosses page boundaries. __faraddressing is more expensive (the page register must be updated for each byte access).

12.2.2.1 See also

• Pointer Qualifiers

12.3 Data Types

This section describes how the basic types of ANSI-C are implemented by the RS08Backend.

12.3.1 Scalar Types

All basic types may be changed with the -T option. Note that all scalar types (exceptchar) have no signed/unsigned qualifier, and are considered signed by default, forexample int is the same as signed int.

The sizes of the simple types are given by the table below together with the possibleformats using the -T option:

Data Types

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

434 Freescale Semiconductor, Inc.

Page 435: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 12-2. Scalar Types

Type Default Format Default Value Range Default Value Range Formats AvailableWith Option -TMin Max

char (unsigned) 8bit 0 255 8bit, 16bit, 32bit

singned char 8bit -128 127 8bit, 16bit, 32bit

unsigned char 8bit 0 255 8bit, 16bit, 32bit

signed short 16bit -32768 32767 8bit, 16bit, 32bit

unsigned short 16bit 0 65535 8bit, 16bit, 32bit

enum (signed) 16bit -32768 32767 8bit, 16bit, 32bit

signed int 16bit -32768 32767 8bit, 16bit, 32bit

unsigned int 16bit 0 65535 8bit, 16bit, 32bit

signed long 32bit -2147483648 2147483647 8bit, 16bit, 32bit

unsigned long 32bit 0 4294967295 8bit, 16bit, 32bit

signed long long 32bit -2147483648 2147483647 8bit, 16bit, 32bit

unsigned long long 32bit 0 4294967295 8bit, 16bit, 32bit

NOTEPlain type char is unsigned. This default is changed with the -Toption.

12.3.2 Floating Point Types

The RS08 compiler supports IEEE32 floating point calculations. The compiler usesIEEE32 format for both types.

The option -T may be used to change the default format of float/double.

Table 12-3. Floating Point Types

Type Default Format Default Value Range Default Value Range Formats AvailableWith Option -TMin Max

float IEEE32 -1.17549435E-38F 3.402823466E+38F IEEE32

double IEEE32 1.17549435E-38F 3.402823466E+38F IEEE32

long double IEEE32 1.17549435E-38F 3.402823466E+38F IEEE32

long long double IEEE32 1.17549435E-38F 3.402823466E+38F IEEE32

12.3.3 Pointer Types and Function Pointers

Chapter 12 RS08 Backend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 435

Page 436: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The following table shows how data pointer size varies with memory model and __far,__near, or __paged keyword usage.

Table 12-4. Data Pointer Sizes

Memory Model Compiler Option Default PointerSize

__near PointerSize

__far PointerSize

__paged PointerSize

SMALL -Ms 1 1 2 2

BANKED -Mb 2 1 2 2

Function pointer size is 2 bytes, regardless of the memory model selected.

12.3.4 Structured Types, Alignment

Local variables are allocated in overlapping areas. The most significant part of a simplevariable is stored at the low memory address.

12.3.5 Bitfields

The maximum width of bitfields is 32 bits. The allocation unit is one byte. The Compileruses words only if a bitfield is wider than eight bits. Allocation order is from the leastsignificant bit up to the most significant bit in the order of declaration.

12.4 Register Usage

The RS08 Compiler and library use five pseudo registers defined in the table below:

Table 12-5. Pseudo Registers

Register Normal Function

U (or _U) scratch register

V (or _V) scratch register

W (or _W) scratch register

Y (or _Y) address register of binary operations

Z (or _Z) scratch register

Register Usage

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

436 Freescale Semiconductor, Inc.

Page 437: CodeWarrior Development Studio for Microcontrollers V10.x RS08

12.5 Parameter Passing

These parameter passing and return value conventions apply for the RS08:

• Registers used for Parameter Passing (only for parameter lists without the ellipsis):• if the last parameter is 8-bit large, the parameter is passed in register A• all other are parameters passed using the shared section (OVERLAP)

• Parameter naming conventions for the shared OVERLAP section are zero-relative startingfrom the last parameter. In other words:

• __OVL_funcname_p0 indicates the last parameter• __OVL_funcname_p1 indicates the next to the last parameter• __OVL_funcname_p2 indicates the third from the last parameter, and so on.

• Ellipsis (for open parameters): Pass open parameters using a parameter blockallocated in the local scope of the caller. The address of this block is passedimplicitly together with the last declared parameter. The callee uses this address toget the open parameters:

unsigned char __OVL_callerfuncname_pblock [MAX_BLOCK_SIZE] // MAX_BLOCK_SIZE is the

maximum of bytes needed by a caller to pass open parameters

• The following return address is used for non-leaf functions or for functions that callthe runtime library):

unsigned char __OVL_funcname_ra[2] // 2 bytes for return address of caller

12.6 Entry and Exit Code

The RS08 uses an overlapping system, rather than a stack, for memory allocation. Thefollowing listing illustrates correct entry and exit code use.

Listing: Entry and Exit Code Example

10: int f(int x) {

0000 45 SHA

0001 b700 STA __OVL_f_14__PSID_75300003 ------> entry code. Saves the SPC value. This only happens for non-leaf functions !

0003 42 SLA

Chapter 12 RS08 Backend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 437

Page 438: CodeWarrior Development Studio for Microcontrollers V10.x RS08

0004 b701 STA __OVL_f_14__PSID_75300003:1

11: g(&x);

0006 a600 LDA #__OVL_f_p0

0008 ad00 BSR PART_0_7(g)

12: return x;

000a 4e000f LDX __OVL_f_p1 --------> stores the return value

000d 4e000e MOV __OVL_f_p0,D[X]

0010 2f INCX

0011 4e010e MOV __OVL_f_p0:1,D[X]

0014 b600 LDA __OVL_f_14__PSID_75300003 -----> restore SPC. This only happens for non-leaf functions !

0016 45 SHA

0017 b601 LDA __OVL_f_14__PSID_75300003:1

0019 42 SLA

13: }

001a be RTS

12.7 Pragmas

The Compiler provides some pragmas that control the generation of entry and exit code.

12.7.1 TRAP_PROC

The return instruction from the function is JMP IEA (jump to the Interrupt Exit Addressregister). At this address, a jump opcode is hard-wired, and the destination of the jump isstored by the core in the Interrupt Return Address register (IRA). When using#pragmaTRAP_PROC, the user can configure which registers should be saved when entering theinterrupt handler and restored at exit.

The syntax for this pragma is:

#pragma TRAP_PROC [SAVE_A|SAVE_X|SAVE_PAGE].

Pragmas

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

438 Freescale Semiconductor, Inc.

Page 439: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThe arguments can be provided in any combination, forexample #pragma TRAP_PROC SAVE_A SAVE_PAGE, and have as effectsaving the accumulator register, the index register, and thePAGESEL register respectively.

12.7.2 NO_ENTRY

Omits generation of procedure entry code.

12.7.3 NO_EXIT

Does not generate procedure exit code.

12.8 Interrupt Functions

Interrupt procedures are marked with the interrupt keyword. These functions return witha JMP IEA instruction instead of RTS and should not have any arguments.

12.8.1 Interrupt Vector Table Allocation

The vector table has to be setup with normal C (or assembly) code.

Instead an array of vectors has to be allocated and initialized with the address of thehandlers and with their initial thread argument.

12.9 Segmentation

Chapter 12 RS08 Backend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 439

Page 440: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Linker memory space may be partitioned into several segments. The Compilerallows attributing a certain segment name to certain global variables or functions whichthen are allocated into that segment by the Linker. Where that segment actually lies isdetermined by an entry in the Linker parameter file.

There are two basic types of segments, code and data segments, each with a matchingpragma:

#pragma CODE_SEG <name>

#pragma DATA_SEG <name>

Both are valid until the next pragma of the same kind is encountered. If no segment isspecified, the Compiler assumes two default segments named DEFAULT_ROM (the defaultcode segment) and DEFAULT_RAM (the default data segment). To explicitly make thesedefault segments the current ones, use the segment name DEFAULT:

#pragma CODE_SEG DEFAULT

#pragma DATA_SEG DEFAULT

12.10 Optimizations

The Compiler applies a variety of code improving techniques commonly calledoptimizations. This section gives a short overview about the most importantoptimizations.

12.10.1 Lazy Instruction Selection

Lazy instruction selection is a very simple optimization that replaces certain instructionsby shorter and/or faster equivalents. Examples are the use of TSTA instead of CMPA #0 orusing COMB instead of EORB #0xFF.

Optimizations

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

440 Freescale Semiconductor, Inc.

Page 441: CodeWarrior Development Studio for Microcontrollers V10.x RS08

12.10.2 Branch Optimizations

The Compiler uses branch instructions with short offsets whenever possible.Additionally, other optimizations for branches are also available.

12.10.3 Constant Folding

Constant folding options only affect constant folding over statements. The constantfolding inside of expressions is always done.

12.10.4 Volatile Objects

The Compiler does not do register tracing on volatile objects. Accesses to volatile objectsare not eliminated. It also doesn't change word operations to byte operations on volatileobjects as it does for other memory accesses.

12.11 Programming Hints

The RS08 is an 8-bit processor not designed with high-level languages in mind. Youmust observe certain points to allow the Compiler to generate reasonably efficient code.The following list provides an idea of what is "good" programming from the processor'spoint of view.

• Use the restrict keyword as a hint for the pointer to thread function argumentdescriptors.

• Use 8-bit computations unless larger types are absolutely required. The RS08 core isan 8-bit MCU, so 16-bit arithmetic operations are expensive, since they areimplemented by runtime calls.

• Limit the number of local variables, since storage space is limited.

Using unsigned types instead of signed types is better in the following cases:

Chapter 12 RS08 Backend

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 441

Page 442: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Implicit or explicit extensions from char to int or from int to long.• Use types long, float or double only when absolutely necessary. They produce a lot of

code.

Programming Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

442 Freescale Semiconductor, Inc.

Page 443: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 13High-Level Inline Assembler for the Freescale RS08

The HLI (High Level Inline) Assembler provides a means to make full use of theproperties of the target processor within a C program. There is no need to write a separateassembly file, assemble it and later bind it with the rest of the application written inANSI-C/C++ with the inline assembler. The Compiler does all that work for you. Formore information, refer to the RS08 Reference Manual.

13.1 Syntax

Inline assembly statements can appear anywhere a C statement can appear (an __asmstatement must be inside a C function). Inline assembly statements take one of two forms,shown in various configurations: __asm <Assembly Instruction> ; [/* Comment */]__asm<Assembly Instruction> ; [// Comment] or __asm { { <Assembly Instruction> [; Comment] \n } }or __asm ( <Assembly Instruction> [; Comment] ); or __asm [ ( ] <string Assembly instruction >[)] [;]with <string Assembly instruction > = <Assembly Instruction> [";" <Assembly

instruction>] or #asm <Assembly Instruction> [; Comment] \n #endasm If you use the first form,multiple __ asm statements are contained on one line and comments are delimited likeregular C or C++ comments. If you use the second form, one to several assemblyinstructions are contained within the __ asm block, but only one assembly instruction perline is possible and the semicolon starts an assembly comment.

13.1.1 Mixing HLI Assembly and HLL

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 443

Page 444: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Mixing High Level Inline (HLI) Assembly with a High Level Language (HLL, forexample C or C++) requires special attention. The Compiler does care about used ormodified registers in HLI Assembly, thus you do not have save/restore registers whichare used in HLI. It is recommended to place complex HLI Assembly code, or HLIAssembly code modifying any registers, into separate functions.

Example:

void foo(void) { /* some C statements */ p->v = 1; __asm { /* some HLI statements destroying registers */ } /* some C statements */ p->v = 2;}

In the above sequence, the Compiler holds the value of p in a register. The compiler willcorrectly reload p if necessary.

13.1.2 Example

A simple example illustrates the use of the HLI-Assembler. Assume the following:

• from points to some memory area• to points to some other, non-overlapping memory area.

Then we can write a simple string copying function in assembly language as follows:

void _CMPS(void) { __asm { ADD #128 STA _Z LDA _Y ADD #128 CMP _Z }}

13.1.3 C Macros

The C macros are expanded inside of inline assembler code as they are expanded in C.One special point to note is the syntax of a __asm directive generated by macros. Asmacros always expand to one single line, only the first form of the __asm keyword is usedin macros:

Syntax

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

444 Freescale Semiconductor, Inc.

Page 445: CodeWarrior Development Studio for Microcontrollers V10.x RS08

__asm NOP;

For example:

#define SPACE_OK { __asm NOP; __asm NOP; }

Using the second form is invalid:

#define NOT_OK { __asm { \ NOP; \ NOP; \ }

The macro NOT_OK is expanded by the preprocessor to one single line, which is thenincorrectly translated because every assembly instruction must be explicitly terminatedby a newline. Use the pragma NO_STRING_CONSTR to build immediates by using # insidemacros.

13.2 Special Features

The following special features are available with the RS08 compiler.

13.2.1 Caller/Callee Saved Registers

Because the compiler does not save any registers on the caller/callee side, you do nothave to save or restore any registers in the HLI across function calls.

13.2.2 Reserved Words

The inline assembler knows a couple of reserved words, which must not collide with userdefined identifiers such as variable names. These reserved words are:

• All opcodes (MOV, NOP, ...)• All register names (A, X, D[X])• The fixup identifiers:

Chapter 13 High-Level Inline Assembler for the Freescale RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 445

Page 446: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 13-1. Fixup Identifiers

Name Address Kind Description

%HIGH_6_13 Logical Address Returns the page number correspondingto a given RS08 14-bit address.

%MAP_ADDR_6 Logical Address Returns the offset within the pagingwindow corresponding to a given RS08address.

For these reserved words, the inline assembler is not case sensitive, that is JSR is the sameas jsr or even JsR. For all other identifiers (labels, variable names and so on) the inlineassembler is case sensitive. The following example shows the syntax of the fixupspecification:

__asm MOV #%HIGH_6_13(var),__PAGESEL

13.2.3 Pseudo-Opcodes

This ection lists the pseudo opcodes for inline assembler.

13.2.3.1 DC - Define constant

The inline assembler provides some pseudo opcodes to put constant bytes into theinstruction stream. These are:

DC.B 1 ; Byte constant 1

DC.B 0 ; Byte constant 0

DC.W 12 ; Word constant 12

DC.L 20,23 ; Longword constants

13.2.3.2 __RETADDR - Specify the return address location

Given a non-leaf function, that is, one that contains JSR/BSR instructions, the value ofthe Shadow PC (SPC) register must be saved and restored accordingly. The value isstored to a temporary in the compiler-generated entry code, and subsequently restored tothe register in the exit code, which is also generated by the compiler. If, however, the

Special Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

446 Freescale Semiconductor, Inc.

Page 447: CodeWarrior Development Studio for Microcontrollers V10.x RS08

function contains only inline assembly and has #pragma NO_ENTRY applied to it, eventhough the SPC value has been properly manipulated, this time by the programmer, thegenerated debug information might be incomplete (the debugger might not be able torecreate the stack trace) - unless the __RETADDR pseudo-opcode is used to specify inwhich variable has the return address been stored. The following listing contains anexample of using __RETADDR

Listing: Using __RETADDR to specify the return address location

#pragma NO_ENTRY

#pragma NO_EXIT

void foo(void) {

unsigned int ret;

asm {

STA tmp

SHA

STA ret

SLA

STA ret+1

__RETADDR ret /* starting from this PC value on, the return address resides in variable 'ret' */

LDA tmp

...

}

}

13.2.4 Accessing Variables

The inline assembler allows accessing local and global variables declared in C by usingtheir name in the instruction. For global variable names, use the correct fixupspecification (usually %LOWC for the low byte and %HIGH for the high byte part).

13.2.5 Constant Expressions

Chapter 13 High-Level Inline Assembler for the Freescale RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 447

Page 448: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Constant expressions may be used anywhere an IMMEDIATE value is expected. The HLIsupports the same operators as in ANSI-C code. The syntax of numbers is the same as inANSI-C.

Special Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

448 Freescale Semiconductor, Inc.

Page 449: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 14ANSI-C Library Reference

This section covers the ANSI-C Library.

• Library Files : Description of the types of library files• Special Features : Description of special considerations of the ANSI-C standard

library relating to embedded systems programming• Library Structure : Examination of the various elements of the ANSI-C library,

grouped by category.• Types and Macros in Standard Library : Discussion of all types and macros defined

in the ANSI-C standard library.• Standard Functions : Description of all functions in the ANSI-C library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 449

Page 450: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

450 Freescale Semiconductor, Inc.

Page 451: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 15Library Files

The chapter describes library files.

15.1 Directory Structure

The library files are delivered in the following structure:

Listing: Layout of files after a CodeWarrior installation/

CWInstallDir\MCU\lib\<target>c\ /* readme files, make files */CWInstallDir\MCU\lib\<target>c\src /* C library source files */

CWInstallDir\MCU\lib\<target>c\include /* library include files */

CWInstallDir\MCU\lib\<target>c\lib /* default library files */

CWInstallDir\MCU\lib\<target>c\prm /* Linker parameter files */

Read the README.TXT located in the library folder for additional information on memorymodels and library filenames.

NOTEThe RS08 and the HC08 share the standard library files.Therefore, the RS08 library files are located in, CWInstallDir\MCU\lib\hc08c where, CWInstallDir is the directory in which theCodeWarrior software is installed.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 451

Page 452: CodeWarrior Development Studio for Microcontrollers V10.x RS08

15.2 Generating a Library

In the directory structure above, a CodeWarrior *.mcp file is provided to build all thelibraries and the startup code object files. Simply load the <target>_lib.mcp file into theCodeWarrior IDE and build all the targets.

15.3 Common Source Files

The following table lists the source and header files of the Standard ANSI Library thatare not target-dependent.

Table 15-1. Standard ANSI Library-Target Independent Source and Header Files

Source File Header File

alloc.c

assert.c assert.h

ctype.c ctype.h

errno.h

heap.c heap.h

limits.h

math.c, mathf.c limits.h, ieemath.h, float.h

printf.c, scanf.c stdio.h

signal.c signal.h

stdarg.h

stddef.h

stdlib.c stdlib.h

string.c string.h

time.h

15.4 Startup Files

Because every memory model needs special startup initialization, there are also startupobject files compiled with different Compiler option settings (see Compiler options fordetails).

The correct startup file must be linked with the application depending on the memorymodel chosen. The floating point format used does not matter for the startup code.

Common Source Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

452 Freescale Semiconductor, Inc.

Page 453: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Note that the library files contain a generic startup written in C as an example of doing allthe tasks needed for a startup:

• Zero Out• Copy Down• Handling ROM libraries

Because not all of the above tasks may be needed for an application and for efficiencyreasons, special startup is provided as well (e.g., written in HLI). However, the versionwritten in C could be used as well. For example, just compile the ` startup.c' file with thememory/options settings and link it to the application.

NOTEWhen using the small memory model, the size of data pointersis (if not specified otherwise) 8 bits. This means that anymemory location above 0xFF cannot be accessed using such apointer. The startup code makes use of pointers whenperforming the zero-out and copy-down operations. If theapplication has data above the 0xFF boundary, then the startupcode has to use the __far pointers. To enforce this, the user hasto provide -D__STARTUP_USE_FAR_POINTERS in the command linewhen compiling the startup code. This is also true when usingthe banked memory model, since in this situation the pointersare __paged by default. This means that in a scenario where thepointed data crossing page boundary is not supported, thestartup code does not work with the __paged pointers.

15.5 Library Files

Most of the object files of the ANSI library are delivered in the form of an object library.

Several Library files are bundled with the Compiler. The reasons for having differentlibrary files are due to different memory models or floating point formats.

The library files contain all necessary runtime functions used by the compiler and theANSI Standard Library as well. The list files ( *.lst extension) contains a summary of allobjects in the library file.

To link against a modified file which also exists in the library, it must be specified first inthe link order.

Chapter 15 Library Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 453

Page 454: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check out the readme.txt located in the library structure ( lib\<target>c\README.TXT) for a listof all delivered library files and memory model or options used.

Library Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

454 Freescale Semiconductor, Inc.

Page 455: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 16Special Features

Not everything defined in the ANSI standard library makes sense in embedded systemsprogramming. Therefore, not all functions have been implemented, and some have beenleft open to be implemented because they strongly depend on the actual setup of thetarget system.

This chapter describes and explains these points.

NOTEAll functions not implemented do a HALT when called. Allfunctions are re-entrant, except rand() and srand() because theseuse a global variable to store the seed, which might giveproblems with light-weight processes. Another function using aglobal variable is strtok(), because it has been defined that wayin the ANSI standard.

16.1 Memory Management -- malloc(), free(), calloc(),realloc(); alloc.c, and heap.c

File alloc.c provides a full implementation of these functions. The only problemsremaining are the question of heap location, heap size, and what happens when heapmemory runs out.

All these points can be addressed in the heap.c file. The heap is viewed as a large array,and there is a default error handling function. Modify this function or the size of the heapto suit the needs of the application. The size of the heap is defined in libdefs.h,LIBDEF_HEAPSIZE.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 455

Page 456: CodeWarrior Development Studio for Microcontrollers V10.x RS08

16.2 Signals - signal.c

Signals have been implemented as traps. This means the signal() function allows you toset a vector to some function of your own (ideally a TRAP_PROC), while the raise() functionis unimplemented. If you decide to ignore a certain signal, a default handler is installedthat does nothing.

16.3 Multi-byte Characters - mblen(), mbtowc(), wctomb(),mbstowcs(), wcstombs(); stdlib.c

Because the compiler does not support multi-byte characters, all routines in stdlib.cdealing with those are unimplemented. If these functions are needed, the programmermust write them.

16.4 Program Termination - abort(), exit(), atexit(); stdlib.c

Because programs in embedded systems usually are not expected to terminate, we onlyprovide a minimum implementation of the first two functions, while atexit() is notimplemented at all. Both abort() and exit() perform a HALT.

16.5 I/O - printf.c

The printf() library function is unimplemented in the current version of the library sets inthe ANSI libraries, but it is found in the terminal.c file.

This difference has been planned because often no terminal is available at all or aterminal depends highly on the user hardware.

The ANSI library contains several functions which makes it simple to implement theprintf() function with all its special cases in a few lines.

The first, ANSI-compliant way is to allocate a buffer and then use the vsprintf() ANSIfunction .

Listing: An implementation of the printf() function

Multi-byte Characters - mblen(), mbtowc(), wctomb(), mbstowcs(), wcstombs(); stdlib.c

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

456 Freescale Semiconductor, Inc.

Page 457: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int printf(const char *format, ...) { char outbuf[MAXLINE]; int i; va_list args; va_start(args, format); i = vsprintf(outbuf, format, args); va_end(args); WriteString(outbuf); return i; }

The value of MAXLINE defines the maximum size of any value of printf(). The WriteString()function is assumed to write one string to a terminal. There are two disadvantages to thissolution:

• A buffer is needed which alone may use a large amount of RAM.• As unimportant how large the buffer (MAXLINE) is, it is always possible that a buffer

overflow occurs. Therefore this solution is not safe.

Two non-ANSI functions, vprintf() and set_printf(), are provided in its newer libraryversions in order to avoid both disadvantages. Because these functions are a non-ANSIextension, they are not contained in the stdio.h header file. Therefore, their prototypesmust be specified before they are used:

Listing: Prototypes of vprintf() and set_printf()

int vprintf(const char *pformat, va_list args); void set_printf(void (*f)(char));

The set_printf() function installs a callback function, which is called later for everycharacter which should be printed by vprintf().

Be advised that the standard ANSI C printf() derivatives functions, sprintf() andvsprintf(), are also implemented by calls to set_printf() and vprintf(). This way much ofthe code for all printf derivatives can be shared across them.

There is also a limitation of the current implementation of printf(). Because the callbackfunction is not passed as an argument to vprintf(), but held in a global variable, all theprintf() derivatives are not reentrant. Even calls to different derivatives at the same timeare not allowed.

For example, a simple implementation of a printf() with vprintf() and set_printf() isshown in the following listing:

Listing: Implementation of prinft() with vprintf() and set_printf()

int printf(const char *format, ...){ int i; va_list args; set_printf(PutChar); va_start(args, format); i = vprintf(format, args);

Chapter 16 Special Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 457

Page 458: CodeWarrior Development Studio for Microcontrollers V10.x RS08

va_end(args); return i; }

The PutChar()function is assumed to print one character to the terminal.

Another remark has to be made about the printf() and scanf() functions. The full sourcecode is provided of all printf() derivatives in "printf.c" and of scanf() in scanf.c. Usuallymany of the features of printf() and scanf() are not used by a specific application. Thesource code of the library modules printf and scanf contains switches (defines) to allowthe use to switch off unused parts of the code. This especially includes the large floating-point parts of vprintf() and vsscanf().

16.6 Locales - locale.*

Has not been implemented.

16.7 ctype

ctype contains two sets of implementations for all functions. The standard is a set ofmacros which translate into accesses to a lookup table.

This table uses 257 bytes of memory, so an implementation using real functions isprovided. These are accessible if the macros are undefined first. After #undef isupper,isupper is translated into a call to function isupper(). Without the undef, isupper is replacedby the corresponding macro.

Using the functions instead of the macros of course saves RAM and code size - at theexpense of some additional function call overhead.

16.8 String Conversions - strtol(), strtoul(), strtod(), andstdlib.c

To follow the ANSI requirements for string conversions, range checking has to be done.The variable errno is set accordingly and special limit values are returned. The macroENABLE_OVERFLOW_CHECK is set to 1 by default. To reduce code size, switching this macro offis recommended (clear ENABLE_OVERFLOW_CHECK to 0).

Locales - locale.*

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

458 Freescale Semiconductor, Inc.

Page 459: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 17Library Structure

In this chapter, the various parts of the ANSI-C standard library are examined, groupedby category. This library not only contains a rich set of functions, but also numeroustypes and macros.

17.1 Error Handling

Error handling in the ANSI library is done using a global variable errno that is set by thelibrary routines and may be tested by a user program. There also are a few functions forerror handling:

Listing: Error handling functions

void assert(int expr);void perror(const char *msg);

char * strerror(int errno);

17.2 String Handling Functions

Strings in ANSI-C always are null-terminated character sequences. The ANSI libraryprovides the following functions to manipulate such strings.

Listing: ANSI-C string manipulation functions

size_t strlen(const char *s);char * strcpy(char *to, const char *from);

char * strncpy(char *to, const char *from, size_t size);

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 459

Page 460: CodeWarrior Development Studio for Microcontrollers V10.x RS08

char * strcat(char *to, const char *from);

char * strncat(char *to, const char *from, size_t size);

int strcmp(const char *p, const char *q);

int strncmp(const char *p, const char *q, size_t size);

char * strchr(const char *s, int ch);

char * strrchr(const char *s, int ch);

char * strstr(const char *p, const char *q);

size_t strspn(const char *s, const char *set);

size_t strcspn(const char *s, const char *set);

char * strpbrk(const char *s, const char *set);

char * strtok(char *s, const char *delim);

17.3 Memory Block Functions

Closely related to the string handling functions are those operating on memory blocks.The main difference to the string functions is that they operate on any block of memory,whether it is null-terminated or not. The length of the block must be given as anadditional parameter. Also, these functions work with void pointers instead of charpointers.

Listing: ANSI-C Memory Block functions

void * memcpy(void *to, const void *from, size_t size);void * memmove(void *to, const void *from, size_t size);

int memcmp(const void *p, const void *q, size_t size);

void * memchr(const void *adr, int byte, size_t size);

void * memset(void *adr, int byte, size_t size);

17.4 Mathematical Functions

The ANSI library contains a variety of floating point functions. The standard interface,which is defined for type double, has been augmented by an alternate interface (andimplementation) using type float.

Listing: ANSI-C Double-Precision mathematical functions

Memory Block Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

460 Freescale Semiconductor, Inc.

Page 461: CodeWarrior Development Studio for Microcontrollers V10.x RS08

double acos(double x);double asin(double x);

double atan(double x);

double atan2(double x, double y);

double ceil(double x);

double cos(double x);

double cosh(double x);

double exp(double x);

double fabs(double x);

double floor(double x);

double fmod(double x, double y);

double frexp(double x, int *exp);

double ldexp(double x, int exp);

double log(double x);

double log10(double x);

double modf(double x, double *ip);

double pow(double x, double y);

double sin(double x);

double sinh(double x);

double sqrt(double x);

double tan(double x);

double tanh(double x);

The functions using the float type have the same names with an f appended.

Listing: ANSI-C Single-Precision mathematical functions

float acosf(float x);float asinf(float x);

float atanf(float x);

float atan2f(float x, float y);

float ceilf(float x);

float cosf(float x);

float coshf(float x);

float expf(float x);

float fabsf(float x);

Chapter 17 Library Structure

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 461

Page 462: CodeWarrior Development Studio for Microcontrollers V10.x RS08

float floorf(float x);

float fmodf(float x, float y);

float frexpf(float x, int *exp);

float ldexpf(float x, int exp);

float logf(float x);

float log10f(float x);

float modff(float x, float *ip);

float powf(float x, float y);

float sinf(float x);

float sinhf(float x);

float sqrtf(float x);

float tanf(float x);

float tanhf(float x);

In addition, the ANSI library also defines a couple of functions operating on integralvalues:

Listing: ANSI-C Integral functions

int abs(int i);div_t div(int a, int b);

long labs(long l);

ldiv_t ldiv(long a, long b);

Furthermore, the ANSI-C library contains a simple pseudo-random number generator anda function for generating a seed to start the random-number generator:

Listing: Random number generator functions

int rand(void);void srand(unsigned int seed);

17.5 Memory Management

To allocate and deallocate memory blocks, the ANSI library provides the followingfunctions:

Listing: Memory allocation functions

Memory Management

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

462 Freescale Semiconductor, Inc.

Page 463: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void* malloc(size_t size);void* calloc(size_t n, size_t size);

void* realloc(void* ptr, size_t size);

void free(void* ptr);

Because it is not possible to implement these functions in a way that suits all possibletarget processors and memory configurations, all these functions are based on the systemmodule heap.cfile, which can be modified by the user to fit a particular memory layout.

17.6 Searching and Sorting

The ANSI library contains both a generalized searching and a generalized sortingprocedure:

Listing: Generalized searching and sorting functions

void* bsearch(const void *key, const void *array, size_t n, size_t size, cmp_func f);

void qsort(void *array, size_t n, size_t size, cmp_func f);

Character Functions

These functions test or convert characters. All these functions are implemented both asmacros and as functions, and, by default, the macros are active. To use the correspondingfunction, you have to #undefine the macro.

Listing: ANSI-C character functions

int isalnum(int ch);int isalpha(int ch);

int iscntrl(int ch);

int isdigit(int ch);

int isgraph(int ch);

int islower(int ch);

int isprint(int ch);

int ispunct(int ch);

int isspace(int ch);

int isupper(int ch);

int isxdigit(int ch);

Chapter 17 Library Structure

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 463

Page 464: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int tolower(int ch);

int toupper(int ch);

The ANSI library also defines an interface for multibyte and wide characters. Theimplementation only offers minimum support for this feature: the maximum length of amultibyte character is one byte.

Listing: Interface for multibyte and wide characters

int mblen(char *mbs, size_t n);size_t mbstowcs(wchar_t *wcs, const char *mbs, size_t n);

int mbtowc(wchar_t *wc, const char *mbc, size_t n);

size_t wcstombs(char *mbs, const wchar_t *wcs size_t n);

int wctomb(char *mbc, wchar_t wc);

17.7 System Functions

The ANSI standard includes some system functions for raising and responding to signals,non-local jumping, and so on.

Listing: ANSI-C system functions

void abort(void);int atexit(void(* func) (void));

void exit(int status);

char* getenv(const char* name);

int system(const char* cmd);

int setjmp(jmp_buf env);

void longjmp(jmp_buf env, int val);

_sig_func signal(int sig, _sig_func handler);

int raise(int sig);

To process variable-length argument lists, the ANSI library provides the functions shownin the following listing, implemented as macros:

Listing: Macros with variable-length arguments

void va_start(va_list args, param);type va_arg(va_list args, type);

System Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

464 Freescale Semiconductor, Inc.

Page 465: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void va_end(va_list args);

17.8 Time Functions

In the ANSI library, there also are several function to get the current time. In anembedded systems environment, implementations for these functions cannot be providedbecause different targets may use different ways to count the time.

Listing: ANSI-C time functions

clock_t clock(void);time_t time(time_t *time_val);

struct tm * localtime(const time_t *time_val);

time_t mktime(struct tm *time_rec);

char * asctime(const struct tm *time_rec);

char ctime(const time *time_val);

size_t strftime(char *s, size_t n,

const char *format,

const struct tm *time_rec);

double difftime(time_t t1, time_t t2);

struct tm * gmtime(const time_t *time_val);

17.9 Locale Functions

These functions are for handling locales. The ANSI-C library only supports the minimal Cenvironment.

Listing: ANSI-C locale functions

struct lconv *localeconv(void);char *setlocale(int cat, const char *locale);

int strcoll(const char *p, const char *q);

size_t strxfrm(const char *p, const char *q, size_t n);

Chapter 17 Library Structure

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 465

Page 466: CodeWarrior Development Studio for Microcontrollers V10.x RS08

17.10 Conversion Functions

Functions for converting strings to numbers are found in the following listing.

Listing: AN SI-C string/number conversion functions

int atoi(const char *s);long atol(const char *s);

double atof(const char *s);

long strtol(const char *s, char **end, int base);

unsigned long strtoul(const char *s, char **end, int base);

double strtod(const char *s, char **end);

17.11 printf() and scanf()

More conversions are possible for the C functions for reading and writing formatted data.These functions are shown in the following listing.

Listing: ANSI-C read and write functions

int sprintf(char *s, const char *format, ...);int vsprintf(char *s, const char *format, va_list args);

int sscanf(const char *s, const char *format, ...);

17.12 File I/O

The ANSI-C library contains a fairly large interface for file I/O. In microcontrollerapplications however, one usually does not need file I/O. In the few cases where onewould need it, the implementation depends on the actual setup of the target system.Therefore, it is impossible for Freescale to provide an implementation for these featuresthat the user has to specifically implement.

The following listing contains file I/O functions while Listing: ANSI-C functions forwriting and reading characters has functions for the reading and writing of characters.The functions for reading and writing blocks of data are found in Listing: ANSI-C

printf() and scanf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

466 Freescale Semiconductor, Inc.

Page 467: CodeWarrior Development Studio for Microcontrollers V10.x RS08

functions for reading and writing blocks of data. Functions for formatted I/O on filesare found in Listing: ANSI-C formatted I/O functions on files, and Listing: ANSI-Cpositioning functions has functions for positioning data within files.

Listing: ANSI-C file I/O functions

FILE* fopen(const char *name, const char *mode);FILE* freopen(const char *name, const char *mode, FILE *f);

int fflush(FILE *f);

int fclose(FILE *f);

int feof(FILE *f);

int ferror(FILE *f);

void clearerr(FILE *f);

int remove(const char *name);

int rename(const char *old, const char *new);

FILE* tmpfile(void);

char* tmpnam(char *name);

void setbuf(FILE *f, char *buf);

int setvbuf(FILE *f, char *buf, int mode, size_t size);

Listing: ANSI-C functions for writing and reading characters

int fgetc(FILE *f);char* fgets(char *s, int n, FILE *f);

int fputc(int c, FILE *f);

int fputs(const char *s, FILE *f);

int getc(FILE *f);

int getchar(void);

char* gets(char *s);

int putc(int c, FILE *f);

int puts(const char *s);

int ungetc(int c, FILE *f);

Listing: ANSI-C functions for reading and writing blocks of data

size_t fread(void *buf, size_t size, size_t n, FILE *f);size_t fwrite(void *buf, size_t size, size_t n, FILE *f);

Listing: ANSI-C formatted I/O functions on files

Chapter 17 Library Structure

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 467

Page 468: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int fprintf(FILE *f, const char *format, ...);int vfprintf(FILE *f, const char *format, va_list args);

int fscanf(FILE *f, const char *format, ...);

int printf(const char *format, ...);

int vprintf(const char *format, va_list args);

int scanf(const char *format, ...);

Listing: ANSI-C positioning functions

int fgetpos(FILE *f, fpos_t *pos);int fsetpos(FILE *f, const fpos_t *pos);

int fseek(FILE *f, long offset, int mode);

long ftell(FILE *f);

void rewind(

File I/O

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

468 Freescale Semiconductor, Inc.

Page 469: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 18Types and Macros in Standard Library

This chapter discusses all types and macros defined in the ANSI standard library. Wecover each of the header files, in alphabetical order.

18.1 errno.h

This header file just declared two constants, that are used as error indicators in the globalvariable errno.

extern int errno;

#define EDOM -1

#define ERANGE -2

18.2 float.h

Defines constants describing the properties of floating point arithmetic. Refer to thefollowing tables:

Table 18-1. Rounding and Radix Constants

Constant Description

FLT_ROUNDS Gives the rounding mode implemented

FLT_RADIX The base of the exponent

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 469

Page 470: CodeWarrior Development Studio for Microcontrollers V10.x RS08

All other constants are prefixed by either FLT_, DBL_ or LDBL_. FLT_ is a constant for typefloat, DBL_ for double and LDBL_ for longdouble.

Table 18-2. Other constants defined in float.h

Constant Description

DIG Number of significant digits.

EPSILON Smallest positive x for which 1.0 + x != x.

MANT_DIG Number of binary mantissa digits.

MAX Largest normalized finite value.

MAX_EXP Maximum exponent such that FLT_RADIXMAX_EXP is afinite normalized value.

MAX_10_EXP Maximum exponent such that 10MAX_10_EXP is a finitenormalized value.

MIN Smallest positive normalized value.

MIN_EXP Smallest negative exponent such that FLT_RADIXMIN_EXPis a normalized value.

MIN_10_EXP Smallest negative exponent such that 10MIN_10_EXP is anormalized value.

18.3 limits.h

Defines a couple of constants for the maximum and minimum values that are allowed forcertain types. Refer to the following table:

Table 18-3. Constants Defined in limits.h

Constant Description

CHAR_BIT Number of bits in a character

SCHAR_MIN Minimum value for signed char

SCHAR_MAX Maximum value for signed char

UCHAR_MAX Maximum value for unsigned char

CHAR_MIN Minimum value for char

CHAR_MAX Maximum value for char

MB_LEN_MAX Maximum number of bytes for a multi-byte character.

SHRT_MIN Minimum value for short int

SHRT_MAX Maximum value for short int

USHRT_MAX Maximum value for unsigned short int

INT_MIN Minimum value for int

INT_MAX Maximum value for int

UINT_MAX Maximum value for unsigned int

Table continues on the next page...

limits.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

470 Freescale Semiconductor, Inc.

Page 471: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 18-3. Constants Defined in limits.h (continued)

Constant Description

LONG_MIN Minimum value for long int

LONG_MAX Maximum value for long int

ULONG_MAX Maximum value for unsigned long int

18.4 locale.h

The header file in the following listing defines a struct containing all the locale specificvalues.

Listing: Locale-specific values

struct lconv { /* "C" locale (default) */ char *decimal_point; /* "." */

/* Decimal point character to use for non-monetary numbers */

char *thousands_sep; /* "" */

/* Character to use to separate digit groups in

the integral part of a non-monetary number. */

char *grouping; /* "\CHAR_MAX" */

/* Number of digits that form a group. CHAR_MAX

means "no grouping", '\0' means take previous

value. For example, the string "\3\0" specifies the

repeated use of groups of three digits. */

char *int_curr_symbol; /* "" */

/* 4-character string for the international

currency symbol according to ISO 4217. The

last character is the separator between currency symbol

and amount. */

char *currency_symbol; /* "" */

/* National currency symbol. */

char *mon_decimal_point; /* "." */

char *mon_thousands_sep; /* "" */

char *mon_grouping; /* "\CHAR_MAX" */

Chapter 18 Types and Macros in Standard Library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 471

Page 472: CodeWarrior Development Studio for Microcontrollers V10.x RS08

/* Same as decimal_point etc., but

for monetary numbers. */

char *positive_sign; /* "" */

/* String to use for positive monetary numbers.*/

char *negative_sign; /* "" */

/* String to use for negative monetary numbers. */

char int_frac_digits; /* CHAR_MAX */

/* Number of fractional digits to print in a

monetary number according to international format. */

har frac_digits; /* CHAR_MAX */

/* The same for national format. */

char p_cs_precedes; /* 1 */

/* 1 indicates that the currency symbol is left of a

positive monetary amount; 0 indicates it is on the right. */

char p_sep_by_space; /* 1 */

/* 1 indicates that the currency symbol is

separated from the number by a space for

positive monetary amounts. */

char n_cs_precedes; /* 1 */

char n_sep_by_space; /* 1 */

/* The same for negative monetary amounts. */

char p_sign_posn; /* 4 */

char n_sign_posn; /* 4 */

/* Defines the position of the sign for positive

and negative monetary numbers:

0 amount and currency are in parentheses

1 sign comes before amount and currency

2 sign comes after the amount

3 sign comes immediately before the currency

4 sign comes immediately after the currency */

};

There also are several constants that can be used in setlocale() to define which part of thelocale to set. Refer to the following table:

locale.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

472 Freescale Semiconductor, Inc.

Page 473: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 18-4. Constants used with setlocal()

Constant Description

LC_ALL Changes the complete locale

LC_COLLATE Only changes the locale for the strcoll() and strxfrm()functions

LC_MONETARY Changes the locale for formatting monetary numbers

LC_NUMERIC Changes the locale for numeric, i.e., non-monetary formatting

LC_TIME Changes the locale for the strftime() function

LC_TYPE Changes the locale for character handling and multi-bytecharacter functions

This implementation only supports the minimum C locale.

18.5 math.h

Defines just this constant:

HUGE_VAL

Large value that is returned if overflow occurs.

18.6 setjmp.h

Contains just this type definition:

typedef jmp_buf;

A buffer for setjmp() to store the current program state.

18.7 signal.h

Defines signal handling constants and types. Refer to the following tables.

Chapter 18 Types and Macros in Standard Library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 473

Page 474: CodeWarrior Development Studio for Microcontrollers V10.x RS08

typedef sig_atomic_t;

Table 18-5. Constants defined in signal.h

Constant Definition

SIG_DFL If passed as the second argument to signal, the defaultresponse is installed.

SIG_ERR Return value of signal(), if the handler could not be installed.

SIG_IGN If passed as the second argument to signal(), the signal isignored.

Table 18-6. Signal Type Constants

Constant Definition

SIGABRT Abort program abnormally

SIGFPE Floating point error

SIGILL Illegal instruction

SIGINT Interrupt

SIGSEGV Segmentation violation

SIGTERM Terminate program normally

18.8 stddef.h

Defines a few generally useful types and constants. Refer to the following table:

Table 18-7. Constants Defined in stddef.h

Constant Description

ptrdiff_t The result type of the subtraction of two pointers.

size_t Unsigned type for the result of sizeof.

wchar_t Integral type for wide characters.

#define NULL ((void *) 0)

size_t offsetof ( type, struct_member) Returns the offset of field struct_member in struct type.

18.9 stdio.h

There are two type declarations in this header file. Refer to the following table:

stddef.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

474 Freescale Semiconductor, Inc.

Page 475: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 18-8. Type definitions in stdio.h

Type Definition Description

FILE Defines a type for a file descriptor.

fpos_t A type to hold the position in the file as needed by fgetpos()and fsetpos().

The following table lists the constants defined in stdio.h.

Table 18-9. Constants defined in stdio.h

Constant Description

BUFSIZ Buffer size for setbuf().

EOF Negative constant to indicate end-of-file.

FILENAME_MAX Maximum length of a filename.

FOPEN_MAX Maximum number of open files.

_IOFBF To set full buffering in setvbuf().

_IOLBF To set line buffering in setvbuf().

_IONBF To switch off buffering in setvbuf().

SEEK_CUR fseek() positions relative from current position.

SEEK_END fseek() positions from the end of the file.L

SEEK_SET fseek() positions from the start of the file.

TMP_MAX Maximum number of unique filenames tmpnam() cangenerate.

In addition, there are three variables for the standard I/O streams:

extern FILE * stderr, *stdin, *stdout;

18.10 stdlib.h

Besides a redefinition of NULL, size_t and wchar_t, this header file contains the typedefinitions listed in the following table.

Table 18-10. Type Definitions in stdlib.h

Type Definition Description

typedef div_t; A struct for the return value of div().

typedef ldiv_t; A struct for the return value of ldiv().

Chapter 18 Types and Macros in Standard Library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 475

Page 476: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The following table lists the constants defined in stdlib.h

Table 18-11. Constants Defined in stdlib.h

Constant Definition

EXIT_FAILURE Exit code for unsuccessful termination.

EXIT_SUCCESS Exit code for successful termination.

RAND_MAX Maximum return value of rand().

MB_LEN_MAX Maximum number of bytes in a multi-byte character.

18.11 time.h

This header files defines types and constants for time management. See the followinglisting.

Listing: time.h-Type Definitions and Constants

typedef clock_t;typedef time_t;

struct tm {

int tm_sec; /* Seconds */

int tm_min; /* Minutes */

int tm_hour; /* Hours */

int tm_mday; /* Day of month: 0 .. 31 */

int tm_mon; /* Month: 0 .. 11 */

int tm_year; /* Year since 1900 */

int tm_wday; /* Day of week: 0 .. 6 (Sunday == 0) */

int tm_yday; /* day of year: 0 .. 365 */

int tm_isdst; /* Daylight saving time flag:

> 0 It is DST

0 It is not DST

< 0 unknown */

};

The constant CLOCKS_PER_SEC gives the number of clock ticks per second.

time.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

476 Freescale Semiconductor, Inc.

Page 477: CodeWarrior Development Studio for Microcontrollers V10.x RS08

18.12 string.h

The file string.h defines only functions and not types or special defines.

The functions are explained below together with all other ANSI functions.

18.13 assert.h

The file assert.h defines the assert() macro. If the NDEBUG macro is defined, then assert doesnothing. Otherwise, assert calls the auxiliary function _assert if the one macro parameterof assert evaluates to 0 (FALSE). See the following listing.

Listing: Use assert() to assist in debugging

#ifdef NDEBUG #define assert(EX)

#else

#define assert(EX) ((EX) ? 0 : _assert(__LINE__, __FILE__))

#endif

18.14 stdarg.h

The file stdarg.h defines the type va_list and the va_arg(), va_end(), and va_start()macros. The va_list type implements a pointer to one argument of a open parameter list.The va_start() macro initializes a variable of type va_list to point to the first openparameter, given the last explicit parameter and its type as arguments. The va_arg() macroreturns one open parameter, given its type and also makes the va_list argument pointingto the next parameter. The va_end() macro finally releases the actual pointer. For allimplementations, the va_end() macro does nothing because va_list is implemented as anelementary data type and therefore it must not be released. The va_start() and the va_arg()macros have a type parameter, which is accessed only with sizeof(). So type, but alsovariables can be used. See the following listing for an example using stdarg.h.

Listing: Example using stdarg.h

Chapter 18 Types and Macros in Standard Library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 477

Page 478: CodeWarrior Development Studio for Microcontrollers V10.x RS08

char sum(long p, ...) {

char res=0;

va_list list= va_start()(p, long);

res= va_arg(list, int); // (*)

va_end(list);

return res;

}

void main(void) {

char c = 2;

if (f(10L, c) != 2) Error();

}

In the line (*) va_arg must be called with int, not with char. Because of the defaultargument-promotion rules of C, for integral types at least an int is passed and for floatingtypes at least a double is passed. In other words, the result of using va_arg(..., char) orva_arg(..., short) is undefined in C. Be especially careful when using variables instead oftypes for va_arg(). In the example above, res= va_arg(list, res) is not correct unless reshas the type int and not char.

18.15 ctype.h

The ctype.h file defines functions to check properties of characters, as if a character is adigit - isdigit(), a space - isspace(), and many others. These functions are eitherimplemented as macros, or as real functions. The macro version is used when the -Otcompiler option is used or the macro __OPTIMIZE_FOR_TIME__ is defined. The macros use atable called _ctype.whose length is 257 bytes. In this array, all properties tested by thevarious functions are encoded by single bits, taking the character as indices into the array.The function implementations otherwise do not use this table. They save memory byusing the shorter call to the function (compared with the expanded macro).

The functions in the following listing are explained below together with all other ANSIfunctions.

Listing: Macros defined in ctypes.h

extern unsigned char _ctype[];#define _U (1<<0) /* Uppercase */

ctype.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

478 Freescale Semiconductor, Inc.

Page 479: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#define _L (1<<1) /* Lowercase */

#define _N (1<<2) /* Numeral (digit) */

#define _S (1<<3) /* Spacing character */

#define _P (1<<4) /* Punctuation */

#define _C (1<<5) /* Control character */

#define _B (1<<6) /* Blank */

#define _X (1<<7) /* hexadecimal digit */

#ifdef __OPTIMIZE_FOR_TIME__ /* -Ot defines this macro */

#define isalnum(c) (_ctype[(unsigned char)(c+1)] & (_U|_L|_N))

#define isalpha(c) (_ctype[(unsigned char)(c+1)] & (_U|_L))

#define iscntrl(c) (_ctype[(unsigned char)(c+1)] & _C)

#define isdigit(c) (_ctype[(unsigned char)(c+1)] & _N)

#define isgraph(c) (_ctype[(unsigned char)(c+1)] & (_P|_U|_L|_N))

#define islower(c) (_ctype[(unsigned char)(c+1)] & _L)

#define isprint(c) (_ctype[(unsigned char)(c+1)] & (_P|_U|_L|_N|_B))

#define ispunct(c) (_ctype[(unsigned char)(c+1)] & _P)

#define isspace(c) (_ctype[(unsigned char)(c+1)] & _S)

#define isupper(c) (_ctype[(unsigned char)(c+1)] & _U)

#define isxdigit(c)(_ctype[(unsigned char)(c+1)] & _X)

#define tolower(c) (isupper(c) ? ((c) - 'A' + 'a') : (c))

#define toupper(c) (islower(c) ? ((c) - 'a' + 'A') : (c))

#define isascii(c) (!((c) & ~127))

#define toascii(c) (c & 127)

#endif /* __OPTIMIZE_FOR_TIME__ */

Chapter 18 Types and Macros in Standard Library

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 479

Page 480: CodeWarrior Development Studio for Microcontrollers V10.x RS08

ctype.h

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

480 Freescale Semiconductor, Inc.

Page 481: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 19Standard Functions

This section describes all the standard functions in the ANSI-C library. Each functiondescription contains the subsections listed in the following table.

Table 19-1. Function Description Subsections

Subsection Description

Syntax Shows the function's prototype and also which header file toinclude.

Description A description of how to use the function.

Return Describes what the function returns in which case. If theglobal variable errno is modified by the function, possiblevalues are also described.

See also Contains cross-references to related functions.

The functions listed in this section also include some functions which are notimplemented in the Compiler. These unimplemented functions are categorized as:

• Hardware specific• File I/O

19.1 abort()

Syntax

#include< stdlib.h >

void abort(void);

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 481

Page 482: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

abort() terminates the program. It does the following (in this order):

• raises signal SIGABRT• flushes all open output streams• closes all open files• removes all temporary files• calls HALT

If your application handles SIGABRT and the signal handler does not return (e.g., because itdoes a longjmp()), the application is not halted.

See also

atexit(),

exit(),

raise(), and

signal()

19.2 abs()

Syntax

#include <stdlib.h >

int abs(int i);

Description

abs() computes the absolute value of i.

Return

The absolute value of i; i.e., i if i is positive and -i if i is negative. If i is -32768, thisvalue is returned and errno is set to ERANGE.

See also

fabs() and fabsf()

abs()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

482 Freescale Semiconductor, Inc.

Page 483: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.3 acos() and acosf()

Syntax

#include <math.h >

double acos(double x);

float acosf(float x);

Description

acos() computes the principal value of the arc cosine of x.

Return

The arc cosine cos^(-1)(x) of x in the range between 0 and Pi if x is in the range -1 <= x <=1. If x is not in this range, NAN is returned and errno is set to EDOM.

See also

asin() and asinf(),

atan() and atanf(),

atan2() and atan2f(),

cos() and cosf(),

sin() and sinf(), and

tan() and tanf()

19.4 asctime()

This is a Hardware-specific function. It is not implemented in the Compiler.

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 483

Page 484: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <time.h >

char * asctime(const struct tm* timeptr);

Description

asctime() converts the time, broken down in timeptr, into a string.

Return

A pointer to a string containing the time string.

See also

localtime(),

mktime(), and

time()

19.5 asin() and asinf()

Syntax

#include <math.h >

double asin(double x);

float asinf(float x);

Description

asin() computes the principal value of the arc sine of x.

Return

The arc sine sin^(-1)(x) of x in the range between -Pi/2 and Pi/2 if x is in the range -1 <= x<= 1. If x is not in this range, NAN is returned and errno is set to EDOM.

See also

asin() and asinf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

484 Freescale Semiconductor, Inc.

Page 485: CodeWarrior Development Studio for Microcontrollers V10.x RS08

acos() and acosf(),

atan() and atanf(),

atan2() and atan2f(),

cos() and cosf(), and

tan() and tanf()

19.6 assert()

Syntax

#include <assert.h >

void assert(int expr);

Description

assert() is a macro that indicates expression expr is expected to be true at this point in theprogram. If expr is false (0), assert() halts the program. Compiling with option -DNDEBUG orplacing the preprocessor control statement

#define NDEBUG

before the #include <assert.h > statement effectively deletes all assertions from theprogram.

See also

abort() and

exit()

19.7 atan() and atanf()

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 485

Page 486: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <math.h >

double atan (double x);

float atanf(float x);

Description

atan() computes the principal value of the arc tangent of x.

Return

The arc tangent tan^(-1)(x), in the range from -Pi/2 to Pi/2 radian

See also

acos() and acosf(),

asin() and asinf(),

atan2() and atan2f(),

cos() and cosf(),

sin() and sinf(), and

tan() and tanf()

19.8 atan2() and atan2f()

Syntax

#include <math.h >

double atan2(double y, double x);

float atan2f(float y, float x);

atan2() and atan2f()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

486 Freescale Semiconductor, Inc.

Page 487: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

atan2() computes the principal value of the arc tangent of y/x. It uses the sign of bothoperands to determine the quadrant of the result.

Return

The arc tangent tan^(-1)(y/x), in the range from -Pi to Pi radian, if not both x and y are 0.If both x and y are 0, it returns 0.

See also

acos() and acosf(),

asin() and asinf(),

atan() and atanf(),

cos() and cosf(),

sin() and sinf(), and

tan() and tanf()

19.9 atexit()

Syntax

#include <stdlib.h >

int atexit(void (*func) (void));

Description

atexit() lets you install a function that is to be executed just before the normaltermination of the program. You can register at most 32 functions with atexit(). Thesefunctions are called in the reverse order they were registered.

Return

atexit() returns 0 if it could register the function, otherwise it returns a non-zero value.

See also

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 487

Page 488: CodeWarrior Development Studio for Microcontrollers V10.x RS08

abort() and

exit()

19.10 atof()

Syntax

#include <stdlib.h >

double atof(const char *s);

Description

atof() converts the string s to a double floating point value, skipping over white space atthe beginning of s. It stops converting when it reaches either the end of the string or acharacter that cannot be part of the number. The number format accepted by atof is thefollowing:

FloatNum = Sign{Digit}[.{Digit}][Exp]

Sign = [+|-]

Digit = <any decimal digit from 0 to 9>

Exp = (e|E) SignDigit{Digit}

Return

atof() returns the converted double floating point value.

See also

atoi(),

strtod(),

atof()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

488 Freescale Semiconductor, Inc.

Page 489: CodeWarrior Development Studio for Microcontrollers V10.x RS08

strtol(), and

strtoul()

19.11 atoi()

Syntax

#include <stdlib.h >

int atoi(const char *s);

Description

atoi() converts the string s to an integer value, skipping over white space at the beginningof s. It stops converting when it reaches either the end of the string or a character thatcannot be part of the number. The number format accepted by atoi is the following:

Number = [+|-]Digit{Digit}

Return

atoi() returns the converted integer value.

See also

atof(),

atol(),

strtod(),

strtol(), and

strtoul()

19.12 atol()

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 489

Page 490: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <stdlib.h >

long atol(const char *s);

Description

atol() converts the string s to an long value, skipping over white space at the beginning ofs. It stops converting when it reaches either the end of the string or a character that cannotbe part of the number. The number format accepted by atol() is the following:

Number = [+|-]Digit{Digit}

Return

atol() returns the converted long value.

See also

atoi(),

atof(),

strtod(),

strtol(), and

strtoul()

19.13 bsearch()

Syntax

#include <stdlib.h >

void *bsearch(const void *key, const void *array, size_t n, size_t size, cmp_func cmp());

Description

bsearch() performs a binary search in a sorted array. It calls the comparison function cmp()with two arguments: a pointer to the key element that is to be found and a pointer to anarray element. Thus, the type cmp_func can be declared as:

bsearch()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

490 Freescale Semiconductor, Inc.

Page 491: CodeWarrior Development Studio for Microcontrollers V10.x RS08

typedef int (*cmp_func)(const void *key, const void *data);

The comparison function returns an integer according to, as listed in the following table:

Table 19-2. Return value from the comparison function, cmp_func()

Key element value Return value

less than the array element less than zero (negative)

equal to the array element zero

greater than the array element greater than zero (positive)

The arguments of bsearch() are as listed in the following table:

Table 19-3. Possible arguments to the bsearch() function

Parameter Name Meaning

key A pointer to the key data you are seeking

array A pointer to the beginning (i.e., the first element) of the arraythat is searched

n The number of elements in the array

size The size (in bytes) of one element in the table

cmp() The comparison function

NOTEMake sure the array contains only elements of the same size.bsearch() also assumes that the array is sorted in ascending orderwith respect to the comparison function cmp().

Return

bsearch() returns a pointer to an element of the array that matches the key, if there is one.If the comparison function never returns zero, i.e., there is no matching array element,bsearch() returns NULL.

19.14 calloc()

This is a Hardware-specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 491

Page 492: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void *calloc(size_t n, size_t size);

Description

calloc() allocates a block of memory for an array containing n elements of size size. Allbytes in the memory block are initialized to zero. To deallocate the block, use free(). Donot use the default implementation in interrupt routines because it is not reentrant.

Return

calloc() returns a pointer to the allocated memory block. If the block cannot be allocated,the return value is NULL.

See also

malloc() and

realloc()

19.15 ceil() and ceilf()

Syntax

#include <math.h >

double ceil(double x);

float ceilf(float x);

Description

ceil() returns the smallest integral number larger than x.

See also

floor() and floorf() and

fmod() and fmodf()

ceil() and ceilf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

492 Freescale Semiconductor, Inc.

Page 493: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.16 clearerr()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h>

void clearerr(FILE *f);

Description

clearerr() resets the error flag and the EOF marker of file f.

19.17 clock()

This is a Hardware-specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >

clock_t clock(void);

Description

clock() determines the amount of time since your system started, in clock ticks. Toconvert to seconds, divide by CLOCKS_PER_SEC.

Return

clock() returns the amount of time since system startup.

See also

time()

19.18 cos() and cosf()

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 493

Page 494: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <time.h >

double cos(double x);

float cosf(float x);

Description

cos() computes the principal value of the cosine of x. Express x in radians.

Return

The cosine cos(x)

See also

acos() and acosf(),

asin() and asinf(),

atan() and atanf(),

atan2() and atan2f(),

sin() and sinf(), and

tan() and tanf()

19.19 cosh() and coshf()

Syntax

#include <time.h >

double cosh (double x);

float coshf(float x);

Description

cosh() and coshf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

494 Freescale Semiconductor, Inc.

Page 495: CodeWarrior Development Studio for Microcontrollers V10.x RS08

cosh() computes the hyperbolic cosine of x.

Return

The hyperbolic cosine cosh(x). If the computation fails because the value is too large,HUGE_VAL is returned and errno is set to ERANGE.

See also

cos() and cosf(),

sinh() and sinhf(), and

tanh() and tanhf()

19.20 ctime()

This is a Hardware-specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >

char *ctime(const time_t *timer);

Description

ctime() converts the calendar time timer to a character string.

Return

The string containing the ASCII representation of the date.

See also

asctime(),

mktime(), and

time()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 495

Page 496: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.21 difftime()

This is a Hardware-specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >

double difftime(time_t *t1, time_t t0);

Description

difftime() calculates the number of seconds between any two calendar times.

Return

The number of seconds between the two times, as a double.

See also

mktime() and

time()

19.22 div()

Syntax

#include <stdlib.h >

div_t div(int x, int y);

Description

div() computes both the quotient and the modulus of the division x/y.

Return

A structure with the results of the division.

div()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

496 Freescale Semiconductor, Inc.

Page 497: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

ldiv()

19.23 exit()

Syntax

#include <stdlib.h >

void exit(int status);

Description

exit() terminates the program normally. It does the following, in this order:

• executes all functions registered with atexit()• flushes all open output streams• closes all open files• removes all temporary files• calls HALT

The status argument is ignored.

See also

abort()

19.24 exp() and expf()

Syntax

#include <math.h >

double exp (double x);

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 497

Page 498: CodeWarrior Development Studio for Microcontrollers V10.x RS08

float expf(float x);

Description

exp() computes ex, where e is the base of natural logarithms.

Return

ex. If the computation fails because the value is too large, HUGE_VAL is returned and errno isset to ERANGE.

See also

log() and logf(),

log10() and log10f(), and

pow() and powf()

19.25 fabs() and fabsf()

Syntax

#include <math.h >

double fabs (double x);

float fabsf(float x);

Description

fabs() computes the absolute value of x.

Return

The absolute value of x for any value of x.

See also

abs() and

labs()

fabs() and fabsf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

498 Freescale Semiconductor, Inc.

Page 499: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.26 fclose()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fclose(FILE *f);

Description

fclose() closes file f. Before doing so, it does the following:

• flushes the stream, if the file was not opened in read-only mode• discards and deallocates any buffers that were allocated automatically, i.e., not using

setbuf().

Return

Zero, if the function succeeds; EOF otherwise.

See also

fopen()

19.27 feof()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int feof(FILE *f);

Description

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 499

Page 500: CodeWarrior Development Studio for Microcontrollers V10.x RS08

feof() tests whether previous I/O calls on file f tried to do anything beyond the end of thefile.

NOTECalling clearerr() or fseek() clears the file's end-of-file flag;therefore feof() returns 0.

Return

Zero, if you are not at the end of the file; EOF otherwise.

19.28 ferror()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int ferror(FILE *f);

Description

ferror() tests whether an error had occurred on file f. To clear the error indicator of a file,use clearerr(). rewind() automatically resets the file's error flag.

NOTEDo not use ferror() to test for end-of-file. Use feof() instead.

Return

Zero, if there was no error; non-zero otherwise.

19.29 fflush()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

ferror()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

500 Freescale Semiconductor, Inc.

Page 501: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <stdio.h >

int fflush(FILE *f);

Description

fflush() flushes the I/O buffer of file f, allowing a clean switch between reading andwriting the same file. If the program was writing to file f, fflush() writes all buffered datato the file. If it was reading, fflush() discards any buffered data. If f is NULL, all files openfor writing are flushed.

Return

Zero, if there was no error; EOF otherwise.

See also

setbuf() and

setvbuf()

19.30 fgetc()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fgetc(FILE *f);

Description

fgetc() reads the next character from file f.

NOTEIf file f had been opened as a text file, the end-of-line charactercombination is read as one '\n' character.

Return

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 501

Page 502: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The character is read as an integer in the range from 0 to 255. If there was a read error,fgetc() returns EOF and sets the file's error flag, so that a subsequent call to ferror() willreturn a non-zero value. If an attempt is made to read beyond the end of the file, fgetc()also returns EOF, but sets the end-of-file flag instead of the error flag so that feof() willreturn EOF, but ferror() will return 0.

See also

fgets(),

fopen(),

fread(),

fscanf(), and

getc()

19.31 fgetpos()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fgetpos(FILE *f, fpos_t *pos);

Description

fgetpos() returns the current file position in *pos. This value can be used to later set theposition to this one using fsetpos().

NOTEDo not assume the value in *pos to have any particular meaningsuch as a byte offset from the beginning of the file. The ANSIstandard does not require this, and in fact any value may be putinto *pos as long as there is a fsetpos() with that value resets theposition in the file correctly.

Return

Non-zero, if there was an error; zero otherwise.

fgetpos()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

502 Freescale Semiconductor, Inc.

Page 503: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

fseek() and

ftell()

19.32 fgets()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

char *fgets(char *s, int n, FILE *f);

Description

fgets() reads a string of at most n-1 characters from file f into s. Immediately after the lastcharacter read, a '\0' is appended. If fgets() reads a line break ( '\n') or reaches the endof the file before having read n-1 characters, the following happens:

• If fgets() reads a line break, it adds the '\n' plus a '\0' to s and returns successfully.• If it reaches the end of the file after having read at least 1 character, it adds a '\0' to s

and returns successfully.• If it reaches EOF without having read any character, it sets the file's end-of-file flag

and returns unsuccessfully. ( s is left unchanged.)

Return

NULL, if there was an error; s otherwise.

See also

fgetc() and

fputs()

19.33 floor() and floorf()

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 503

Page 504: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include < math.h >

double floor (double x);

float floorf(float x);

Description

floor() calculates the largest integral number not larger than x.

Return

The largest integral number not larger than x.

See also

ceil() and ceilf() and

modf() and modff()

19.34 fmod() and fmodf()

Syntax

#include <math.h >

double fmod (double x, double y);

float fmodf(float x, float y);

Description

fmod() calculates the floating point remainder of x/y.

Return

fmod() and fmodf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

504 Freescale Semiconductor, Inc.

Page 505: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The floating point remainder of x/y, with the same sign as x. If y is 0, it returns 0 and setserrno to EDOM.

See also

div(),

ldiv(),

ldexp() and ldexpf(), and

modf() and modff()

19.35 fopen()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

FILE *fopen(const char *name, const char *mode);

Description

fopen() opens a file with the given name and mode. It automatically allocates an I/Obuffer for the file.

There are three main modes: read, write, and update (i.e., both read and write) accesses.Each can be combined with either text or binary mode to read a text file or update abinary file. Opening a file for text accesses translates the end-of-line character(combination) into '\n' when reading and vice versa when writing. The following tablelists all possible modes.

Table 19-4. Operating modes of the file opening function, fopen()

Mode Effect

r Open the file as a text file for reading.

w Create a text file and open it for writing.

a Open the file as a text file for appending

rb Open the file as a binary file for reading.

wb Create a file and open as a binary file for writing.

Table continues on the next page...

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 505

Page 506: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 19-4. Operating modes of the file opening function, fopen() (continued)

Mode Effect

ab Open the file as a binary file for appending.

r+ Open a text file for updating.

w+ Create a text file and open for updating.

a+ Open a text file for updating. Append all writes to the end.

r+b, or rb+ Open a binary file for updating.

w+b, or wb+ Create a binary file and open for updating.

a+b, or ab+ Open a binary file for updating, appending all writes to theend.

If the mode contains an " r", but the file does not exist, fopen() returns unsuccessfully.Opening a file for appending (mode contains " a") always appends writing to the end,even if fseek(), fsetpos(), or rewind() is called. Opening a file for updating allows bothread and write accesses on the file. However, fseek(), fsetpos() or rewind() must be calledin order to write after a read or to read after a write.

Return

A pointer to the file descriptor of the file. If the file could not be created, the functionreturns NULL.

See also

fclose(),

freopen(),

setbuf() and

setvbuf()

19.36 fprintf()

Syntax

#include <stdio.h >

int fprintf(FILE *f, const char *format,...);

Description

fprintf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

506 Freescale Semiconductor, Inc.

Page 507: CodeWarrior Development Studio for Microcontrollers V10.x RS08

fprintf() is the same as sprintf(), but the output goes to file f instead of a string.

For a detailed format description see sprintf().

Return

The number of characters written. If some error occurs, fprintf() returns EOF.

See also

printf() and

vfprintf(), vprintf(), and vsprintf()

19.37 fputc()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fputc(int ch, FILE *f);

Description

fputc() writes a character to file f.

Return

The integer value of ch. If an error occurs, fputc() returns EOF.

See also

fputs()

19.38 fputs()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 507

Page 508: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <stdio.h >

int fputs(const char *s, FILE *f);

Description

fputs() writes the zero-terminated string s to file f (without the terminating '\0'.

Return

EOF, if there was an error; zero otherwise.

See also

fputc()

19.39 fread()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

size_t fread(void *ptr, size_t size, size_t n, FILE *f);

Description

fread() reads a contiguous block of data. It attempts to read n items of size size from file fand stores them in the array to which ptr points. If either n or size is 0, nothing is readfrom the file and the array is left unchanged.

Return

The number of items successfully read.

See also

fgetc(),

fgets(), and

fwrite()

fread()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

508 Freescale Semiconductor, Inc.

Page 509: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.40 free()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

void free(void *ptr);

Description

free() deallocates a memory block that had previously been allocated by calloc(),malloc(), or realloc(). If ptr is NULL, nothing happens. Do not use the defaultimplementation in interrupt routines because it is not reentrant.

19.41 freopen()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

void freopen(const char *name,

const char *mode,

FILE *f);

Description

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 509

Page 510: CodeWarrior Development Studio for Microcontrollers V10.x RS08

freopen() opens a file using a specific file descriptor. This can be useful for redirectingstdin, stdout, or stderr. About possible modes, see fopen().

See also

fclose()

19.42 frexp() and frexpf()

Syntax

#include <math.h >

double frexp(double x, int *exp);

float frexpf(float x, int *exp);

Description

frexp() splits a floating point number into mantissa and exponent. The relation is x = m *2^exp. m always is normalized to the range 0.5 < m <= 1.0. The mantissa has the same signas x.

Return

The mantissa of x (the exponent is written to *exp). If x is 0.0, both the mantissa (the returnvalue) and the exponent are 0.

See also

exp() and expf(),

ldexp() and ldexpf(), and

modf() and modff()

19.43 fscanf()

frexp() and frexpf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

510 Freescale Semiconductor, Inc.

Page 511: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h > int fscanf(FILE *f, const char *format,...);

Description

fscanf() is the same as scanf() but the input comes from file f instead of a string.

Return

The number of data arguments read, if any input was converted. If not, it returns EOF.

See also

fgetc(),

fgets(), and

scanf()

19.44 fseek()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fseek(FILE *f, long offset, int mode);

Description

fseek() sets the current position in file f.

For binary files, the position can be set in three ways, as shown in the following table.

Table 19-5. Offset position into the file for the fseek() function

Mode Offset position

SEEK_SET offset bytes from the beginning of the file.

SEEK_CUR offset bytes from the current position.

SEEK_END offset bytes from the end of the file.

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 511

Page 512: CodeWarrior Development Studio for Microcontrollers V10.x RS08

For text files, either offset must be zero or mode is SEEK_SET and offset a value returned by aprevious call to ftell().

If fseek() is successful, it clears the file's end-of -file flag. The position cannot be setbeyond the end of the file.

Return

Zero, if successful; non-zero otherwise.

See also

fgetpos(), and

fsetpos()

19.45 fsetpos()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int fsetpos(FILE *f, const fpos_t *pos);

Description

fsetpos() sets the file position to pos, which must be a value returned by a previous call tofgetpos() on the same file. If the function is successful, it clears the file's end-of-file flag.

The position cannot be set beyond the end of the file.

Return

Zero, if it was successful; non-zero otherwise.

See also

fgetpos(),

fseek(), and

ftell()

fsetpos()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

512 Freescale Semiconductor, Inc.

Page 513: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.46 ftell()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

long ftell(FILE *f);

Description

ftell() returns the current file position. For binary files, this is the byte offset from thebeginning of the file; for text files, do not use this value except as an argument to fseek().

Return

-1, if an error occurred; otherwise the current file position.

See also

fgetpos() and

fsetpos()

19.47 fwrite()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

size_t fwrite(const void *p,

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 513

Page 514: CodeWarrior Development Studio for Microcontrollers V10.x RS08

size_t size,

size_t n,

FILE *f);

Description

fwrite() writes a block of data to file f. It writes n items of size size, starting at addressptr.

Return

The number of items successfully written.

See also

fputc(),

fputs(), and

fread()

19.48 getc()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int getc(FILE *f);

Description

getc() is the same as fgetc(), but may be implemented as a macro. Therefore, make surethat f is not an expression having side effects. See fgetc() for more information.

getc()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

514 Freescale Semiconductor, Inc.

Page 515: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.49 getchar()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int getchar(void);

Description

getchar() is the same as getc() ( stdin). See fgetc() for more information.

19.50 getenv()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

char *getenv(const char *name);

Description

getenv() returns the value of environment variable name.

Return

NULL

19.51 gets()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 515

Page 516: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

char *gets(char *s);

Description

gets() reads a string from stdin and stores it in s. It stops reading when it reaches a linebreak or EOF character. This character is not appended to the string. The string is zero-terminated.

If the function reads EOF before any other character, it sets stdin's end-of-file flag andreturns unsuccessfully without changing string s.

Return

NULL, if there was an error; s otherwise.

See also

fgetc() and

puts()

19.52 gmtime()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >

struct tm *gmtime(const time_t *time);

Description

gmtime()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

516 Freescale Semiconductor, Inc.

Page 517: CodeWarrior Development Studio for Microcontrollers V10.x RS08

gmtime() converts *time to UTC (Universal Coordinated Time), which is equivalent toGMT (Greenwich Mean Time).

Return

NULL, if UTC is not available; a pointer to a struct containing UTC otherwise.

See also

ctime() and

time()

19.53 isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(),islower(), isprint(), ispunct(), isspace(), isupper(), andisxdigit()

Syntax

#include <ctype.h >

int isalnum (int ch);

int isalpha (int ch);

...

int isxdigit(int ch);

Description

These functions determine whether character ch belongs to a certain set of characters. Thefollowing table describes the character ranges tested by the functions.

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 517

Page 518: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 19-6. Appropriate character range for the testing functions

Function Range Tested

isalnum() alphanumeric character, i.e., A-Z, a-z or 0-9.

isalpha() an alphabetic character, i.e., A-Z or a-z.

iscntrl() a control character, i.e., \000-\037 or \177 ( DEL).

isdigit() a decimal digit, i.e., 0-9.

isgraph() a printable character except space ( ! - or ~ ).

islower() a lower case letter, i.e., a-z.

isprint() a printable character ( ' '-'~').

ispunct() a punctuation character, i.e., '!'-'/', ':'-'@', '['-'''and '{'-'~'.

isspace() a white space character, i.e., ' ', '\f', '\n', '\r', '\t'and '\v'.

isupper() an upper case letter, i.e., A-Z.

isxdigit() a hexadecimal digit, i.e., 0-9, A-F or a-f.

Return

TRUE (i.e., 1), if ch is in the character class; zero otherwise.

See also

tolower() and

toupper()

19.54 labs()

Syntax

#include <stdlib.h >

long labs(long i);

Description

labs() computes the absolute value of i.

Return

labs()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

518 Freescale Semiconductor, Inc.

Page 519: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The absolute value of i, i.e., i if i is positive and -i if i is negative. If i is -2,147,483,648,this value is returned and errno is set to ERANGE.

See also

abs()

19.55 ldexp() and ldexpf()

Syntax

#include <math.h >

double ldexp (double x, int exp);

float ldexpf(float x, int exp);

Description

ldexp() multiplies x by 2exp.

Return

x*2exp. If it fails because the result would be too large, HUGE_VAL is returned and errno is setto ERANGE.

See also

exp() and expf(),

frexp() and frexpf(),

log() and logf(),

log10() and log10f(), and

modf() and modff()

19.56 ldiv()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 519

Page 520: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdlib.h >

ldiv_t ldiv(long x, long y);

Description

ldiv() computes both the quotient and the modulus of the division x/y.

Return

A structure with the results of the division.

See also

div()

19.57 localeconv()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <locale.h >

struct lconv *localeconv(void);

Description

localeconv() returns a pointer to a struct containing information about the current locale,e.g., how to format monetary quantities.

Return

A pointer to a struct containing the desired information.

See also

setlocale()

localeconv()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

520 Freescale Semiconductor, Inc.

Page 521: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.58 localtime()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >

struct tm *localetime(const time_t *time);

Description

localtime() converts *time into broken-down time.

Return

A pointer to a struct containing the broken-down time.

See also

asctime(),

mktime(), and

time()

19.59 log() and logf()

Syntax

#include <math.h >

double log (double x);

float logf(float x);

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 521

Page 522: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

log() computes the natural logarithm of x.

Return

ln(x), if x is greater than zero. If x is smaller then zero, NAN is returned; if it is equal tozero, log() returns negative infinity. In both cases, errno is set to EDOM.

See also

exp() and expf() and

log10() and log10f()

19.60 log10() and log10f()

Syntax

#include <math.h >

double log10(double x);

float log10f(float x);

Description

log10() computes the decadic logarithm (the logarithm to base 10) of x.

Return

log10(x), if x is greater than zero. If x is smaller then zero, NAN is returned; if it is equal tozero, log10() returns negative infinity. In both cases, errno is set to EDOM.

Seealso

exp() and expf() and

log10() and log10f()

log10() and log10f()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

522 Freescale Semiconductor, Inc.

Page 523: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.61 longjmp()

Syntax

#include <setjmp.h >

void longjmp(jmp_buf env, int val);

Description

longjmp() performs a non-local jump to some location earlier in the call chain. Thatlocation must have been marked by a call to setjmp(). The environment at the time of thatcall to setjmp() - env, which also was the parameter to setjmp() - is restored and yourapplication continues as if the call to setjmp() just had returned the value val.

See also

setjmp()

19.62 malloc()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

void *malloc(size_t size);

Description

malloc() allocates a block of memory for an object of size size bytes. The content of thismemory block is undefined. To deallocate the block, use free(). Do not use the defaultimplementation in interrupt routines because it is not reentrant.

Return

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 523

Page 524: CodeWarrior Development Studio for Microcontrollers V10.x RS08

malloc() returns a pointer to the allocated memory block. If the block could not beallocated, the return value is NULL.

See also

calloc() and

realloc()

19.63 mblen()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

int mblen(const char *s, size_t n);

Description

mblen() determines the number of bytes the multi-byte character pointed to by s occupies.

Return

0, if s is NULL.

-1, if the first n bytes of *s do not form a valid multi-byte character.

n, the number of bytes of the multi-byte character otherwise.

See also

mbtowc() and

mbstowcs()

19.64 mbstowcs()

This is a Hardware specific function. It is not implemented in the Compiler.

mblen()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

524 Freescale Semiconductor, Inc.

Page 525: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdlib.h >

size_t mbstowcs(wchar_t *wcs,

const char *mbs,

size_t n);

Description

mbstowcs() converts a multi-byte character string mbs to a wide character string wcs. Onlythe first n elements are converted.

Return

The number of elements converted, or (size_t) - 1 if there was an error.

See also

mblen() and

mbtowc()

19.65 mbtowc()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

int mbtowc(wchar_t *wc, const char *s, size_t n);

Description

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 525

Page 526: CodeWarrior Development Studio for Microcontrollers V10.x RS08

mbtowc() converts a multi-byte character s to a wide character code wc. Only the first nbytes of *s are taken into consideration.

Return

The number of bytes of the multi-byte character converted (size_t) if successful or -1 ifthere was an error.

See also

mblen(), and

mbstowcs()

19.66 memchr()

Syntax

#include <string.h >

void *memchr(const void *p, int ch, size_t n);

Description

memchr() looks for the first occurrence of a byte containing ( ch & 0xFF) in the first n bytesof the memory are pointed to by p.

Return

A pointer to the byte found, or NULL if no such byte was found.

See also

memcmp(),

strchr(), and

strrchr()

19.67 memcmp()

memchr()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

526 Freescale Semiconductor, Inc.

Page 527: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <string.h >

void *memcmp(const void *p,

const void *q,

size_t n);

Description

memcmp() compares the first n bytes of the two memory areas pointed to by p and q.

Return

A positive integer, if p is considered greater than q; a negative integer if p is consideredsmaller than q or zero if the two memory areas are equal.

See also

memchr(),

strcmp(), and

strncmp()

19.68 memcpy() and memmove()

Syntax

#include <string.h >

void *memcpy(const void *p,

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 527

Page 528: CodeWarrior Development Studio for Microcontrollers V10.x RS08

const void *q,

size_t n);

void *memmove(const void *p,

const void *q,

size_t n);

Description

Both functions copy n bytes from q to p. memmove() also works if the two memory areasoverlap.

Return

p

See also

strcpy() and

strncpy()

19.69 memset()

Syntax

#include <string.h >

void *memset(void *p, int val, size_t n);

Description

memset() sets the first n bytes of the memory area pointed to by p to the value ( val & 0xFF).

memset()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

528 Freescale Semiconductor, Inc.

Page 529: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Return

p

See also

calloc() and

memcpy() and memmove()

19.70 mktime()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <string.h >

time_t mktime(struct tm *time);

Description

mktime() converts *time to a time_t. The fields of *time may have any value; they are notrestricted to the ranges given time.h. If the conversion was successful, mktime() restrictsthe fields of *time to these ranges and also sets the tm_wday and tm_yday fields correctly.

Return

*time as a time_t.

See also

ctime(),

gmtime(), and

time()

19.71 modf() and modff()

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 529

Page 530: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <math.h >

double modf(double x, double *i);

float modff(float x, float *i);

Description

modf() splits the floating-point number x into an integral part (returned in *i) and afractional part. Both parts have the same sign as x.

Return

The fractional part of x.

See also

floor() and floorf(),

fmod() and fmodf(),

frexp() and frexpf(), and

ldexp() and ldexpf()

19.72 perror()

Syntax

#include <stdio.h >

void perror(const char *msg);

Description

perror() writes an error message appropriate for the current value of errno to stderr. Thecharacter string msg is part of perror's output.

See also

perror()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

530 Freescale Semiconductor, Inc.

Page 531: CodeWarrior Development Studio for Microcontrollers V10.x RS08

assert() and

strerror()

19.73 pow() and powf()

Syntax

#include <math.h >

double pow (double x, double y);

float powf(float x, float y);

Description

pow() computes x to the power of y, i.e., xy.

Return

xy, if x > 0

1, if y == 0

+×, if ( x == 0 && y < 0)

NAN, if ( x < 0 && y is not integral). Also, errno is set to EDOM.

±×, with the same sign as x, if the result is too large.

See also

exp() and expf(),

ldexp() and ldexpf(),

log() and logf(), and

modf() and modff()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 531

Page 532: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.74 printf()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int printf(const char *format,...);

Description

printf() is the same as sprintf(), but the output goes to stdout instead of a string.

For a detailed format description see sprintf().

Return

The number of characters written. If some error occurred, EOF is returned.

See also

fprintf() and

vfprintf(), vprintf(), and vsprintf()

19.75 putc()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int putc(char ch, FILE *f);

Description

putc() is the same as fputc(), but may be implemented as a macro. Therefore, make surethat the expression f has no unexpected effects. See fputc() for more information.

putc()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

532 Freescale Semiconductor, Inc.

Page 533: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.76 putchar()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int putchar(char ch);

Description

putchar(ch) is the same as putc (ch, stdin). See fputc() for more information.

19.77 puts()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int puts(const char *s);

Description

puts() writes string s followed by a newline '\n' to stdout.

Return

EOF, if there was an error; zero otherwise.

See also

fputc() and

putc()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 533

Page 534: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.78 qsort()

Syntax

#include <stdlib.h >

void *qsort(const void *array,

size_t n,

size_t size,

cmp_func cmp);

Description

qsort() sorts the array according to the ordering implemented by the comparison function.It calls the comparison function cmp() with two pointers to array elements. Thus, the typecmp_func() can be declared as:

typedef int (*cmp_func)(const void *key,

const void *other);

The comparison function returns an integer according to the following table:

Table 19-7. Return value from the comparison function, cmp_func()

Key element value Return value

less than the other one less than zero (negative)

equal to the other one zero

greater than the other one greater than zero (positive)

qsort()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

534 Freescale Semiconductor, Inc.

Page 535: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The arguments to qsort() are listed in the following table:

Table 19-8. Possible arguments to the sorting function, qsort()

Argument Name Meaning

array A pointer to the beginning (i.e., the first element) of the arrayto be sorted

n The number of elements in the array

size The size (in bytes) of one element in the table

cmp() The comparison function

NOTEMake sure the array contains elements of equal size.

19.79 raise()

Syntax

#include <signal.h >

int raise(int sig);

Description

raise() raises the given signal, invoking the signal handler or performing the definedresponse to the signal. If a response was not defined or a signal handler was not installed,the application is aborted.

Return

Non-zero, if there was an error; zero otherwise.

See also

signal()

19.80 rand()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 535

Page 536: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdlib.h >

int rand(void);

Description

rand() generates a pseudo random number in the range from 0 to RAND_MAX. The numbersgenerated are based on a seed, which initially is 1. To change the seed, use srand().

The same seeds always lead to the same sequence of pseudo random numbers.

Return

A pseudo random integer in the range from 0 to RAND_MAX.

19.81 realloc()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

void *realloc(void *ptr, size_t size);

Description

realloc() changes the size of a block of memory, preserving its contents. ptr must be apointer returned by calloc(), malloc(), realloc(), or NULL. In the latter case, realloc() isequivalent to malloc().

If the new size of the memory block is smaller than the old size, realloc() discards thatmemory at the end of the block. If size is zero (and ptr is not NULL), realloc() frees thewhole memory block.

realloc()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

536 Freescale Semiconductor, Inc.

Page 537: CodeWarrior Development Studio for Microcontrollers V10.x RS08

If there is not enough memory to perform the realloc(), the old memory block is leftunchanged, and realloc() returns NULL. Do not use the default implementation in interruptroutines because it is not reentrant.

Return

realloc() returns a pointer to the new memory block. If the operation cannot beperformed, the return value is NULL.

See also

free()

19.82 remove()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

int remove(const char *filename);

Description

remove() deletes the file filename. If the file is open, remove() does not delete it and returnsunsuccessfully.

Return

Non-zero, if there was an error; zero otherwise.

See also

tmpfile() and

tmpnam()

19.83 rename()

This is a File I/O function. It is not implemented in the Compiler.

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 537

Page 538: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdio.h >

int rename(const char *from, const char *to);

Description

rename() renames the from file to to. If there already is a to file, rename() does not changeanything and returns with an error code.

Return

Non-zero, if there was an error; zero otherwise.

See also

tmpfile() and

tmpnam()

19.84 rewind()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

void rewind(FILE *f);

Description

rewind() resets the current position in file f to the beginning of the file. It also clears thefile's error indicator.

See also

fopen(),

fseek(), and

rewind()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

538 Freescale Semiconductor, Inc.

Page 539: CodeWarrior Development Studio for Microcontrollers V10.x RS08

fsetpos()

19.85 scanf()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int scanf(const char *format,...);

Description

scanf() is the same as sscanf(), but the input comes from stdin instead of a string.

Return

The number of data arguments read, if any input was converted. If not, it returns EOF.

See also

fgetc(),

fgets(), and

fscanf()

19.86 setbuf()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

void setbuf(FILE *f, char *buf);

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 539

Page 540: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

setbuf() lets you specify how a file is buffered. If buf is NULL, the file is unbuffered; i.e., allinput or output goes directly to and comes directly from the file. If buf is not NULL, it isused as a buffer (in that case, buf points to an array of BUFSIZ bytes).

See also

fflush() and

setvbuf()

19.87 setjmp()

Syntax

#include <setjmp.h >

int setjmp(jmp_buf env);

Description

setjmp() saves the current program state in the environment buffer env and returns zero.This buffer can be used as a parameter to a later call to longjmp(), which then restores theprogram state and jumps back to the location of the setjmp. This time, setjmp() returns anon-zero value, which is equal to the second parameter to longjmp().

Return

Zero if called directly; non-zero if called by a longjmp().

See also

longjmp()

19.88 setlocale()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

setjmp()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

540 Freescale Semiconductor, Inc.

Page 541: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <locale.h>

char *setlocale(int class, const char *loc);

Description

setlocale() changes all or part of the program's locale, depending on class. The new localeis given by the character string loc. The classes allowed are given in the following table.

Table 19-9. Allowable classes for the setlocale() function

Class Affected portion of program locale

LC_ALL All classes

LC_COLLATE strcoll() and strxfrm() functions

LC_MONETARY Monetary formatting

LC_NUMERIC Numeric formatting

LC_TIME strftime() function

LC_TYPE Character handling and multi-byte character functions

The CodeWarrior IDE supports only the minimum locale C (see locale.h) so this functionhas no effect.

Return

C, if loc is C or NULL; NULL otherwise.

See also

localeconv(),

strcoll(),

strftime(), and

strxfrm()

19.89 setvbuf()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 541

Page 542: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <stdio.h >

void setvbuf(FILE *f,

char *buf,

int mode,

size_t size);

Description

setvbuf() is used to specify how a file is buffered. mode determines how the file is buffered.

Table 19-10. Operating Modes for the setvbuf() Function

Mode Buffering

_IOFBF Fully buffered

_IOLBF Line buffered

_IONBF Unbuffered

To make a file unbuffered, call setvbuf() with mode _IONBF; the other arguments ( buf andsize) are ignored.

In all other modes, the file uses buffer buf of size size. If buf is NULL, the function allocatesa buffer of size size itself.

See also

fflush() and

setbuf()

19.90 signal()

Syntax

signal()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

542 Freescale Semiconductor, Inc.

Page 543: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <signal.h >

_sig_func signal(int sig, _sig_func handler);

Description

signal() defines how the application shall respond to the sig signal. The various responsesare given in the following table.

Table 19-11. Various responses to the signal() function's input signal

Handler Response to the signal

SIG_IGN The signal is ignored.

SIG_DFL The default response ( HALT).

a function The function is called with sig as parameter.

The signal handling function is defined as:

typedef void (*_sig_func)(int sig);

The signal can be raised using the raise() function. Before the handler is called, theresponse is reset to SIG_DFL.

In the CodeWarrior IDE, there are only two signals: SIGABRT indicates an abnormalprogram termination, and SIGTERM a normal program termination.

Return

If signal succeeds, it returns the previous response for the signal; otherwise it returnsSIG_ERR and sets errno to a positive non-zero value.

See also

raise()

19.91 sin() and sinf()

Syntax

#include <math.h >

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 543

Page 544: CodeWarrior Development Studio for Microcontrollers V10.x RS08

double sin(double x);

float sinf(float x);

Description

sin() computes the sine of x.

Return

The sine sin(x) of x in radians.

See also

asin() and asinf(),

acos() and acosf(),

atan() and atanf(),

atan2() and atan2f(),

cos() and cosf(), and

tan() and tanf()

19.92 sinh() and sinhf()

Syntax

#include <math.h >

double sinh(double x);

float sinhf(float x);

Description

sinh() computes the hyperbolic sine of x.

Return

sinh() and sinhf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

544 Freescale Semiconductor, Inc.

Page 545: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The hyperbolic sine sinh(x) of x. If it fails because the value is too large, it returns infinitywith the same sign as x and sets errno to ERANGE.

See also

asin() and asinf(),

cosh() and coshf(),

sin() and sinf(), and

tan() and tanf()

19.93 sprintf()

Syntax

#include <stdio.h >

int sprintf(char *s, const char *format,...);

Description

sprintf() writes formatted output to the s string. It evaluates the arguments, converts themaccording to the specified format, and writes the result to s, terminated with a zerocharacter.

The format string contains the text to be printed. Any character sequence in a formatstarting with ' %' is a format specifier that is replaced by the corresponding argument. Thefirst format specifier is replaced with the first argument after format, the second formatspecifier by the second argument, and so on.

A format specifier has the form:

FormatSpec = %{Format}[Width][.Precision]

[Length]Conversion

where:

• Format = -|+|<a blank>|#

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 545

Page 546: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Format defines justification and sign information (the latter only for numericalarguments). A " -" left-justifies the output, a "+" forces output of the sign, and a blankoutputs a blank if the number is positive and a "-" if it is negative. The effect of "#"depends on the Conversion character, as listed in the following chapter.

Table 19-12. Effect of # in the Formatspecification

Conversion Effect of "#"

e, E, f The value of the argument always is printed withdecimal point, even if there are no fractional digits.

g, G As above, but In addition zeroes are appended tothe fraction until the specified width is reached.

o A zero is printed before the number to indicate anoctal value.

x, X "0x" (if the conversion is "x") or "0X" (if it is "X") isprinted before the number to indicate a hexadecimalvalue.

others undefined.

A "0" as format specifier adds leading zeroes to the number until the desired width isreached, if the conversion character specifies a numerical argument.

If both " " and "+" are given, only "+" is active; if both "0" and "-" are specified, only"-" is active. If there is a precision specification for integral conversions, "0" isignored.

• Width = *|Number|0Number

Number defines the minimum field width into which the output is to be put. If theargument is smaller, the space is filled as defined by the format characters.

0Number is the same as above, but 0s are used instead of blanks.

If an asterisk "*" is given, the field width is taken from the next argument, which ofcourse must be a number. If that number is negative, the output is left-justified.

• Precision = [Number]

The effect of the Precision specification depends on the conversion character, aslisted in the following table.

Table 19-13. Effect of the Precisionspecification

Conversion Precision

d, i, o, u, x, X The minimum number of digits to print.

Table continues on the next page...

sprintf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

546 Freescale Semiconductor, Inc.

Page 547: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 19-13. Effect of the Precision specification(continued)

Conversion Precision

e, E, f The number of fractional digits to print.

g, G The maximum number of significant digits to print.

s The maximum number of characters to print.

others undefined.

If the Precision specifier is "*", the precision is taken from the next argument, which mustbe an int. If that value is negative, the precision is ignored.

• Length = h|l|L

A length specifier tells sprintf() what type the argument has. The first two lengthspecifiers can be used in connection with all conversion characters for integralnumbers. "h" defines short; "l" defines long. Specifier "L" is used in conjunction withthe conversion characters for floating point numbers and specifies long double.

Conversion = c|d|e|E|f|g|

G|i|n|o|p|s|

u|x|X|%

The conversion characters have the following meanings, as the following table lists:

Table 19-14. Meaning of the Conversion Characters

Conversion Description

c The int argument is converted to unsigned char; theresulting character is printed.

d, i An int argument is printed.

e, E The argument must be a double. It is printed in the form[-]d.ddde±dd (scientific notation). The precisiondetermines the number of fractional digits; the digit to the leftof the decimal is ¦ 0 unless the argument is 0.0. The defaultprecision is 6 digits. If the precision is zero and the formatspecifier " #" is not given, no decimal point is printed. Theexponent always has at least 2 digits; the conversioncharacter is printed just before the exponent.

f The argument must be a double. It is printed in the form[-]ddd.ddd (see above). If the decimal point is printed,there is at least one digit to the left of it.

g, G The argument must be a double. sprintf chooses eitherformat f or e (or E if G is given), depending on the magnitudeof the value. Scientific notation is used only if the exponent is< -4 or greater than or equal to the precision.

Table continues on the next page...

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 547

Page 548: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 19-14. Meaning of the Conversion Characters (continued)

Conversion Description

n The argument must be a pointer to an int. sprintf()writes the number of characters written so far to that address.If n is used together with length specifier h or l, the argumentmust be a pointer to a short int or a longint.

o The argument, which must be an unsigned int, is printedin octal notation.

p The argument must be a pointer; its value is printed inhexadecimal notation.

s The argument must be a char *; sprintf() writes thestring.

u The argument, which must be an unsigned int, is writtenin decimal notation.

x, X The argument, which must be an unsigned int, is writtenin hexadecimal notation. x uses lower case letters a to f,while X uses upper case letters.

% Prints a " %" sign. Give only as " %%".

Conversion characters for integral types are d, i, o, u, x, and X; for floating point types e, E,f, g, and G.

If sprintf() finds an incorrect format specification, it stops processing, terminates thestring with a zero character, and returns successfully.

NOTEFloating point support increases the sprintf() size considerably,and therefore the define LIBDEF_PRINTF_FLOATING exists. SetLIBDEF_PRINTF_FLOATING if no floating point support is used. Sometargets contain special libraries without floating point support.The IEEE64 floating point implementation is not supported.

Return

The number of characters written to s.

See also

sscanf()

19.94 sqrt() and sqrtf()

Syntax

sqrt() and sqrtf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

548 Freescale Semiconductor, Inc.

Page 549: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <math.h >

double sqrt(double x);

float sqrtf(float x);

Description

sqrt() computes the square root of x.

Return

The square root of x. If x is negative, it returns 0 and sets errno to EDOM.

See also

pow() and powf()

19.95 srand()

Syntax

#include <stdlib.h >

void srand(unsigned int seed);

Description

srand() initializes the seed of the random number generator. The default seed is 1.

See also

rand()

19.96 sscanf()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 549

Page 550: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdio.h >

int sscanf(const char *s, const char *format,...);

Description

sscanf() scans string s according to the given format, storing the values in the givenparameters. The format specifiers in the format tell sscanf() what to expect next. A formatspecifier has the format:

FormatSpec = "%" [Flag] [Width] [Size] Conversion.

where:

• Flag = "*"

If the "%" sign which starts a format specification is followed by a "*", the scanned valueis not assigned to the corresponding parameter.

• Width = Number

Specifies the maximum number of characters to read when scanning the value. Scanningalso stops if white space or a character not matching the expected syntax is reached.

• Size = h|l|L

Specifies the size of the argument to read. The meaning is given in the following table.

Table 19-15. Relationship of the Size parameter with allowable conversions and types

Size Allowable Conversions Parameter Type

h d, i, n short int * (instead of int *)

h o, u, x, X unsigned short int * (instead ofunsigned int *)

l d, i, n long int * (instead of int *)

l o, u, x, X unsigned long int * (instead ofunsigned int *)

l e, E, f, g, G double * (instead of float *)

L e, E, f, g, G long double * (instead of float *)

Conversion = c|d|e|E|f|g|

G|i|n|o|p|s| u|x|X|%|Range

sscanf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

550 Freescale Semiconductor, Inc.

Page 551: CodeWarrior Development Studio for Microcontrollers V10.x RS08

These conversion characters tell sscanf() what to read and how to store it in a parameter.Their meaning is shown in the following table.

Table 19-16. Description of the action taken for each conversion.

Conversion Description

c Reads a string of exactly width characters and stores it inthe parameter. If no width is given, one character is read. Theargument must be a char *. The string read is not zero-terminated.

d A decimal number (syntax below) is read and stored in theparameter. The parameter must be a pointer to an integraltype.

i As d, but also reads octal and hexadecimal numbers (syntaxbelow).

e, E, f, g, or G Reads a floating point number (syntax below). The parametermust be a pointer to a floating-point type.

n The argument must be a pointer to an int. sscanf() writesthe number of characters read so far to that address. If n isused together with length specifier h or l, the argument mustbe a pointer to a shortint or a long int.

o Reads an octal number (syntax below). The parameter mustbe a pointer to an integral type.

p Reads a pointer in the same format assprintf() prints it. Theparameter must be a void **.

s Reads a character string up to the next white space characteror at most width characters. The string is zero-terminated.The argument must be of type char *.

u As d, but the parameter must be a pointer to an unsignedintegral type.

x, X As u, but reads a hexadecimal number.

% Skips a % sign in the input. Give only as %%.

• Range = "["["^"]List"]"

• List = Element {Element}

• Element = <any char> ["-"<any char>]

You can also use a scan set to read a character string that either contains only the givencharacters or contains only characters not in the set. A scan set always is bracketed by leftand right brackets. If the first character in the set is ^, the set is inverted (i.e., onlycharacters not in the set are allowed). You can specify whole character ranges, e.g., A-Zspecifies all upper-case letters. If you want to include a right bracket in the scan set, itmust be the first element in the list, a dash (-) must be either the first or the last element.A ^ that shall be included in the list instead of indicating an inverted list must not be thefirst character after the left bracket.

Some examples are:

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 551

Page 552: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• [A-Za-z]

Allows all upper- and lower-case characters.

• [^A-Z]

Allows any character that is not an uppercase character.

• []abc]

Allows ], a, b and c.

• [^]abc] Allows any char except ], a, b and c.

• [-abc] Allows -, a, b and c.

A white space in the format string skips all white space characters up to the next non-white-space character. Any other character in the format must be exactly matched by theinput; otherwise sscanf() stops scanning.

The syntax for numbers as scanned by sscanf() is the following:

Listing: Syntax for Numbers

Number = FloatNumber|IntNumberIntNumber = DecNumber|OctNumber|HexNumber

DecNumber = Sign Digit {Digit}

OctNumber = Sign 0 {OctDigit}

HexNumber = 0 (x|X) HexDigit{HexDigit}

FloatNumber = Sign {Digit} [.{Digit}][Exponent]

Exponent = (e|E) DecNumber

OctDigit = 0|1|2|3|4|5|6|7

Digit = OctDigit |8|9

HexDigit = Digit |A|B|C|D|E|F|

a|b|c|d|e|f

Return

EOF, if s is NULL; otherwise it returns the number of arguments filled in.

NOTEIf sscanf() finds an illegal input (i.e., not matching the requiredsyntax), it simply stops scanning and returns successfully!

strcat()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

552 Freescale Semiconductor, Inc.

Page 553: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.97 strcat()

Syntax

#include <string.h >

char *strcat(char *p, const char *q);

Description

strcat() appends string q to the end of string p. Both strings and the resultingconcatenation are zero-terminated.

Return

p

See also

memcpy() and memmove(),

strcpy(),

strncat(), and

strncpy()

19.98 strchr()

Syntax

#include <string.h >

char *strchr(const char *p, int ch);

Description

strchr() looks for character ch in string p. If ch is ' \0', the function looks for the end of thestring.

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 553

Page 554: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Return

A pointer to the character, if found; if there is no such character in *p, NULL is returned.

Seealso

memchr(),

strrchr(), and

strstr()

19.99 strcmp()

Syntax

#include <string.h >

int strcmp(const char *p, const char *q);

Description

strcmp() compares the two strings, using the character ordering given by the ASCIIcharacter set.

Return

A negative integer, if p is smaller than q; zero, if both strings are equal; or a positiveinteger if p is greater than q.

NOTEThe return value of strcmp() is such that it could be used as acomparison function in bsearch() and qsort().

See also

memcmp(),

strcoll(), and

strncmp()

strcmp()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

554 Freescale Semiconductor, Inc.

Page 555: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.100 strcoll()

Syntax

#include <string.h >

int strcoll(const char *p, const char *q);

Description

strcoll() compares the two strings interpreting them according to the current locale, usingthe character ordering given by the ASCII character set.

Return

A negative integer, if p is smaller than q; zero, if both strings are equal; or a positiveinteger if p is greater than q.

See also

memcmp(),

strcpy(), and

strncmp()

19.101 strcpy()

Syntax

#include <string.h > char *strcpy(char *p, const char *q);

Description

strcpy() copies string q into string p (including the terminating '\0').

Return

p

See also

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 555

Page 556: CodeWarrior Development Studio for Microcontrollers V10.x RS08

memcpy() and memmove() and

strncpy()

19.102 strcspn()

Syntax

#include <string.h >

size_t strcspn(const char *p, const char *q);

Description

strcspn() searches p for the first character that also appears in q.

Return

The length of the initial segment of p that contains only characters not in q.

See also

strchr(),

strpbrk(),

strrchr(), and

strspn()

19.103 strerror()

Syntax

#include <string.h >

char *strerror(int errno);

Description

strerror() returns an error message appropriate for error number errno.

strcspn()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

556 Freescale Semiconductor, Inc.

Page 557: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Return

A pointer to the message string.

See also

perror()

19.104 strftime()

Syntax

#include <time.h >

size_t strftime(char *s,

size_t max,

const char *format,

const struct tm *time);

Description

strftime() converts time to a character string s. If the conversion results in a string longerthan max characters (including the terminating '\0'), s is left unchanged and the functionreturns unsuccessfully. How the conversion is done is determined by the format string.This string contains text, which is copied one-to-one to s, and format specifiers. The latteralways start with a % sign and are replaced by the following, as listed in the table below:

Table 19-17. strftime() output string content and format

Format Replaced with

%a Abbreviated name of the weekday of the current locale, e.g.,Fri.

%A Full name of the weekday of the current locale, e.g., Friday.

Table continues on the next page...

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 557

Page 558: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 19-17. strftime() output string content and format (continued)

Format Replaced with

%b Abbreviated name of the month of the current locale, e.g.,Feb.

%B Full name of the month of the current locale, e.g., February.

%c Date and time in the form given by the current locale.

%d Day of the month in the range from 0 to 31.

%H Hour, in 24-hour-clock format.

%I Hour, in 12-hour-clock format.

%j Day of the year, in the range from 0 to 366.

%m Month, as a decimal number from 0 to 12.

%M Minutes

%p AM/PM specification of a 12-hour clock or equivalent ofcurrent locale.

%S Seconds

%U Week number in the range from 0 to 53, with Sunday as thefirst day of the first week.

%w Day of the week (Sunday = 0, Saturday = 6).

%W Week number in the range from 0 to 53, with Monday as thefirst day of the first week.

%x The date in format given by current locale.

%X The time in format given by current locale.

%y The year in short format, e.g., "93".

%Y The year, including the century (e.g., "2007").

%Z The time zone, if it can be determined.

%% A single '%' sign.

Return

If the resulting string would have had more than max characters, zero is returned;otherwise the length of the created string is returned.

See also

mktime(),

setlocale(), and

time()

19.105 strlen()

strlen()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

558 Freescale Semiconductor, Inc.

Page 559: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <string.h >

size_t strlen(const char *s);

Description

strlen() returns the number of characters in string s.

Return

The length of the string.

19.106 strncat()

Syntax

#include <string.h >

char *strncat(char *p, const char *q, size_t n);

Description

strncat() appends string q to string p. If q contains more than n characters, only the first ncharacters of q are appended to p. The two strings and the result all are zero-terminated.

Return

p

See also

strcat()

19.107 strncmp()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 559

Page 560: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <string.h >

char *strncmp(char *p, const char *q, size_t n);

Description

strncmp() compares at most the first n characters of the two strings.

Return

A negative integer, if p is smaller than q; zero, if both strings are equal; or a positiveinteger if p is greater than q.

See also

memcmp() and

strcmp()

19.108 strncpy()

Syntax

#include <string.h >

char *strncpy(char *p, const char *q, size_t n);

Description

strncpy() copies at most the first n characters of string q to string p, overwriting p'sprevious contents. If q contains less than n characters, a '\0' is appended.

Return

p

See also

memcpy() and memmove() and

strncpy()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

560 Freescale Semiconductor, Inc.

Page 561: CodeWarrior Development Studio for Microcontrollers V10.x RS08

strcpy()

19.109 strpbrk()

Syntax

#include <string.h >char *strpbrk(const char *p, const char *q);

Description

strpbrk() searches for the first character in p that also appears in q.

Return

NULL, if there is no such character in p; a pointer to the character otherwise.

See also

strchr(),

strcspn(),

strrchr(), and

strspn()

19.110 strrchr()

Syntax

#include <string.h >

char *strrchr(const char *s, int c);

Description

strpbrk() searches for the last occurrence of character ch in s.

Return

NULL, if there is no such character in p; a pointer to the character otherwise.

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 561

Page 562: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also

strchr(),

strcspn(),

strpbrk(), and

strspn()

19.111 strspn()

Syntax

#include <string.h >

size_t strspn(const char *p, const char *q);

Description

strspn() returns the length of the initial part of p that contains only characters alsoappearing in q.

Return

The position of the first character in p that is not in q.

See also

strchr(),

strcspn(),

strpbrk(), and

strrchr()

19.112 strstr()

Syntax

strspn()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

562 Freescale Semiconductor, Inc.

Page 563: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#include <string.h >

char *strstr(const char *p, const char *q);

Description

strstr() looks for substring q appearing in string p.

Return

A pointer to the beginning of the first occurrence of string q in p, or NULL, if q does notappear in p.

See also

strchr(),

strcspn(),

strpbrk(),

strrchr(), and

strspn()

19.113 strtod()

Syntax

#include <stdlib.h >

double strtod(const char *s, char **end);

Description

strtod() converts string s into a floating point number, skipping over any white space atthe beginning of s. It stops scanning when it reaches a character not matching therequired syntax and returns a pointer to that character in *end. The number format strtod()accepts is:

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 563

Page 564: CodeWarrior Development Studio for Microcontrollers V10.x RS08

FloatNum = Sign{Digit}[.{Digit}][Exp]

Sign = [+|-]

Exp = (e|E) SignDigit{Digit}

Digit = <any decimal digit from 0 to 9>

Return

The floating point number read. If an underflow occurred, 0.0 is returned. If the valuecauses an overflow, HUGE_VAL is returned. In both cases, errno is set to ERANGE.

See also

atof(),

scanf(),

strtol(), and

strtoul()

19.114 strtok()

Syntax

#include <string.h >

char *strtok(char *p, const char *q);

Description

strtok() breaks the string p into tokens which are separated by at least one characterappearing in q. The first time, call strtok() using the original string as the first parameter.Afterwards, pass NULL as first parameter: strtok() will continue at the position it stoppedthe previous time. strtok() saves the string p if it is not NULL.

strtok()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

564 Freescale Semiconductor, Inc.

Page 565: CodeWarrior Development Studio for Microcontrollers V10.x RS08

NOTEThis function is not re-entrant because it uses a global variablefor saving string p. ANSI defines this function in this way.

Return

A pointer to the token found, or NULL, if no token was found.

See also

strchr(),

strcspn(),

strpbrk().

strrchr(),

strspn(), and

strstr()

19.115 strtol()

Syntax

#include <stdlib.h >

long strtol(const char *s, char **end, int base);

Description

strtol() converts string s into a long int of base base, skipping over any white space at thebeginning of s. It stops scanning when it reaches a character not matching the requiredsyntax (or a character too large for a given base) and returns a pointer to that character in*end. The number format strtol() accepts is:

Listing: Number Format

Int_Number = Dec_Number|Oct_Number| Hex_Number|Other_Num Dec_Number = SignDigit{Digit} Oct_Number = Sign0{OctDigit} Hex_Number = 0(x|X)Hex_Digit{Hex_Digit} Other_Num = SignOther_Digit{Other_Digit} Oct_Digit = 0|1|2|3|4|5|6|7 Digit = Oct_Digit |8|9 Hex_Digit = Digit |A|B|C|D|E|F|

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 565

Page 566: CodeWarrior Development Studio for Microcontrollers V10.x RS08

a|b|c|d|e|f Other_Digit = Hex_Digit | <any char between 'G' and 'Z'> | <any char between 'g' and 'z'>

The base must be 0 or in the range from 2 to 36. If it is between 2 and 36, strtol convertsa number in that base (digits larger than 9 are represented by upper or lower casecharacters from A to Z). If base is zero, the function uses the prefix to find the base. If theprefix is 0, base 8 (octal) is assumed. If it is 0x or 0X, base 16 (hexadecimal) is taken. Anyother prefixes make strtol() scan a decimal number.

Return

The number read. If no number is found, zero is returned; if the value is smaller thanLONG_MIN or larger than LONG_MAX, LONG_MIN or LONG_MAX is returned and errno is set to ERANGE.

See also

atoi(),

atol(),

scanf(),

strtod(), and

strtoul()

19.116 strtoul()

Syntax

#include <stdlib.h >

unsigned long strtoul(const char *s,

char **end,

int base);

Description

strtoul()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

566 Freescale Semiconductor, Inc.

Page 567: CodeWarrior Development Studio for Microcontrollers V10.x RS08

strtoul() converts string s into an unsigned long int of base base, skipping over any whitespace at the beginning of s. It stops scanning when it reaches a character not matching therequired syntax (or a character too large for a given base) and returns a pointer to thatcharacter in *end. The number format strtoul() accepts is the same as for strtol() exceptthat the negative sign is not allowed, and so are the possible values for base.

Return

The number read. If no number is found, zero is returned; if the value is larger thanULONG_MAX, ULONG_MAX is returned and errno is set to ERANGE.

See also

atoi(),

atol(),

scanf(),

strtod(), and

strtol()

19.117 strxfrm()

Syntax

#include <string.h >

size_t strxfrm(char *p, const char *q, size_t n);

Description

strxfrm() transforms string q according to the current locale, such that the comparison oftwo strings converted with strxfrm() using strcmp() yields the same result as a comparisonusing strcoll(). If the resulting string would be longer than n characters, p is leftunchanged.

Return

The length of the converted string.

See also

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 567

Page 568: CodeWarrior Development Studio for Microcontrollers V10.x RS08

setlocale(),

strcmp(), and

strcoll()

19.118 system()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <string.h >

int system(const char *cmd);

Description

system() executes the cmd command line

Return

Zero

19.119 tan() and tanf()

Syntax

#include <math.h >

double tan(double x);

float tanf(float x);

Description

system()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

568 Freescale Semiconductor, Inc.

Page 569: CodeWarrior Development Studio for Microcontrollers V10.x RS08

tan() computes the tangent of x. Express x in radians.

Return

tan(x). If x is an odd multiple of Pi/2, it returns infinity and sets errno to EDOM.

See also

acos() and acosf(),

asin() and asinf(),

atan() and atanf(),

atan2() and atan2f(),

cosh() and coshf(),

sin() and sinf(), and

tan() and tanf()

19.120 tanh() and tanhf()

Syntax

#include <math.h >double tanh(double x);float tanhf(float x);

Description

tanh() computes the hyperbolic tangent of x.

Return

tanh(x).

See also

atan() and atanf(),

atan2() and atan2f(),

cosh() and coshf(),

sin() and sinf(), and

tan() and tanf()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 569

Page 570: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.121 time()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <time.h >time_t time(time_t *timer);

Description

time() gets the current calendar time. If timer is not NULL, the current calendar time isassigned to timer.

Return

The current calendar time.

See also

clock(),

mktime(), and

strftime()

19.122 tmpfile()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >FILE *tmpfile(void);

Description

tmpfile() creates a new temporary file using mode "wb+". Temporary files automaticallyare deleted when they are closed or the application ends.

Return

A pointer to the file descriptor if the file could be created; NULL otherwise.

See also

time()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

570 Freescale Semiconductor, Inc.

Page 571: CodeWarrior Development Studio for Microcontrollers V10.x RS08

fopen() and

tmpnam()

19.123 tmpnam()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

char *tmpnam(char *s);

Description

tmpnam() creates a new unique filename. If s is not NULL, this name is assigned to it.

Return

A unique filename.

Seealso

tmpfile()

19.124 tolower()

Syntax

#include <ctype.h >

int tolower(int ch);

Description

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 571

Page 572: CodeWarrior Development Studio for Microcontrollers V10.x RS08

tolower() converts any upper-case character in the range from A to Z into a lower-casecharacter from a to z.

Return

If ch is an upper-case character, the corresponding lower-case letter. Otherwise, ch isreturned (unchanged).

Seealso

isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(),isupper(), and isxdigit(),

toupper()

19.125 toupper()

Syntax

#include <ctype.h >int toupper(int ch);

Description

tolower() converts any lower-case character in the range from a to z into an upper-casecharacter from A to Z.

Return

If ch is a lower-case character, the corresponding upper-case letter. Otherwise, ch isreturned (unchanged).

See also

isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(),isupper(), and isxdigit(),

tolower()

19.126 ungetc()

This is a File I/O function. It is not implemented in the Compiler.

toupper()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

572 Freescale Semiconductor, Inc.

Page 573: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Syntax

#include <stdio.h >

int ungetc(int ch, FILE *f);

Description

ungetc() pushes the single character ch back onto the input stream f. The next read from fwill read that character.

Return

ch

See also

fgets(),

fopen(),

getc(), and

getchar()

19.127 va_arg(), va_end(), and va_start()

Syntax

#include <stdarg.h >void va_start(va_list args, param);type va_arg(va_list args, type);void va_end(va_list args);

Description

These macros can be used to get the parameters into an open parameter list. Calls tova_arg() get a parameter of the given type. The following listing shows how to do it:

Listing: Calling an open-parameter function

void my_func(char *s, ...) { va_list args;

int i;

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 573

Page 574: CodeWarrior Development Studio for Microcontrollers V10.x RS08

char *q;

va_start(args, s);

/* First call to 'va_arg' gets the first arg. */

i = va_arg (args, int);

/* Second call gets the second argument. */

q = va_arg(args, char *);

...

va_end (args);

}

19.128 vfprintf(), vprintf(), and vsprintf()

This is a File I/O function. It is not implemented in the Compiler.

Syntax

#include <stdio.h >

int vfprintf(FILE *f,

const char *format,

va_list args);

int vprintf(const char *format, va_list args);

int vsprintf(char *s,

const char *format,

vfprintf(), vprintf(), and vsprintf()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

574 Freescale Semiconductor, Inc.

Page 575: CodeWarrior Development Studio for Microcontrollers V10.x RS08

va_list args);

Description

These functions are the same as fprintf(), printf(), and sprintf(), except that they take ava_list instead of an open parameter list as argument.

For a detailed format description see sprintf().

NOTEOnly vsprintf() is implemented because the other two functionsdepend on the actual setup and environment of the target.

Return

The number of characters written, if successful; a negative number otherwise.

See also

va_arg(), va_end(), and va_start()

19.129 wctomb()

Syntax

#include <stdlib.h >

int wctomb(char *s, wchar_t wchar);

Description

wctomb() converts wchar to a multi-byte character, stores that character in s, and returns thelength in bytes of s.

Return

The length of s in bytes after the conversion.

See also

wcstombs()

Chapter 19 Standard Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 575

Page 576: CodeWarrior Development Studio for Microcontrollers V10.x RS08

19.130 wcstombs()

This is a Hardware specific function. It is not implemented in the Compiler.

Syntax

#include <stdlib.h >

int wcstombs(char *s, const wchar_t *ws, size_t n);

Description

wcstombs() converts the first n wide character codes in ws to multi-byte characters, storesthem character in s, and returns the number of wide characters converted.

Return

The number of wide characters converted.

See also

wctomb()

wcstombs()

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

576 Freescale Semiconductor, Inc.

Page 577: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 20Appendices

The appendices covered in this manual are:

• Porting Tips and FAQs : Hints about EBNF notation used by the linker and aboutporting applications from other Compiler vendors to this Compiler

• Global Configuration File Entries : Documentation for the entries in the mcutools.inifile

• Local Configuration File Entries : Documentation for the entries in the project.inifile.

• Known C++ Issues in RS08 Compilers : Documentation on known issues.• RS08 Compiler Messages : Documentation on compiler messages.

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 577

Page 578: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

578 Freescale Semiconductor, Inc.

Page 579: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 21Porting Tips and FAQs

This appendix describes some FAQs and provides tips on the syntax of EBNF or how toport the application from a different tool vendor.

• Migration Hints• General Optimization Hints• Frequently Asked Questions (FAQs), Troubleshooting• EBNF Notation• Abbreviations, Lexical Conventions• Number Formats• Precedence and Associativity of Operators for ANSI-C• List of all Escape Sequences

21.1 Migration Hints

This section describes the differences between this compiler and the compilers of othervendors. It also provides information about porting sources and how to adapt them.

21.1.1 Porting from Cosmic

If your current application is written for Cosmic compilers, there are some special thingsto consider.

21.1.1.1 Getting Started

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 579

Page 580: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The best way is to create a new project using the New Project Wizard (in theCodeWarrior IDE: Menu File > New) or a project from a stationery template. This setsup a project for you with all the default options and library files included. Then add theexisting files used for Cosmic to the project (e.g., through drag & drop from the WindowsExplorer or using in the CodeWarrior IDE: the menu Project > Add Files. Make sure thatthe right memory model and CPU type are used as for the Cosmic project.

21.1.1.2 Cosmic Compatibility Mode Switch

The latest compiler offers a Cosmic compatibility mode switch ( -Ccx: CosmicCompatibility Mode for Space Modifiers and Interrupt Handlers). Enable this compileroption so the compiler accepts most Cosmic constructs.

21.1.1.3 Assembly Equates

For the Cosmic compiler, you need to define equates for the inline assembly using equ. Ifyou want to use an equate or value in C as well, you need to define it using #define aswell. For this compiler, you only need one version (i.e., use #define) both for C and forinline assembly. The equ directive is not supported in normal C code.

Listing: An example using the EQU directive

#ifdef __MWERKS__

#define CLKSRC_B 0x00 /*; Clock source */

#else

CLKSRC_B : equ $00 ; Clock source

#endif

21.1.1.4 Inline Assembly Identifiers

For the Cosmic compiler, you need to place an underscore (`_') in front of each identifier,but for this compiler you can use the same name both for C and inline assembly. Inaddition, for better type-safety with this compiler you need to place a `@' in front of

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

580 Freescale Semiconductor, Inc.

Page 581: CodeWarrior Development Studio for Microcontrollers V10.x RS08

variables if you want to use the address of a variable. Using a conditional block like theone below in the following listing may be difficult. Using macros which deal with thecases below is a better way to deal with this.

Listing: Using a conditional block to account for different compilers

#ifdef __MWERKS__

ldx @myVariable,x

jsr MyFunction

#else

ldx _myVariable,x

jsr _MyFunction

#endif

Listing: Using a macro to account for different compilers

#ifdef __MWERKS__

#define USCR(ident) ident

#define USCRA(ident) @ ident

#else /* for COSMIC, add a _ (underscore) to each ident */

#define USCR(ident) _##ident

#define USCRA(ident) _##ident

#endif

The source can use the macros:

ldx USCRA(myVariable),x

jsr USCR(MyFunction)

21.1.1.5 Pragma Sections

Cosmic uses the #pragma section syntax, while this compiler employs either #pragmaDATA_SEG or #pragma CONST_SEG or another example (for the data section):

Listing: <codeph>#pragma DATA_SEG</codeph>

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 581

Page 582: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#ifdef __MWERKS__

#pragma DATA_SEG APPLDATA_SEG

#else

#pragma section {APPLDATA}

#endif

Listing: <codeph>#pragma CONST_SEG</codeph>

#ifdef __MWERKS__

#pragma CONST_SEG CONSTVECT_SEG

#else

#pragma section const {CONSTVECT}

#endif

Do not forget to use the segments (in the examples above CONSTVECT_SEG and APPLDATA_SEG)in the linker *.prm file in the PLACEMENT block.

21.1.1.6 Inline Assembly Constants

Cosmic uses an assembly constant syntax, whereas this compiler employs the normal Cconstant syntax:

Listing: Normal C constant syntax

#ifdef __MWERKS__

and 0xF8

#else

and #$F8

#endif

21.1.1.7 Inline Assembly and Index Calculation

Cosmic uses the + operator to calculate offsets into arrays. For the CodeWarrior IDE, youhave to use a colon (:) instead:

Listing: Using a colon for offset

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

582 Freescale Semiconductor, Inc.

Page 583: CodeWarrior Development Studio for Microcontrollers V10.x RS08

ldx array:7

#else

ldx array+7

#endif

21.1.1.8 Inline Assembly and Tabs

Cosmic lets you use TAB characters in normal C strings (surrounded by double quotes):

asm("This string contains hidden tabs!");

Because the compiler rejects hidden tab characters in C strings according to the ANSI-Cstandard, you need to remove the tab characters from such strings.

21.1.1.9 Inline Assembly and Operators

Cosmic's and this compiler's inline assembly may not support the same amount or levelof operators. But in most cases it is simple to rewrite or transform them.

Listing: Accounting for different operators among different compilers

#ifdef __MWERKS__

ldx #(BOFFIE + WUPIE) ; enable Interrupts

#else

ldx #(BOFFIE | WUPIE) ; enable Interrupts

#endif

#ifdef __MWERKS__

lda #(_TxBuf2+Data0)

ldx #((_TxBuf2+Data0) / 256)

#else

lda #((_TxBuf2+Data0) & $ff)

ldx #(((_TxBuf2+Data0) >> 8) & $ff)

#endif

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 583

Page 584: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.1.1.10 @interrupt

Cosmic uses the @interrupt syntax, whereas this compiler employs the interrupt syntax. Inorder to keep the source base portable, a macro can be used (e.g., in a main header filewhich selects the correct syntax depending on the compiler used:

Listing: interrupt syntax

/* place the following in a header file: */

#ifdef __MWERKS__

#define INTERRUPT interrupt

#else

#define INTERRUPT @interrupt

#endif

/* now for each @interrupt we use the INTERRUPT macro: */

void INTERRUPT myISRFunction(void) { ...

21.1.1.11 Inline Assembly and Conditional Blocks

In most cases, the ( -Ccx: Cosmic Compatibility Mode for Space Modifiers and InterruptHandlers) will handle the #asm blocks used in Cosmic inline assembly code Cosmiccompatibility switch. However, if #asm is used with conditional blocks like #ifdef or #if,then the C parser may not accept it.

Listing: Use of Conditional Blocks without asm { and } Block Markers

void foo(void) {

#asm

nop

#if 1

#endasm

foo();

#asm

#endif

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

584 Freescale Semiconductor, Inc.

Page 585: CodeWarrior Development Studio for Microcontrollers V10.x RS08

nop

#endasm

}

In such case, the #asm and #endasm must be ported to asm { and } block markers.

Listing: Use of Conditional Blocks with asm { and } Block Markers

void foo(void) {

asm { // asm #1

nop

#if 1

} // end of asm #1

foo();

asm { // asm #2

#endif

nop

} // end of asm #2

}

21.1.1.12 Compiler Warnings

Check compiler warnings carefully. The Cosmic compiler does not warn about manycases where your application code may contain a bug. Later on the warnings can beswitched off if desired (e.g., using the -W2: Do Not Print Information or Warning Messagesoption or using #pragma MESSAGE: Message Setting in the source code).

21.1.1.13 Linker *.prm File (for the Cosmic compiler) and Linker *.prmFile (for this compiler)

Cosmic uses a *.prm file for the linker with a special syntax. This compiler uses a linkerparameter file with a *.prm file extension. The syntax is not the same format, but mostthings are straightforward to port. For this compiler, you must declare the RAM or ROMareas in the SEGMENTS...END block and place the sections into the SEGMENTS in thePLACEMENT...END block.

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 585

Page 586: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Make sure that all your segments you declared in your application (through #pragmaDATA_SEG, #pragma CONST_SEG, and #pragma CODE_SEG) are used in the PLACEMENT block of thelinker prm file.

Check the linker warnings or errors carefully. They may indicate what you need to adjustor correct in your application. E.g., you may have allocated the vectors in the linker .prmfile (using VECTOR or ADDRESS syntax) and allocated them as well in the application itself(e.g., with the #pragma CONST_SEG or with the @address syntax). Allocating objects twice is anerror, so these objects must be allocated one or the other way, but not both.

Consult your map file produced by the linker to check that everything is correctlyallocated.

Remember that the linker is a smart linker. This means that objects not used or referencedare not linked to the application. The Cosmic linker may link objects even if they are notused or referenced, but, nevertheless, these objects may still be required to be linked tothe application for some reason not required by the linker. In order to have objects linkedto the application regardless if they are used or not, use the ENTRIES...END block in thelinker .prm file:

ENTRIES /* the following objects or variables need to be linked even if not referenced by the application */

_vectab ApplHeader FlashEraseTable

END

21.1.2 Allocation of Bitfields

Allocation of bitfields is very compiler-dependent. Some compilers allocate the bits firstfrom right (LSByte) to left (MSByte), and others allocate from left to right. Also,alignment and byte or word crossing of bitfields is not implemented consistently. Somepossibilities are to:

• Check the different allocation strategies,• Check if there is an option to change the allocation strategy in the compiler, or• Use the compiler defines to hold sources portable:

• __BITFIELD_LSBIT_FIRST__

• __BITFIELD_MSBIT_FIRST__

• __BITFIELD_LSBYTE_FIRST__

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

586 Freescale Semiconductor, Inc.

Page 587: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• __BITFIELD_MSBYTE_FIRST__

• __BITFIELD_LSWORD_FIRST__

• __BITFIELD_MSWORD_FIRST__

• __BITFIELD_TYPE_SIZE_REDUCTION__

• __BITFIELD_NO_TYPE_SIZE_REDUCTION__

21.1.3 Type Sizes and Sign of char

Carefully check the type sizes that a particular compiler uses. Some compilers implementthe sizes for the standard types (char, short, int, long, float, or double) differently. Forinstance, the size for an int is 16 bits for some compilers and 32 bits for others.

The sign of plain char is also not consistent for all compilers. If the software programrequires that char be signed or unsigned, either change all plain char types to the signedor unsigned types or change the sign of char with the -T: Flexible Type Managementoption.

21.1.4 @bool Qualifier

Some compiler vendors provide a special keyword @bool to specify that a functionreturns a boolean value:

@bool int foo(void);

Because this special keyword is not supported, remove @bool or use a define such asthis:

#define _BOOL /*@bool*/

_BOOL int foo(void);

21.1.5 @tiny and @far Qualifier for Variables

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 587

Page 588: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Some compiler vendors provide special keywords to place variables in absolute locations.Such absolute locations can be expressed in ANSI-C as constant pointers:

#ifdef __HIWARE__

#define REG_PTB (*(volatile char*)(0x01))

#else /* other compiler vendors use non-ANSI features */

@tiny volatile char REG_PTB @0x01; /* port B */

#endif

The Compiler does not need the @tiny qualifier directly. The Compiler is smart enoughto take the right addressing mode depending on the address:

/* compiler uses the correct addressing mode */

volatile char REG_PTB @0x01;

21.1.6 Arrays with Unknown Size

Some compilers accept the following non-ANSI compliant statement to declare an arraywith an unknown size:

extern char buf[0];

However, the compiler will issue an error message for this because an object with sizezero (even if declared as extern) is illegal. Use the legal version:

extern char buf[];

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

588 Freescale Semiconductor, Inc.

Page 589: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.1.7 Missing Prototype

Many compilers accept a function-call usage without a prototype. This compiler willissue a warning for this. However if the prototype of a function with open arguments ismissing or this function is called with a different number of arguments, this is clearly anerror:

printf( "hello world!"); // compiler assumes void

printf(char*);

// error, argument number mismatch!

printf( "hello %s!", "world");

To avoid such programming bugs use the -Wpd: Error for Implicit Parameter Declarationcompiler option and always include or provide a prototype.

21.1.8 _asm("sequence")

Some compilers use _asm(" string" ) to write inline assembly code in normal C sourcecode: _asm(" nop" );

This can be rewritten with asm or asm {}: asm nop;

21.1.9 Recursive Comments

Some compilers accept recursive comments without any warnings. The Compiler willissue a warning for each such recursive comment:

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 589

Page 590: CodeWarrior Development Studio for Microcontrollers V10.x RS08

/* this is a recursive comment /*

int a;

/* */

The Compiler will treat the above source completely as one single comment, so thedefinition of `a' is inside the comment. That is, the Compiler treats everything betweenthe first opening comment ` /*' until the closing comment token ` */' as a comment. Ifthere are such recursive comments, correct them.

21.1.10 Interrupt Function, @interrupt

Interrupt functions have to be marked with #pragma TRAP_PROC or using the interruptkeyword.

Listing: Using the TRAP_PROC pragma with an Interrupt Function

#ifdef __HIWARE__ #pragma TRAP_PROC

void MyTrapProc(void)

#else /* other compiler-vendor non-ANSI declaration of interrupt

function */

@interrupt void MyTrapProc(void)

#endif

{

/* code follows here */

}

21.1.11 Defining Interrupt Functions

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

590 Freescale Semiconductor, Inc.

Page 591: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This manual section discusses some important topics related to the handling of interruptfunctions:

• Definition of an interrupt function• Initialization of the vector table• Placing an interrupt function in a special section

21.1.11.1 Defining an Interrupt Function

The compiler provides two ways to define an interrupt function:

• Using pragma TRAP_PROC.• Using the keyword interrupt.

21.1.11.1.1 Using the TRAP_PROC Pragma

The TRAP_PROC pragma informs the compiler that the following function is an interruptfunction. In that case, the compiler terminates the function by a special interrupt returnsequence (for many processors, an RTI instead of an RTS).

Listing: Example of using the TRAP_PROC pragma

#pragma TRAP_PROCvoid INCcount(void) {

tcount++;

}

21.1.11.1.2 Using the interrupt keyword

The interrupt keyword is non-standard ANSI-C and therefore is not supported by allANSI-C compiler vendors. In the same way, the syntax for the usage of this keywordmay change between different compilers. The keyword interrupt informs the compilerthat the following function is an interrupt function.

Listing: Example of using the "interrupt" keyword

interrupt void INCcount(void) { tcount++;

}

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 591

Page 592: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.1.11.2 Initializing the Vector Table

Once the code for an interrupt function has been written, you must associated thisfunction with an interrupt vector. This is done through initialization of the vector table.You can initialize the vector table in the following ways:

• Using the VECTOR ADDRESS or VECTOR command in the PRM file• Using the "interrupt" keyword.

21.1.11.2.1 Using the Linker Commands

The Linker provides two commands to initialize the vector table: VECTOR ADDRESSor VECTOR. You use the VECTOR ADDRESS command to write the address of afunction at a specific address in the vector table.

In order to enter the address of the INCcount() function at address 0x8A, insert thefollowing command in the application's PRM file.

Listing: Using the VECTOR ADDRESS command

VECTOR ADDRESS 0x8A INCcount

The VECTOR command is used to associate a function with a specific vector, identifiedwith its number. The mapping from the vector number is target-specific.

In order to associate the address of the INCcount() function with the vector number 69,insert the following command in the application's PRM file.

Listing: Using the VECTOR command

VECTOR 69 INCcount

21.1.11.2.2 Using the interrupt Keyword

When you are using the keyword "interrupt", you may directly associate your interruptfunction with a vector number in the ANSI C-source file. For that purpose, just specifythe vector number next to the keyword interrupt.

In order to associate the address of the INCcount function with the vector number 75,define the function as in the following listing.

Listing: Definition of the INCcount() interrupt function

Migration Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

592 Freescale Semiconductor, Inc.

Page 593: CodeWarrior Development Studio for Microcontrollers V10.x RS08

interrupt 75 void INCcount(void) {int card1;

tcount++;

}

21.1.11.3 Placing an Interrupt Function in a Special Section

For all targets supporting paging, allocate the interrupt function in an area that isaccessible all the time. You can do this by placing the interrupt function in a specificsegment.

21.1.11.3.1 Defining a Function in a Specific Segment

In order to define a function in a specific segment, use the CODE_SEG pragma.

Listing: Defining a Function in a Specific Segment

/* This function is defined in segment `int_Function'*/#pragma CODE_SEG Int_Function

#pragma TRAP_PROC

void INCcount(void) {

tcount++;

}

#pragma CODE_SEG DEFAULT /* Back to default code segment.*/

21.1.11.3.2 Allocating a Segment in Specific Memory

In the PRM file, you can define where you want to allocate each segment you havedefined in your source code. In order to place a segment in a specific memory area, justadd the segment name in the PLACEMENT block of your PRM file. Be careful, as thelinker is case-sensitive. Pay special attention to the upper and lower cases in yoursegment name.

Listing: Allocating a Segment in Specific Memory

LINK test.absNAMES test.o ... END

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 593

Page 594: CodeWarrior Development Studio for Microcontrollers V10.x RS08

SECTIONS

INTERRUPT_ROM = READ_ONLY 0x4000 TO 0x5FFF;

MY_RAM = READ_WRITE ...

PLACEMENT

Int_Function INTO INTERRUPT_ROM;

DEFAULT_RAM INTO MY_RAM;

...

END

21.2 General Optimization Hints

Here are some hints to reduce the size of your application:

• Find out if you need the full startup code. For example, if you do not have anyinitialized data, you can ignore or remove the copy-down. If you do not need anyinitialized memory, you can remove the zero-out. And if you do not need either, youmay remove the complete startup code and set up your memory in the main routine.Use INIT main in the prm file as the startup or entry into your main routine of theapplication.

• Check the compiler options. For example, the -OdocF: Dynamic OptionConfiguration for Functions compiler option increases the compilation speed, but itdecreases the code size. Using the -Li: List of Included Files to ".inc" File option towrite a log file displays the statistics for each single option.

• Find out if you can use IEEE32 for both float and double. See the -T: Flexible TypeManagement option for how to configure this. Do not forget to link thecorresponding ANSI-C library.

• Use smaller data types whenever possible (e.g., 8 bits instead of 16 or 32 bits).• Look into the map file to check runtime routines, which usually have a `_' prefix.

Check for 32-bit integral routines (e.g., _BMUL). Check if you need the long arithmetic.• Enumerations: if you are using enums, by default they have the size of `int'. They can

be set to an unsigned 8-bit (see option -T, or use -TE1uE).• Check if you are using switch tables (have a look into the map file as well). There are

options to configure this (see -CswMinSLB: Minimum Number of Labels for SwitchSearch Tables for an example).

• Finally, the linker has an option to overlap ROM areas (see the -COCC option in thelinker).

General Optimization Hints

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

594 Freescale Semiconductor, Inc.

Page 595: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.3 Frequently Asked Questions (FAQs), Troubleshooting

This section provides some tips on how to solve the most commonly encounteredproblems.

21.3.1 Making Applications

If the compiler or linker crashes, isolate the construct causing the crash and send a bugreport to Freescale support. Other common problems are:

21.3.1.1 The Compiler Reports an Error, but WinEdit Does notDisplay it.

This means that WinEdit did not find the EDOUT file, i.e., the compiler wrote it to a placenot expected by WinEdit. This can have several causes. Check that the DEFAULTDIR:Default Current Directory environment variable is not set and that the project directory isset correctly. Also in WinEdit 2.1, make sure that the OUTPUT entry in the file WINEDIT.INI isempty.

21.3.1.2 Some Programs Cannot Find a File.

Make sure the environment is set up correctly. Also check WinEdit's project directory.Read the Input Files section of the Files chapter.

21.3.1.3 The Compiler Seems to Generate Incorrect Code.

First, determine if the code is incorrect or not. Sometimes the operator-precedence rulesof ANSI-C do not quite give the results one would expect. Sometimes faulty code canappear to be correct. Consider the example in the following listing:

Listing: Possibly faulty code?

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 595

Page 596: CodeWarrior Development Studio for Microcontrollers V10.x RS08

if (x & y != 0) ...evaluates as:if (x & (y != 0)) ...but not as:if ((x & y) != 0) ...

Another source of unexpected behavior can be found among the integral promotion rulesof C. Characters are usually (sign-)extended to integers. This can sometimes have quiteunexpected effects, e.g., the if condition in the following listing is FALSE:

Listing: if condition is always FALSE

unsigned char a, b; b = -8;

a = ~b;

if (a == ~b) ...

because extending a results in 0x0007, while extending b gives 0x00F8 and the ' ~' results in0xFF07. If the code contains a bug, isolate the construct causing it and send a bug report toFreescale support.

21.3.1.4 The code seems to be correct, but the application does notwork.

Check whether the hardware is not set up correctly (e.g., using chip selects). Somememory expansions are accessible only with a special access mode (e.g., only wordaccesses). If memory is accessible only in a certain way, use inline assembly or use the `volatile' keyword.

21.3.1.5 The linker cannot handle an object file.

Make sure all object files have been compiled with the latest version of the compiler andwith the same flags concerning memory models and floating point formats. If not,recompile them.

21.3.1.6 The make Utility does not Make the entire Application.

Frequently Asked Questions (FAQs), Troubleshooting

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

596 Freescale Semiconductor, Inc.

Page 597: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Most probably you did not specify that the target is to be made on the command line. Inthis case, the make utility assumes the target of the first rule is the top target. Either putthe rule for your application as the first in the make file, or specify the target on thecommand line.

21.3.1.7 The make utility unnecessarily re-compiles a file.

This problem can appear if you have short source files in your application. It is caused bythe fact that MS-DOS only saves the time of last modification of a file with an accuracyof ±2 seconds. If the compiler compiles two files in that time, both will have the sametime stamp. The make utility makes the safe assumption that if one file depends onanother file with the same time stamp, the first file has to be recompiled. There is no wayto solve this problem.

21.3.1.8 The help file cannot be opened by double clicking on it in thefile manager or in the explorer.

The compiler help file is a true Win32 help file. It is not compatible with the windows 3.1version of WinHelp. The program winhelp.exe delivered with Windows 3.1, Windows 95and Windows NT can only open Windows 3.1 help files. To open the compiler help file,use Winhlp32.exe.

The winhlp32.exe program resides either in the windows directory (usually C:\windows) or inits system (Win32s) or system32 (Windows 2000, Windows XP, or Windows Vistaoperating systems) subdirectory. The Win32s distribution also contains Winhlp32.exe.

To change the association with Windows either (1) use the explorer menu View>Optionsand then the File Types tab or (2) select any help file and press the Shift key. Hold itwhile opening the context menu by clicking on the right mouse button. Select Open withfrom the menu. Enable the Always using this program check box and select thewinhlp32.exe file with the "other" button.

To change the association with the file manager under Windows 3.1 use theFile>Associate menu entry.

21.3.1.9 How can constant objects be allocated in ROM?

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 597

Page 598: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use #pragma INTO_ROM: Put Next Variable Definition into ROM and the -Cc: AllocateConst Objects into ROM compiler option.

21.3.1.10 The compiler cannot find my source file. What is wrong?

Check if in the default.env file the path to the source file is set in the environmentvariable GENPATH: #include "File" Path. In addition, you can use the -I: Include FilePath compiler option to specify the include file path. With the CodeWarrior IDE, checkthe access path in the preference panel.

21.3.1.11 How can I switch off smart linking?

By adding a '+' after the object in the NAMES list of the prm file.

With the CodeWarrior IDE and the ELF/DWARF object-file format (see -F (-F2, -F2o):Object File Format) compiler option, you can link all in the object within an ENTRIES...ENDdirective in the linker prm file:

ENTRIES fibo.o:* END

21.3.1.12 How to avoid the `no access to memory' warning?

In the simulator or debugger, change the memory configuration mode (menu Simulator >Configure) to `auto on access'.

21.3.1.13 How can the same memory configuration be loaded everytime the simulator or debugger is started?

Save that memory configuration under default.mem. For example, select Simulator >Configure > Save and enter default.mem.

Frequently Asked Questions (FAQs), Troubleshooting

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

598 Freescale Semiconductor, Inc.

Page 599: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.3.1.14 How can a loaded program in the simulator or debugger bestarted automatically and stop at a specified breakpoint?

Define the postload.cmd file. For example:

bs &main t

g

21.3.1.15 How can an overview of all the compiler options beproduced?

Type in -H: Short Help on the command line of the compiler.

21.3.1.16 How can a custom startup function be called after reset?

In the prm file, use:

INIT myStartup

21.3.1.17 How can a custom name for the main() function be used?

In the prm file, use:

MAIN myMain

21.3.1.18 How can the reset vector be set to the beginning of thestartup code?

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 599

Page 600: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use this line in the prm file:

/* set reset vector on _Startup */

VECTOR ADDRESS 0xFFFE _Startup

21.3.1.19 How can the compiler be configured for the editor?

Open the compiler, select File > Configuration from the menubar, and choose EditorSettings.

21.3.1.20 Where are configuration settings saved?

In the project.ini file. With the CodeWarrior IDE, the compiler settings are stored in the* .mcp file.

21.3.1.21 What should be done when "error while adding default.envoptions" appears after starting the compiler?

Choose the options set by the compiler to those set in the default.env file and then savethem in the project.ini file by clicking the save button in the compiler.

21.3.1.22 After starting up the ICD Debugger, an "Illegal breakpointdetected" error appears. What could be wrong?

The cable might be too long. The maximum length for unshielded cables is about 20 cmand it also depends on the electrical noise in the environment.

21.3.1.23 Why can no initialized data be written into the ROM area?

Frequently Asked Questions (FAQs), Troubleshooting

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

600 Freescale Semiconductor, Inc.

Page 601: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The const qualifier must be used, and the source must be compiled with the -Cc: AllocateConst Objects into ROM option.

21.3.1.24 Problems in the communication or losing communication.

The cable might be too long. The maximal length for unshielded cables is about 20 cmand it also depends on the electrical noise in the environment.

21.3.1.25 What should be done if an assertion happens (internalerror)?

Extract the source where the assertion appears and send it as a zipped file with all theheaders, options and versions of all tools.

21.3.1.26 How to get help on an error message?

Either press F1 after clicking on the message to start up the help file, or else copy themessage number, open the pdf manual, and make a search on the copied messagenumber.

21.3.1.27 How to get help on an option?

Open the compiler and type -H: Short Help into the command line. A list of all optionsappears with a short description of them. Or, otherwise, look into the manual for detailedinformation. A third way is to press F1 in the options setting dialog while a option ismarked.

21.4 EBNF Notation

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 601

Page 602: CodeWarrior Development Studio for Microcontrollers V10.x RS08

This chapter gives a short overview of the Extended Backus-Naur Form (EBNF)notation, which is frequently used in this document to describe file formats and syntaxrules. A short introduction to EBNF is presented.

Listing: EBNF Syntax

ProcDecl = PROCEDURE "(" ArgList ")".

ArgList = Expression {"," Expression}.

Expression = Term ("*"|"/") Term.

Term = Factor AddOp Factor.

AddOp = "+"|"-".

Factor = (["-"] Number)|"(" Expression ")".

The EBNF language is a formalism that can be used to express the syntax of context-freelanguages. The EBNF grammar consists of a rule set called - productions of the form:

LeftHandSide = RightHandSide.

The left-hand side is a non-terminal symbol. The right-hand side describes how it iscomposed.

EBNF consists of the symbols discussed in the sections that follow.

• Terminal Symbols• Non-Terminal Symbols• Vertical Bar• Brackets• Parentheses• Production End• EBNF Syntax• Extensions

21.4.1 Terminal Symbols

Terminal symbols (terminals for short) are the basic symbols which form the languagedescribed. In above example, the word PROCEDURE is a terminal. Punctuation symbols of thelanguage described (not of EBNF itself) are quoted (they are terminals, too), while otherterminal symbols are printed in boldface.

EBNF Notation

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

602 Freescale Semiconductor, Inc.

Page 603: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.4.2 Non-Terminal Symbols

Non-terminal symbols (non-terminals) are syntactic variables and have to be defined in aproduction, i.e., they have to appear on the left hand side of a production somewhere. Inthe example above, there are many non-terminals, e.g., ArgList or AddOp.

21.4.3 Vertical Bar

The vertical bar "|" denotes an alternative, i.e., either the left or the right side of the barcan appear in the language described, but one of them must appear. e.g., the 3rdproduction above means "an expression is a term followed by either a "*" or a "/"followed by another term."

21.4.4 Brackets

Parts of an EBNF production enclosed by "[" and "]" are optional. They may appearexactly once in the language, or they may be skipped. The minus sign in the lastproduction above is optional, both -7 and 7 are allowed.

The repetition is another useful construct. Any part of a production enclosed by "{" and"}" may appear any number of times in the language described (including zero, i.e., itmay also be skipped). ArgList above is an example: an argument list is a single expressionor a list of any number of expressions separated by commas. (Note that the syntax in theexample does not allow empty argument lists.)

21.4.5 Parentheses

For better readability, normal parentheses may be used for grouping EBNF expressions,as is done in the last production of the example. Note the difference between the first andthe second left bracket. The first one is part of the EBNF notation. The second one is aterminal symbol (it is quoted) and may appear in the language.

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 603

Page 604: CodeWarrior Development Studio for Microcontrollers V10.x RS08

21.4.6 Production End

A production is always terminated by a period.

21.4.7 EBNF Syntax

The definition of EBNF in the EBNF language is:

Listing: Definition of EBNF in the EBNF Language

Production = NonTerminal "=" Expression ".".Expression = Term {"|" Term}.

Term = Factor {Factor}.

Factor = NonTerminal

| Terminal

| "(" Expression ")"

| "[" Expression "]"

| "{" Expression "}".

Terminal = Identifier | """ <any char> """.

NonTerminal = Identifier.

The identifier for a non-terminal can be any name you like. Terminal symbols are eitheridentifiers appearing in the language described or any character sequence that is quoted.

21.4.8 Extensions

In addition to this standard definition of EBNF, the following notational conventions areused.

The counting repetition: Anything enclosed by "{" and "}" and followed by asuperscripted expression x must appear exactlyx times. x may also be a non-terminal. Inthe following example, exactly four stars are allowed:

Stars = {"*"}4.

EBNF Notation

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

604 Freescale Semiconductor, Inc.

Page 605: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The size in bytes: Any identifier immediately followed by a number n in square brackets("[" and "]") may be assumed to be a binary number with the most significant byte storedfirst, having exactly n bytes. See the example in the following listing.

Listing: Example of a 4-byte identifier - FilePos

Struct = RefNo FilePos[4].

In some examples, text is enclosed by "<" and ">". This text is a meta-literal, i.e.,whatever the text says may be inserted in place of the text (confer <any char> in thefollowing listing, where any character can be inserted).

21.5 Abbreviations, Lexical Conventions

The following table has some programming terms used in this manual.

Table 21-1. Common terminology

Topic Description

ANSI American National Standards Institute

Compilation Unit Source file to be compiled, includes all included header files

Floating Type Numerical type with a fractional part, e.g., float, double, longdouble

HLI High-level Inline Assembly

Integral Type Numerical type without a fractional part, e.g., char, short, int,long, long long

21.6 Number Formats

Valid constant floating number suffixes are f and F for float and l or L for long double.Note that floating constants without suffixes are double constants in ANSI. Forexponential numbers e or E has to be used. - and + can be used for signed representationof the floating number or the exponent.

The following suffixes are supported:

Table 21-2. Supported number suffixes

Constant Suffix Type

floating F float

Table continues on the next page...

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 605

Page 606: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 21-2. Supported number suffixes (continued)

Constant Suffix Type

floating L long double

integral U unsigned in t

integral uL unsigned long

Suffixes are not case-sensitive, e.g., ul, Ul, uL and UL all denote an unsigned long type. Thefollowing listing has examples of these numerical formats.

Listing: Examples of supported number suffixes

+3.15f /* float */ -0.125f /* float */

3.125f /* float */

0.787F /* float */

7.125 /* double */

3.E7 /* double */

8.E+7 /* double */

9.E-7 /* double */

3.2l /* long double */

3.2e12L /* long double */

21.7 Precedence and Associativity of Operators for ANSI-C

The following table gives an overview of the precedence and associativity of operators.

Table 21-3. ANSI-C Precedence and Associativity of Operators

Operators Associativity

() [] -> . left to right

! ~ ++ -- + - * & (type) sizeof right to left

* / % left to right

+ - left to right

<< >> left to right

< <= > >= left to right

== != left to right

& left to right

^ left to right

Table continues on the next page...

Precedence and Associativity of Operators for ANSI-C

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

606 Freescale Semiconductor, Inc.

Page 607: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 21-3. ANSI-C Precedence and Associativity of Operators (continued)

Operators Associativity

| left to right

&& left to right

|| left to right

? : right to left

= += -= *= /= %= &= ^= |= <<= >>= right to left

, left to right

NOTEUnary +, - and * have higher precedence than the binary forms.

The precedence and associativity is determined by the ANSI-C syntax (ANSI/ISO9899-1990, p. 38 and Kernighan/ Ritchie, "The C Programming Language", SecondEdition, Appendix Table 2-1).

Listing: Examples of operator precedence and associativity

if (a == b&&c) and if ((a == b)&&c) are equivalent.However, if (a == b|c)is the same as if ((a == b)|c)

a = b + c * d;

In above listing, operator-precedence causes the product of (c*d) to be added to b, and thatsum is then assigned to a.

In the following listing, the associativity rules first evaluates c+=1, then assigns b to thevalue of b plus (c+=1), and then assigns the result to a.

Listing: Three assignments in one statement

a = b += c += 1;

21.8 List of all Escape Sequences

The following table gives an overview over escape sequences which could be used insidestrings (e.g., for printf):

Chapter 21 Porting Tips and FAQs

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 607

Page 608: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Table 21-4. Escape Sequences

Description Escape Sequence

Line Feed \n

Tabulator sign \t

Vertical Tabulator \v

Backspace \b

Carriage Return \r

Line feed \f

Bell \a

Backslash \\

Question Mark \?

Quotation Mark \^

Double Quotation Mark \"

Octal Number \ooo

Hexadecimal Number \xhh

List of all Escape Sequences

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

608 Freescale Semiconductor, Inc.

Page 609: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 22Global Configuration File Entries

This appendix documents the entries that can appear in the global configuration file. Thisfile is named mcutools.ini.

mcutools.ini can contain these sections:

• [Options] Section• [XXX_Compiler] Section• [Editor] Section• Example

22.1 [Options] Section

This section documents the entries that can appear in the [Options] section of the filemcutools.ini.

22.1.1 DefaultDir

Arguments

Default Directory to be used.

Description

Specifies the current directory for all tools on a global level (see also the DEFAULTDIR:Default Current Directory environment variable).

Example

DefaultDir=C:\install\project

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 609

Page 610: CodeWarrior Development Studio for Microcontrollers V10.x RS08

22.2 [XXX_Compiler] Section

This section documents the entries that can appear in an [XXX_Compiler] section of the filemcutools.ini.

NOTEXXX is a placeholder for the name of the actual backend. Forexample, for the RS08 compiler, the name of this section wouldbe [RS08_Compiler].

22.2.1 SaveOnExit

Arguments

1/0

Description

Set to 1 to store configuration when the compiler is closed. Clear to 0 otherwise. Thecompiler does not ask to store a configuration in either case.

22.2.2 SaveAppearance

Arguments

1/0

Description

Set to 1 to store the visible topics when writing a project file. Clear to 0 if not. Thecommand line, its history, the windows position, and other topics belong to this entry.

22.2.3 SaveEditor

Arguments

[XXX_Compiler] Section

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

610 Freescale Semiconductor, Inc.

Page 611: CodeWarrior Development Studio for Microcontrollers V10.x RS08

1/0

Description

Set to 1 to store the visible topics when writing a project file. Clear to 0 if not. The editorsetting contains all information of the Editor Configuration dialog box.

22.2.4 SaveOptions

Arguments

1/0

Description

Set to 1 to save the options when writing a project file. Clear to 0 otherwise. The optionsalso contain the message settings.

22.2.5 RecentProject0, RecentProject1, etc.

Arguments

Names of the last and prior project files

Description

This list is updated when a project is loaded or saved. Its current content is shown in thefile menu.

Example

SaveOnExit=1 SaveAppearance=1 SaveEditor=1 SaveOptions=1 RecentProject0=C:\myprj\project.ini RecentProject1=C:\otherprj\project.ini

22.2.6 TipFilePos

Arguments

Chapter 22 Global Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 611

Page 612: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Any integer, e.g., 236

Description

Actual position in tip of the day file. Used so different tips show at different calls.

Saved

Always saved when saving a configuration file.

22.2.7 ShowTipOfDay

Arguments

0/1

Description

Show the Tip of the Day dialog box at startup by setting ShowTipOfDay to 1.

1: Show Tip of the Day

0: Show only when opened in the help menu

Saved

Always saved when saving a configuration file.

22.2.8 TipTimeStamp

Arguments

date and time

Description

Date and time when the tips were last used.

Saved

Always saved when saving a configuration file.

[Editor] Section

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

612 Freescale Semiconductor, Inc.

Page 613: CodeWarrior Development Studio for Microcontrollers V10.x RS08

22.3 [Editor] Section

This section documents the entries that can appear in the [Editor] section of themcutools.ini file.

22.3.1 Editor_Name

Arguments

The name of the global editor

Description

Specifies the name which is displayed for the global editor. This entry has only adescriptive effect. Its content is not used to start the editor.

Saved

Only with Editor Configuration set in the File>Configuration Save Configuration dialogbox.

22.3.2 Editor_Exe

Arguments

The name of the executable file of the global editor

Description

Specifies the filename that is called (for showing a text file) when the global editorsetting is active. In the Editor Configuration dialog box, the global editor selection isactive only when this entry is present and not empty.

Saved

Only with Editor Configuration set in the File>Configuration Save Configuration dialogbox.

Chapter 22 Global Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 613

Page 614: CodeWarrior Development Studio for Microcontrollers V10.x RS08

22.3.3 Editor_Opts

Arguments

The options to use the global editor

Description

Specifies options used for the global editor. If this entry is not present or empty, %f isused. The command line to launch the editor is built by taking the Editor_Exe content, thenappending a space followed by this entry.

Saved

Only with Editor Configuration set in the File > Configuration Save Configurationdialog box.

Example

[Editor]

editor_name=notepad

editor_exe=C:\windows\notepad.exe

editor_opts=%f

22.4 Example

The following listing shows a typical mcutools.ini file.

Listing: A Typical mcutools.ini File Layout

[Installation]Path=c:\Freescale

Group=ANSI-C Compiler

[Editor]

editor_name=notepad

editor_exe=C:\windows\notepad.exe

editor_opts=%f

[Options]

DefaultDir=c:\myprj

Example

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

614 Freescale Semiconductor, Inc.

Page 615: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[XXXX_Compiler]

SaveOnExit=1

SaveAppearance=1

SaveEditor=1

SaveOptions=1

RecentProject0=c:\myprj\project.ini

RecentProject1=c:\otherprj\project.ini

TipFilePos=0

ShowTipOfDay=1

TipTimeStamp=Jan 21 2006 17:25:16

Chapter 22 Global Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 615

Page 616: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

616 Freescale Semiconductor, Inc.

Page 617: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 23Local Configuration File Entries

This appendix documents the entries that can appear in the local configuration file.Usually, you name this file project.ini, where project is a placeholder for the name ofyour project.

A project.ini file can contain these sections:

• [Editor] Section• [XXX_Compiler] Section• Example

23.1 Editor_Name

Arguments

The name of the local editor

Description

Specifies the name that is displayed for the local editor. This entry contains only adescriptive effect. Its content is not used to start the editor.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box. This entry has the same format as the global Editor Configuration in themcutools.ini file.

23.1.1 Editor_Name

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 617

Page 618: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

The name of the local editor

Description

Specifies the name that is displayed for the local editor. This entry contains only adescriptive effect. Its content is not used to start the editor.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box. This entry has the same format as the global Editor Configuration in themcutools.ini file.

23.1.2 Editor_Exe

Arguments

The name of the executable file of the local editor

Description

Specifies the filename that is used for a text file when the local editor setting is active. Inthe Editor Configuration dialog box, the local editor selection is only active when thisentry is present and not empty.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box. This entry has the same format as for the global Editor Configuration in themcutools.ini file.

23.1.3 Editor_Opts

Arguments

Local editor options

Description

Editor_Name

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

618 Freescale Semiconductor, Inc.

Page 619: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Specifies options for the local editor to use. If this entry is not present or empty, %f isused. The command line to launch the editor is built by taking the Editor_Exe content, thenappending a space followed by this entry.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box. This entry has the same format as the global Editor Configuration in themcutools.ini file.

23.1.4 Example [Editor] Section

[Editor]

editor_name=notepad

editor_exe=C:\windows\notepad.exe

editor_opts=%f

23.2 [XXX_Compiler] Section

This section documents the entries that can appear in an [XXX_Compiler] section of aproject.ini file.

NOTEXXX is a placeholder for the name of the actual backend. Forexample, for the RS08 compiler, the name of this section wouldbe [RS08_Compiler].

23.2.1 RecentCommandLineX

NOTEX is a placeholder for an integer.

Arguments

String with a command line history entry, e.g., fibo.c

Chapter 23 Local Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 619

Page 620: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

This list of entries contains the content of the command line history.

Saved

Only with Appearance set in the File > Configuration > Save Configuration dialogbox.

23.2.2 CurrentCommandLine

Arguments

String with the command line, e.g., fibo.c -w1

Description

The currently visible command line content.

Saved

Only with Appearance set in the File > Configuration >Save Configuration dialog box.

23.2.3 StatusbarEnabled

Arguments

1/0

Special

This entry is only considered at startup. Later load operations do not use it afterwards.

Description

Is status bar currently enabled?

1: The status bar is visible

0: The status bar is hidden

Saved

Only with Appearance set in the File > Configuration > Save Configuration dialogbox.

[XXX_Compiler] Section

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

620 Freescale Semiconductor, Inc.

Page 621: CodeWarrior Development Studio for Microcontrollers V10.x RS08

23.2.4 ToolbarEnabled

Arguments

1/0

Special

This entry is only considered at startup. Later load operations do not use it afterwards.

Description

Is the toolbar currently enabled?

1: The toolbar is visible

0: The toolbar is hidden

Saved

Only with Appearance set in the File>Configuration > Save Configuration dialog box.

23.2.5 WindowPos

Arguments

10 integers, e.g., " 0,1,-1,-1,-1,-1,390,107,1103,643"

Special

This entry is only considered at startup. Later load operations do not use it afterwards.

Changes of this entry do not show the "*" in the title.

Description

This number contains the position and the state of the window (maximized) and otherflags.

Saved

Only with Appearance set in the File > Configuration > Save Configuration dialogbox.

Chapter 23 Local Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 621

Page 622: CodeWarrior Development Studio for Microcontrollers V10.x RS08

23.2.6 WindowFont

Arguments

size: == 0 -> generic size, < 0 -> font character height, > 0 font cell height

weight: 400 = normal, 700 = bold (valid values are 0 - 1000)

italic: 0 == no, 1 == yes

font name: max 32 characters.

Description

Font attributes.

Saved

Only with Appearance set in the File > Configuration > Save Configuration dialogbox.

Example

WindowFont=-16,500,0,Courier

23.2.7 Options

Arguments

-W2

Description

The currently active option string. This entry is quite long as the messages are also storedhere.

Saved

Only with Options set in the File > Configuration > Save Configuration dialog box.

23.2.8 EditorType

[XXX_Compiler] Section

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

622 Freescale Semiconductor, Inc.

Page 623: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Arguments

0/1/2/3

Description

This entry specifies which Editor Configuration is active.

0: Global Editor Configuration (in the file mcutools.ini)

1: Local Editor Configuration (the one in this file)

2: Command line Editor Configuration, entry EditorCommandLine

3: DDE Editor Configuration, entries beginning with EditorDDE

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box.

23.2.9 EditorCommandLine

Arguments

Command line for the editor.

Description

Command line content to open a file.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box.

23.2.10 EditorDDEClientName

Arguments

Client command, e.g., [open(%f)]

Description

Chapter 23 Local Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 623

Page 624: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Name of the client for DDE Editor Configuration. For details see Editor Started withDDE.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box.

23.2.11 EditorDDETopicName

Arguments

Topic name. For example, "system"

Description

Name of the topic for DDE Editor Configuration. For details, see

Editor Started with DDE

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box.

23.2.12 EditorDDEServiceName

Arguments

Service name. For example, "system"

Description

Name of the service for DDE Editor Configuration. For details, see Editor Started withDDE.

Saved

Only with Editor Configuration set in the File > Configuration > Save Configurationdialog box.

Example

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

624 Freescale Semiconductor, Inc.

Page 625: CodeWarrior Development Studio for Microcontrollers V10.x RS08

23.3 Example

The following listing shows a typical configuration file layout (usually project.ini):

Listing: A Typical Local Configuration File Layout

[Editor]Editor_Name=notepad

Editor_Exe=C:\windows\notepad.exe

Editor_Opts=%f

[XXX_Compiler]

StatusbarEnabled=1

ToolbarEnabled=1

WindowPos=0,1,-1,-1,-1,-1,390,107,1103,643

WindowFont=-16,500,0,Courier

Options=-w1

EditorType=3

RecentCommandLine0=fibo.c -w2

RecentCommandLine1=fibo.c

CurrentCommandLine=fibo.c -w2

EditorDDEClientName=[open(%f)]

EditorDDETopicName=system

EditorDDEServiceName=msdev

EditorCommandLine=C:\windows\notepad.exe %f

Chapter 23 Local Configuration File Entries

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 625

Page 626: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

626 Freescale Semiconductor, Inc.

Page 627: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 24Known C++ Issues in RS08 Compilers

This appendix describes the known issues when using C++ with the RS08 compilers, andcontains these sections:

• Template Issues• Operators• Header Files• Bigraph and Trigraph Support• Known Class Issues• Keyword Support• Member Issues• Constructor and Destructor Functions• Overload Features• Conversion Features• Initialization Features• Known Errors• Other Features

24.1 Template Issues

This section describes unsupported template features.

• Template specialization is unsupported. Example:Listing: Example - Unsupported Template Specialization

template <class T> class C {};template <> class C<double> {};

---------^-------------------- ERROR

• Declaring a template in a class is unsupported. Example:Listing: Example - Unsupported Declaration of Template in a Class

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 627

Page 628: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct S { template <class T1, class T2> void f(T1, T2) {}

};

- template <class T> struct S<...>

-template <int i>

• Non-template parameters are unsupported. Example:Listing: Example - Unsupported Non-template Parameters

template<> int f()- S03< ::T03[3]> s03;

--------------^------------------Doesn't know global scope ::

template <int i, class P> struct S {}

S<0xa301, int(*)[4][3]> s0;

-------------------------^--------Wrong type of template argument

• Implicit instantiations are unsupported. Example:Listing: Example - Unsupported Implicit Instantiations

template <int i > struct A{ A<i>() {}

-----------------^----------------ERROR implicit instantiation

}

- void g00(void) {}

void g00(U) {}

int g00(char) { return 0; }

------^-------------------------ERROR: Function differ in return type

• Accepting a template template parameter is unsupported. Example:Listing: Example - Unsupported template Parameter

template <template <class P> class X, class T> struct A{}

• Defining a static function template is unsupported. Example:Listing: Example - Unsupported Static Function

template <class T> static int f(T t) {return 1}----------------^--ERROR : Illegal storage class

Operators

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

628 Freescale Semiconductor, Inc.

Page 629: CodeWarrior Development Studio for Microcontrollers V10.x RS08

24.2 Operators

This section describes operator-related limitations and issues as well as unsupportedoperator features.

• Relational o perators other than `==' are unsupported for function pointers.• Operators in expressions are unsupported. Example:

Listing: Example - Unsupported Operators in Expressions

- struct A { }; void operator*(A) { counter++; }

enum B{ };

int operator*(B) { return 0; }

-------------------^-----Function differs in return type only

(found 'void ' expected 'int ')

- struct A{

operator int*(){return &global;}

}

A a;

(void)*a;

--------^----------------Compile ERROR

- struct A{};

struct B:struct A{};

int operator*(A) {return 1;}

int f() {

B b;

return (*b);

-----------------^----------------Illegal cast operation

}

- int operator->*(B,int){ return 1; }

----------------^------ERROR: unary operator must have one parameter

• When an expression uses an operator, a member function with the operator's nameshould not hide a non-member function with the same name. Example:Listing: Example - Using an Operator

struct A { void operator*() { }

void test();

};

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 629

Page 630: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void operator*(S, int) { } // not hidden by S::operator*()

void S::test(){

S s;

(void) (s * 3);

--------------^------------------Compile ERROR

• Explicit operator calls are unsupported. Example:Listing: Example - Unsupported Explicit Operator Calls

struct B { operator int() { return 1; }

};

B b;

b.operator int();

-------------^-------------ERROR: Not supported explicit operator call

24.2.1 Binary Operators

The following binary operator functions are unsupported:

• Implementing the binary ->* operator as a non-member function with two parameters.Example:

friend long operator->* (base x, base y) ;

• Implementing the binary ->* operator as a non-static member function with oneparameter. Example:

int operator ->* (C) ;

• Overloaded operators are unsupported. Example:Listing: Example - Unsupported Overloaded Operators

struct S { int m;

template <class T> void operator+=(T t) { m += t; } //

ERROR at template

};

Operators

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

630 Freescale Semiconductor, Inc.

Page 631: CodeWarrior Development Studio for Microcontrollers V10.x RS08

24.2.2 Unary operators

The following unary operator functions are unsupported:

• Implementing the unary ~ operator as a non-member function with one parameter.Example:Listing: Example - Implemeting Unary ~ Operator

int operator ~(C &X) { return 1; } int tilda (C &X) { return 1; }

if (~c != tilda(c))

----- -----^----------------------------ERROR: Integer-operand expected

• Implementing the unary ! operator as a non-member function with one parameter.Example:Listing: Example - Implemeting Unary ! Operator

class A{}; int operator!(A &X) { return 1; }

int bang_(A &X) { return 1; }

A a;

if ((!a) != (bang_(a)))

---------^--------ERROR : Arithmetic type or pointer expected

• Logical OR operators are unsupported. Example:Listing: Example - Unsupported OR Operator

class X {public:

operator int() {i = 1; return 1;}

} x;

(void) (0 || x);

-----------^------------ERROR

• Conditional operators are unsupported. Example:Listing: Example - Unsupported Conditional Operators

int x = 1; int a = 2;

int b = 3;

x?a:b = 1;

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 631

Page 632: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-------------^------------------ERROR

• Assignment operators are incorrectly implemented. Example:Listing: Example - Incorrect Assignment Operator

(i = 2) = 3;-------------^-------- The result of the = operator shall be an lvalue

(i *= 2) = 3;

-------------^-------- The result of the *= operator shall be an lvalue

(i += 5) = 3;

-------------^-------- The result of the += operator shall be an lvalue

24.2.3 Equality Operators

The following equality operator features are unsupported.

• Defining a pointer to member function type. Example:Listing: Example - Defining a Pointer to Member Function Type

struct X { void f() {}

};

typedef void (X::*PROC)();

• Permitting an implementation to compare a pointer to member operand with aconstant expression which evaluates to zero using the == operator.Listing: Example - Permitting an Implemetation

class X {public:

int m;

};

(void) ( &X::m == 0 );

-----------^-------------ERROR

24.3 Header Files

Header Files

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

632 Freescale Semiconductor, Inc.

Page 633: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Header files of type std namespace are unsupported.

Included cname header files are not mapped to name.h. Example:

#include <cstring>

-------^-------------------- ERROR

The following table shows unimplemented header files.

Table 24-1. Unimplemented Header Files

<algorithm> <iomanip> <memory> <streambuf>

<bitset> <iosfwd> <new> <typeinfo>

<climits> <iostream> <numeric> <utility>

<complex> <istream> <ostream> <valarray>

<deque> <iterator> <queue> <vector>

<exception> <limits> <sstream> <wchar.h>

<fstream> <list> <stack> <wctype.h>

<functional> <map> <stdexcept>

24.4 Bigraph and Trigraph Support

The compiler does not recognize the trigraph sequence ??! as equal to |.

In some cases the compiler fails to replace the %: sequence. Example:

Listing: Example - Unsupported %: Sequence Replacement

#if (4 == 9)#include <string.h>

%:endif

^----------------------------- ERROR (missing endif directive)

24.5 Known Class Issues

The following section describes known class issues and unimplemented or unsupportedfeatures.

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 633

Page 634: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Class Names

Usually, using elaborate type specifiers ensures the validity of both names when youdefine a class and a function with the same name in the same scope. However, in theRS08 compilers this type of class name definition causes an error. Example:

Listing: Example - Unsupported Class Name Definition

class C { char c; };void C(int x) { }

int x;

void main()

{

C(x);

------^----------------------- ERROR

}

• Local classes are unsupported on the RS08 compilers. Example:Listing: Example - Unsupported Local Class

void f(void){

class C {

C() { }

};

}

• The class member access feature is unsupported. Example:Listing: Example - Unsupported Class Member Access Feature

class X { public:

enum E { a, b, c };

} x;

int type(int ) {return INT;}

int type(long ) {return LONG;}

int type(char ) {return CHAR;}

int type(X::E ) {return ENUMX;}

type(x.a);

----------^---------------- Ambiguous parameters type

Known Class Issues

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

634 Freescale Semiconductor, Inc.

Page 635: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Nested class declaration is unsupported, although some accesses and calls maysucceed when using nested classes.

• Nested class depths of ten or more are not supported. Example:Listing: Example - Unsupported Nested Class

struct :: A a;-------------------^----------------ERROR

• Function member definitions are not allowed within local class definitions. Example:Listing: Example - Unsupported Member Function Definition

void f (){ class A{

int g();

---------------^------Illegal local function definition

};

}

• Defining a class within a function template is not allowed. Example:Listing: Example - Unsupported Definition of Class within a Function Template

template <class T> struct A {

void f();

};

template <class T>

void A<T>::f(){

class B {

T x;

};

-------------^----------------ERROR

}

• Unsupported Scope rules for classes

Declaring the name of a class does not ensure that the scope name extends throughthe declarative regions of classes nested within the first class. Example:

Listing: Example - Unsupported Scope

struct X4 { enum {i = 4};

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 635

Page 636: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct Y4 {

int ar[i];

---------------^-------------------ERROR

}

}

• Unimplemented Storage class specifiers

Normally, C++ allows taking the address of an object declared register. Example:

Listing: Example - Unimplemented Storage Class Specifiers

register int a; int* ab = &a;

----------^----- ERROR: Cannot take address of this object

• The mutable storage class specifier is unsupported.

24.6 Keyword Support

The following keywords are unsupported:

• typeid

• explicit

• typename

• mutable storage class specifier• Cast keywords:

• static_cast

• const_cast

• reinterpret_cast

• dynamic_cast

24.7 Member Issues

The following member features are either unimplemented, unsupported, or notfunctioning correctly in the RS08 compilers.

• Pointer to Member• Global pointer to member initialization is unimplemented. Example:

Listing: Example - Unsupported Pointer to Member

Keyword Support

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

636 Freescale Semiconductor, Inc.

Page 637: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct S1{};struct S2 { int member; };

struct S3 : S1, S2 {};

int S3::*pmi = &S3::member;

--------------^--------------- ERROR

• Accessing or initializing a class member using a pointer_to_member from that classis unsupported. Example:Listing: Example - Unsupported Initialization

class X{public :

int a;

};

int main(){

int X::* p0 = &X::a;

X obj;

obj.*p0 = -1;

--------^-----------------ERROR:Unrecognized member

}

• Constructing an array from a pointer to member of a struct is unsupported.Example:Listing: Example - Unsupported Arrary Construction

int S::* a0[3];a0[1] = &S::i

---------^-----------------Failed

• Static member - When you refer to a static member using the class member accesssyntax, the object-expression is not evaluated or is evaluated incorrectly. Example:Listing: Example - Static Member

int flag;struct S {

static int val(void) { return flag; }

} s;

S* f01() { flag = 101; return &s; }

void main(){

int g;

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 637

Page 638: CodeWarrior Development Studio for Microcontrollers V10.x RS08

g = f01()->val(); //evaluation failed

}

• Non-Static Member Functions• Using non-static data members defined directly in their overlying class in non-

static member functions is unsupported. Example:Listing: Example - Unsupported Non-Static Member Functions

class X { int var;

public:

X() : var(1) {}

int mem_func();

} x;

int X::mem_func(){

return var; //returned value should be 1

}

• A non-static data member/member function name should refer to the object forwhich it was called. However, in the RS08 compiler, it does not. Example:Listing: Example - Unsupported Non-Static Data Member

class X {public:

int m;

X(int a) : m(a) {}

}

X obj = 2;

int a = obj.m; //should be 2 (but is not)

• Member Access Control• Accessing a protected member of a base class using a friend function of the

derived class is unsupported. Example:Listing: Example - Accessing a protected Member Using a Friend Function

class A{protected:

int i;

};

class B:public A{

friend int f(B* p){return p->i};

Member Issues

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

638 Freescale Semiconductor, Inc.

Page 639: CodeWarrior Development Studio for Microcontrollers V10.x RS08

} ;

• Specifying a private nested type as the return type of a member function of thesame class or a derived class is unsupported. Example:Listing: Example - Specifying a Private Nested Type as the Return Type

class A {protected:

typedef int nested_type;

nested_type func_A(void);

};

Class B: public A{

nested_type func_B(void);

};

A::nested_type A::func_A(void) { return m; }

B:: nested_type B::func_B(void) { return m; }

^------------------------------------ERROR: Not allowed

• Accessing a protected member is unsupported. Example:Listing: Example - Accessing a Protected Member

class B {

protected:

int i;

};

class C : private B {

friend void f(void);

};

void f(void) { (void) &C::i;}

-------------------------^------ERROR: Member cannot be accessed

• Access declaration

Base class member access modification is unimplemented in the following case:

Listing: Example - Access Modification of a Base Class Member

class A{public:

int z;

};

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 639

Page 640: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class B: public A{

public:

A::z;

---------^------------ERROR

};

24.8 Constructor and Destructor Functions

The compiler does not support the following destructor features:

• When a class has a base class with a virtual destructor, its user-declared destructor isvirtual

• When a class has a base class with a virtual destructor, its implicitly-declareddestructor is virtual

The compiler does not support the following constructor features:

• Copy constructor is an unsupported feature. Example:Listing: Example - Unsupported Copy Constructor

class C { int member;};void f(void) {

C c1;

C c2 = c1;

-------^-----------ERROR: Illegal initialization of non-aggregate type

}

• Using a non-explicit constructor for an implicit conversion (conversion byconstructor) is unsupported. Example:Listing: Example - Unsupported Usage of Non-Expilcit Constructor

class A{public:

int m;

S(int x):m(x){};

};

int f(A a) {return a.m};

int b = f(5) /*value of b should be 5 because of explicit conversion of f parameter(b = f(A(5)))*/

Constructor and Destructor Functions

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

640 Freescale Semiconductor, Inc.

Page 641: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Directly invoking a virtual member function defined in a derived class using aconstructor/destructor of class x is unsupported. Example:Listing: Example - Unsupported Direct Invoking of a Virtual Function

class A{ int m;

virtual void vf(){};

A(int) {vf()}

}

class B: public A{

void vf(){}

B(int i) : A(i) {}

}

B b(1); // this should result in call to A::vf()

• Indirectly invoking a virtual member function defined in a derived class using aconstructor of class x is unsupported. Example:Listing: Example - Unsupported Indirect Invoking of a Virtual Function

class A{ int m;

virtual void vf(){};

void gf(){vf();}

A(int) {gf();}

}

class B: public A{

void vf(){}

B(int i) : A(i) {}

}

B b(1); // this should result in call to A::vf()

• Invoking a virtual member function defined in a derived class using a ctor-initializerof a constructor of class x is unsupported. Example:Listing: Unsupported Invoking of a Virtual Function Defined in Derived Class

class A{ int m;

virtual int vf(){return 1;};

A(int):m(vf()){}

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 641

Page 642: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

class B: public A{

int vf(){return 2;}

B(int i) : A(i) {}

}

B b(1); // this should result in call to A::vf()

24.9 Overload Features

The following overload features are unsupported at this time.

• Overloadable Declarations

Usually, two function declarations of the same name with parameter types that onlydiffer in a parameter that is an enumeration in one declaration, and a differentenumeration in the other, can be overloaded. This feature is unsupported at this time.Example:

Listing: Example - Unsupported Overloaded Declaration

enum e1 {a, b, c}; enum e2 {d, e};

int g(e1) { return 3; }

int g(e2) { return 4; }

----------------^--------------------ERROR:function redefinition

• Address of Overloaded Function

Usually, in the context of a pointer-to-function parameter of a user-defined operator,using a function name without arguments selects the non-member function thatmatches the target. This feature is unsupported at this time. Example:

Listing: Example - Unsupported Address of Overloaded Function

const int F_char = 100;int func(char)

{

return F_char;

}

struct A {} a;

Overload Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

642 Freescale Semiconductor, Inc.

Page 643: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int operator+(A, int (*pfc)(char))

{

return pfc(0);

}

if (a + func != F_char){}

-----------^----------------- Arithmetic types expected

• Usually, in the context of a pointer-to-member-function return value of a function,using a function name without arguments selects the member function that matchesthe target. This feature is unsupported at this time. Example:Listing: Example - Unsupported Pointer to Member Function Return Value

struct X { void f (void) {}

void f (int) {}

} x;

typedef void (X::*mfvp)(void);

mfvp f03() {

return &X::f;

----------------------^-------ERROR:Cannot take address of this object

}

• Usually, when an overloaded name is a function template and template argumentdeduction succeeds, the resulting template argument list is used to generate anoverload resolution candidate that should be a function template specialization. Thisfeature is unsupported at this time. Example:Listing: Example - Unsupported Overloaded Name

template <class T> int f(T) { return F_char; }int f(int) { return F_int; }

int (*p00)(char) = f;

--------------------------------^-----------ERROR: Indirection to different types ('int (*)(int)' instead of 'int (*)(char )')

• Overloading operators is unsupported at this time. Example:Listing: Example - Unsupported Operator Overloading

struct S { int m;

template <class T> void operator+=(T t) { m += t; } //

ERROR at template

};

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 643

Page 644: CodeWarrior Development Studio for Microcontrollers V10.x RS08

24.10 Conversion Features

The following conversion features are unsupported.

• Implicit conversions using non-explicit constructors are unsupported. Example:Listing: Example - Unsupported Implicit Conversions

class A{public:

int m;

S(int x):m(x){};

};

int f(A a) {return a.m};

int b = f(5) /*value of b should be 5 because of explicit conversion of f parameter(b = f(A(5)))*/

• Initializations using user-defined conversions are unsupported. Usually, when youinvoke a user-defined conversion to convert an assignment-expression of type cv S(where S is a class type), to a type cv1 T (where T is a class type), a conversionmember function of S that converts to cv1 T is considered a candidate function byoverload resolution. However, this type of situation is unsupported on RS08compilers. Example:Listing: Example - Unsupported Initialization

struct T{ int m;

T() { m = 0; }

} t;

struct S {

operator T() { counter++; return t; }

} s00;

T t00 = s00;

---------------^------Constructor call with wrong number of arguments

24.10.1 Standard Conversion Sequences

The following standard conversion sequences are unsupported:

Conversion Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

644 Freescale Semiconductor, Inc.

Page 645: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• A standard conversion sequence that includes a conversion having a conversion rank.Example:Listing: Example - Standard Conversion Sequence

int f0(long double) { return 0; }int f0(double) { return 1; }

float f = 2.3f;

value = f0(f); //should be 1

-----------^------------- ERROR ambiguous

• A standard conversion sequence that includes a promotion, but no conversion, havinga conversion rank. Example:Listing: Example - Standard Conversion Sequence2

int f0(char) { return 0; }int f0(int) { return 1; }

short s = 5;

value = f0(s);

-----------------^------------- ERROR ambiguous

• A pointer conversion with a Conversion rank. Example:Listing: Example - Pointer Conversion with a Conversion Rank

int f0(void *) { return 0; }int f0(int) { return 1; }

value = f0((short) 0);

----------------^------------- ERROR ambiguous

• User-Defined Conversion Sequences

A conversion sequence that consists of a standard conversion sequence, followed bya conversion constructor and a standard conversion sequence, is considered a user-defined conversion sequence by overload resolution and is unsupported. Example:

Listing: Example - User-Defined Conversion Sequence

char k = 'a';char * kp = &k;

struct S0 {

S0(...) { flag = 0; }

S0(void *) { flag = 1; }

};

const S0& s0r = kp;

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 645

Page 646: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-----------------^-----ERROR: Illegal cast-operation

24.10.2 Ranking implicit conversion sequences

The following implicit conversion sequence rankings situations are unsupported at thistime.

• When s1 and s2 are distinct standard conversion sequences and s1 is a sub-sequenceof s2, overload resolution prefers s1 to s2. Example:Listing: Example - Implicit conversion sequence

int f0(const char*) { return 0; }int f0(char*) { return 1; }

value = f0('a');

---------------^----------------ERROR:Ambiguous

• When s1 and s2 are distinct standard conversion sequences of the same rank, neitherof which is a sub-sequence of the other, and when s1 converts c* to b* (where b is abase of class c), while s2 converts c* to a* (where a is a base of class b), then overloadresolution prefers s1 to s2. Example:Listing: Example 2 - Implicit conversion sequence

struct astruct b : public a

struct c : public b

int f0(a*) { return 0; }

int f0(b*) { return 1; }

c* cp;

value = f0(cp);

--------------^----------------ERROR:Ambiguous

• When s1 and s2 are distinct standard conversion sequences neither of which is a sub-sequence of the other, and when s1 has Promotion rank, and s2 has Conversion rank,then overload resolution prefers s1 to s2. Example:Listing: Example 3 - Implicit conversion sequence

int f(int) { return 11; }int f(long) { return 55; }

short aa = 1;

Conversion Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

646 Freescale Semiconductor, Inc.

Page 647: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int i = f(aa)

----------^------------------- ERROR:Ambiguous

24.10.3 Explicit Type Conversion

The following syntax use is not allowed when using explicit type conversions on an RS08compiler:

Listing: Example - Explicit Type Conversions

i = int();//A simple-type-name followed by a pair of parentheses

The following explicit type conversion features are unsupported at this time:

• Casting reference to a volatile type object into a reference to a non-volatile typeobject. Example:Listing: Example 2 - Explicit Type Conversions

volatile int x = 1;volatile int& y= x;

if((int&)y != 1);

-------^-------------------------ERROR

• Converting an object or a value to a class object even when an appropriateconstructor or conversion operator has been declared. Example:Listing: Example 3 - Explicit Type Conversions

class X {public:

int i;

X(int a) { i = a; }

};

X x = 1;

x = 2;

-----^-------------------ERROR: Illegal cast-operation

• Explicitly converting a pointer to an object of a derived class (private) to a pointer toits base class. Example:Listing: Example 4 - Explicit Type Conversions

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 647

Page 648: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A {public: int x;};class B : private A {

public:

int y;

};

int main(){

B b;

A *ap = (A *) &b;

---------------^----- ERROR: BASE_CLASS of class B cannot be accessed

}

24.11 Initialization Features

The compiler does not support the following initialization features:

• When an array of a class type T is a sub-object of a class object, each array element isinitialized by the constructor for T. Example:Listing: Example - Unsupported Initialization Features

class A{public:

A(){}

};

class B{

public:

A x[3];

B(){};

};

B b; /*the constructor of A is not called in order to initialize the elements of the array*/

• Creating and initializing a new object (call constructor) using a new-expression withone of the following forms:

• (void) new C();

• (void) new C;

• When initializing bases and members, a constructor's mem-initializer-list mayinitialize a base class using any name that denotes that base class type (typedef); thename used may differ from the class definition. Example:

Initialization Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

648 Freescale Semiconductor, Inc.

Page 649: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Example 2 - Unsupported Initialization Features

struct B { int im;

B(int i=0) { im = i; }

};

typedef class B B2;

struct C : public B {

C(int i) : B2(i) {} ;

---------------------^------------------ERROR

};

• Specifying explicit initializers for arrays is not supported. Example:Listing: Example 3 - Unsupported Initialization Features

typedef M MA[3];

struct S {

MA a;

S(int i) : a() {}

-----------------------^----------ERROR: Cannot specify explicit initializer for arrays

};

• Initialization of local static class objects with constructor is unimplemented.Example:Listing: Example 4 - Unsupported Initialization Features

struct S { int a;

S(int aa) : a(aa) {}

};

static S s(10);

---------^-------------ERROR

See Conversion Features also.

24.12 Known Errors

The following functions are incorrectly implemented:

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 649

Page 650: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• sprintf

• vprintf

• putc

• atexit from stdlib.h

• strlen from string.h

• IO functions (freopen, fseek, rewind, etc.)

The following errors occur when using C++ with the RS08 compiler.

• EILSEQ is undefined when <errno.h> is included• Float parameters pass incorrectly

int func(float, float, float );

func(f, 6.000300000e0, 5.999700000e0)

the second value becomes -6.0003

• Local scope of switch statement is unsupported for the default branch. Example:Listing: Example - Unsupported Scope

switch (a){ case 'a': break;

default :

int x = 1;

----------^--------------ERROR: Not declared x

}

• An if condition with initialized declaration is unsupported. Example:Listing: Example - Unsupported Initialization Features

if(int i = 0)------^-----------------ERROR

The following internal errors occur when using C++ with the RS08 compiler:

• Internal Error #103. Example:Listing: Example - Internal Error #103

long double & f(int i ) {return 1;}long double i;

if (f(i)!=i)

--------^-----------------Internal Error

• Internal Error #385, generated by the following example:Listing: Example - Internal Error #385

Known Errors

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

650 Freescale Semiconductor, Inc.

Page 651: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class C{public:

int n;

operator int() { return n; };

}cy;

switch(cy) {

--------^-------------ERROR

case 1:

break;

default:

break;

}

• Internal Error #418, generated by the following example:Listing: Example - Internal Error #418

#include <time.h>struct std::tm T;

• Internal Error #604, generated by the following example:Listing: Example - Internal Error #604

class C { public:

int a;

unsigned func() { return 1;}

};

unsigned (C::*pf)() = &C::func;

if (pf != 0 );

-------^------------------Generates the error

• Internal Error #1209, when using a twelve-dimensional array• Internal Error #1810, generated by the following example:

Listing: Example - Internal Error #1810

struct Index { int s;

Index(int size) { s = size; }

~Index(void){ ++x; }

};

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 651

Page 652: CodeWarrior Development Studio for Microcontrollers V10.x RS08

for (int i = 0; i < 10; i++)

for (Index j(0); j.s < 10; j.s++) {

// ...

}

24.13 Other Features

This section describes unsupported or unimplemented features.

• Unsupported data types include:• bool

• wchar_t (wide character).• Exception h andling is unsupported• Using comma e xpressions as lvalues is unsupported. Example:

(a=7, b) = 10;

• Name Features• Namespaces are currently unsupported. Example:

Listing: Example - Namespaces

namespace A { ----------^------------------- ERROR

int f(int x);

}

• The name lookup feature is currently unsupported. Name lookup is defined aslooking up a class as if the name is used in a member function of X when thename is used in the definition of a static data member of the class. Example:Listing: Example - Name Lookup Feature

class C { public:

static int i;

static struct S {

int i; char c;

} s;

};

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

652 Freescale Semiconductor, Inc.

Page 653: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int C::i = s.i;

• Hiding a class name or enumeration name using the name of an object, function,or enumerator declared in the same scope is unsupported. Example:Listing: Example - Enumerator Declaration

enum {one=1, two, hidden_name }; struct hidden_name{int x;};

-----------^----------------Not allowed

• Global initializers with non-const variables are unsupported. Example:Listing: Example - Global Initializers

int x;int y = x;

• Anonymous unions are unsupported. Example:Listing: Example - Anonymous Unions

void f(){

union { int x; double y; };

x = 1;

y = 1.0;

}

• The following time functions (<ctime>) are unsupported:• time()

• localtime()

• strftime()

• ctime()

• gmtime()

• mktime()

• clock()

• asctime()

• The fundamental type feature is not supported:Listing: Example - Fundamental Type Feature

int fun (char x){} int fun (unsigned char x){}

--------------^--------------------------Illegal function redefinition

• Enumeration declaration features• Defining an enum in a local scope of the same name is unsupported. Example:

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 653

Page 654: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Example - Unsupported Enumeration Declaration

enum e { gwiz }; // global enum e void f()

{

enum e { lwiz };

---------------^---------------- ERROR: Illegal enum redeclaration

}

• The identifiers in an enumerator-list declared as constants, and appearingwherever constants are required, is unsupported. Example:Listing: Example 2 - Unsupported Enumeration Declaration

int fun(short l) { return 0; } int fun(const int l) { return 1; }

enum E { x, y };

fun(x); /*should be 1*/

• Unsupported union features:• An unnamed union for which an object is declared having member functions• Allocation of bit-fields within a class object. Example:

Listing: Example - Unsupported Union

enum {two = 2}; struct D { unsigned char : two; };

• The following multiple base definition features are unimplemented as yet:• More than one indirect base class for a derived class. Example:

Listing: Example - Multiple Base Definition

Class B:public A(){};Class C: public B(){};

Class D :public B, public A,publicC{};

• Multiple virtual base classes. Example:Listing: Example - Multiple Virtual Base

class A{};class B: public virtual A{};

class C: public virtual A{};

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

654 Freescale Semiconductor, Inc.

Page 655: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class D: public B, public C{}

• Generally, a friend function defined in a class is in the scope of the class inwhich it is defined. However, this feature is unsupported at this time. Example:Listing: Example - Unsupported Friend Function

class A{public:

static int b;

int f(){return b;};

};

int A::b = 1;

int x = f(); /*ERROR : x!=1 (it should be 1)*/

• The compiler considers the following types ambiguous (the same):• char

• unsigned char

• signed char

• The Call to Named Function feature is unsupported. Example:Listing: Example - Call to Named Function

class A{ static int f(){return 0;}

friend void call_f(){

f();

------^-----ERROR: missing prototype (it should be accepted

by the compiler)

}

}

• Preprocessing directives are unsupported. Example:Listing: Example - Preprocessing Directives

#define MACRO (X) 1+ XMACRO(1) + 1;

-------------^-------------------Illegal cast-operation

• The following line control feature is unsupported.• Including a character-sequence in a line directive makes the implementation

behave as if the content of the character string literal is equal to the name of thesource file. Example:Listing: Example - Line Control

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 655

Page 656: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#line 19 "testfile.C" //line directive should alter __FILE__

• The following floating point characteristics errors occur:• Float exponent is inconsistent with minimum

power(FLT_RADIX, FLT_MIN_EXP -1) != FLT_MIN

• Float largest radix power is incorrect

FLT_MAX / FLT_RADIX + power(FLT_RADIX, FLT_MAX_EXP-FLT_MANT_DIG-1)!=

power(FLT_RADIX,FLT_MAX_EXP-1)

• Multiplying then dividing by radix is inexact• Dividing then multiplying by radix is inexact• Double exponent is inconsistent with minimum• Double, power of radix is too small• Double largest radix power is incorrect• Multiplying then dividing by radix is inexact• Dividing then multiplying by radix is inexact• Long double exponent is inconsistent with minimum• Long double, power of radix is too small• Long double largest radix power is incorrect

• The following best viable function is unsupported:• When two viable functions are indistinguishable implicit conversion sequences,

it is normal for the overload resolution to prefer a non-template function over atemplate function. Example:Listing: Example - Viable Function

int f ( short , int ) { return 1; }template <class T> int f(char, T) { return 2; }

value = f(1, 2);

---------^----------------------ERROR: Ambiguous

• The following Reference features are unsupported:• Object created and initialized/destroyed when reference is to a const. Example:

Listing: Example - Reference

const X& r = 4;-----------------------^------------ERROR: Illegal cast-operation

• The following syntax is unsupported:Listing: Example - Unsupported Syntax

int a7, a; if(&(::a7) == &a);

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

656 Freescale Semiconductor, Inc.

Page 657: CodeWarrior Development Studio for Microcontrollers V10.x RS08

---------^-------------------ERROR:Not supported operator ::

• Aggregate features• Object initialization fails. Example:

Listing: Example - Unsupported Object Initialization

class complex{ float re, im;

complex(float r, float i = 0) { re=r; im=i; };

int operator!=( complex x ){}

}

complex z = 1;

z!=1

---------^------------ERROR :Type mismatch

• Initialization of aggregate with an object of a struct/class publicly derived fromthe aggregate fails. Example:Listing: Example 2 - Unsupported Object Initialization

class A { public:

int a;

A(int);

};

class B: public A{

public:

int b;

B(int, int);

};

B::B(int c, int d) : A(d) { b = c; }

B b_obj(1, 2);

int x = B_obj.a;

-----^----------ERROR: x should be 2

• Evaluating default arguments at each point of call is an unsupported feature.• The following typedef specifier is unsupported:

Listing: Example - Unsupported typedef Specifier

typedef int new_type;typedef int new_type;

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 657

Page 658: CodeWarrior Development Studio for Microcontrollers V10.x RS08

--------------^-------ERROR: Invalid redeclaration of new_type

• This return statement causes an error:Listing: Example - Unsupported Return Statement

return ((void) 1);----------------------------^------------ERROR

• Permitting a function to appear in an integral constant if it appears in a sizeofexpression is unsupported. Example:Listing: Example - Unsupported Expression

void f() {}int i[sizeof &f];

--------------------^-------------ERROR

• Defining a local scope using a compound statement is an unimplemented feature.Example:Listing: Example - Local Scope

int i = 4; int main(){

if ((i != 1) || (::i != 4));

------------------------^----------ERROR

}

• The following Main function is currently unimplemented:Listing: Example - Unimplemented Main Function

argv[argc]!=0 (it should be guaranteed that argv[argc]==0.)

• The following Object lifetime feature is currently unimplemented:• When the lifetime of an object ends and a new object is created at the same

location before it is released, a pointer that pointed to the original object can beused to manipulate the new object.

• The following Function call features are unsupported:• References to functions feature is not supported. Example:

Listing: Example - Unsupported Function Call

int main(){ int f(void);

int (&fr)(void) = f;/

}

• Return pointer type of a function make ambiguous between void * and X *.Example:

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

658 Freescale Semiconductor, Inc.

Page 659: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Listing: Example 2 - Unsupported Function Call

class X {public:

X *f() { return this; }

};

int type(void *x) {return VOIDP;}

int type(X *x) {return CXP;}

X x;

type(x.f())

-----^--------ERROR: ambiguous

• Incorrect implementation of a member function call when the call is aconditional expression followed by argument list. Example:Listing: Example 3 - Unsupported Function Call

struct S {S(){}

int f() { return 0; }

int g() { return 11; }

int h() {

return (this->*((0?(&S::f) : (&S::g))))();

------------------------------^-------------ERROR

}

};

• The following Enumeration feature is unsupported:• For enumerators and objects of enumeration type, if an int can represent all the

values of the underlying type, the value is converted to an int; otherwise if anunsigned int can represent all the values, the value is converted to an unsigned int;otherwise if a long can represent all the values, the value is converted to a long;otherwise it is converted to unsigned long. Example:Listing: Example - Unsupported Enumeration

enum E { i=INT_MAX, ui=UINT_MAX , l=LONG_MAX, ul=ULONG_MAX };-------------------------^--------------ERROR: Integral type expected or enum value out of range

• Delete operations have the following restrictions:• Use the S::operator delete only for single cell deletion and not array deletion. For

array deletion, use the global ::delete(). Example:Listing: Example - Restrictions for Delete Operation

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 659

Page 660: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct S{ S() {}

~S () {destruct_counter++;}

void * operator new (size_t size) {

return new char[size];

}

void operator delete (void * p) {

delete_counter ++;

::delete p;}

};

S * ps = new S[3];

delete [] ps;

-------------^--------ERROR: Used delete operator (should use global ::delete)

• Global ::delete uses the class destructor once for each cell of an array of classobjects. Example:Listing: Example 2 - Restrictions for Delete Operation

S * ps1 = new S[5]; ::delete [] ps1;

------------^------ERROR: ~S is not used

• Error at declaring delete operator. Example:Listing: Example 3 - Restrictions for Delete Operation

void operator delete[](void *p){};-----------------------^--------------ERROR

• The New operator is unimplemented. Example:Listing: Example - Unimplemented New Operator

- void * operator new[](size_t); -------------------^--------ERROR: Operator must be a function

• The following Expression fails to initialize the object. Example:Listing: Example - Failed Initialization of the Object

int *p = new int(1+(2*4)-3);-----------------^-----ERROR: The object is not initialized

• Use placement syntax for new int objects. Example:Listing: Example - Using Placement Syntax for New int Objects

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

660 Freescale Semiconductor, Inc.

Page 661: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int * p1, *p2;p1 = new int;

p2 = new (p1) int;

--------------^----------------ERROR: Too many arguments

• The following Multi-dimensional array syntax is not supported:Listing: Example 7 - Unsupported Multi-dimensional Array Syntax

int tab[2][3]; int fun(int (*tab)[3]);

-------------------^---------------------ERROR

• The following Goto syntax is unsupported:Listing: Example - Unsupported Goto Syntax

label: int x = 0;

--------------^---------------ERROR: x not declared (or typename)

• The following Declaration Statement feature is not implemented:• Transfer out of a loop, out of a block, or past an initialized auto variable involves

the destruction of auto variables declared at the point transferred from but not atthe point transferred to.

• The following Function Syntax features are not supported:• Function taking an argument and returning a pointer to a function that takes an

integer argument and returns an integer should be accepted. Example:Listing: Example - Unsupported Function Syntax

int (*fun1(int))(int a) {} int fun2(int (*fun1(int))(int))()

-----^-------------------------ERROR

• Declaring a function fun taking a parameter of type integer and returning aninteger with typedef is not allowed. Example:Listing: Example 2 - Unsupported Function Syntax

typedef int fun(int) -------------------------^-----ERROR

• A cv-qualifier-seq can only be part of a declaration or definition of a non-staticmember function, and of a pointer to a member function. Example:Listing: Example 3 - Unsupported Function Syntax

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 661

Page 662: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class C { const int fun1(short);

volatile int fun2(long);

const volatile int fun3(signed);

};

const int (C::*cp1)(short);

-------------^--------------- ERROR:Should be initialized

volatile int (C::*cp2)(long);

-------------^--------------- ERROR: Should be initialized

const volatile int (C::*cp3)(signed);

------------------------^---- ERROR: Should be initialized

• Use of const in a definition of a pointer to a member function of a struct shouldbe accepted. Example:Listing: Example 4 - Unsupported Function Syntax

struct S { const int fun1(void);

volatile int fun2(void);

const volatile int fun3(void);

} s;

const int (S::*sp1)(void) = &S::fun1;

if(!sp1);

--------^----------------------------ERROR:Expected int

• When using Character literals, the Multi-characters constant is not treated as int.Example:Listing: Example - Unsupported Character Literals

int f(int i, char c) {return 1;} f('abcd', 'c');

-----------^--------------------ERROR

• The String characteristic "A string is an `array of nconstchar'" is not supported.Example:Listing: Example - Unsupported String Characterstic

int type(const char a[]){return 1};type("five") != 1 /*Runtime failed*/

• Ambiguity ResolutionListing: Example - Ambiguity Resolution

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

662 Freescale Semiconductor, Inc.

Page 663: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct S { int i;

S(int b){ i = b;}

};

S x(int(a));

--------^----------ERROR: Should have been a function declaration, not an object declaration

• Using const as a qualified reference is an unsupported feature. Example:Listing: Example - Unsupported const Reference

int i; typedef int& c;

const c cref = i;// reference to int

--------------------^------------------ERROR

• No warning on invalid jump past a declaration with explicit or implicit initializer.Example:Listing: Example - Invalid Jump

switch(val) {case 0:

int a = 10; // invalid, warning should be reported

break;

case 1:

int b; // valid

b = 11;

break;

case 2:

break;

}

Chapter 24 Known C++ Issues in RS08 Compilers

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 663

Page 664: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Other Features

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

664 Freescale Semiconductor, Inc.

Page 665: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Chapter 25RS08 Compiler Messages

This chapter describes the compiler messages.

NOTENot all tools messages have been defined for this release. Alldescriptions will be available in an upcoming release.

25.1 Compiler Messages

Following is the list of the compiler messages.

25.1.1 C1: Unknown message occurred

[FATAL]

Description

The application tried to emit a message which was not defined. This is a internal errorwhich should not occur. Please report any occurrences to your support.

Tips

Try to find out the and avoid the reason for the unknown message.

25.1.2 C2: Message overflow, skipping <kind> messages

[INFORMATION]

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 665

Page 666: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The application did show the number of messages of the specific kind as controlled withthe options -WmsgNi, -WmsgNw and -WmsgNe. Further options of this kind are notdisplayed.

Tips

Use the options -WmsgNi, -WmsgNw and -WmsgNe to change the number of messages.

25.1.3 C50: Input file '<file>' not found

[FATAL]

Description

The Application was not able to find a file needed for processing.

Tips

Check if the file really exits. Check if you are using a file name containing spaces (in thiscase you have to quote it).

25.1.4 C51: Cannot open statistic log file <file>

[WARNING]

Description

It was not possible to open a statistic output file, therefore no statistics are generated.Note: Not all tools support statistic log files. Even if a tool does not support it, themessage still exists, but is never issued in this case.

25.1.5 C52: Error in command line <cmd>

[FATAL]

Description

In case there is an error while processing the command line, this message is issued.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

666 Freescale Semiconductor, Inc.

Page 667: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.6 C53: Message <Id> is not used by this version. Themapping of this message is ignored.

[WARNING]

Description

The given message id was not recognized as known message. Usually this message isissued with the options -WmsgS[D|I|W|E]<Num> which should map a specific messageto a different message kind.

Example

-WmsgSD123456789

Tips

There are various reasons why the tool would not recognize a certain message:

• make sure you are using the option with the right tool, say you don't disable linkermessages in the compiler preferences

• The message may have existed for an previous version of the tool but was removedfor example because a limitation does no longer exist.

• The message was added in a more recent version and the used old version did notsupport it yet.

• The message did never exist. Maybe a typo?

25.1.7 C54: Option <Option> .

[INFORMATION]

Description

This information is used to inform about special cases for options. One reason thismessage is used is for options which a previous version did support but this version doesno longer support. The message itself contains a descriptive text how to handle thisoption now.

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 667

Page 668: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check the manual for all the current option. Check the release notes about thebackground of this change.

25.1.8 C56: Option value overriden for option <OptionName>.Old value `<OldValue>', new value `<NewValue>'.

[WARNING]

Description

This message is issued when two or more sub options (of the same option) which aremutually exclusive are passed as arguments to the compiler.

Example

crs08.exe -Mb -Ml

/*WARNING C56: Option value overridden for option -M. Old value 'b', new value 'l'.*/

25.1.9 C64: Line Continuation occurred in <FileName>

[INFORMATION]

Description

In any environment file, the character '\' at the end of a line is taken as line continuation.This line and the next one are handles as one line only. Because the path separationcharacter of MS-DOS is also '\', paths are often incorrectly written ending with '\'. Insteaduse a '.' after the last '\' to not finish a line with '\' unless you really want a linecontinuation.

Example

Current Default.env:

... LIBPATH=c:\Codewarrior\lib\ OBJPATH=c:\Codewarrior\work ...

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

668 Freescale Semiconductor, Inc.

Page 669: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Is taken identical as

... LIBPATH=c:\Codewarrior\libOBJPATH=c:\Codewarrior\work ...

Tips

To fix it, append a '.' behind the '\'

... LIBPATH=c:\Codewarrior\lib\. OBJPATH=c:\Codewarrior\work ...

NOTEBecause this information occurs during the initialization phaseof the application, the message prefix might not occur in theerror message. So it might occur as "64: Line Continuationoccurred in <FileName>".

25.1.10 C65: Environment macro expansion message'<description>' for <variablename>

[INFORMATION]

Description

During a environment variable macro substitution an problem did occur. Possible causesare that the named macro did not exist or some length limitation was reached. Alsorecursive macros may cause this message.

Example

Current variables:

...

LIBPATH=${LIBPATH}

...

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 669

Page 670: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check the definition of the environment variable.

25.1.11 C66: Search path <Name> does not exist

[INFORMATION]

Description

The tool did look for a file which was not found. During the failed search for the file, anon existing path was encountered.

Tips

Check the spelling of your paths. Update the paths when moving a project. Use relativepaths.

25.1.12 C1000: Illegal identifier list in declaration

[ERROR]

Description

A function prototype declaration had formal parameter names, but no types wereprovided for the parameters.

Example

int f(i);

Tips

Declare the types for the parameters.

25.1.13 C1001: Multiple const declaration makes no sense

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

670 Freescale Semiconductor, Inc.

Page 671: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The const qualifier was used more than once for the same variable.

Example

const const int i;

Tips

Constant variables need only one const qualifier.

See also• Qualifiers

25.1.14 C1002: Multiple volatile declaration makes no sense

[WARNING]

Description

The volatile qualifier was used more than once for the same variable.

Example

volatile volatile int i;

Tips

Volatile variables need only one volatile qualifier.

25.1.15 C1003: Illegal combination of qualifiers

[ERROR]

Description

The combination of qualifiers used in this declaration is illegal.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 671

Page 672: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int *far near p;

Tips

Remove the illegal qualifiers.

25.1.16 C1004: Redefinition of storage class

[ERROR]

Description

A declaration contains more than one storage class.

Example

static static int i;

Tips

Declare only one storage class per item.

25.1.17 C1005: Illegal storage class

[ERROR]

Description

A declaration contains an illegal storage class.

Example

auto int i; // 'auto' illegal for global variables

Tips

Apply a correct combination of storage classes.

Seealso• Storage Classes

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

672 Freescale Semiconductor, Inc.

Page 673: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.18 C1006: Illegal storage class

[WARNING]

Description

A declaration contains an illegal storage class. This message is used for storage classeswhich makes no sense and are ignored (e.g. using 'register' for a global variable.

Example

register int i; //'register' for global variables

Tips

Apply a correct combination of storage classes.

25.1.19 C1007: Type specifier mismatch

[ERROR]

Description

The type declaration is wrong.

Example

int float i;

Tips

Do not use an illegal type chain.

25.1.20 C1008: Typedef name expected

[ERROR]

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 673

Page 674: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

A variable or a structure field has to be either one of the standard types (char, int, short,float, ...) or a type declared with a typedef directive.

Example

struct A {

type j; // type is not known

} A;

Tips

Use a typedef-name for the object declaration.

25.1.21 C1009: Invalid redeclaration

[ERROR]

Description

Classes, structures and unions may be declared only once. Function redeclarations musthave the same parameters and return values as the original declaration. In C++, dataobjects cannot be redeclared (except with the extern specifier).

Example

struct A { int i; };

struct A { // error int i; };

Tips

Avoid redeclaration, e.g. guarding include files with #ifndef.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

674 Freescale Semiconductor, Inc.

Page 675: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.22 C1010: Illegal enum redeclaration

[ERROR]

Description

An enumeration has been declared twice.

Example

enum A { B};enum A { //error B};

Tips

Enums have to be declared only once.

25.1.23 C1012: Illegal local function definition

[ERROR]

Description

Non-standard error!

Example

void main() { struct A { void f() {} };}

Tips

The function definitions must always be in the global scope.

void main(void) { struct A { void f(); };}void A::f(void) { // function definition in global scope}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 675

Page 676: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.24 C1013: Old style declaration

[WARNING]

Description

The compiler has detected an old style declaration. Old style declarations are common inold non-ANSI sources, however they are accepted. With old style declarations, only thenames are in the parameter list and the names and types are declared afterwards.

Example

foo(a, b)

int a, long b;

{

...

}

Tips

Remove such old style declarations from your application:

void foo(int a, long b) {

...

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

676 Freescale Semiconductor, Inc.

Page 677: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.25 C1014: Integral type expected or enum value out of range

[ERROR]

Description

A non-integral value was assigned to a member of an enum or the enumeration valuedoes not fit into the size specified for the enum (in ANSI-C the enumeration type is int).

Example

enum E {

F="Hello"

};

Tips

Enum-members may only get int-values.

25.1.26 C1015: Type is being defined

[ERROR]

Description

The given class or structure was declared as a member of itself. Recursive definition ofclasses and structures are not allowed.

Example

struct A {

A a;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 677

Page 678: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

Tips

Use a pointer to the class being defined instead of the class itself.

25.1.27 C1016: Parameter redeclaration not permitted

[ERROR]

Description

A parameter object was declared with the same name as another parameter object of thesame function.

Example

void f(int i, int i);

Tips

Choose another name for the parameter object with the already used name.

25.1.28 C1017: Empty declaration

[ERROR]

Description

A declaration cannot be empty.

Example

int;

Tips

There must be a name for an object.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

678 Freescale Semiconductor, Inc.

Page 679: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.29 C1018: Illegal type composition

[ERROR]

Description

The type was composed with an illegal combination. A typical example is

extern struct A dummy[];

Example

void v[2];

Tips

Type compositions must not contain illegal combinations.

25.1.30 C1019: Incompatible type to previous declaration

[ERROR]

Description

The specified identifier was already declared

Example

int i;

int i();

Tips

Choose another name for the identifier of the second object.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 679

Page 680: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.31 C1020: Incompatible type to previous declaration

[WARNING]

Description

The specified identifier was already declared with different type modifiers. If the option -Ansi is enabled, this warning becomes an error.

Example

int i;

int i();

Tips

Use the same type modifiers for the first declaration and the redeclaration.

25.1.32 C1021: Bit field type is not 'int'

[ERROR]

Description

Another type than 'int' was used for the bitfield declaration. Some Back Ends maysupport non-int bitfields, but only if the Compiler switch -Ansi is not given.

Example

struct {

char b:1;

} S;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

680 Freescale Semiconductor, Inc.

Page 681: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Use int type for bitfields or remove the -Ansi from the Compiler options.

Seealso• C1106: Non-standard bitfield type

25.1.33 C1022: 'far' used in illegal context

[ERROR]

Description

far, rom or uni has been specified for an array parameter where it is not legal to use it. InANSI C, passing an array to a function always means passing a pointer to the array,because it is not possible to pass an array by value. To indicate that the pointer is a non-standard pointer, non-standard keywords as near or far may be specified if supported.

Example

void foo(int far a) {}; // error

void foo(ARRAY far ap) {} // ok: passing a far pointer

Tips

Remove the illegal modifier.

25.1.34 C1023: 'near' used in illegal context

[ERROR]

Description

far, rom or uni has been specified for an array parameter where it is not legal to use it. InANSI C, passing an array to a function always means passing a pointer to the array,because it is not possible to pass an array by value. To indicate that the pointer is a non-standard pointer, non-standard keywords as near or far may be specified if supported.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 681

Page 682: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

void foo(int near a) {}; // error

void foo(ARRAY near ap) {} // ok: passing a near pointer

Tips

Remove the illegal modifier.

25.1.35 C1024: Illegal bit field width

[ERROR]

Description

The type of the bit field is too small for the number of bits specified.

Example

struct {

int b:1234;

} S;

Tips

Choose a smaller number of bits, or choose a larger type of the bitfield (if the backendallows such a non-standard extension).

25.1.36 C1025: ',' expected before '...'

[ERROR]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

682 Freescale Semiconductor, Inc.

Page 683: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

An open parameter list was declared without a ',' before the '...'.

Example

void foo(int a ...);

Tips

Insert a ',' before the '...'.

25.1.37 C1026: Constant must be initialized

[ERROR]

Description

The specified identifier was declared as const but was not initialized.

Example

const int i; // error

extern const int i; // ok

Tips

Initialize the constant object, or remove the const specifier from the declaration.

25.1.38 C1027: Reference must be initialized

[ERROR]

Description

A reference was not initialized when it was declared.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 683

Page 684: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int j;

int& i // = j; missing

Tips

Initialize the reference with an object of the same type as the reference points to.

25.1.39 C1028: Member functions cannot be initialized

[ERROR]

Description

A member function of the specified class was initialized.

Tips

Do not initialize member functions in the initialization list for a class or structure.

25.1.40 C1029: Undefined class

[ERROR]

Description

A class is used which is not defined/declared.

Example

class A;

class B {

A::I i; // error

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

684 Freescale Semiconductor, Inc.

Page 685: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

Tips

Define/declare a class before using it.

25.1.41 C1030: Pointer to reference illegal

[ERROR]

Description

A pointer to a reference was declared.

Example

void f(int & * p);

Tips

The variable must be dereferenced before a pointer to it can be declared.

25.1.42 C1031: Reference to reference illegal

[ERROR]

Description

A reference to a reference was declared.

Tips

This error can be avoided by using pointer syntax and declaring a reference to a pointer.

25.1.43 C1032: Invalid argument expression

[ERROR]

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 685

Page 686: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The argument expression of a function call in a Ctor-Init list was illegal.

Example

struct A {

A(int i);

};

struct B : A {

B();

};

B::B() : A((3) {// error

}

Tips

In the argument expression of a Ctor-Init function call, there must be the same number of( as ).

25.1.44 C1033: Ident should be base class or data member

[ERROR]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

686 Freescale Semiconductor, Inc.

Page 687: CodeWarrior Development Studio for Microcontrollers V10.x RS08

An object in an initialization list was not a base class or member.

Example

class A {

int i;

A(int j) : B(j) {};// error

};

Tips

Only a member or base class can be in the initialization list for a class or structure.

25.1.45 C1034: Unknown kind of linkage

[ERROR]

Description

The indicated linkage specifier was not legal. This error is caused by using a linkagespecifier that is not supported.

Example

extern "MODULA-2" void foo(void);

Tips

Only the "C" linkage specifier is supported.

25.1.46 C1035: Friend must be declared in class declaration

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 687

Page 688: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The specified function was declared with the friend specifier outside of a class, structureor union.

Example

friend void foo(void);

Tips

Do not use the friend specifier outside of class, structure or union declarations.

25.1.47 C1036: Static member functions cannot be virtual

[ERROR]

Description

A static member function was declared as virtual.

Example

class A {

static virtual f(void); // error

};

Tips

Do not declare a static member function as virtual.

25.1.48 C1037: Illegal initialization for extern variable in blockscope

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

688 Freescale Semiconductor, Inc.

Page 689: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

A variable with extern storage class cannot be initialized in a function.

Example

void f(void) {

extern int i= 1;

}

Tips

Initialize the variable, where it is defined.

25.1.49 C1038: Cannot be friend of myself

[WARNING]

Description

The friend specifier was applied to a function/class inside the scope resolution of thesame class.

Example

class A {

friend A::f(); //treated by the compiler as "friend f();

};

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 689

Page 690: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Do not write a scope resolution to the same class for a friend of a class.

25.1.50 C1039: Typedef-name or ClassName expected

[ERROR]

Description

In the current context either a typedef name or a class name was expected.

Example

struct A {

int i;

};

void main() {

A *a;

a=new a; // error

}

Tips

Write the ident of a type or class/struct tag.

25.1.51 C1040: No valid :: classname specified

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

690 Freescale Semiconductor, Inc.

Page 691: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The specified identifier after a scope resolution was not a class, struct, or union.

Example

class B {

class A {

};

};

class C : B::AA { // AA is not valid

};

Tips

Use an identifier of an already declared class, struct, or union.

25.1.52 C1041: Multiple access specifiers illegal

[ERROR]

Description

The specified base class had more than one access modifier.

Tips

Use only one access modifier (public, private or protected).

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 691

Page 692: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.53 C1042: Multiple virtual declaration makes no sense

[WARNING]

Description

The specified class or structure was declared as virtual more than once.

Tips

Use only one virtual modifier for each base class.

25.1.54 C1043: Base class already declared in base list

[ERROR]

Description

The specified class (or structure) appeared more than once in a list of base classes for aderived class.

Example

class A {};

class B: A, A {

};

Tips

Specify a direct base class only once.

25.1.55 C1044: User defined Constructor is required

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

692 Freescale Semiconductor, Inc.

Page 693: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

A user-defined constructor should be defined. This error occurs when a constructorshould exist, but cannot be generated by the Compiler for the class.

Example

class A {

const int i;

};

The compiler can not generate a constructor because he does not know the value for i.

Tips

Define a constructor for the class.

25.1.56 C1045: <Special member function> not generated

[WARNING]

Description

The Compiler option -Cn=Ctr disabled the creation of Compiler generated specialmember functions (Copy Constructor, Default Constructor, Destructor, Assignmentoperator).

Tips

If you want the special member functions to be generated by the Compiler, disable theCompiler option -Cn=Ctr.

25.1.57 C1046: Cannot create compiler generated <Specialmember="" function>=""> for nameless class

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 693

Page 694: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The Compiler could not generate a special member function (Copy Constructor, DefaultConstructor, Destructor, Assignment operator) for the nameless class.

Example

class B {

public:

B();

};

class {

B b;

} A;

Tips

Give a name to nameless class.

25.1.58 C1047: Local compiler generated <Special memberfunction> not supported

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

694 Freescale Semiconductor, Inc.

Page 695: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Local class declarations would force the compiler to generate local special memberfunctions (Copy Constructor, Default Constructor, Destructor, Assignment \c operator).But local functions are not supported.

Example

;

Tips

If you really want the compiler generated special member functions to be created, thendeclare the class (or struct) in the global scope.

25.1.59 C1048: Generate compiler defined <Special memberfunction>

[INFORMATION]

Description

A special member function (Copy Constructor, Default Constructor, Destructor,Assignment operator) was created by the compiler. When a class member or a base classcontains a Constructor or a Destructor, then the new class must also have this specialfunction so that the base class Constructor or Destructor is called in every case. If theuser does not define one, then the compiler automatically generates one.

Example

struct A {

A(void);

A(const A&);

A& operator =(const A& );

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 695

Page 696: CodeWarrior Development Studio for Microcontrollers V10.x RS08

~A();

};

struct B : A {

};

Tips

If you do not want the compiler to generate the special member functions, then enable theoption -Cn=Ctr. The compiler only calls a compiler generated function if it is reallynecessary. Often a compiler generated function is created, but then never called. Then thesmart linker does not waste code space for such functions.

25.1.60 C1049: Members cannot be extern

[ERROR]

Description

Class member cannot have the storage class extern.

Example

class A {

extern int f();

};

Tips

Remove the extern specifier.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

696 Freescale Semiconductor, Inc.

Page 697: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.61 C1050: Friend must be a class or a function

[ERROR]

Description

The friend specifier can only be used for classes (or structures or unions) and functions.

Example

typedef int I;

struct A {

friend I; // illegal

};

Tips

Use the friend specifier only for classes (or structures or unions) and functions.

25.1.62 C1051: Invalid function body

[ERROR]

Description

The function body of a member function inside a class declaration is invalid.

Example

struct A {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 697

Page 698: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f() { {{int i; }

};

Tips

The function body of a member function inside a class declaration must have the samenumber of "{" as "}".

25.1.63 C1052: Unions cannot have class/struct object memberscontaining Con/Destructor/Assign-Operator

[ERROR]

Description

The specified union member was declared with a special member (Con/Destructor/Assign-Operator).

Example

class A {

A(void);

};

union B {

A a;

};

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

698 Freescale Semiconductor, Inc.

Page 699: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

The union member may contain only compiler generated special members. So try tocompile with the option -Cn=Ctr enabled.

25.1.64 C1053: Nameless class cannot have member functions

[ERROR]

Description

A function was declared in a nameless class.

Example

class {

void f(void);

};

Tips

Name the nameless class, or remove all member functions of the nameless class.

25.1.65 C1054: Incomplete type or function in class/struct/union

[ERROR]

Description

A used type in a function, class, struct or union was not completely defined.

Tips

Define types before using them.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 699

Page 700: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.66 C1055: External linkage for class members not possible

[ERROR]

Description

Member redeclarations cannot have external linkage.

Example

struct A {

f();

}a;

extern "C" A::f() {return 3;}

Tips

Do not declare members as extern.

25.1.67 C1056: Friend specifier is illegal for data declarations

[ERROR]

Description

The friend specifier cannot be used for data declarations.

Example

class A {

friend int a;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

700 Freescale Semiconductor, Inc.

Page 701: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

Tips

Remove the friend specifier from the data declaration.

25.1.68 C1057: Wrong return type for <FunctionKind>

[ERROR]

Description

The declaration of a function of FunctionKind contained an illegal return type.

Tips

Depending on FunctionKind:

• operator -> must return a pointer or a reference or an instance of a class, structure orunion

• operator delete must return void• operator new must return void *

25.1.69 C1058: Return type for FunctionKind must be<ReturnType>

[ERROR]

Description

Some special functions must have certain return types. An occurred function did have anillegal return type.

Tips

Depending on FunctionKind:

• operator -> must return a pointer or a reference or an instance of a class, structure orunion

• operator delete must return void• operator new must return void *

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 701

Page 702: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.70 C1059: Parameter type for <FunctionKind> parameter<No> must be <Type>

[ERROR]

Description

The declaration of a function of FunctionKind has a parameter of a wrong type.

Tips

Depending on FunctionKind:

• operator new parameter 1 must be unsigned int• operator delete parameter 1 must be void *• operator delete parameter 2 must be unsigned int

25.1.71 C1060: <FunctionKind> wrong number of parameters

[ERROR]

Description

The declaration of a function of FunctionKind has a wrong number of parameters

Tips

Depending on FunctionKind: member operator delete must have one or two parameters

25.1.72 C1061: Conversion operator must not have return typespecified before operator keyword

[ERROR]

Description

A user-defined conversion cannot specify a return type.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

702 Freescale Semiconductor, Inc.

Page 703: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A {

public:

int operator int() {return value;}// error

operator int() {return value;} // ok

private:

int value;

}

Tips

Do not specify a return type before the operator keyword.

25.1.73 C1062: Delete can only be global, if parameter is (void *)

[ERROR]

Description

Global declarations/definitions of operator delete are allowed to have only one parameter.

Tips

Declare only one parameter for the global delete operator. Or declare the delete operatoras a class member, where it can have 2 parameters.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 703

Page 704: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.74 C1063: Global or static-member operators must have aclass as first parameter

[ERROR]

Description

The specified overloaded operator was declared without a class parameter.

Example

int operator+ (int, int); // error;

Tips

The first parameter must be of class type.

25.1.75 C1064: Constructor must not have return type

[ERROR]

Description

The specified constructor returned a value, or the class name is used for a member.

Example

struct C {

int C(); // error

C(); // ok

};

Tips

Do not declare a return type for constructors.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

704 Freescale Semiconductor, Inc.

Page 705: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.76 C1065: 'inline' is the only legal storage class forConstructors

[ERROR]

Description

The specified constructor has an illegal storage class (auto, register, static, extern,virtual).

Tips

The only possible storage class for constructors is inline.

25.1.77 C1066: Destructor must not have return type

[ERROR]

Description

The specified destructor returned a value.

Tips

Do not declare a return type for destructors.

25.1.78 C1067: Object is missing decl specifiers

[ERROR]

Description

An object was declared without decl-specifiers (type, modifiers, ...). There is no error, ifcompiling C-source without the -ANSI option.

Example

i

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 705

Page 706: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Apply decl-specifiers for the object, or compile without the options -ANSI and -C++.

25.1.79 C1068: Illegal storage class for Destructor

[ERROR]

Description

The specified destructor has an illegal storage class (static, extern).

Tips

Do not use the storage classes static and extern for destructors.

25.1.80 C1069: Wrong use of far/near/rom/uni/paged in localscope

[ERROR]

Description

The far/near/rom/uni/paged keyword has no effect in the local declaration of the givenidentifier. far may be used to indicate a special addressing mode for a global variableonly. Note that such additional keywords are not ANSI compliant and not supported onall targets.

Example

far int i; // legal on some targets

void foo(void) {

far int j; // error message C1069

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

706 Freescale Semiconductor, Inc.

Page 707: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Remove the far/near/rom/uni/paged qualifier, or declare the object in the global scope.

25.1.81 C1070: Object of incomplete type

[ERROR]

Description

An Object with an undefined or not completely defined type was used.

Example

void f(struct A a) {

}

Tips

Check the spelling of the usage and the definition of this type. It is legal in C to pass apointer to a undefined structure, so examine if is possible to pass a pointer to this typerather than the value itself.

25.1.82 C1071: Redefined extern to static

[ERROR]

Description

An extern identifier was redefined as static.

Example

extern int i;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 707

Page 708: CodeWarrior Development Studio for Microcontrollers V10.x RS08

static int i; // error

Tips

Remove either the extern specifier of the first declaration, or the static specifier of thesecond occurrence of the identifier.

25.1.83 C1072: Redefined extern to static

[WARNING]

Description

If the option -ANSI is disabled, the nonstandard extension issues only a warning, not anerror.

Example

extern int i;

static int i; // warning

Tips

Remove either the extern specifier of the first declaration, or the static specifier of thesecond occurrence of the identifier.

25.1.84 C1073: Linkage specification contradicts earlierspecification

[ERROR]

Description

The specified function was already declared with a different linkage specifier. This errorcan be caused by different linkage specifiers found in include files.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

708 Freescale Semiconductor, Inc.

Page 709: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int f(int i);

extern "C" int f(int i);

Tips

Use the same linkage specification for the same function/variable.

25.1.85 C1074: Wrong member function definition

[ERROR]

Description

The specified member function was not declared in the class/structure for the givenparameters.

Example

class A {

void f(int i);

};

void A::f(int i, int i) { // error

}

Tips

Check the parameter lists of the member function declarations in the class declaration andthe member function declarations/definitions outside the class declaration.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 709

Page 710: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.86 C1075: Typedef object id already used as tag

[ERROR]

Description

The identifier was already used as tag. In C++, tags have the same namespace thanobjects. So there would be no name conflict compiling in C.

Example

typedef const struct A A; // error in C++, ANSI-C ok

Tips

Compile without the option -C++, or choose another name for the typedef object id.

25.1.87 C1076: Illegal scope resolution in member declaration

[ERROR]

Description

An access declaration was made for the specified identifier, but it is not a member of abase class.

Example

struct A {

int i;

};

struct B {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

710 Freescale Semiconductor, Inc.

Page 711: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int j;

};

struct C : A {

A::i; // ok

B::j; // error

};

Tips

Put the owner class of the specified member into the base class list, or do without theaccess declaration.

25.1.88 C1077: <FunctionKind> must not have parameters

[ERROR]

Description

Parameters were declared where it is illegal.

Tips

Do not declare parameters for Destructors and Conversions.

25.1.89 C1078: <FunctionKind> must be a function

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 711

Page 712: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A constructor, destructor, operator or conversion operator was declared as a variable.

Example

struct A {

int A;

};

Tips

Constructors, destructors, operators and conversion operators must be declared asfunctions.

25.1.90 C1080: Constructor/destructor: Parenthesis missing

[ERROR]

Description

A redeclaration of a constructor/destructor is done without parenthesis.

Example

struct A {

~A();

};

A::~A; // error

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

712 Freescale Semiconductor, Inc.

Page 713: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A::~A(); // ok

Tips

Add parenthesis to the redeclaration of the constructor/destructor.

25.1.91 C1081: Not a static member

[ERROR]

Description

The specified identifier was not a static member of a class or structure.

Example

struct A {

int i;

};

void main() {

A::i=4; // error

}

Tips

Use a member access operator (. or ->) with a class or structure object; or declare themember as static.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 713

Page 714: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.92 C1082: <FunctionKind> must be non-static member of aclass/struct

[ERROR]

Description

The specified overloaded operator was not a member of a class, structure or union, and/orwas declared as static. FunctionKind can be a conversion or an operator =, -> or ().

Tips

Declare the function inside a class declaration without the static storage class.

25.1.93 C1084: Not a member

[ERROR]

Description

An ident has been used which is not a member of a class or a struct field.

Tips

Check the struct/class declaration.

25.1.94 C1085: <ident> is not a member

[ERROR]

Description

A nonmember of a structure or union was incorrectly used.

Example

struct A {

int i;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

714 Freescale Semiconductor, Inc.

Page 715: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void main() {

A a;

a.r=3; // error

}

Tips

Using . or ->, specify a declared member.

25.1.95 C1086: Global unary operator must have one parameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Global member unary operator must have exactly one parameter.

25.1.96 C1087: Static unary operator must have one parameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 715

Page 716: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Static member unary operator must have exactly one parameter.

25.1.97 C1088: Unary operator must have no parameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Member unary operator must have no parameters.

25.1.98 C1089: Global binary operator must have two parameters

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Global binary operator must have two parameters.

25.1.99 C1090: Static binary operator must have two parameters

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

716 Freescale Semiconductor, Inc.

Page 717: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Static binary operator must have two parameters.

25.1.100 C1091: Binary operator must have one parameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Binary operator must have one parameter.

25.1.101 C1092: Global unary/binary operator must have one ortwo parameters

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Global unary/binary operator must have one or two parameters.

25.1.102 C1093: Static unary/binary operator must have one ortwo parameters

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 717

Page 718: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Static unary/binary operator must have one or two parameters.

25.1.103 C1094: Unary/binary operator must have no or oneparameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong number ofparameters.

Tips

Unary/binary operator must have no or one parameter.

25.1.104 C1095: Postfix ++/-- operator must have integerparameter

[ERROR]

Description

The specified overloaded operator was incorrectly declared with the wrong type ofparameters.

Tips

Postfix ++/-- operator must have integer parameter.

25.1.105 C1096: Illegal index value

[ERROR]

Description

The index value of an array declaration was equal or less than 0.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

718 Freescale Semiconductor, Inc.

Page 719: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int i[0]; // error;

// for 16bit int this is 0x8CA0 or -29536 !

static char dct_data[400*90];

Tips

The index value must be greater than 0. If the index value is a calculated one, use a 'u' tomake the calculation unsigned (e.g. 400*90u).

25.1.106 C1097: Array bounds missing

[ERROR]

Description

The non-first dimension of an array has no subscript value.

Example

int i[3][]; // error

int j[][4]; // ok

Tips

Specify a subscript value for the non-first dimensions of an array.

25.1.107 C1098: Modifiers for non-member or static memberfunctions illegal

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 719

Page 720: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The specified non-member function was declared with a modifier.

Example

void f() const; // error;

Tips

Do not use modifiers on non-member or static member functions.

25.1.108 C1099: Not a parameter type

[ERROR]

Description

An illegal type specification was parsed.

Example

struct A {

int i;

};

void f(A::i); // error

Tips

Specify a correct type for the parameter.

25.1.109 C1100: Reference to void illegal

[ERROR]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

720 Freescale Semiconductor, Inc.

Page 721: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The specified identifier was declared as a reference to void.

Example

void &amp;vr; // error;

Tips

Do not declare references to a void type.

25.1.110 C1101: Reference to bitfield illegal

[ERROR]

Description

A reference to the specified bit field was declared.

Example

struct A {

int &i : 3; // error

};

Tips

Do not declare references to bitfields.

25.1.111 C1102: Array of reference illegal

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 721

Page 722: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A reference to the specified array was declared.

Example

extern int &j[20];

Tips

Do not declare references to arrays.

25.1.112 C1103: Second C linkage of overloaded function notallowed

[ERROR]

Description

More than one overloaded function was declared with C linkage.

Example

extern "C" void f(int);

extern "C" void f(long);

Tips

When using C linkage, only one form of a given function can be made external.

25.1.113 C1104: Bit field type is neither integral nor enum type

[ERROR]

Description

Bit fields must have an integral type (or enum type for C).

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

722 Freescale Semiconductor, Inc.

Page 723: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct A {

double d:1;

};

Tips

Specify an integral type (int, long, short, ...) instead of the non-integral type.

25.1.114 C1105: Backend does not support non-int bitfields

[ERROR]

Description

Bit fields must be of integer type. Any other integral or non-integral type is illegal. Somebackends support non int bitfields, others do not. See the chapter backend for details.

Example

struct A {

char i:2;

}

When the actual backend supports non-int bitfields, this message does not occur.

Tips

Specify an integer-type (int, signed int or unsigned int) for the bitfield.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 723

Page 724: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.115 C1106: Non-standard bitfield type

[WARNING]

Description

Some of the Back Ends allow bitfield structure members of any integral type.

Example

struct bitfields {

unsigned short j:4; // warning

};

Tips

If you want portable code, use an integer-type for bitfields.

25.1.116 C1107: Long long bit fields not supported yet

[ERROR]

Description

Long long bit fields are not yet supported.

Example

struct A {

long long l:64;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

724 Freescale Semiconductor, Inc.

Page 725: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

Tips

Do not use long long bit fields.

25.1.117 C1108: Constructor cannot have own class/struct typeas first and only parameter

[ERROR]

Description

A constructor was declared with one parameter, and the parameter has the type of theclass itself.

Example

struct B {

B(B b); // error

};

Tips

Use a reference of the class instead of the class itself.

25.1.118 C1109: Generate call to Copy Constructor

[INFORMATION]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 725

Page 726: CodeWarrior Development Studio for Microcontrollers V10.x RS08

An instance of a class was passed as argument of a function, needing to be copied ontothe stack with the Copy Constructor. Or an instance of a class was used as initializer ofanother instance of the same class, needing to be copied to the new class instance withthe Copy Constructor

Example

struct A {

A(A &);

A();

};

void f(A a);

void main(void) {

A a;

f(a); // generate call to copy ctor

}

Tips

If conventional structure copying is desired, try to compile with the option -Cn=Ctr anddo not declare copy constructors manually.

25.1.119 C1110: Inline specifier is illegal for data declarations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

726 Freescale Semiconductor, Inc.

Page 727: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The inline specifier was used for a data declaration.

Example

inline int i;

Tips

Do not use inline specifiers for data declarations.

25.1.120 C1111: Bitfield cannot have indirection

[ERROR]

Description

A bitfield declaration must not contain a *. There are no pointer to bits in C. Use insteada pointer to the structure containing the bitfield.

Example

struct bitfield {

int *i : 2; // error

};

Tips

Do not use pointers in bitfield declarations.

25.1.121 C1112: Interrupt specifier is illegal for data declaration

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 727

Page 728: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The interrupt specifier was applied to a data declaration.

Example

interrupt int i; // error

Tips

Apply the interrupt specifier for functions only

25.1.122 C1113: Interrupt specifier used twice for same function

[ERROR]

Description

The interrupt specifier was used twice for the same function.

Example

interrupt 4 void interrupt 2 f(); // error

Tips

25.1.123 C1114: Illegal interrupt number

[ERROR]

Description

The specified vector entry number for the interrupt was illegal.

Example

interrupt 1000 void f(); // error

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

728 Freescale Semiconductor, Inc.

Page 729: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Check the backend for the range of legal interrupt numbers! The interrupt number is notthe same as the address of the interrupt vector table entry. The mapping from the interruptnumber to the vector address is backend specific.

25.1.124 C1115: Template declaration must be class or function

[ERROR]

Description

A non-class/non-function was specified in a template declaration.

Example

template<class A> int i; // error

Tips

Template declarations must be class or function

25.1.125 C1116: Template class needs a tag

[ERROR]

Description

A template class was specified without a tag.

Example

template<class A> struct { // error

A a;

};

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 729

Page 730: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Use tags for template classes.

25.1.126 C1117: Illegal template/non-template redeclaration

[ERROR]

Description

An illegal template/non-template redeclaration was found.

Example

template<class A> struct B {

A a;

};

struct B { // error

A a;

};

Tips

Correct the source. Protect header files with from multiple inclusion.

25.1.127 C1118: Only bases and class member functions can bevirtual

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

730 Freescale Semiconductor, Inc.

Page 731: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

Because virtual functions are called only for objects of class types, you cannot declareglobal functions or union member functions as 'virtual'.

Example

virtual void f(void); // ERROR: definition of a global

// virtual function.

union U {

virtual void f(void); // ERROR: virtual union member

// function

};

Tips

Do not declare a global function or a union member function as virtual.

25.1.128 C1119: Pure virtual function qualifier should be (=0)

[ERROR]

Description

The '=0' qualifier is used to declare a pure virtual function. Following example shows anill-formed declaration.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 731

Page 732: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A{ // class

public:

virtual void f(void)=2; // ill-formed pure virtual

// function declaration.

};

Tips

Correct the source.

25.1.129 C1120: Only virtual functions can be pure

[ERROR]

Description

Only a virtual function can be declared as pure. Following example shows an hill-formeddeclaration.

Example

class A{ // class

public:

void f(void)=0; // ill-formed declaration.

};

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

732 Freescale Semiconductor, Inc.

Page 733: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Make the function virtual. For overloaded functions check if the parameters are identicalto the base virtual function.

25.1.130 C1121: Definition needed if called with explicit scoperesolution

[INFORMATION]

Description

A definition for a pure virtual function is not needed unless explicitly called with thequalified-id syntax (nested-name-specifier [template] unqualified-id).

Example

class A{

public:

virtual void f(void) = 0; // pure virtual function.

};

class B : public A{

public:

void f(void){ int local=0; }

};

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 733

Page 734: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void){

B b;

b.A::f(); // generate a linking error cause

// no object is defined.

b.f(); // call the function defined in

// B class.

}

Tips

Correct the source.

25.1.131 C1122: Cannot instantiate abstract class object

[ERROR]

Description

An abstract class is a class that can be used only as a base class of some other class; noobjects of an abstract class may be created except as objects representing a base class of aclass derived from it.

Example

class A{

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

734 Freescale Semiconductor, Inc.

Page 735: CodeWarrior Development Studio for Microcontrollers V10.x RS08

public:

virtual void f(void) = 0; //pure virtual function ==> A

//is an abstract class

};

void main(void){

A a;

}

Tips

Use a pointer/reference to the object:

void main(void){

A *pa;

}

Use a derived class from abstract class:

class B : public A{

public:

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 735

Page 736: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f(void){}

};

void main(void){

B b;

}

25.1.132 C1123: Cannot instantiate abstract class as argumenttype

[ERROR]

Description

An abstract class may not be used as argument type

Example

class A{

public:

virtual void f(void) = 0; // pure virtual function

// ==> A is an abstract class

};

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

736 Freescale Semiconductor, Inc.

Page 737: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void){

void fct(A);

}

Tips

Use a pointer/reference to the object:

void main(void){

void fct(A *);

}

Use a derived class from abstract class

class B : public A{

public:

void f(void){}

};

void main(void){

void fct(B);

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 737

Page 738: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

25.1.133 C1124: Cannot instantiate abstract class as return type

[ERROR]

Description

An abstract class may not be used as a function return type.

Example

class A{

public:

virtual void f(void) = 0; //pure virtual function ==> A

//is an abstract class

};

void main(void){

A fct(void);

}

Tips

Use a pointer/reference to the object

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

738 Freescale Semiconductor, Inc.

Page 739: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void){

A *fct(void);

}

Use a derived class from abstract class

class B : public A{

public:

void f(void){}

};

void main(void){

B fct(void);

}

25.1.134 C1125: Cannot instantiate abstract class as a type ofexplicit conversion

[ERROR]

Description

An abstract class may not be used as a type of an explicit conversion.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 739

Page 740: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

class A{

public:

virtual void f(void) = 0; //pure virtual function ==> A is an abstract class

};

class B : public A{

public:

void f(void){}

};

void main(void){

A *pa;

B b;

pa = &amp;(A)b;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

740 Freescale Semiconductor, Inc.

Page 741: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Use a pointer/reference to the object

void main(void){

A *pa;

B b;

pa = (A *)b;

}

25.1.135 C1126: Abstract class cause inheriting pure virtualwithout overriding function(s)

[INFORMATION]

Description

Pure virtual functions are inherited as pure virtual functions.

Example

class A{

public:

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 741

Page 742: CodeWarrior Development Studio for Microcontrollers V10.x RS08

virtual void f(void) = 0;

virtual void g(void) = 0;

};

class B : public A{

public:

void f(void){}

// void B::g(void) is inherited pure virtual

// ==> B is an implicit abstract class

};

25.1.136 C1127: Constant void type probably makes no sense

[INFORMATION]

Description

A pointer/reference to a constant void type was declared

Example

const void *cvp; // warning (pointer to constant void)

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

742 Freescale Semiconductor, Inc.

Page 743: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void *const vpc; // no warning (constant pointer)

Tips

A pointer to a constant type is a different thing than a constant pointer.

25.1.137 C1128: Class contains private members only

[WARNING]

Description

A class was declared with only private members.

Example

class A {

private:

int i;

};

Tips

You can never access any member of a class containing only private members!

25.1.138 C1129: Parameter list missing in pointer to memberfunction type

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 743

Page 744: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The current declaration is neither the one of pointer to member nor the one of pointer tomember function. But something looking like melting of both.

Example

class A{

public:

int a;

};

typedef int (A::*pm);

Tips

Use the standard declaration: for a pointer to member 'type class::*ident' and for a pointerto member function 'type (class::*ident)(param list)'

class A{

public:

int a;

void fct(void);

};

typedef int A::*pmi;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

744 Freescale Semiconductor, Inc.

Page 745: CodeWarrior Development Studio for Microcontrollers V10.x RS08

typedef void (A::*pmf)(void);

25.1.139 C1130: This C++ feature is disabled in your current cC++/EC++ configuration

[ERROR]

Description

Either the Embedded C++ language (EC++) is enabled (option -C++e), or the compactC++ language (cC++) is enabled (option -C++c) plus the appropriate feature is disabled(option -Cn). Following features could be disabled: virtual functions templates pointer tomember multiple inheritance and virtual base classes class parameters and class returns

Tips

If you really don't want to use this C++ feature, you have to find a workaround to theproblem. Otherwise change the C++ language configuration with the options -C++ and -Cn, or use the advanced option dialog

25.1.140 C1131: Illegal use of global variable address modifier

[ERROR]

Description

The global variable address modifier was used for another object than a global variable.

Example

int glob @0xf90b; // ok, the global variable "glob" is at 0xf90b

int *globp @0xf80b = &amp;glob; // ok, the global variable

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 745

Page 746: CodeWarrior Development Studio for Microcontrollers V10.x RS08

// "globp" is at 0xf80b and

// points to "glob"

void g() @0x40c0; // error (the object is a function)

void f() {

int i @0x40cc; // error (the object is a local variable)

}

Tips

Global variable address modifiers can only be used for global variables. They cannot beused for functions or local variables. Global variable address modifiers are a not ANSIstandard. So the option -Ansi has to be disabled. To Put a function at a fixed address, usea pragma CODE_SEG to specify a segment for a function. Then map the function in theprm file with the linker. To call a function at a absolute address use a cast:

#define f ((void (*) (void)) 0x100)

void main(void) {

f();

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

746 Freescale Semiconductor, Inc.

Page 747: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.141 C1132: Cannot define an anonymous type insideparentheses

[ERROR]

Description

An anonymous type was defined inside parentheses. This is illegal in C++.

Example

void f(enum {BB,AA} a) { // C ok, C++ error

}

Tips

Define the type in the global scope.

25.1.142 C1133: Such an initialization requires STATIC CONSTINTEGRAL member

[ERROR]

Description

A static CONST member of integral type may be initialized by a constant expression inits member declaration within the class declaration.

Example

int e = 0;

class A{

public:

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 747

Page 748: CodeWarrior Development Studio for Microcontrollers V10.x RS08

static int a = 1; // ERROR: non-const initialized

const int b = 2; // ERROR: non-static initialized

static const float c = 3.0;// ERROR: non-integral

// initializer

static const int d = e; // ERROR: non-const initializer

// ...

};

Tips

class A{

public:

static const int a = 5; // Initialization

// ...

};

const int A::a; // Definition

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

748 Freescale Semiconductor, Inc.

Page 749: CodeWarrior Development Studio for Microcontrollers V10.x RS08

or the other way round:

class A{

public:

static const int a; // Definition

// ...

};

const int A::a = 5; // Initialization

25.1.143 C1134: Static data members are not allowed in localclasses

[ERROR]

Description

Static members of a local class have no linkage and cannot be defined outside the classdeclaration. It follows that a local class cannot have static data members.

Example

void foo(void){

class A{

public:

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 749

Page 750: CodeWarrior Development Studio for Microcontrollers V10.x RS08

static int a; // ERROR because static data member

static void myFct(void); // OK because static method

};

}

Tips

Remove the static specifier from the data member declarations of any local class.

void foo(void){

class A{

public:

int a; // OK because data member.

static void myFct(void); // OK because static method

};

}

25.1.144 C1135: Ignore Storage Class Specifier cause it onlyapplies on objects

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

750 Freescale Semiconductor, Inc.

Page 751: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

The specified Storage Class Specifier is not taken in account by the compiler, because itdoes not apply to an object.

Example

static class A{

public:

int a;

};

Tips

Remove the Storage Class Specifier from the class definition and apply it to theinstances.

class A{

public:

int a;

};

static A myClassA;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 751

Page 752: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.145 C1136: Class <Ident> is not a correct nested class ofclass <Ident>

[ERROR]

Description

Error detected while parsing the scope resolution of a nested class.

Example

class A{

class B;

}

class A::C{};

Tips

Check that the scope resolution matches the nested class.

class A{

class B;

}

class A::B{};

25.1.146 C1137: Unknown or illegal segment name

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

752 Freescale Semiconductor, Inc.

Page 753: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

A segment name used in a segment specifier was not defined with a segment pragmabefore.

Example

#pragma DATA_SEG AA

#pragma DATA_SEG DEFAULT

int i @ "AA"; // OK

int i @ "BB"; // Error C1137, segment name BB not known

Tips

All segment names must be known before they are used to avoid tipping mistakes and tospecify a place to put segment modifiers.

See also• pragma DATA_SEG• pragma CONST_SEG• pragma CODE_SEG

25.1.147 C1138: Illegal segment type

[ERROR]

Description

A segment name with an illegal type was specified. Functions can only be placed intosegments of type CODE_SEG, variable/constants can only be placed into segments oftype DATA_SEG or CONST_SEG.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 753

Page 754: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma DATA_SEG AA

#pragma CODE_SEG BB

int i @ "AA"; // OK

int i @ "BB"; // Error C1138, data cannot be placed in codeseg

Tips

Use different segment names for data and code. To place constants into rom, usesegments of type CONST_SEG.

See also• pragma DATA_SEG• pragma CONST_SEG• pragma CODE_SEG

25.1.148 C1139: Interrupt routine should not have any returnvalue nor any parameter

[WARNING]

Description

Interrupt routines should not have any return value nor any parameter. In C++, memberfunctions cannot be interrupt routines due to hidden THIS parameter. Another problemmay be that a pragma TRAP_PROC is active where it should not be.

Example

int interrupt myFct1(void){

return 4;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

754 Freescale Semiconductor, Inc.

Page 755: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

#pragma TRAP_PROC

void myFct2(int param){ }

class A{

public:

void myFctMbr(void);

};

void interrupt A::myFctMbr(void){}

Tips

Remove all return value and all parameter (even hidden, e.g. 'this' pointer for C++):

void interrupt myFct1(void){ }

#pragma TRAP_PROC

void myFct2(void){

}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 755

Page 756: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A{

public:

void myFctMbr(void);

};

void A::myFctMbr(void){ }

void interrupt myInterFct(void){ }

25.1.149 C1140: This function is already declared and has adifferent prototype

[WARNING]

Description

There are several different prototypes for the same function in a C module.

Example

int Foo (char,float,int,int* );

int Foo (char,float,int,int**);

int Foo (char,char,int,int**);

Tips

Check which one is correct and remove the other(s).

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

756 Freescale Semiconductor, Inc.

Page 757: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.150 C1141: Ident <ident> cannot be allocated in globalregister

[ERROR]

Description

The global variable 'ident' cannot be allocated in the specified register. There are twopossible reasons: The type of the variable is not supported to be accessed in a register. orThe specified register number is not possible (e.g. used for parameter passing).

Example

extern int glob_var @__REG 4; //r4 is used for parameters

Tips

Consider the ABI of the target processor.

25.1.151 C1142: Invalid Cosmic modifier. Accepted: , , or (-ANSIoff)

[ERROR]

Description

The modified after the @ was not recognized.

Example

@nearer unsigned char index;

Tips

Check the spelling. Cosmic modifiers are only supported with the option -Ccx. Not allbackends do support all qualifiers. Consider using a pragma DATA_SEG with a qualifierinstead.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 757

Page 758: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.152 C1143: Ambiguous Cosmic space modifier. Only oneper declaration allowed

[ERROR]

Description

Multiple cosmic modifiers where found for a single declaration. Use only one of them.

Example

@near @far unsigned char index;

Tips

Cosmic modifiers are only supported with the option -Ccx. Not all backends do supportall qualifiers. Only use one qualifier. Consider using a pragma DATA_SEG with aqualifier instead.

25.1.153 C1144: Multiple restrict declaration makes no sense

[WARNING]

Description

The restrict qualifier should only be applied once and not several times.

Example

int * restrict restrict pointer;

Tips

Only specify restrict once.

25.1.154 C1390: Implicit virtual function

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

758 Freescale Semiconductor, Inc.

Page 759: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[INFORMATION]

Description

The 'virtual' keyword is needed only in the base class's declaration of the function; anysubsequent declarations in derived classes are virtual by default.

Example

class A{ //base class

public:

virtual void f(void){ glob=2; } //definition of a

//virtual function

};

class B : public A{ //derived class

public:

void f(void){ glob=3; } //overriding function

//IMPLICIT VIRTUAL FUNCTION

};

Example2:

class A{ // base class

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 759

Page 760: CodeWarrior Development Studio for Microcontrollers V10.x RS08

public:

virtual void f(void){ glob=2; } //definition of a

//virtual function.

};

class B : public A{ //derived class

public:

virtual void f(void){ glob=3; } //overriding function:

//'virtual' is not

// necessary here

};

Example3:

class A{ //base class

public:

virtual void f(void){ glob=2; } //definition of a

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

760 Freescale Semiconductor, Inc.

Page 761: CodeWarrior Development Studio for Microcontrollers V10.x RS08

//virtual function.

};

class B : public A { //derived class

public:

void f(int a){ glob=3+a; } // not overriding function

};

Tips

A derived class's version of a virtual function must have the same parameter list andreturn type as those of the base class. If these are different, the function is not considereda redefinition of the virtual function. A redefined virtual function cannot differ from theoriginal only by the return type.

25.1.155 C1391: Pseudo Base Class is added to this class

[INFORMATION]

Description

The virtual keyword ensures that only one copy of the subobject is included in thememory scope of the object. This single copy is the PSEUDO BASE CLASS.

Example

class A{ //base class

// member list

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 761

Page 762: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

class B : public virtual A { //derived class

public:

// member list

};

class C : public virtual A { //derived class

public:

// member list

};

class D : public B, public C { //derived class

public:

// member list

};

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

762 Freescale Semiconductor, Inc.

Page 763: CodeWarrior Development Studio for Microcontrollers V10.x RS08

According to this definition, an object 'd' would have the following memory layout:

A part

B part

------

A part

C part

------

D part

But the 'virtual' keyword makes the compiler to generate the following memory layout.

B part

------

C part

------

A part // This is the PSEUDO BASE CLASS of class D

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 763

Page 764: CodeWarrior Development Studio for Microcontrollers V10.x RS08

------

D part

In addition, a pointer to the PSEUDO BASE CLASS is included in each base class thatpreviously derived from virtual base class (here B and C classes).

25.1.156 C1392: Pointer to virtual methods table not qualified forcode address space (use -Qvtprom or -Qvtpuni)

[ERROR]

Description

If a virtual methods table of a class is forced to be allocated in code address space (onlypossible with Harvard architecture), the pointers to the virtual methods table must bequalified with a 'rom' attribute (i.e. rom pointer). This message currently appears only ifyou specify the compiler option -Cc (allocate 'const' objects in rom). For Harvard targetsall virtual methods tables are put into code address space because the virtual methodstables are always constant. In this case the compiler generated pointers to the virtualmethods table must be qualified with the rom or uni attribute (see under Tips).

Tips

Qualify virtual table pointers with 'rom' by setting the compiler option -Qvtprom.

See also• Option -Qvtp

25.1.157 C1393: Delta value does not fit into range (option -Tvtd)

[ERROR]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

764 Freescale Semiconductor, Inc.

Page 765: CodeWarrior Development Studio for Microcontrollers V10.x RS08

An option ' -Tvtd' is provided by the compiler to let the user specify the delta value size.The delta value is used in virtual functions management in order to set up the value of theTHIS pointer. Delta value is stored in virtual tables. Letting the user specify the size ofthe delta value can save memory space. But one can imagine that the specified size canbe too short, that is the aim of this error message.

Example

class A{

public:

long a[33]

};

class B{

public:

void virtual fct2 (void){}

};

class C : public A, public B{

public:

};

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 765

Page 766: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main (void){

C c;

c.fct2();

}

If the previous example is compiled using the option \c -Tvtd1 then the minimal value allowed for delta is (-128) and a real value of delta is -(4*33)=-132.

Tips

Specify a larger size for the delta value: -Tvtd2.

See also• option -T• C++ Front End

25.1.158 C1395: Classes should be the same or derive one fromanother

[ERROR]

Description

Pointer to member is defined to point on a class member, then classes (the one whichmember belongs to and the one where the pointer to member points) have to be identical.If the member is inherited from a base class then classes can be different.

Example

class A{

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

766 Freescale Semiconductor, Inc.

Page 767: CodeWarrior Development Studio for Microcontrollers V10.x RS08

public:

int a;

void fct1(void){}

};

class B{

public:

int b;

void fct2(void){}

};

void main(void){

int B::*pmi = &amp;A::a;

void (B::*pmf)() = &amp;A::fct1;

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 767

Page 768: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use the same classes

class A{

public:

int a;

void fct1(void){}

};

class B{

public:

int b;

void fct2(void){}

};

void main(void){

int A::*pmi = &amp;A::a;

void (A::*pmf)() = &amp;A::fct1;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

768 Freescale Semiconductor, Inc.

Page 769: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Use classes which derive one from an other

class A{

public:

int a;

void fct1(void){}

};

class B : public A{

public:

int b;

void fct2(void){}

};

void main(void){

int B::*pmi = &amp;A::a;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 769

Page 770: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void (B::*pmf)() = &amp;A::fct1;

}

25.1.159 C1396: No pointer to STATIC member: use classicpointer

[ERROR]

Description

Syntax of pointer to member cannot be used to point to a static member. Static memberhave to be pointed in the classic way.

Example

int glob;

class A{

public:

static int a;

static void fct(void){}

};

void main(void){

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

770 Freescale Semiconductor, Inc.

Page 771: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int A::*pmi = &amp;A::a;

void (A::*pmf)() = &amp;A::fct;

}

Tips

Use the classic pointer to point static members

class A{

public:

static int a;

static void fct(void){}

};

void main(void){

A aClass;

int *pmi = &amp;aClass.a;

void (*pmf)() = &amp;aClass.fct;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 771

Page 772: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

25.1.160 C1397: Kind of member and kind of pointer to memberare not compatible

[ERROR]

Description

A pointer to member can not point to a function member and a pointer to functionmember can not point a member.

Example

class A{

public:

int b;

int c;

void fct(){}

void fct2(){}

};

void main(void){

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

772 Freescale Semiconductor, Inc.

Page 773: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int A::*pmi = &amp;A::b;

void (A::* pmf)() = &amp;A::fct;

pmi=&amp;A::fct2;

pmf=&amp;A::c;

}

Tips

class A{

public:

int b;

int c;

void fct(){}

void fct2(){}

};

void main(void){

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 773

Page 774: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int A::*pmi = &amp;A::b;

void (A::* pmf)() = &amp;A::fct;

pmf=&amp;A::fct2;

pmi=&amp;A::c;

}

25.1.161 C1398: Pointer to member offset does not fit into rangeof given type (option -Tpmo)

[ERROR]

Description

An option -Tpmo is provided by the compiler to let the user specify the pointer tomember offset value size. Letting the user specify the size of the offset value can savememory space. But one can imagine that the specified size is too short, that is the aim ofthis message.

Example

class A{

public:

long a[33];

int b;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

774 Freescale Semiconductor, Inc.

Page 775: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void main (void){

A myA;

int A::*pmi;

pmi = &amp;A::b;

myA.*pmi = 5;

}

If the previous example is compiled using the option \c -Tpmo1 then the maximal value allowed for offset is (127) and a real value of offset is (4*33)=132.

Tips

Specify a larger size for the offset value: -Tpmo2.

Seealso• option -T• C++ Front End.

25.1.162 C1400: Missing parameter name in function head

[ERROR]

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 775

Page 776: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

There was no identifier for a name of the parameter. Only the type was specified. Infunction declarations, this is legal. But in function definitions, it's illegal.

Example

void f(int) {} // error

void f(int); // ok

Tips

Declare a name for the parameter. In C++ parameter names must not be specified.

25.1.163 C1401: This C++ feature has not been implemented yet

[ERROR]

Description

The C++ compiler does not support all C++ features yet.

Tips

Try to find a workaround of the problem or ask about the latest version of the compiler.

See also• C++ section about features that are not implemented yet.

25.1.164 C1402: This C++ feature (<Feature>) is not implementedyet

[ERROR]

Description

The C++ compiler does not support all C++ features yet. Here is the list of featurescausing the error:

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

776 Freescale Semiconductor, Inc.

Page 777: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Compiler generated functions of nested nameless classes• calling destructors with goto• explicit operator call• Create Default Ctor of unnamed class• Base class member access modification• local static class obj• global init with non-const

Tips

Try to avoid to use such a feature, e.g. using global static objects instead local ones.

25.1.165 C1403: Out of memory

[FATAL]

Description

The compiler wanted to allocate memory on the heap, but there was no space left.

Tips

Modify the memory management on your system.

25.1.166 C1404: Return expected

[WARNING]

Description

A function with a return type has no return statement. In C it's a warning, in C++ an error.

Example

int f() {} // warning

Tips

Insert a return statement, if you want to return something, otherwise declare the functionas returning void type.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 777

Page 778: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.167 C1405: Goto <undeclared label>=""> in this function

[ERROR]

Description

A goto label was found, but the specified label did not exist in the same function.

Example

void main(void) {

goto label;

}

Tips

Insert a label in the function with the same name as specified in the goto statement.

25.1.168 C1406: Illegal use of identifierList

[ERROR]

Description

A function prototype declaration had formal parameter names, but no types wereprovided for the parameters.

Example

int f(i); // error

Tips

Declare the types for the parameters.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

778 Freescale Semiconductor, Inc.

Page 779: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.169 C1407: Illegal function-redefinition

[ERROR]

Description

The function has already a function body, it has already been defined.

Example

void main(void) {}

void main(void) {}

Tips

Define a function only once.

25.1.170 C1408: Incorrect function-definition

[ERROR]

Description

The function definition is not correct or ill formed.

Tips

Correct the source.

25.1.171 C1409: Illegal combination of parameterlist and identlist

[ERROR]

Description

The parameter declaration for a function does not match with the declaration.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 779

Page 780: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Correct the source. Maybe a wrong header file has been included.

25.1.172 C1410: Parameter-declaration - identifier-list mismatch

[ERROR]

Description

The parameter declaration for a function does not match with the declaration.

Tips

Correct the source. Maybe a wrong header file has been included.

25.1.173 C1411: Function-definition incompatible to previousdeclaration

[ERROR]

Description

An old-style function parameter declaration was not compatible to a previous declaration.

Example

void f(int i);

void f(i,j) int i; int j; {} // error

Tips

Declare the same parameters as in the previous declaration.

25.1.174 C1412: Not a function call, address of a function

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

780 Freescale Semiconductor, Inc.

Page 781: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

A function call was probably desired, but the expression denotes an address of thefunction.

Example

void f(int i);

void main() {

f; // warning

}

Tips

Write parenthesis (, ) with the arguments after the name of the function to be called.

25.1.175 C1413: Illegal label-redeclaration

[ERROR]

Description

The label was defined more than once.

Example

Label:

...

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 781

Page 782: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Label: // label redefined

Tips

Choose another name for the label.

25.1.176 C1414: Casting to pointer of non base class

[WARNING]

Description

A cast was done from a pointer of a class/struct to a pointer to another class/struct, but thesecond class/struct is not a base of the first one.

Example

class A{} a;

class B{};

void main(void) {

B* b= (B*)&a;

}

Tips

Check if your code really does what you want it to.

25.1.177 C1415: Type expected

[ERROR]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

782 Freescale Semiconductor, Inc.

Page 783: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The compiler cannot resolve the type specified or no type was specified. This messagemay also occur if no type is specified for a new operator.

Tips

Correct the source, add a type for the new operator.

25.1.178 C1416: No initializer can be specified for arrays

[ERROR]

Description

An initializer was given for the specified array created with the new operator.

Tips

Initialize the elements of the array after the statement containing the new operator.

25.1.179 C1417: Const/volatile not allowed for type of newoperator

[ERROR]

Description

The new operator can only create non const and non volatile objects.

Example

void main() {

int *a;

typedef const int I;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 783

Page 784: CodeWarrior Development Studio for Microcontrollers V10.x RS08

a=new I; // error

}

Tips

Do not use const/volatile qualifiers for the type given to the new operator.

25.1.180 C1418: ] expected for array delete operator

[ERROR]

Description

There was no ] found after the [ of a delete operator.

Example

delete [] MyArray; // ok

delete [3] MyArray; // error

Tips

Add a ] after the [.

25.1.181 C1419: Non-constant pointer expected for deleteoperator

[ERROR]

Description

A pointer to a constant object was illegally deleted using the delete operator.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

784 Freescale Semiconductor, Inc.

Page 785: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main() {

const int *a;

a=new int;

delete a; // error

}

Tips

The pointer to be deleted has to be non-constant.

25.1.182 C1420: Result of function-call is ignored

[WARNING]

Description

A function call was done without saving the result.

Example

int f(void);

void main(void) {

f(); // ignore result

}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 785

Page 786: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Assign the function call to a variable, if you need the result afterwards. Otherwise castthe result to void. E.g.:

int f(void);

void main(void) {

(void)f(); // explicitly ignore result

}

25.1.183 C1421: Undefined class/struct/union

[ERROR]

Description

An undefined class, structure or union was used.

Example

void f(void) {

struct S *p, *p1;

*p=*p1;

}

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

786 Freescale Semiconductor, Inc.

Page 787: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Define the class/struct/union.

25.1.184 C1422: No default Ctor available

[ERROR]

Description

No default constructor was available for the specified class/struct. The compiler willsupply a default constructor only if user-defined constructors are not provided in thesame class/struct and there are default constructors provided in all base/member classes/structs.

Example

class A {

public:

A(int i); // constructor with non-void parameter

A(); // default constructor

};

Tips

If you provide a constructor that takes a non-void parameter, then you must also providea default constructor. Otherwise, if you do not provide a default constructor, you mustcall the constructor with parameters.

Example

class A {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 787

Page 788: CodeWarrior Development Studio for Microcontrollers V10.x RS08

public:

A(int i);

};

A a(3); // constructor call with parameters

25.1.185 C1423: Constant member must be in initializer list

[ERROR]

Description

There are constant members in the class/struct, that are not initialized with an initializerlist in the object constructor.

Example

struct A {

A();

const int i;

};

A::A() : i(4) { // initialize i with 4

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

788 Freescale Semiconductor, Inc.

Page 789: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

If a const or reference member variable is not given a value when it is initialized, it mustbe given a value in the object constructor.

25.1.186 C1424: Cannot specify explicit initializer for arrays

[ERROR]

Description

The specified member of the class/struct could not be initialized, because it is an array.

Tips

Initialize the member inside the function body of the constructor.

25.1.187 C1425: No Destructor available to call

[WARNING]

Description

No destructor is available, but one must be called.

25.1.188 C1426: Explicit Destructor call not allowed here

[ERROR]

Description

Explicit Destructor calls inside member functions without using this are illegal.

Example

struct A {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 789

Page 790: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f();

~A();

};

void A::f() {

~A(); // illegal

this->~A(); // ok

}

Tips

Use the this pointer.

25.1.189 C1427: 'this' allowed in member functions only

[ERROR]

Description

The specified global function did not have a this pointer to access.

Tips

Do not use this in global functions.

25.1.190 C1428: No wide characters supported

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

790 Freescale Semiconductor, Inc.

Page 791: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

The Compiler does not support wide characters. They are treated as conventionalcharacters.

Example

char c= L'a'; // warning

Tips

Do not specify the L before the character/string constant.

25.1.191 C1429: Not a destructor id

[ERROR]

Description

Another name than the name of the class was used to declare a destructor.

Tips

Use the same name for the destructor as the class name.

25.1.192 C1430: No destructor in class/struct declaration

[ERROR]

Description

There was no destructor declared in the class/struct.

Example

struct A {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 791

Page 792: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

A::~A() {} // error

void main() {

A.a;

a.~A(); // legal

}

Tips

Declare a destructor in the class/struct.

25.1.193 C1431: Wrong destructor call

[ERROR]

Description

This call to the destructor would require the destructor to be static. But destructors arenever static.

Example

class A {

public:

~A();

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

792 Freescale Semiconductor, Inc.

Page 793: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A();

};

void main() {

A::~A(); // error

A::A(); // ok, generating temporary object

}

Tips

Do not make calls to static destructors, because there are no static destructors.

25.1.194 C1432: No valid classname specified

[ERROR]

Description

The specified identifier was not a class/structure or union.

Example

int i;

void main() {

i::f(); // error

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 793

Page 794: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Use a name of a class/struct/union.

25.1.195 C1433: Explicit Constructor call not allowed here

[ERROR]

Description

An explicit constructor call was done for a specific object.

Example

struct A {

A();

void f();

};

void A::f() {

this->A(); // error

A(); // ok, generating temporary object

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

794 Freescale Semiconductor, Inc.

Page 795: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main() {

A a;

a.A(); // error

A(); // ok, generating temporary object

}

Tips

Explicit constructor calls are only legal, if no object is specified, that means, a temporaryobject is generated.

25.1.196 C1434: This C++ feature is not yet implemented

[WARNING]

Description

The C++ compiler does not yet support all C++ features. Here is a list of not yetimplemented features causing a warning: Check for NULL ptr for this complexexpression Class parameters (for some processors this is already implemented!) Classreturns (for some processors this is already implemented!)

Tips

The C++ compiler ignores this C++ feature and behaves like a C-Compiler.

25.1.197 C1435: Return expected

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 795

Page 796: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The specified function was declared as returning a value, but the function definition didnot contain a return statement.

Example

int foo(void) {}

Tips

Write a return statement in this function or declare the function with a void return type.

25.1.198 C1436: delete needs number of elements of array

[WARNING]

Description

A call to the delete[] operator was made without specifying the number of elements of thearray, which is necessary for deleting a pointer to a class needing to call a destructor.

Example

class A {

// ...

~A();

};

class B {

// ...

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

796 Freescale Semiconductor, Inc.

Page 797: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void f(A *ap, B *bp) {

delete ap; // ok

delete[] ap; // error

delete[4] ap; // ok

delete bp; // ok

delete[] bp; // ok

delete[4] bp; // ok

}

Tips

Specify the number of elements at calling delete[].

25.1.199 C1437: Member address expected

[ERROR]

Description

A member address is expected to initialize the pointer to member. 0 value can also beprovide to set the pointer to member to NULL.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 797

Page 798: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A{

public:

int a;

void fct(void){}

};

void main(void){

int A::*pmi = NULL;

...

}

Tips

Use a member address

class A{

public:

int a;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

798 Freescale Semiconductor, Inc.

Page 799: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void fct(void){}

};

void main(void){

int A::*pmi = &amp;A::a;

void (A::*pmf)() = &amp;A::fct;

...

}

Use 0 value to set the pointer to member to NULL

class A{

public:

int a;

void fct(void){}

};

void main(void){

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 799

Page 800: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int A::*pmi = 0;

void (A::*pmf)() = 0;

...

}

25.1.200 C1438: ... is not a pointer to member ident

[ERROR]

Description

Parsing ident is not a pointer to member as expected.

Example

int glob;

class A{

public:

int a;

void fct(void){}

};

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

800 Freescale Semiconductor, Inc.

Page 801: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void){

int A::*pmi = &amp;A::a;

void (A::*pmf)() = &amp;A::fct;

A aClass;

...

aClass.*glob = 4;

(aclass.*glob)();

}

Tips

Use the pointer to member ident

class A{

public:

int a;

void fct(void){}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 801

Page 802: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void main(void){

int A::*pmi = &amp;A::a;

void (A::*pmf)() = &amp;A::fct;

A aClass;

...

aClass.*pmi = 4;

(aclass.*pmf)();

}

25.1.201 C1439: Illegal pragma __OPTION_ACTIVE__, <Reason>

[ERROR]

Description

An ill formed __OPTION_ACTIVE__ expression was detected. The reason argumentgives a more concrete hint what actually is wrong.

Example

#if __OPTION_ACTIVE__("-dABS")

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

802 Freescale Semiconductor, Inc.

Page 803: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#endif

The __OPTION_ACTIVE__ expression only allows the option to be tested (here -d andnot the content of the option here ABS.

Tips

Only use the option. To check if a macro is defined as in the example above, use ifdefined(ABS). Only options known to the compiler can be tested. This option can bemoved to an warning or less.

See also• if __OPTION_ACTIVE__

25.1.202 C1440: This is causing previous message<MsgNumber>

[INFORMATION]

Description

This message informs about the problem causing the previous message with the number'MsgNumber'. Because the reason for the previous message may be in another file (e.g.header file), this message helps to find out the problem.

Example

void foo(void);

int foo(void) {}

produces following messages:

int foo(void) {}

^

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 803

Page 804: CodeWarrior Development Studio for Microcontrollers V10.x RS08

ERROR C1019: Incompatible type to previous declaration

(found 'int (*) ()', expected 'void (*) ()')

void foo(void);

^

INFORMATION C1440: This is causing previous message 1019

Tips

The problem location is either the one indicated by the previous message or the locationindicated by this message.

25.1.203 C1441: Constant expression shall be integral constantexpression

[ERROR]

Description

A constant expression which has to be an integral expression is not integral. A non-integral expression is e.g. a floating constant expression.

Example

#if 1. // <&lt; has to be integral!

;

#endif

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

804 Freescale Semiconductor, Inc.

Page 805: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Use a integral constant expression. Note: if you move this message (to disable/information/warning), the non-integral constant expression is transformed into an integralexpression (e.g. 2.3 => 2).

25.1.204 C1442: Typedef cannot be used for function definition

[ERROR]

Description

A typedef name was used for a function definition.

Example

typedef int INTFN();

INTFN f { return (0); } // <&lt; error

Tips

Do not use a typedef name for a function definition.

25.1.205 C1443: Illegal wide character

[ERROR]

Description

There is a illegal wide character after a wide character designator (L).

Example

int i = sizeof(L 3.5);

Tips

After L there has to be a character constant (e.g. L'a') or a string (e.g. L"abc").

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 805

Page 806: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.206 C1444: Initialization of <Variable> is skipped by 'case'label

[ERROR]

Description

Initialization of a local variable is skipped by a 'case' label.

Example

void main(void){

int i;

switch(i){

int myVar = 5;

case 0: // C1444 init skipped

//...

break;

case 1: // C1444 init skipped

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

806 Freescale Semiconductor, Inc.

Page 807: CodeWarrior Development Studio for Microcontrollers V10.x RS08

//...

break;

}

Tips

Declare the local variable in the block where it is used.

void main(void){

int i;

switch(i){

case 0:

//...

break;

case 1:

int myVar = 5;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 807

Page 808: CodeWarrior Development Studio for Microcontrollers V10.x RS08

//...

break;

}

25.1.207 C1445: Initialization of <Variable> is skipped by 'default'label

[ERROR]

Description

Initialization of a local variable is skipped by a 'default' label.

Example

void main(void){

int i;

switch(i){

case 0:

//...

break;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

808 Freescale Semiconductor, Inc.

Page 809: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int myVar = 5;

default: // C1445 init skipped

//...

break;

}

Tips

Declare the local variable in the block where it is used.

void main(void){

int i;

switch(i){

case 0:

//...

break;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 809

Page 810: CodeWarrior Development Studio for Microcontrollers V10.x RS08

default:

int myVar = 5;

//...

break;

}

25.1.208 C1800: Implicit parameter-declaration (missingprototype) for '<FuncName>'

[ERROR]

Description

A function was called without its prototype being declared before.

Example

void f(void) {

g();

}

This message is only used for C++ or for C if option \c -Wpd, but not Option \c -Ansi is given

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

810 Freescale Semiconductor, Inc.

Page 811: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Prototype the function before calling it. Use void to define a function with no parameters.

void f(); // better: 'void f(void)'

void g(void);

The C the declaration f does not define anything about the parameters of f. The first timef is used, the parameters get defined implicitly. The function g is defined to have noparameters.

The C the declaration f does not define anything about the parameters of f. The first timef is used, the parameters get defined implicitly. The function g is defined to have noparameters.

25.1.209 C1801: Implicit parameter-declaration for '<FuncName>'

[WARNING]

Description

A function was called without its prototype being declared before.

Example

void f(void) {

g();

}

Tips

Prototype the function before calling it. Make sure that there is a prototype/declarationfor the function. E.g. for above example:

void g(void); // having correct prototype for 'g'

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 811

Page 812: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f(void) {

g();

}

25.1.210 C1802: Must be static member

[ERROR]

Description

A non-static member has been accessed inside a static member function.

Example

struct A {

static void f();

int i;

};

void A::f() {

i=3; // error

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

812 Freescale Semiconductor, Inc.

Page 813: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Remove the static specifier from the member function, or declare the member to beaccessed as static.

25.1.211 C1803: Illegal use of address of function compiledunder the pragma REG_PROTOTYPE

[ERROR]

Description

A function compiler with the pragma REG_PROTOTYPE was used in a unsafe way.

25.1.212 C1804: Ident expected

[ERROR]

Description

An identifier was expected.

Example

int ;

25.1.213 C1805: Non standard conversion used

[WARNING]

Description

An object pointer is cast to a function pointer or vice-versa - which is not allowed inANSI-C. Note that the layout of a function pointer may not be the same than the layout ofa object pointer.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 813

Page 814: CodeWarrior Development Studio for Microcontrollers V10.x RS08

typedef unsigned char (*CmdPtrType)

(unsigned char, unsigned char);

typedef struct STR {int a;} baseSTR;

baseSTR strDescriptor;

CmdPtrType myPtr;

// next line does not strictly correspond to ANSI C

// but we make sure that the correct cast is being used

void foo(void) {

myPtr=(CmdPtrType)(void*)&amp;strDescriptor; // message C1805

}

25.1.214 C1806: Illegal cast-operation

[ERROR]

Description

There is no conversion for doing the desired cast.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

814 Freescale Semiconductor, Inc.

Page 815: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

The cast operator must specify a type, that can be converted to the type, which theexpression containing the cast operator would be converted to.

25.1.215 C1807: No conversion to non-base class

[ERROR]

Description

There is no conversion from a class to another class that is not a base class of the firstclass.

Example

struct A {

int i;

};

struct B : A {

int j;

};

void main() {

A a;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 815

Page 816: CodeWarrior Development Studio for Microcontrollers V10.x RS08

B b;

b=a; // error: B is not a base class of A

}

Tips

Remove this statement, or modify the class hierarchy.

25.1.216 C1808: Too many nested switch-statements

[ERROR]

Description

The number of nested switches was too high.

Example

switch(i0) {

switch(i1) {

switch(i2) {

...

Tips

Use "if-else if" statements instead or reduce nesting level.

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

816 Freescale Semiconductor, Inc.

Page 817: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.217 C1809: Integer value for switch-expression expected

[ERROR]

Description

The specified switch expression evaluated to an illegal type.

Example

float f;

void main(void) {

switch(f) {

case 1:

f=2.1f;

break;

case 2:

f=2.1f;

break;

}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 817

Page 818: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

A switch expression must evaluate to an integral type, or a class type that has anunambiguous conversion to an integral type.

25.1.218 C1810: Label outside of switch-statement

[ERROR]

Description

The keyword case was used outside a switch.

Tips

The keyword case can appear only within a switch statement.

25.1.219 C1811: Default-label twice defined

[ERROR]

Description

A switch statement must have no or one default label. Two default labels are indicated bythis error.

Example

switch (i) {

default: break;

case 1: f(1); break;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

818 Freescale Semiconductor, Inc.

Page 819: CodeWarrior Development Studio for Microcontrollers V10.x RS08

case 2: f(2); break;

default: f(0); break;

}

Tips

Define the default label only once per switch-statement.

25.1.220 C1812: Case-label-value already present

[ERROR]

Description

A case label value is already present.

Tips

Define a case-label-value only once for each value. Use different values for differentlabels.

25.1.221 C1813: Division by zero

[ERROR]

Description

A constant expression was evaluated and found to have a zero denominator.

Example

int i = 1/0;

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 819

Page 820: CodeWarrior Development Studio for Microcontrollers V10.x RS08

mod or divide should never be by zero. Note that this error can be changed to a warningor less. This way code like the following can be compiled:

int i = (sizeof(int) == sizeof(long)) ? 0 : sizeof(long) / (sizeof(long)-sizeof(int))

25.1.222 C1814: Arithmetic or pointer-expression expected

[ERROR]

Description

The expression had an illegal type!.

Tips

Expressions after a ! operator and expressions in conditions must be of arithmetic orpointer type.

25.1.223 C1815: <Name> not declared (or typename)

[ERROR]

Description

The specified identifier was not declared.

Example

void main(void) {

i=2;

}

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

820 Freescale Semiconductor, Inc.

Page 821: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A variable's type must be specified in a declaration before it can be used. The parametersthat a function uses must be specified in a declaration before the function can be used.This error can be caused, if an include file containing the required declaration wasomitted.

25.1.224 C1816: Unknown struct- or union-member

[ERROR]

Description

A nonmember of a structure or union was incorrectly used.

Example

struct A {

int i;

} a;

void main(void) {

a.I=2;

}

Tips

On the right side of the ì->ì or . operator, there must be a member of the structure/unionspecified on the left side. C is case sensitive.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 821

Page 822: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.225 C1817: Parameter cannot be converted to non-constantreference

[ERROR]

Description

A constant argument was specified for calling a function with a reference parameter to anon-constant.

Example

void f(const int &amp;); // ok

void f(int &amp;); // causes error, when calling

// with constant argument

void main() {

f(3); // error for second function declaration

}

Tips

The parameter must be a reference to a constant, or pass a non-constant variable asargument.

25.1.226 C1819: Constructor call with wrong number ofarguments

[ERROR]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

822 Freescale Semiconductor, Inc.

Page 823: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The number of arguments for the constructor call at a class object initialization waswrong.

Example

struct A {

A();

};

void main() {

A a(3); // error

}

Tips

Specify the correct number of arguments for calling the constructor. Try to disable theoption -Cn=Ctr, so the compiler generates a copy constructor, which may be required inyour code.

25.1.227 C1820: Destructor call must have 'void' formalparameter list

[ERROR]

Description

A destructor call was specified with arguments.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 823

Page 824: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct A {

~A();

};

void main() {

A a;

a.~A(3); // error

}

Tips

Destructor calls have no arguments!

25.1.228 C1821: Wrong number of arguments

[ERROR]

Description

A function call was specified with the wrong number of formal parameters.

Example

struct A {

void f();

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

824 Freescale Semiconductor, Inc.

Page 825: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void main() {

A a;

a.f(3); // error

}

Tips

Specify the correct number of arguments.

25.1.229 C1822: Type mismatch

[ERROR]

Description

There is no conversion between the two specified types.

Example

void main() {

int *p;

int j;

p=j; // error

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 825

Page 826: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Use types that can be converted.

25.1.230 C1823: Undefining an implicit parameter-declaration

[WARNING]

Description

A implicit parameter declaration was removed because of a assignment.

Example

void (*f)();

void g(long );

void main(void) {

f(1);

f=g;

f(2);

}

Tips

Avoid implicit parameter declarations whenever possible.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

826 Freescale Semiconductor, Inc.

Page 827: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.231 C1824: Indirection to different types

[ERROR]

Description

There are two pointers in the statement pointing to non-equal types.

Example

void main() {

int *i;

const int *ci;

char *c;

i=ci; // C: warning, C++ error, C++ -ec warning

i=c; // C: warning, C++: error

}

Tips

Both pointers must point to equal types. If the types only differ in the qualifiers (const,volatile) try to compile with the option -ec.

25.1.232 C1825: Indirection to different types

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 827

Page 828: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

There are two pointers in the statement pointing to non-equal types.

Example

void main() {

int *i;

char *c;

i=c; // C: warning, C++: error

}

Tips

Both pointers should point to equal types.

25.1.233 C1826: Integer-expression expected

[ERROR]

Description

The expression was not of integral type.

Example

void main() {

int *p;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

828 Freescale Semiconductor, Inc.

Page 829: CodeWarrior Development Studio for Microcontrollers V10.x RS08

p<&lt;3;// error

}

Tips

The expression must be an integral type.

25.1.234 C1827: Arithmetic types expected

[ERROR]

Description

After certain operators as * or /, arithmetic types must follow.

Example

void main() {

int * p;

p*3; // error

}

Tips

* and / must have operands with arithmetic types.

25.1.235 C1828: Illegal pointer-subtraction

[ERROR]

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 829

Page 830: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

A pointer was subtracted from an integral type.

Example

void main() {

int *p;

int i;

i-p; // error

}

Tips

Insert a cast operator from the pointer to the integral type.

25.1.236 C1829: + - incompatible Types

[ERROR]

Description

For + and - only compatible types on both sides can be used. In C++ own implementationcan be used with overloading.

Example

struct A {

int i;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

830 Freescale Semiconductor, Inc.

Page 831: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void main() {

int i;

A a;

i=i+a; // error

}

Tips

Use compatible types on the left and on the right side of the +/- operator. Or use theoperator-overloading and define an own + or - operator!

25.1.237 C1830: Modifiable lvalue expected

[ERROR]

Description

An attempt was made to modify an item declared with const type.

Example

const i;

void main(void) {

i=2;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 831

Page 832: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Do not modify this item, or declare the item without the const qualifier.

25.1.238 C1831: Wrong type or not an lvalue

[ERROR]

Description

An unary operator has an operand of wrong or/and constant type.

Tips

The operand of the unary operator must be a non-const integral type or a non-constpointer to a non-void type. Or use operator overloading!.

25.1.239 C1832: Const object cannot get incremented

[ERROR]

Description

Constant objects can not be changed.

Example

int* const pi;

void main(void) {

*pi++;

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

832 Freescale Semiconductor, Inc.

Page 833: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Either do not declare the object as constant or use a different constant for the new value.In the case above, use parenthesis to increment the value pi points to and to not incrementpi itself.

int* const pi;

void main(void) {

(*pi)++;

}

25.1.240 C1833: Cannot take address of this object

[ERROR]

Description

An attempt to take the address of an object without an address was made.

Example

void main() {

register i;

int *p=&amp;i; // error

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 833

Page 834: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Specify the object you want to dereference in a manner that it has an address.

25.1.241 C1834: Indirection applied to non-pointer

[ERROR]

Description

The indirection operator (*) was applied to a non-pointer value.

Example

void main(void) {

int i;

*i=2;

}

Tips

Apply the indirection operator only on pointer values.

25.1.242 C1835: Arithmetic operand expected

[ERROR]

Description

The unary (-) operator was used with an illegal operand type.

Example

const char* p= -"abc";

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

834 Freescale Semiconductor, Inc.

Page 835: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

There must be an arithmetic operand for the unary (-) operator.

25.1.243 C1836: Integer-operand expected

[ERROR]

Description

The unary (~) operator was used with an illegal operand type.

Example

float f= ~1.45;

Tips

There must be an operand of integer type for the unary (~) operator.

25.1.244 C1837: Arithmetic type or pointer expected

[ERROR]

Description

The conditional expression evaluated to an illegal type.

Tips

Conditional expressions must be of arithmetic type or pointer.

25.1.245 C1838: Unknown object-size: sizeof (incomplete type)

[ERROR]

Description

The type of the expression in the sizeof operand is incomplete.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 835

Page 836: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

int i = sizeof(struct A);

Tips

The type of the expression in the sizeof operand must be defined complete.

25.1.246 C1839: Variable of type struct or union expected

[ERROR]

Description

A variable of structure or union type was expected.

25.1.247 C1840: Pointer to struct or union expected

[ERROR]

Description

A pointer to a structure or union was expected.

25.1.248 C1842: [ incompatible types

[ incompatible types [ERROR]

Description

Binary operator [: There was no global operator defined, which takes the type used.

Example

struct A {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

836 Freescale Semiconductor, Inc.

Page 837: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int j;

int operator [] (A a);

};

void main() {

A a;

int i;

int b[3];

i=a[a]; // ok

i=b[a]; // error

}

Tips

Use a type compatible to ì[ì. If there is no global operator for [, take an integer type.

25.1.249 C1843: Switch-expression: integer required

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 837

Page 838: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Another type than an integer type was used in the switch expression.

Tips

Use an integer type in the switch expression.

25.1.250 C1844: Call-operator applied to non-function

[ERROR]

Description

A call was made to a function through an expression that did not evaluate to a functionpointer.

Example

int i;

void main(void) {

i();

}

Tips

The error is probably caused by attempting to call a non-function. In C++ classes canoverload the call operator, but basic types as pointers cannot.

25.1.251 C1845: Constant integer-value expected

[ERROR]

Description

The case expression was not an integral constant.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

838 Freescale Semiconductor, Inc.

Page 839: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

int i;

void main(void) {

switch (i) {

case i+1:

i=1;

}

}

Tips

Case expressions must be integral constants.

25.1.252 C1846: Continue outside of iteration-statement

[ERROR]

Description

A continue was made outside of an iteration-statement.

Tips

The continue must be done inside an iteration-statement.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 839

Page 840: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.253 C1847: Break outside of switch or iteration-statement

[ERROR]

Description

A break was made outside of an iteration-statement.

Example

int i;

void f(void) {

int res;

for (i=0; i < 10; i++ )

res=f(-1);

if (res == -1)

break;

printf("%d\n", res);

}

Tips

The break must be done inside an iteration-statement. Check for the correct number ofopen braces.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

840 Freescale Semiconductor, Inc.

Page 841: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.254 C1848: Return <expression> expected

[ERROR]

Description

A return was made without an expression to be returned in a function with a non-voidreturn type.

Tips

The return statement must return an expression of the return-type of the function.

25.1.255 C1849: Result returned in void-result-function

[ERROR]

Description

A return was made with an expression, though the function has void return type.

Example

void f(void) {

return 1;

}

Tips

Do not return an expression in a function with void return type. Just write return, or writenothing.

25.1.256 C1850: Incompatible pointer operands

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 841

Page 842: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

Pointer operands were incompatible.

Tips

Either change the source or explicitly cast the pointers.

25.1.257 C1851: Incompatible types

[ERROR]

Description

Two operands of a binary operator did not have compatible types (there was noconversion, or the overloaded version of the operand does not take the same types as theformal parameters).

Tips

Both operands of the binary operator must have compatible types.

25.1.258 C1852: Illegal sizeof operand

[ERROR]

Description

The sizeof operand was a bitfield.

Tips

Do not use bitfields as sizeof operands.

25.1.259 C1853: Unary minus operator applied to unsigned type

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

842 Freescale Semiconductor, Inc.

Page 843: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The unary minus operator was applied to an unsigned type.

Example

void main(void) {

unsigned char c;

unsigned char d= -c;

}

Tips

An unsigned type never can become a negative value. So using the unary minus operatormay cause an unwanted behavior! Note that ANSI C treats -1 as negated value of 1.Therefore 2147483648 is an unsigned int, if int is 32 bits large or an unsigned long if not.The negation is a unary function as any other, so the result type is the argument typepropagated to int, if smaller. Note that the value -2147483648 is the negation of2147483648 and therefore also of a unsigned type, even if the signed representationcontains this value.

25.1.260 C1854: Returning address of local variable

[WARNING]

Description

An address of a local variable is returned.

Example

int &f(void) {

int i;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 843

Page 844: CodeWarrior Development Studio for Microcontrollers V10.x RS08

return i; // warning

}

Tips

Either change the return type of the function to the type of the local variable returned, ordeclare the variable to be returned as global (returning the reference of this globalvariable)!

25.1.261 C1855: Recursive function call

[WARNING]

Description

A recursive function call was detected. There is a danger of endless recursion, whichleads to a stack overflow.

Example

void f(void) {

f(); // warning; this code leads to an endless recursion

}

void g(int i) {

if(i>0) {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

844 Freescale Semiconductor, Inc.

Page 845: CodeWarrior Development Studio for Microcontrollers V10.x RS08

g(--i); // warning; this code has no endless recursion

}

}

Tips

Be sure there is no endless recursion. This would lead to a stack overflow.

25.1.262 C1856: Return <expression> expected

[WARNING]

Description

A return statement without expression is executed while the function expects a returnvalue. In ANSI-C, this is correct but not clean. In such a case, the program runs back tothe caller. If the caller uses the value of the function call then the behavior is undefined.

Example

int foo(void){

return;

}

void main(void){

int a;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 845

Page 846: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

a = foo();

... // behavior undefined

}

Tips

#define ERROR_CASE_VALUE 0

int foo(void){

return ERROR_CASE_VALUE; // return something...

}

void main(void){

int a;

...

a = foo();

if (a==ERROR_CASE_VALUE){ // ... and treat this case

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

846 Freescale Semiconductor, Inc.

Page 847: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

} else {

...

}

...

}

25.1.263 C1857: Access out of range

[WARNING]

Description

The compiler has detected that there is an array access outside of the array bounds. Thisis legal in ANSI-C/C++, but normally it is a programming error. Check carefully suchaccesses that are out of range. This warning does not check the access, but also taking theaddress out of an array. However, it is legal in C to take the address of one elementoutside the array range, so there is no warning for this. Because array accesses are treatedinternally like address-access operations, there is no message for accessing on elementoutside of the array bounds.

Example

char buf[3], *p;

p = &buf[3]; // no message!

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 847

Page 848: CodeWarrior Development Studio for Microcontrollers V10.x RS08

buf[4] = 0; // message

25.1.264 C1858: Partial implicit parameter-declaration

[WARNING]

Description

A function was called without its prototype being totally declared before.

Example

void foo(); // not complete prototype, arguments not known

void main(void) {

foo();

}

Tips

Prototype all arguments of the function before calling it.

25.1.265 C1859: Indirection operator is illegal on Pointer ToMember operands

[ERROR]

Description

It is illegal to apply indirection '*' operator to Pointer To Member operands.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

848 Freescale Semiconductor, Inc.

Page 849: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A {

public:

void f(void) {}

};

typedef void (A::*ptrMbrFctType)(void);

void fct0(void){

ptrMbrFctType pmf;

*pmf=A::f; // ERROR

}

void fct1(void){

void (* A::*pmf)(void)=A::f; // ERROR

}

Tips

Remove the indirection operator.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 849

Page 850: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class A {

public:

void f(void) {}

};

typedef void (A::*ptrMbrFctType)(void);

void fct0(void){

ptrMbrFctType pmf;

pmf=&amp;A::f;

}

void fct1(void){

void (A::*pmf)(void)=&amp;A::f;

}

25.1.266 C1860: Pointer conversion: possible loss of data

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

850 Freescale Semiconductor, Inc.

Page 851: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

Whenever there is a pointer conversion which may produce loss of data, this message isproduces. Loss of data can happen if a far (e.g. 3 byte pointer) is assigned to a pointer ofsmaller type (e.g. a near 1 byte pointer).

Example

char *near nP;

char *far fP;

void foo(void) {

nP = fP; // warning here

}

Tips

Check if this loss of data is intended.

25.1.267 C1861: Illegal use of type 'void'

[WARNING]

Description

The compiler has detected an illegal usage of the void type. The compiler accepts thisbecause of historical reasons. Some other vendor compilers may not accept this at all, sothis may cause portability problems.

Example

int foo(void buf[256]) { // warning here

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 851

Page 852: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

}

Tips

Correct your code. E.g. replace in the above example the argument with 'void *buf'.

25.1.268 C2000: No constructor available

[ERROR]

Description

A constructor must be called, but none is available.

Tips

Define a constructor. No compiler defined default constructor is defined in somesituations, for example when the class has constant members.

25.1.269 C2001: Illegal type assigned to reference.

[ERROR]

Description

There is no conversion from type assigned to the type of the reference.

Example

int *i;

int &amp;r=i; // error

Tips

The type of the reference must be equal to the type assigned.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

852 Freescale Semiconductor, Inc.

Page 853: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.270 C2004: Non-volatile reference initialization with volatileillegal

[ERROR]

Description

The reference type is not volatile, the assigned type is.

Example

volatile i;

const int &amp;r=i; // illegal

Tips

Either both are volatile or both are not volatile.

25.1.271 C2005: Non-constant reference initialization withconstant illegal

[ERROR]

Description

The reference type is not constant, the assigned type is.

Example

void main(void) {

const int i=1;

int &amp;p=i;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 853

Page 854: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Either both are const or both are not const.

25.1.272 C2006: (un)signed char reference must be const for initwith char

[ERROR]

Description

The initializer for a reference to a signed or unsigned char must be const for initializationwith a plain char.

Example

char i;

signed char &amp;r=i; // error

Tips

Either declare the reference type as const, or the type of the initializer must not be plain.

25.1.273 C2007: Cannot create temporary for reference in class/struct

[ERROR]

Description

A member initializer for a reference was constant, though the member was non-constant

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

854 Freescale Semiconductor, Inc.

Page 855: CodeWarrior Development Studio for Microcontrollers V10.x RS08

struct A {

int &amp;i;

A();

};

A::A() : i(3) { // error

}

Tips

Initialize the reference with a non-constant variable.

25.1.274 C2008: Too many arguments for member initialization

[ERROR]

Description

The member-initializer contains too many arguments.

Example

struct A {

const int i;

A();

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 855

Page 856: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

A::A() : i(3,5) { // error

}

Tips

Supply the correct number of arguments in the initializer list of a constructor.

25.1.275 C2009: No call target found!

[ERROR]

Description

The ambiguity resolution mechanism did not find a function in the scope, where itexpected one.

Tips

Check, if the function called is declared in the correct scope.

25.1.276 C2010: <Name> is ambiguous

[ERROR]

Description

The ambiguity resolution mechanism found an ambiguity. That means, more than oneobject could be taken for the identifier Name. So the compiler does not know which oneis desired.

Example

struct A {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

856 Freescale Semiconductor, Inc.

Page 857: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int i;

};

struct B : A {

};

struct C : A {

};

struct D : B, C {

};

void main() {

D d;

d.i=3; // error, could take i from B::A or C::A

d.B::i=4; // ok

d.C::i=5; // ok

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 857

Page 858: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Specify a path, how to get to the desired object. Or use virtual base classes in multipleinheritance. The compiler can handle a most 10'000 different numbers for a compilationunit. Internally for each number a descriptor exists. If an internal number descriptoralready exists for a given number value with a given type, the existing one is used. But ife.g. more than 10'000 different numbers are used, this message will appear.

25.1.277 C2011: <Name> can not be accessed

[ERROR]

Description

There is no access to the object specified by the identifier.

Example

struct A {

private:

int i;

protected:

int j;

public:

int k;

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

858 Freescale Semiconductor, Inc.

Page 859: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void g();

};

struct B : public A {

void h();

};

void A::g() {

this->i=3; // ok

this->j=4; // ok

this->k=5; // ok

}

void B::h() {

this->i=3; // error

this->j=4; // ok

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 859

Page 860: CodeWarrior Development Studio for Microcontrollers V10.x RS08

this->k=5; // ok

}

void f() {

A a;

a.i=3; // error

a.j=4; // error

a.k=5; // ok

}

Tips

Change the access specifiers in the class declaration, if you really need access to theobject. Or use the friend-mechanism.

See also• Limitations

25.1.278 C2012: Only exact match allowed yet or ambiguous!

[ERROR]

Description

An overloaded function was called with non-exact matching arguments.

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

860 Freescale Semiconductor, Inc.

Page 861: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Supply exact matching parameters.

See also• Limitations

25.1.279 C2013: No access to special member of base class

[WARNING]

Description

The special member (Constructor, destructor or assignment operator) could not beaccessed.

Example

struct A {

private:

A();

};

struct B : A {

};

void main() {

B b; // error

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 861

Page 862: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Change the access specifier for the special member.

See also• Limitations

25.1.280 C2014: No access to special member of member class

[WARNING]

Description

The special member (Constructor, destructor or assignment operator) could not beaccessed.

Example

struct A {

private:

A();

};

struct B {

A a;

};

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

862 Freescale Semiconductor, Inc.

Page 863: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main() {

B b; // error

}

Tips

Change the access specifier for the special member.

See also• Limitations

25.1.281 C2015: Template is used with the wrong number ofarguments

[ERROR]

Description

A template was instantiated with the wrong number of template arguments.

Example

template<class S> struct A {

S s;

};

A<int, int> a; // error

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 863

Page 864: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The instantiation of a template type must have the same number of parameters as thetemplate specification.

25.1.282 C2016: Wrong type of template argument

[ERROR]

Description

A template was instantiated with the wrong type template arguments.

Example

template<class S> struct A {

S s;

};

A<4> a; // error

Tips

The instantiation of a template type must have the same argument type as the onestemplate specification.

25.1.283 C2017: Use of incomplete template class

[ERROR]

Description

A template was instantiated from an incomplete class.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

864 Freescale Semiconductor, Inc.

Page 865: CodeWarrior Development Studio for Microcontrollers V10.x RS08

template<class S> struct A;

A<int, int> a; // error

Tips

The template to be instantiated must be of a defined class.

25.1.284 C2018: Generate class/struct from template

[INFORMATION]

Description

A class was instantiated from a template.

Example

template<class S> struct A {

S s;

};

A<int> a; // information

25.1.285 C2019: Generate function from template

[INFORMATION]

Description

A function was instantiated from a template.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 865

Page 866: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

template<class S> void f(S s) {

// ...

};

void main(void) {

int i;

char ch;

f(4); // generate

f(i); // not generating, already generated

f(ch); // generate

}

Tips

The fewer functions are instantiated from a template, the less code is produced. So try touse already generated template functions instead of letting the compiler generate newones.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

866 Freescale Semiconductor, Inc.

Page 867: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.286 C2020: Template parameter not used in functionparameter list

[ERROR]

Description

A template parameter didn't occur in the parameter list of the template function.

Example

template<class S> void f(int i) { // error

// ...

};

Tips

The parameter list of the template function must contain the template parameters.

25.1.287 C2021: Generate NULL-check for class pointer

[INFORMATION]

Description

Operations with pointers to related classes always need separate NULL-checks beforeadding offsets from base classes to inherited classes.

Example

class A {

};

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 867

Page 868: CodeWarrior Development Studio for Microcontrollers V10.x RS08

class B : public A{

};

void main() {

A *ap;

B *bp;

ap=bp; // warning

}

Tips

Try to avoid operations with pointers to different, but related classes.

25.1.288 C2022: Pure virtual can be called only using explicitscope resolution

[ERROR]

Description

Pure virtual functions can be called from a constructor of an abstract class; the effect ofcalling a pure virtual function directly or indirectly for the object being created from sucha constructor is an error.

Example

class A{

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

868 Freescale Semiconductor, Inc.

Page 869: CodeWarrior Development Studio for Microcontrollers V10.x RS08

public:

virtual void f(void) = 0;

A(){

f();

}

};

Tips

A pure virtual can be defined. It can be called using explicit qualification only.

class A{

public:

virtual void f(void) = 0;

A(){

A::f();

}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 869

Page 870: CodeWarrior Development Studio for Microcontrollers V10.x RS08

};

void A::f(void){ // defined somewhere

//...

}

25.1.289 C2023: Missing default parameter

[ERROR]

Description

A subsequent parameter of a default parameter is not a default parameter.

Example

void f(int i=0, int j); // error

void f(int i=0, int j=0); // ok

Tips

All subsequent parameters of a default parameter must be default, too.

See also• Overloading.

25.1.290 C2024: Overloaded operators cannot have defaultarguments

[ERROR]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

870 Freescale Semiconductor, Inc.

Page 871: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

An overloaded operator was specified with default arguments.

Example

struct A{

// ...

};

operator + (A a, int i=0); // error

Tips

Overloaded operators cannot have default arguments. Declare several versions of theoperator with different numbers of arguments.

See also• Overloading.

25.1.291 C2025: Default argument expression can only containstatic or global objects or constants

[ERROR]

Description

A local object or non-static class member was used in the expression for a defaultargument.

Example

struct A {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 871

Page 872: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int t;

void f(int i=t); // error

};

void g(int i, int j=i); // error

Tips

Only use static or global objects or constants in expressions for default arguments.

25.1.292 C2200: Reference object type must be const

[ERROR]

Description

If a reference is initialized by a constant, the reference has to be constant as well

Example

int &amp;ref = 4; // err

Tips

Declare the reference as constant.

See also• Limitations

25.1.293 C2201: Initializers have too many dimensions

[ERROR]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

872 Freescale Semiconductor, Inc.

Page 873: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

An initialization of an array of class objects with constructor call arguments was havingmore opening braces than dimensions of the array.

Example

struct A {

A(int);

};

void main() {

A a[3]={{3,4},4}; // errors

A a[3]={3,4,4}; // ok

}

Tips

Provide the same number of opening braces in an initialization of an array of classobjects.

See also• Limitations

25.1.294 C2202: Too many initializers for global Ctor arguments

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 873

Page 874: CodeWarrior Development Studio for Microcontrollers V10.x RS08

An initialization of a global array of class objects with constructor call arguments washaving more arguments than elements in the array.

Example

struct A {

A(int);

};

A a[3]={3,4,5,6}; // errors

A a[3]={3,4,5}; // ok

Tips

Provide the same number of arguments than number of elements in the global array ofclass objects. If you want to make calls to constructors with more than one argument, useexplicit calls of constructors.

See also• Limitations

25.1.295 C2203: Too many initializers for Ctor arguments

[ERROR]

Description

An initialization of an array of class objects with constructor call arguments was havingmore arguments than elements in the array.

Example

struct A {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

874 Freescale Semiconductor, Inc.

Page 875: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A(int);

};

void main() {

A a[3]={3,4,5,6}; // errors

A a[3]={3,4,5}; // ok

}

Tips

Provide the same number of arguments than number of elements in the array of classobjects. If you want to make calls to constructors with more than one argument, useexplicit calls of constructors.

struct A {

A(int);

A();

A(int,int);

};

void main() {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 875

Page 876: CodeWarrior Development Studio for Microcontrollers V10.x RS08

A a[3]={A(3,4),5,A()};

// first element calls A::A(int,int)

// second element calls A::A(int)

// third element calls A::A()

}

See also• Limitations

25.1.296 C2204: Illegal reinitialization

[ERROR]

Description

The variable was initialized more than once.

Example

extern int i=2;

int i=3; // error

Tips

A variable must be initialized at most once.

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

876 Freescale Semiconductor, Inc.

Page 877: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.297 C2205: Incomplete struct/union, object can not beinitialized

[ERROR]

Description

Incomplete struct/union, object can not be initialized

Example

struct A;

extern A a={3}; // error

Tips

Do not initialize incomplete struct/union. Declare first the struct/union, then initialize it.

See also• Limitations

25.1.298 C2206: Illegal initialization of aggregate type

[ERROR]

Description

An aggregate type (array or structure/class) was initialized the wrong way.

Tips

Use the braces correctly.

See also• Limitations

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 877

Page 878: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.299 C2207: Initializer must be constant

[ERROR]

Description

A global variable was initialized with a non-constant.

Example

int i;

int j=i; // error

or

void function(void){

int local;

static int *ptr = &amp;local;

// error: address of local can be different

// in each function call.

// At second call of this function *ptr is not the same!

}

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

878 Freescale Semiconductor, Inc.

Page 879: CodeWarrior Development Studio for Microcontrollers V10.x RS08

In C, global variables can only be initialized by constants. If you need non-constantinitialization values for your global variables, create an InitModule() function in yourcompilation unit, where you can assign any expression to your globals. This functionshould be called at the beginning of the execution of your program. If you compile yourcode with C++, this error won't occur anymore! In C, initialization of a static variables isdone only once. Initializer is not required to be constant by ANSI-C, but this behaviorwill avoid troubles hard to debug.

See also• Limitations

25.1.300 C2209: Illegal reference initialization

[ERROR]

Description

A reference was initialized with a braced {, } initializer.

Example

struct A {

int i;

};

A &amp;ref = {4}; // error

A a = {4}; // ok

A &amp;ref2 = a; // ok

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 879

Page 880: CodeWarrior Development Studio for Microcontrollers V10.x RS08

References must be initialized with non-braced expressions.

See also• Limitations

25.1.301 C2210: Illegal initialization of non-aggregate type

[ERROR]

Description

A class without a constructor and with non-public members was initialized.

Tips

Classes with non-public members can only be initialized by constructors.

See also• Limitations

25.1.302 C2211: Initialization of a function

[ERROR]

Description

A function was initialized.

Example

void f()=3;

Tips

Functions cannot be initialized. But function pointers can.

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

880 Freescale Semiconductor, Inc.

Page 881: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.303 C2212: Initializer may be not constant

[ERROR]

Description

A global variable was initialized with a non-constant.

Example

int i;

int j=i; // error

or

void function(void){

int local;

static int *ptr = &amp;local;

// error: address of local can be different

// in each function call.

// At second call of this function *ptr is not the same!

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 881

Page 882: CodeWarrior Development Studio for Microcontrollers V10.x RS08

In C, global variables can only be initialized by constants. If you need non-constantinitialization values for your global variables, create an InitModule() function in yourcompilation unit, where you can assign any expression to your globals. This functionshould be called at the beginning of the execution of your program. If you compile yourcode with C++, this error won't occur anymore! In C, initialization of a static variables isdone only once. Initializer is not required to be constant by ANSI-C, but this behaviorwill avoid troubles hard to debug. You can disable this error if your initialization turnsout to be constant

See also• Limitations

25.1.304 C2401: Pragma <ident> expected

[WARNING]

Description

A single pragma was found.

Example

#pragma

Tips

Probably this is a bug. Correct it.

25.1.305 C2402: Variable <Ident> <State>

[DISABLE]

Description

A variable was allocated differently because of a pragma INTO_ROM or a pragma FAR.

Example

#pragma INTO_ROM

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

882 Freescale Semiconductor, Inc.

Page 883: CodeWarrior Development Studio for Microcontrollers V10.x RS08

const int i;

Tips

Be careful with the pragmas INTO_ROM and pragma FAR. They are only valid for onesingle variable. In the following code the pragma INTO_ROM puts var_rom into therom, but var_ram not.

#pragma INTO_ROM

const int var_rom, var_ram;

Note that pragma INTO_ROM is only for the HIWARE Object file format.

25.1.306 C2450: Expected:

[ERROR]

Description

An unexpected token was found.

Example

void f(void);

void main(void) {

int i=f(void); // error: "void" is an unexpected keyword!

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 883

Page 884: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use a token listed in the error message. Check if you are using the right compilerlanguage option. E.g. you may compile a file with C++ keywords, but are not compilingthe file with C++ option set. Too many nested scopes

25.1.307 C2550: Too many nested scopes

[FATAL]

Description

Too many scopes are open at the same time. For the actual limitation number, please seechapter Limitations

Example

void main(void) {

{

{

{

....

Tips

Use less scopes.

See also• Limitations

25.1.308 C2700: Too many numbers

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

884 Freescale Semiconductor, Inc.

Page 885: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[FATAL]

Description

Too many different numbers were used in one compilation unit. For the actual limitationnumber, please see chapter Limitations

Example

int main(void) {

return 1+2+3+4+5+6+.....

}

Tips

Split up very large compilation units.

See also• Limitations

25.1.309 C2701: Illegal floating-point number

[WARNING]

Description

An illegal floating point number has been specified or the exponent specified is to largefor floating number.

Example

float f = 3.e345689;

Tips

Correct the floating point number.

See also

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 885

Page 886: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Number Formats• header file "float.h"

25.1.310 C2702: Number too large for float

[ERROR]

Description

A float number larger than the maximum value for a float has been specified.

Example

float f = 3.402823466E+300F;

Tips

Correct the number.

Seecalso• Number Formats• header file "float.h"

25.1.311 C2703: Illegal character in float number

[ERROR]

Description

The floating number contains an illegal character. Legal characters in floating numbersare the postfixes 'f' and 'F' (for float) or 'l' and 'L' (for long double). Valid characters forexponential numbers are 'e' and 'E'.

Example

float f = 3.x4;

Tips

Correct the number.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

886 Freescale Semiconductor, Inc.

Page 887: CodeWarrior Development Studio for Microcontrollers V10.x RS08

See also• Number Formats

25.1.312 C2704: Illegal number

[ERROR]

Description

An illegal immediate number has been specified.

Example

int i = 4x; // error

float f= 12345678901234567890;//error too large for a long!

float f= 12345678901234567890.;//OK, doubles can be as large

Tips

Correct the number. For floating point numbers, specify a dot.

See also• Number Formats

25.1.313 C2705: Possible loss of data

[WARNING]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 887

Page 888: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The compiler generates this message if a constant is used which exceeds the value for atype. Another reason for this message is if a object (e.g. long) is assigned to an objectwith smaller size (e.g. char). Another example is to pass an actual argument too large fora given formal argument, e.g. passing a 32bit value to a function which expects a 8bitvalue.

Example

signed char ch = 128; // char holds only -128..127

char c;

long L;

void foo(short);

void main(void) {

c = L; // possible lost of data

foo(L); // possible lost of data

}

Tips

Usually this is a programming error.

See also• Header file "limits.h"

25.1.314 C2706: Octal Number

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

888 Freescale Semiconductor, Inc.

Page 889: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

An octal number was parsed.

Example

int f(void) {

return 0100; // warning

}

Tips

If you want to have a decimal number, don't write a '0' at the beginning.

25.1.315 C2707: Number too large

[ERROR]

Description

While reading a numerical constant, the compiler has detected the number is too large fora data type.

Example

x: REAL;

x := 300e51234;

Tips

Reduce the numerical constant value, or choose another data type.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 889

Page 890: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.316 C2708: Illegal digit

[ERROR]

Description

While reading a numerical constant, an illegal digit has been found.

Example

x: REAL;

x := 123e4a;

Tips

Check your numerical constant for correctness.

25.1.317 C2709: Illegal floating-point exponent ('-', '+' or digitexpected)

[ERROR]

Description

While reading a numerical constant, an illegal exponent has been found.

Example

x = 123e;

Tips

Check your numerical constant for correctness. After the exponent, there has to be anoptional '+' or '-' sign followed by a sequence of digits.

25.1.318 C2800: Illegal operator

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

890 Freescale Semiconductor, Inc.

Page 891: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

An illegal operator has been found. This could be caused by an illegal usage of saturationoperators, e.g. the using saturation operators without enabling them with a compilerswitch if available. Note that not all compiler backends support saturation operators.

Example

i = j +? 3; // illegal usage of saturation \c operator

Tips

Enable the usage of Saturation operators if available.

See also• Saturation Operator• Compiler Backend Chapter

25.1.319 C2801: <Symbol> missing"

[ERROR]

Description

There is a missing symbol for the Compiler to complete a parsing rule. Normally this isjust a closing parenthesis or a missing semicolon.

Example

void main(void) {

// '}' missing

other example

void f() {

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 891

Page 892: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int i

}

Tips

Usually this is a programming error. Correct your source code.

25.1.320 C2802: Illegal character found: <Character>

[ERROR]

Description

In the source there is a character which does not match with the name rules for C/C++.As an example it is not legal to have '$' in identifiers. Note: The pragma MESSAGE doesnot apply to this message because it is issued in the preprocessing phase.

Example

int $j;

Tips

Usually this is a programming error. Replace the illegal character with a legal one. SomeE-MAIL programs set the most significant bit of two immediately following spaces. In ahex editor, such files then contain "a0 a0 a0 20" for four spaces instead of "20 20 20 20".When this occurs in your E-Mail configuration, send sources as attachment.

25.1.321 C2803: Limitation: Parser was going out of sync!

[ERROR]

Description

The parser was going out of synchronization. This is caused by complex code with manyblocks, gotos and labels.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

892 Freescale Semiconductor, Inc.

Page 893: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

It would take too much space to write an example here!

Tips

Try to simplify your code!

See also• Limitations

25.1.322 C2900: Constant condition found, removing loop

[WARNING]

Description

A constant loop condition has been found and the loop is never executed. No code isproduced for such a loop. Normally, such a constant loop condition may be aprogramming error.

Example

for(i=10; i<9; i--)

Because the loop condition 'i<9' never becomes true, the loop is removed by the compiler and only the code for the initialization 'i=10' is generated.

Tips

If it is a programming error, correct the loop condition.

Seealso• Loop Unrolling

25.1.323 C2901: Unrolling loop

[INFORMATION]

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 893

Page 894: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

A loop has been detected for unrolling. Either the loop has only one round, e.g.

for(i=1; i<2; i++)

or loop unrolling was explicitly requested (Compiler Option -Cu or pragmaLOOP_UNROLL) or the loop has been detected as empty as

for(i=1; i<200; i++);

Tips

If it is a programming error, correct the loop condition.

See also• Loop Unrolling

25.1.324 C3000: File-stack-overflow (recursive include?)

[FATAL]

Description

There are more than 256 file includes in one chain or a possible recursion during aninclude sequence. Maybe the included header files are not guarded with ifndef

Example

// foo.c

#include "foo.c"

Tips

Use ifndef to break a possible recursion during include:

// foo.h

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

894 Freescale Semiconductor, Inc.

Page 895: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#ifndef FOO_H

#define FOO_H

// additional includes, declarations, ...

#endif

Simplify the include complexity to less than 256 include files in one include chain.

See also• Limitations

25.1.325 C3100: Flag stack overflow -- flag ignored

[WARNING]

Description

There were too many flags used at the same time. This message occurs for Modula-2versions of the compiler only. It does not occur for C/C++ compilers.

25.1.326 C3200: Source file too big

[FATAL]

Description

The compiler can handle about 400'000 lexical source tokens. A source token is either anumber or an ident, e.g. 'int a[2] = {0,1};' contains the 12 tokens 'int', 'a', '[', '2', ']', '=', '{','0', '1', '}' and ';'.

Example

A source file with more than 400'000 lexical tokens.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 895

Page 896: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Split up the source file into parts with less then 400'000 lexical tokens.

See also• Limitations

25.1.327 C3201: Carriage-Return without a Line-Feed wasdetected

[WARNING]

Description

On a PC, the usual 'newline' sequence is a carriage return (CR) followed by a line feed(LF). With this message the compiler warns that there is a CR without a LF. The reasoncould be a not correctly transformed UNIX source file. However, the compiler can handlecorrect UNIX source files (LF only). Note: The pragma MESSAGE does not apply to thismessage because it is issued in the preprocessing phase.

Tips

Maybe the source file is corrupted or the source file is not properly converted from aUNIX source file. Try to load the source file into an editor and to save the source file,because most of the editors will correct this.

25.1.328 C3202: Ident too long

[FATAL]

Description

An identifier was longer than allowed. The compiler supports identifiers with up to 16000characters. Note that the limits of the linker/debugger may be smaller. The 16000characters are in respect of the length of the identifier in the source. A name mangled C++ identifier is only limited by available memory.

Tips

Do not use such extremely large names!

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

896 Freescale Semiconductor, Inc.

Page 897: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.329 C3300: String buffer overflow

[FATAL]

Description

The compiler can handle a maximum of about 10'000 strings in a compilation unit. If thecompilation unit contains too many strings, this message will appear.

Example

A source file with more than 10'000 strings, e.g.

char *chPtr[] = {"string", "string1",

"string2", ... "string1000"};

Tips

Split up the source file into parts with less then 10'000 strings.

See also• Limitations

25.1.330 C3301: Concatenated string too long

[FATAL]

Description

The compiler cannot handle an implicit string concatenation with a total of more than8192 characters.

Example

Implicit string concatenation of two strings with each more than 4096 characters:

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 897

Page 898: CodeWarrior Development Studio for Microcontrollers V10.x RS08

char *str = "MoreThan4096...." "OtherWithMoreThan4096...."

Tips

Do not use implicit string concatenation, write the string in one piece:

char *str = "MoreThan4096....OtherWithMoreThan4096...."

See also• Limitations• C3303: Implicit concatenation of strings

25.1.331 C3302: Preprocessor-number buffer overflow

[FATAL]

Description

This message may occur during preprocessing if there are too many numbers to handlefor the compiler in a compilation unit. The compiler can handle a most 10'000 differentnumbers for a compilation unit. Internally for each number a descriptor exists. If aninternal number descriptor already exists for a given number value with a given type, theexisting one is used. But if e.g. more than 10'000 different numbers are used, thismessage will appear.

Example

An array initialized with the full range of numbers from 0 to 10'000:

const int array[] = {0, 1, 2, ... 10000};

Tips

Splitting up the source file into smaller parts until this message disappears.

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

898 Freescale Semiconductor, Inc.

Page 899: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.332 C3303: Implicit concatenation of strings

[WARNING]

Description

ANSI-C allows the implicit concatenation of strings: Two strings are merged by thepreprocessor if there is no other preprocessor token between them. This is a useful featureif two long strings should be one entity and you do want to write a very long line:

char *message = "This is my very long message string which "

"which has been splitted into two parts!"

This feature may be dangerous if there is just a missing comma (see example below!). Ifintention was to allocate a array of char pointers with two elements, the compiler onlywill allo cate one pointer to the string "abcdef" instead two pointers if there is a commabetween the two strings. Note: The pragma MESSAGE does not apply to this messagebecause it is issued in the preprocessing phase.

Example

char *str[] = {"abc" "def"}; // same as "abcdef"

Tips

If it is a programming error, correct it.

25.1.333 C3304: Too many internal ids, split up compilation unit

[FATAL]

Description

The compiler internally maintains some internal id's for artificial local variables. Thenumber of such internal id's is limited to 256 for a single compilation unit.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 899

Page 900: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Split up the compilation unit.

See also• Limitations

25.1.334 C3400: Cannot initialize object (destination too small)

[ERROR]

Description

An object cannot been initialized, because the destination is too small, e.g. because thepointer is too small to hold the address. The message typically occurs if the programmertries to initialize a near pointer (e.g. 16bit) with a far pointer (e.g. 24bit).

Example

#pragma DATA_SEG FAR MyFarSegment

char Array[10];

#pragma DATA_SEG DEFAULT

char *p = Array;

Tips

Increase the type size for the destination (e.g. with using the far keyword if supported)

char *far p = Array;

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

900 Freescale Semiconductor, Inc.

Page 901: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.335 C3401: Resulting string is not zero terminated

[WARNING]

Description

The compiler issues this message if a the resulting string is not terminated with a zerobyte. Thus if such a string is used for printf or strcpy, the operation may fail. In C it islegal to initialize an array with a string if the string fits without the zero byte.

Example

void main(void) {

char buf[3] = "abc";

}

Tips

For array initialization it is always better to use [] instead to specify the size:

char buf[] = "abc";

25.1.336 C3500: Not supported fixup-type for ELF-Outputoccurred

[FATAL]

Description

A fixup type not supported by the ELF Object file writer occurred. This messageindicates an internal compiler error because all necessary fixup types must be supported.This message also can occur if in HLI (High Level Inline) Assembler an unsupportedrelocation/fixup type is used.

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 901

Page 902: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Report this error to your support.

25.1.337 C3501: ELF Error <

[]

Description

[FATAL]

Description

The ELF generation module reports an error. Possible causes are when the object file tobe generated is locked by another application or the disk is full.

Tips

Check if the output file exists and is locked. Close all applications which might lock it.

25.1.338 C3600: Function has no code: remove it!

[ERROR]

Description

It is an error when a function is really empty because such a function can not berepresented in the memory and it does not have an address. Because all C functions haveat least a return instruction, this error can only occur with the pragma NO_EXIT. Remarkthat not all targets support NO_EXIT.

Example

#pragma NO_EXIT

void main(void) {}

Tips

Remove the function. It is not possible to use an empty function.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

902 Freescale Semiconductor, Inc.

Page 903: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.339 C3601: Pragma TEST_CODE: mode <Mode>, size given<Size> expected <Size>, hashcode given <HashCode>,expected <HashCode>

[ERROR]

Description

The condition tested with a pragma TEST_CODE was false.

Example

#pragma TEST_CODE == 0

void main(void) {}

Tips

There are many reasons why the generated code may have been changed. Check why thepragma was added and which code is now generated. If the code is correct, adapt thepragma. Otherwise change the code.

See also• pragma TEST_CODE

25.1.340 C3602: Global objects: <Number>, Data Size (RAM):<Size>, Const Data Size (ROM): <Size>

[INFORMATION]

Description

This message is used to give some additional information about the last compilation unitcompiled.

Example

Compile any C file.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 903

Page 904: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Smart Linking may not link all variables or constants, so the real application may besmaller than this value. No alignment bytes are counted.

25.1.341 C3603: Static '<Function>' was not defined

[WARNING]

Description

A static function was used, but not defined. As static functions can only be defined in thiscompilation unit, the function using the undefined static cannot successfully link.

Example

static void f(void);

void main(void) {

f();

}

Tips

Define the static function, remove its usage or declare it as external.

25.1.342 C3604: Static '<Object>' was not referenced

[INFORMATION]

Description

A static object was defined but not referenced. When using smart linking, this object willnot be used.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

904 Freescale Semiconductor, Inc.

Page 905: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

static int i;

Tips

Remove the static object, comment it out or do not compile it with conditionalcompilation. Not referenced static functions often exist because the were used sometimeago but no longer or because the usage is present but not compiled because of conditionalcompilation.

25.1.343 C3605: Runtime object '<Object>' is used at PC <PC>

[DISABLE]

Description

By default this message is disabled. This message may be enabled to report every runtimeobject used. Runtime objects (or calls) are used if the target CPU itself does not support aspecific operation, e.g. a 32bit division or if the usage of such a runtime function is betterthan directly to inline it. The message is issued at the end of a function and reports thename and the PC where the object is used.

Example

double d1, d2;

void foo(void) {

d1 = d2 * 4.5; // compiler calls _DMUL for

// IEEE64 multiplication

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 905

Page 906: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Set this message to an error if you have to ensure that no runtime calls are made.

25.1.344 C3606: Initializing object '<Object>'

[DISABLE]

Description

If global variables are initialized, such initialized objects have to be initialized duringstartup of the application. This message (which is disabled by default) reports everysingle global or static local initialization.

Example

int i = 3; // message C3606

char *p = "abc"; // message C3606

void foo(void) {

int k = 3; // no message!

static int j = 3; // message C3606

}

Tips

Set this message to an error if you have to ensure that no additional global initialization isnecessary for a copy down during startup of the application.

25.1.345 C3700: Special opcode too large

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

906 Freescale Semiconductor, Inc.

Page 907: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[FATAL]

Description

An internal buffer overflow in the ELF/DWARF 2 debug information output. This errorindicates an internal error. It should not be possible to generate this error with legal input.

25.1.346 C3701: Too many attributes for DWARF2.0 Output

[FATAL]

Description

The ELF/DWARF 2 debug information output supports 128*128-128 different DWARFtags. This error indicates an internal error. It should not be possible to generate this errorwith legal input because similar objects use the same tag and there much less possiblecombinations.

25.1.347 C3800: Segment name already used

[ERROR]

Description

The same segment name was used for different segment type.

Example

#pragma DATA_SEG Test

#pragma CODE_SEG Test

Tips

Use different names for different types. If the two segments must be linked to the samearea, this could be done in the link parameter file.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 907

Page 908: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.348 C3801: Segment already used with different attributes

[WARNING]

Description

A segment was used several times with different attributes.

Example

#pragma DATA_SEG FAR AA

..

#pragma DATA_SEG NEAR BB

..

Tips

Use the same attributes with one segment. Keep variables of the same segment togetherto avoid inconsistencies.

25.1.349 C3802: Segment pragma incorrect

[WARNING]

Description

A section pragma was used with incorrect attributes or an incorrect name.

Example

#pragma DATA_SEG FAR FAR

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

908 Freescale Semiconductor, Inc.

Page 909: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Take care about not using keywords as names segment names. Note that you can use e.g.the __FAR_SEG instead FAR.

Example

#pragma DATA_SEG __FAR_SEG MyFarSeg

25.1.350 C3803: Illegal Segment Attribute

[WARNING]

Description

A Segment attribute was recognized, but this attribute is not applicable to this segment.Code segments may only be FAR, NEAR and SHORT. The DIRECT attribute is allowedfor data segments only. The actual available segment attributes and their semanticdepends on the target processor.

Example

#pragma CODE_SEG DIRECT MyFarSegment

Tips

Correct the attribute. Do not use segment attribute specifiers as segment names. Note thatyou can use the 'safe' qualifiers as well, e.g. __FAR_SEG.

25.1.351 C3804: Predefined segment '<segmentName>' used

[WARNING]

Description

A Segment name was recognized which is a predefined one. Predefined segment namesare FUNCS, STRINGS, ROM_VAR, COPY, STARTUP, _PRESTART, SSTACK,DEFAULT_RAM, DEFAULT_ROM and _OVERLAP. If you use such segment names,this may raise conflicts during linking.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 909

Page 910: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma CODE_SEG FUNCS // WARNING here

Tips

Use another name. Do not use predefined segment names.

25.1.352 C3900: Return value too large

[ERROR]

Description

The return type of the function is too large for this compiler.

Example

typedef struct A {

int i,j,k,l,m,n,o,p;

}A;

A f();

Tips

In C++, instead of a class/struct type, return a reference to it! In C, allocate the structureat the caller and pass a pointer/reference as additional parameter.

See also• Compiler Backend

25.1.353 C4000: Condition always is TRUE

[INFORMATION]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

910 Freescale Semiconductor, Inc.

Page 911: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The compiler has detected a condition to be always true. This may also happen if thecompiler uses high level optimizations, but could also be a hint for a possibleprogramming error.

Example

unsigned int i= 2;

...

if (i >= 0) i = 1;

Example

extern void work(void);

void test(void) {

while (1) {

work();

}

}

Tips

If it is a programming error, correct the statement. For endless loops, use for (;;) ...instead of while (1).

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 911

Page 912: CodeWarrior Development Studio for Microcontrollers V10.x RS08

extern void work(void);

void test(void) {

for (;;) {

work();

}

}

25.1.354 C4001: Condition always is FALSE

[INFORMATION]

Description

The compiler has detected a condition to be always false. This may also happen if thecompiler uses high level optimizations, but could also be a hint for a possibleprogramming error.

Example

unsigned int i;

if (-i < 0) i = -i;

Tips

If it is a programming error, correct the statement

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

912 Freescale Semiconductor, Inc.

Page 913: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.355 C4002: Result not used

[WARNING]

Description

The result of an expression outside a condition is not used. In ANSI-C it is legal to writecode as in the example below. Some programmers are using such a statement to enforceonly a read access to a variable without write access, but in most cases the compiler willoptimize such statements away.

Example

int i;

i+1; // should be 'i=1;', but programming error

Tips

If it is a programming error, correct the statement.

25.1.356 C4003: Shift count converted to unsigned char

[INFORMATION]

Description

In ANSI-C, if a shift count exceeds the number of bits of the value to be shifted, theresult is undefined. Because there is no integral data type available with more than 256bits yet, the compiler implicitly converts a shift count larger than 8 bits (char) to anunsigned char, avoiding loading a shift count too large for shifting, which does not affectthe result. This ensures that the code is as compact as possible.

Example

int j, i;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 913

Page 914: CodeWarrior Development Studio for Microcontrollers V10.x RS08

i <<= j; // same as 'i <<= (unsigned char)j;'

In the above example, both 'i' and 'j' have type 'int', but the compile can safely replace the'int' shift count 'j' with a 'unsigned char' type.

Tips

None, because it is a hint of compiler optimizations.

25.1.357 C4004: BitSet/BitClr bit number converted to unsignedchar

[INFORMATION]

Description

The compiler has detected a shift count larger than 8bit used for a bitset/bitclearoperation. Because it makes no sense to use a shift count larger than 256, the compileroptimizes the shift count to a character type. Reducing the shift count may reduce thecode size and improve the code speed (e.g. a 32bit shift compared with a 8bit shift).

Example

int j; long L;

j |= (1<<L); // the compiler converts 'L'

// to a unsigned character type

Tips

None, because it is a hint of compiler optimizations.

25.1.358 C4006: Expression too complex

[FATAL]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

914 Freescale Semiconductor, Inc.

Page 915: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

The compiler cannot handle an expression which has more than 32 recursion levels.

Example

typedef struct S {

struct S *n;

} S;

S *s;

void foo(void) {

s->n-&gt;n->n-&gt;n-> ... n->n-&gt;n->n-&gt;n->n- &gt;n->n-&gt;n = 0;

}

Tips

Try to simplify the expression, e.g. use temporary variables to hold expression results.

See also• Limitations

25.1.359 C4007: Pointer DREF is NOT allowed

[INFORMATION]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 915

Page 916: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The dereferencing operator cannot be applied. For some back-ends, pointer types that donot support this operation may exist (for instance, __linear pointers for HCS08).

25.1.360 C4100: Converted bit field signed -1 to 1 in comparison

[WARNING]

Description

A signed bitfield entry of size 1 can only have the values 0 and -1. The compiler did finda comparison of such a value with 1. The compiler did use -1 instead to generate theexpected code.

Example

struct A {

int i:1;

} a;

void f(void);

void main(void) {

if (a.i == 1) {

f();

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

916 Freescale Semiconductor, Inc.

Page 917: CodeWarrior Development Studio for Microcontrollers V10.x RS08

}

Tips

Correct the source code. Either use an unsigned bitfield entry or compare the value to -1.

25.1.361 C4101: Address of bitfield is illegal

[ERROR]

Description

The address of a bitfield was taken.

Example

typedef struct A {

int bf1:1;

} A;

void f() {

A a;

if(&amp;a.bf1);

}

Tips

Use a "normal" integral member type, if you really need to have the address.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 917

Page 918: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.362 C4200: Other segment than in previous declaration

[WARNING]

Description

A object (variable or function) was declared with inconsistent segments.

Example

#pragma DATA_SEG A

extern int i;

#pragma DATA_SEG B

int i;

Tips

Change the segment pragmas in a way that all declarations and the definition of oneobject are in the same segment. Otherwise wrong optimizations could happen.

25.1.363 C4201: pragma <name> was not handled

[WARNING]

Description

A pragma was not used by the compiler. This may have different reasons: the pragma isintended for a different compiler by a typing mistake, the compiler did not recognize apragma. Note that pragma names are case sensitive. there was no context, a specificpragma could take some action The segment pragma DATA_SEG, CODE_SEG,CONST_SEG and their aliases never issue this warning, even if they are not used.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

918 Freescale Semiconductor, Inc.

Page 919: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#pragma TRAP_PROG

// typing mistake: the interrupt pragma is called TRAP_PROC

void Inter(void) {

...

}

Tips

Investigate this warning carefully. This warning can be mapped to an error if onlypragmas are used which are known.

25.1.364 C4202: Invalid pragma OPTION,

[ERROR]

Description

A ill formed pragma OPTION was found or the given options were not valid. Thedescription says more precisely what is the problem with a specific pragma OPTION.

Example

#pragma OPTION add "-or"

Tips

When the format was illegal, correct it. You can add comments, but they must follow theusual C rules. Be careful which options are given by the command line when addingoptions. It is not possible to add options which contradicts to command line options.Notice the limitations of the pragma OPTION.

See also

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 919

Page 920: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• pragma OPTION

25.1.365 C4203: Invalid pragma MESSAGE, <description>

[WARNING]

Description

A ill formed pragma MESSAGE was found or the given message number cannot bemoved. The description says more precisely what is the problem with a specific pragmaMESSAGE.

Example

#pragma MESSAGE warning C4203

The pragma OPTION keyword warning is case sensitive!

Write instead:

#pragma MESSAGE WARNING C4203

Tips

When the format was illegal, correct it. You can add comments, but they must follow theusual C rules. The same message can be moved at different code positions to a differentstate. Be careful not to specify the same message with a option or with graphical userinterface and with this pragma. If this is done, it is not defined which definition isactually taken.

See also• pragma MESSAGE

25.1.366 C4204: Invalid pragma REALLOC_OBJ,

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

920 Freescale Semiconductor, Inc.

Page 921: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[ERROR]

Description

The pragma REALLOC_OBJ was used in a ill formed way.

See also• pragma REALLOC_OBJ• Linker Manual

25.1.367 C4205: Invalid pragma LINK_INFO, <description>

[WARNING]

Description

The pragma LINK_INFO was used in a ill formed way.

See also• pragma LINK_INFO

25.1.368 C4206: pragma pop found without correspondingpragma push

[ERROR]

Description

A pragma pop was found, but there was no corresponding pragma push.

See also• pragma pop• pragma push

25.1.369 C4207: Invalid pragma pop, <description>

[WARNING]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 921

Page 922: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The pragma pop was used in a ill formed way.

See also• pragma pop• pragma push

25.1.370 C4208: Invalid pragma push, <description>

[WARNING]

Description

The pragma push was used in a ill formed way.

Seealso• pragma pop• pragma push

25.1.371 C4209: Usage: pragma align (on|off)

[WARNING]

Description

The pragma align was not used together with on or off.

See also• pragma align

25.1.372 C4300: Call of an empty function removed

[WARNING]

Description

If the option -Oi is enabled, calls of empty functions are removed.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

922 Freescale Semiconductor, Inc.

Page 923: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void f() {

}

void main() {

f(); // this call is removed !

}

Tips

If for any reason you need a call of an empty function, disable the option -Oi.

See also• Option -Oi

25.1.373 C4301: Inline expansion done for function call

[INFORMATION]

Description

The compiler was replacing the function call with the code of the function to be called.

Example

inline int f(int i) {

return i+1;

}

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 923

Page 924: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main() {

int i=f(3); // gets replaced by i=3+1;

}

Tips

To force the compiler to inline function calls use the keyword "inline".

See also• Option -Oi

25.1.374 C4302: Could not generate inline expansion for thisfunction call

[INFORMATION]

Description

The compiler could not replace the function call with the code of the function to becalled. The expression containing the function call may be too complex, the function tobe called may be recursive or too complex.

Example

inline int f(int i) {

if(i>10) return 0;

return f(i+1);

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

924 Freescale Semiconductor, Inc.

Page 925: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main() {

int i=f(3); // Cannot inline,

// because f() contains a recursive call

}

Tips

To have the same effect as inlining the function, replace the call with the code of thefunction manually.

25.1.375 C4303: Illegal pragma <name>

[WARNING]

Description

An parsing error was found inside of the given pragma.

Example

#pragma INLINE Inline it!

// pragma INLINE does not expect any arguments

void foo(void) {

}

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 925

Page 926: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• Check the exact definition of this pragma.• Use comments to add text behind a pragma.

25.1.376 C4400: Comment not closed

[FATAL]

Description

The preprocessor has found a comment which has not been closed.

Example

/*

Tips

Close the comment.

25.1.377 C4401: Recursive comments not allowed

[WARNING]

Description

A recursive comment has been found (a comment with inside a comment).

Example

/* /* nested comment */

Tips

Either correct the comment, use

'#if 0'

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

926 Freescale Semiconductor, Inc.

Page 927: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

'#endif'

or the C++ like comment '\\\\':

#if 0

/* nested comment */

#endif

\\ /* /* nested comment */

25.1.378 C4402: Redefinition of existing macro '<MacroName>'

[FATAL]

Description

It is not allowed to redefine a macro.

Example

#define ABC 10

#define ABC 20

Tips

Correct the macro (e.g. using another name).

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 927

Page 928: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.379 C4403: Macro-buffer overflow

[FATAL]

Description

There are more than 10'000 macros in a single compilation unit.

Example

#define macro0

#define macro1

...

#define macro10000

Tips

Simplify the compilation unit to reduce the amount of macro definitions.

See also• Limitations

25.1.380 C4404: Macro parents not closed

[FATAL]

Description

In a usage of a macro with parameters, the closing parenthesis is not present.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

928 Freescale Semiconductor, Inc.

Page 929: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#define cat(a,b) (a##b)

int i = cat(12,34;

Tips

Add a closing ')'.

25.1.381 C4405: Include-directive followed by illegal symbol

[FATAL]

Description

After an include directive, there is an illegal symbol (not a file name in double quotes orwithin '<' and '>'.

Example

#include <string.h> <&lt;< message C4405 here

Tips

Correct the include directive.

25.1.382 C4406: Closing '>' missing

[FATAL]

Description

There is a missing closing '>' for the include directive.

Example

#include <string.h

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 929

Page 930: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Correct the include directive.

25.1.383 C4407: Illegal character in string or closing '>' missing

[FATAL]

Description

Either there is a non-printable character (as control characters) inside the file name for theinclude directive or the file name is not enclosed with '<' and '>'.

Example

#include <abc.h[control character]

Tips

If there are non-printable characters inside the file name, remove them. If there is amissing '>', add a '>' to the end of the file name.

25.1.384 C4408: Filename too long

[FATAL]

Description

A include file name longer than 2048 characters has been specified.

Example

#include <VeryLongFilename.....>

Tips

Shorten the file name, e.g. using a relative path or setting up the include file path in thedefault.env environment file.

See also• Limitations

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

930 Freescale Semiconductor, Inc.

Page 931: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.385 C4409: a ## b: the concatenation of a and b is not alegal symbol

[WARNING]

Description

The concatenation operator ## is used to concatenate symbols. If the resulting symbol isnot a legal one, this message is issued. Note: The pragma MESSAGE does not apply tothis message because it is issued in the preprocessing phase.

Example

#define concat(a,b) a ## b

void foo(int a) {

a concat(=,@) 5; // message: =@ is not a legal symbol

}

Tips

Check your macro definition. Generate a preprocessor output (option -Lp) to find theproblem.

25.1.386 C4410: Unbalanced Parentheses

[FATAL]

Description

The number of opening parentheses '(' and the number of closing parentheses ')' does notmatch.

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 931

Page 932: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check your macro definition. Generate a preprocessor output (option -Lp) to find theproblem.

25.1.387 C4411: Maximum number of arguments for macroexpansion reached

[FATAL]

Description

The compiler has reached the limit for the number of macro arguments for a macroinvocation.

Example

#define A0(p1,p2,...,p1024) (p1+p2+...+p1024)

#define A1(p1,p2,...,p1024) A0(p1+p2+...+p1024)

void foo(void) {

A1(1,2,...,1024); // message C4411 here

}

Tips

Try to avoid such a huge number of macro parameters, use simpler macros instead.

See also• Limitations

25.1.388 C4412: Maximum macro expansion level reached

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

932 Freescale Semiconductor, Inc.

Page 933: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[FATAL]

Description

The compiler has reached the limit for recursive macro expansion. A recursive macro is ifa macro depends on another macro. The compiler also stops macro expansion with thismessage if it seems to be an endless macro expansion.

Example

#define A0 0

#define A1 A0

#define A2 A1

...

Tips

Try to reduce huge dependency list of macros.

See also• Limitations

25.1.389 C4413: Assertion: pos failed

[FATAL]

Description

This is a compiler internal error message only. It happens if during macro expansion themacro definition position is not the same as during the initial macro scanning.

Tips

If you encounter this message, please send us a preprocessor output (option -Lp).

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 933

Page 934: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.390 C4414: Argument of macro expected

[FATAL]

Description

The preprocessor tries to resolve a macro expansion. However, there is no macroargument given after the comma separating the different macro arguments.

Example

#define Macro(a,b)

void foo(void) {

Macro(,);

}

Tips

Check your macro definition or usage. Generate a preprocessor output (option -Lp) tofind the problem.

25.1.391 C4415: ')' expected

[FATAL]

Description

The preprocessor expects a closing parenthesis. This may happen if a preprocessor macrohas been called more argument than previously declared.

Example

#define A(a,b) (a+b)

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

934 Freescale Semiconductor, Inc.

Page 935: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void) {

int i = A(3,4,5); // message C4415 here

}

Tips

Use the same number of arguments as declared in the macro.

25.1.392 C4416: Comma expected

[FATAL]

Description

The preprocessor expects a comma at the given position.

Tips

Check your macro definition or usage.

25.1.393 C4417: Mismatch number of formal, number of actualparameters

[FATAL]

Description

A preprocessor macro has been called with a different number of argument thanpreviously declared.

Example

#define A(a,b) (a+b)

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 935

Page 936: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(void) {

int i = A(3,5,7); // message C4417 here

}

Tips

Use the same number of arguments as declared in the macro.

25.1.394 C4418: Illegal escape sequence

[ERROR]

Description

An illegal escape sequence occurred. A set of escape sequences is well defined in ANSIC. Additionally there are two forms of numerical escape sequences. The compiler hasdetected an escape sequence which is not covered by ANSI. Note: The pragmaMESSAGE does not apply to this message because it is issued in the preprocessingphase.

Example

char c= '\\p';

Tips

Remove the escape character if you just want the character. When this message isignored, the compiler issued just the character without considering the escape character.So '\p' gives just a 'p' when this message is ignored. To specify and additional characteruse the either the octal or hexadecimal form of numerical escape sequences.

char c_space1= ' '; // conventional space

char c_space2= '\x20'; // space with hex notation

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

936 Freescale Semiconductor, Inc.

Page 937: CodeWarrior Development Studio for Microcontrollers V10.x RS08

char c_space3= '\040'; // space with octal notation

\encode

Only 3 digits are read for octal numbers, so when you specify 3 digits, then, there is no danger of combining the numerical escape sequence with the next character in sequence. Hexadecimal escape sequences should be terminate explicitly.

\code

const char string1[]= " 0";// gives " 0"

const char string2[]= "\400";// error because 0400> 255

const char string3[]= "\x200";// error because 0x200 > 255

const char string4[]= "\0400";// gives " 0"

const char string5[]= "\x20" "0";// gives " 0"

See also• List of Escape Sequences

25.1.395 C4419: Closing ì missing

[FATAL]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 937

Page 938: CodeWarrior Development Studio for Microcontrollers V10.x RS08

There is a string which is not terminated by a double quote. This message is also issued ifthe not closed string is at the end of the compilation unit file.

25.1.396 C4420: Illegal character in string or closing " missing

[FATAL]

Description

A string contains either an illegal character or is not terminated by a closing doublequote.

Example

#define String "abc

Tips

Check your strings for illegal characters or if they are terminated by a double quote.

25.1.397 C4421: String too long

[FATAL]

Description

Strings in the preprocessor are actually limited to 8192 characters.

Tips

Use a smaller string or try to split it up.

See also• Limitations

25.1.398 C4422: ' missing

[FATAL]

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

938 Freescale Semiconductor, Inc.

Page 939: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Description

To define a character, it has to be surrounded by single quotes (').

Example

#define CHAR 'a

Tips

Add a single quote at the end of the character constant.

25.1.399 C4423: Number too long

[FATAL]

Description

During preprocessing, the maximum length for a number has been reached. Actually thislength is limited to 8192 characters.

Example

#define MyNum 12345......8193 // 8193 characters

Tips

Probably there is a typing error or the number is just too big.

See also• Limitations

25.1.400 C4424: # in substitution list must be followed by nameof formal parameter

[FATAL]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 939

Page 940: CodeWarrior Development Studio for Microcontrollers V10.x RS08

There is a problem with the '#' operator during preprocessing, because there is no legalname as formal parameter specified.

Example

#define cat(a,b) a #

void foo(void) {

i = cat(3,3);

}

Tips

Check your macro definition or usage. Generate a preprocessor output (option -Lp) tofind the problem.

25.1.401 C4425: ## in substitution list must be preceded andfollowed by a symbol

[FATAL]

Description

There is a problem with the string concatenation ## operator during preprocessing,because there is no legal name as formal parameter specified.

Example

#define cat(a,b) a ##

void foo(void) {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

940 Freescale Semiconductor, Inc.

Page 941: CodeWarrior Development Studio for Microcontrollers V10.x RS08

i = cat(3,3);

}

Tips

Check your macro definition or usage. Generate a preprocessor output (option -Lp) tofind the problem.

25.1.402 C4426: Macro must be a name

[FATAL]

Description

There has to be a legal C/C++ ident to be used as a macro name. An ident has to be startwith a normal letter (e.g. 'a'..'Z') or any legal ident symbol.

Example

#define "abc"

Tips

Use a legal macro name, e.g. not a string or a digit.

25.1.403 C4427: Parameter name expected

[FATAL]

Description

The preprocessor expects a name for preprocessor macros with parameters.

Example

#define A(3) (B)

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 941

Page 942: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Do not use numbers or anything else than a name as macro parameter names.

25.1.404 C4428: Maximum macro arguments for declarationreached

[FATAL]

Description

The preprocessor has reached the maximum number of arguments allowed for a macrodeclaration.

Example

#define A(p0, p1, ..., p1023, p1024) (p0+p1+...p1024)

Tips

Try to split your macro into two smaller ones.

See also• Limitations

25.1.405 C4429: Macro name expected

[FATAL]

Description

The preprocessor expects macro name for the undef directive.

Example

#undef #xyz

Tips

Use only a legal macro name for the undef directive.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

942 Freescale Semiconductor, Inc.

Page 943: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.406 C4430: Include macro does not expand to string

[FATAL]

Description

The file name specified is not a legal string. A legal file name has to be surrounded withdouble quotes '"'.

Example

#define file 3

#include file

Tips

Specify a legal file name.

25.1.407 C4431: Include "filename" expected

[FATAL]

Description

There is no legal file name for a include directive specified. A file name has to be non-empty and surrounded either by '<' and '>' or by double quotes '"'.

Example

#include <>

Tips

Specify a legal file name.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 943

Page 944: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.408 C4432: Macro expects '('

[FATAL]

Description

While expanding macros, the preprocessor expects here an opening parenthesis tocontinue with macro expansion.

Tips

Check your macro definition or usage. Generate a preprocessor output (option -Lp) tofind the problem.

25.1.409 C4433: Defined <name> expected

[FATAL]

Description

Using 'defined', it can be checked if a macro is defined or not. However, there has to be aname used as argument for defined.

Example

#if defined()

#endif

Tips

Specify a name for the defined directive, e.g. if defined(abc).

25.1.410 C4434: Closing ')' missing

[FATAL]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

944 Freescale Semiconductor, Inc.

Page 945: CodeWarrior Development Studio for Microcontrollers V10.x RS08

During macro expansion, the preprocessor expects a closing parenthesis to continue.

Tips

Check your macro definition or usage. Generate a preprocessor output (option -Lp) tofind the problem.

25.1.411 C4435: Illegal expression in conditional expression

[FATAL]

Description

There is an illegal conditional expression used in a if or elif directive.

Example

#if (3*)

#endif

Tips

Check the conditional expression.

25.1.412 C4436: Name expected

[FATAL]

Description

The preprocessor expects a name for the ifdef and ifndef directive.

Example

#ifndef 3333_H // <&lt; C4436 here

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 945

Page 946: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#define 3333_H

#endif

Tips

Check if a legal name is used, e.g. it is not legal to start a name with a digit.

25.1.413 C4437: Error-directive found: <message>

[ERROR]

Description

The preprocessor stops with this message if he encounters an error directive. Note: Thepragma MESSAGE does not apply to this message because it is issued in thepreprocessing phase.

Example

#error "error directive"

Tips

Check why the preprocessor evaluates to this error directive. Maybe you have forgottento define a macro which has caused this error directive.

25.1.414 C4438: Endif-directive missing

[FATAL]

Description

All if or ifdef directives need a endif at the end. If the compiler does not find one, thismessage is issued.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

946 Freescale Semiconductor, Inc.

Page 947: CodeWarrior Development Studio for Microcontrollers V10.x RS08

#if 1

Tips

Check where the endif is missing. Generate a preprocessor output (option -Lp) to find theproblem.

25.1.415 C4439: Source file <file> not found

[FATAL]

Description

The compiler did not found the source file to be used for preprocessing.

Tips

Check why the compiler was not able to open the indicated file. Maybe the file is notaccessible any more or locked by another application.

25.1.416 C4440: Unknown directive: <directive>

[FATAL]

Description

The preprocessor has detected a directive which is unknown and which cannot behandled.

Example

#notadirective

Tips

Check the directive. Maybe it is a non-ANSI directive supported by another compiler.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 947

Page 948: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.417 C4441: Preprocessor output file <file> could not beopened

[FATAL]

Description

The compiler was not able to open the preprocessor output file. The preprocessor file isgenerated if the option -Lp is specified.

Tips

Check your macro definition or usage. Check the option -Lp: the format specified may beillegal.

25.1.418 C4442: Endif-directive missing

[FATAL]

Description

The asm directive needs a endasm at the end. If the compiler does not find one, thismessage is issued.

Example

#asm

Tips

Check where the endasm is missing. Generate a preprocessor output (option -Lp) to findthe problem.

25.1.419 C4443: Undefined Macro 'MacroName' is taken as 0

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

948 Freescale Semiconductor, Inc.

Page 949: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Whenever the preprocessor evaluates a condition and finds a identifier which was notdefined before, he implicitly takes its value to be the integral value 0. This C stylebehavior may arise in hard to find bug. So when the header file, which actually definesthe value is not included or when the macro name was entered incorrectly, for examplewith a different case, then the preprocessor "#if" and "#elif" instructions wont behave asexpected. Note: The pragma MESSAGE does not apply to this message because it isissued in the preprocessing phase.

Example

#define _Debug_Me 1

...

void main(int i) {

#if Debug_Me // missing _ in front of _Debug_Me.

assert(i!=0);

#endif

}

The assert will never be reached.

Tips

This warning is a good candidate to be mapped to an error. To save test macros defined insome header files, also test if the macros are defined:

#define _Debug_Me

...

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 949

Page 950: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(int i) {

#ifndef(Debug_Me)

#error // macro must be defined above

#endif

#if Debug_Me // missing _ in front of _Debug_Me.

assert(i!=0);

#endif

}

The checking of macros with "#ifdef" and "#ifndef" cannot detect if the header file, amacro should define is really included or not. Note that using a undefined macro in Csource will treat the macro as C identifier and so usually be remarked by the compiler.Also note a undefined macro has the value 0 inside of preprocessor conditions, while adefined macro with nothing as second argument of a "#define" replaces to nothing. E.g.

#define DEFINED_MACRO

#if UNDEFINED_MACRO // evaluates to 0, giving this warning

#endif

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

950 Freescale Semiconductor, Inc.

Page 951: CodeWarrior Development Studio for Microcontrollers V10.x RS08

if DEFINED_MACRO // error FATAL: C4435: Illegal

// expression in conditional expression

#endif

25.1.420 C4444: Line number for line directive must be > 0 and<= 32767

[WARNING]

Description

ANSI requires that the line number for the line directive is greater zero or smaller-equalthan 32767. If this message occurs and it is currently mapped to an error, the compilersets the line number to 1.

Example

#line 0

#line 32768 "myFile.c"

Tips

Specify a line number greater zero and smaller 32768. For automatically generated code,which has such illegal line directives, you can move this error to a warning.

25.1.421 C4445: Line numberfor line directive expected

[ERROR]

Description

ANSI requires that after the line directive a number has to follow.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 951

Page 952: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

#line // <&lt; ERROR C4445

#line "myFile.c" // <&lt; ERROR C4445

Tips

Specify a line number greater zero and smaller 32768.

25.1.422 C4446: Missing macro argument(s)

[WARNING]

Description

In a macro 'call', one or more arguments are missing. The pre-processor replaces theparameter string with nothing. Note: The pragma MESSAGE does not apply to thismessage because it is issued in the preprocessing phase.

Example

#define f(A, B) int A B

void main(void){

f(i,);// this statement will be replaced with 'int i;'

// by the pre-processor.

}

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

952 Freescale Semiconductor, Inc.

Page 953: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Be careful with empty macro arguments, because the behavior is undefined in ANSI-C.So avoid it if possible.

25.1.423 C4447: Unexpected tokens following preprocessordirective - expected a newline

[WARNING]

Description

The compiler has detected that after a directive there was something unexpected.Directives are normally line oriented, thus the unexpected tokens are just ignored. Note:The pragma MESSAGE does not apply to this message because it is issued in thepreprocessing phase.

Example

#include "myheader.h" something

Tips

Remove the unexpected tokens.

25.1.424 C4448: Warning-directive found: <message>

[WARNING]

Description

The preprocessor stops with this message if he encounters an #warning directive. Notethat this directive is only support if -Ansi is not set. Note: The pragma MESSAGE doesnot apply to this message because it is issued in the preprocessing phase.

Example

#warning "warning directive"

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 953

Page 954: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check why the preprocessor evaluates to this warning directive. Maybe you haveforgotten to define a macro which has caused this directive.

25.1.425 C4449: Exceeded preprocessor if level of 4092

[ERROR]

Description

The preprocessor does by default only allow 4092 concurrently open if directives. If moredo happen, this message is printed. Usually this message does only happen because of aprogramming error.

Example

#if 1 // 0

#if 2 // 0

#if 3 // 0

.....

#if 4092 // 0

Tips

Check why there are that many open preprocessor if's. Are the endif's missing?

25.1.426 C4700: Illegal pragma TEST_ERROR

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

954 Freescale Semiconductor, Inc.

Page 955: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The pragma TEST_ERROR is for internal use only. It is used to test the messagemanagement and also to test error cases in the compiler.

25.1.427 C4701: pragma TEST_ERROR: Message <ErrorNumber>did not occur

[ERROR]

Description

The pragma TEST_ERROR is for internal use only. It is used to test the messagemanagement and also to test error cases in the compiler.

25.1.428 C4800: Implicit cast in assignment

[WARNING]

Description

An assignment requiring an implicit cast was made.

Tips

Check, if the casting results in correct behavior.

25.1.429 C4801: Too many initializers

[ERROR]

Description

The braced initialization has too many members.

Example

char name[4]={'n','a','m','e',0};

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 955

Page 956: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Write the correct number of members in the braced initializer.

25.1.430 C4802: String-initializer too large

[ERROR]

Description

The string initializer was too large.

Tips

Take a shorter string, or try to allocate memory for your string in an initializationfunction of the compilation unit.

25.1.431 C4900: Function differs in return type only

[ERROR]

Description

The overloaded function has the same parameters, but not the same return type.

Example

void f(int);

void f();

int f(int); // error

Tips

A function redeclaration with the same parameters must have the same return type thanthe first declaration.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

956 Freescale Semiconductor, Inc.

Page 957: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.432 C5000: Following condition fails: sizeof(char) <=sizeof(short) <= sizeof(int) <= sizeof(long) <=sizeof(long long)

[ERROR]

Description

Type sizes has been set to illegal sizes. For compliance with the ANSI-C rules, the typesizes of char, short, int, long and long long has to in a increasing order, e.g. setting char toa size of two and int to a size of one will violate this ANSI rule.

Example

-Tc2i1

Tips

Change the -T option.

25.1.433 C5001: Following condition fails: sizeof(float) <=sizeof(double) <= sizeof(long double) <= sizeof(longlong double)

[ERROR]

Description

Your settings of the Standard Types are wrong!

Example

-Tf4d2

Tips

Set your Standard Types correctly

See also• Change the -T option.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 957

Page 958: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.434 C5002: Illegal type

[ERROR]

Description

A unknown or illegal type occurred. This error may happen as consequence of anothererror creating the illegal type.

Tips

Check for other errors happening before.

25.1.435 C5003: Unknown array-size

[ERROR]

Description

A compiler internal error happened!

Tips

Please contact your support.

25.1.436 C5004: Unknown struct-union-size

[ERROR]

Description

A compiler internal error happened!

Tips

Please contact your support.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

958 Freescale Semiconductor, Inc.

Page 959: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.437 C5005: PACE illegal type

[ERROR]

Description

A compiler internal error happened!

Tips

Please contact your support.

25.1.438 C5006: Illegal type settings for HIWARE Object FileFormat

[ERROR]

Description

For HIWARE object file format (option -Fh, -F7 and default if no other object file formatis selected) the char type must always be of size 1. This limitation is because there maynot be any new types introduced in this format and 1 byte types are used internally in thecompiler ever if the user only need multibyte characters. For the strict HIWARE objectfile format (option -F7) the additional limitation that the enum type has the size 2 bytes,and must be signed, is checked with this message. The HIWARE Object File Format (-Fh) has following limitations: The type char is limited to a size of 1 byte Symbolicdebugging for enumerations is limited to 16bit signed enumerations No symbolicdebugging for enumerations No zero bytes in strings allowed (zero byte marks the end ofthe string) The strict HIWARE V2.7 Object File Format (option -F7) has somelimitations: The type char is limited to a size of 1 byte Enumerations are limited to a sizeof 2 and has to be signed No symbolic debugging for enumerations The standard type'short' is encoded as 'int' in the object file format No zero bytes in strings allowed (zerobyte marks the end of the string)

Example

COMPOPTIONS= \c -Te2 \c -Fh

Tips

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 959

Page 960: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Use -Fh HIWARE object file format to change the enum type. To change the char type,only the ELF object file format can be used (if supported). Note that not all backendsallow the change of all types.

See also• Option for object file format -Fh, -F7, -F1, -F2• Option for Type Setting -T

25.1.439 C5100: Code size too large

[ERROR]

Description

The code size is too large for this compiler.

Example

// a large source file

Tips

Split up your source into several compilation units!

See also• Limitations

25.1.440 C5200: 'FileName' file not found

[ERROR]

Description

The specified source file was not found.

Example

#include "notexisting.h"

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

960 Freescale Semiconductor, Inc.

Page 961: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Specify the correct path and name of your source file!

See also• Input Files

25.1.441 C5250: Error in type settings: <Msg>

[ERROR]

Description

There is an inconsistent state in the type option settings. E.g. it is illegal to have the 'char'size larger than the size for the type 'short'.

Tips

Check the -T option in your configuration files. Check if the option is valid.

See also• Option -T

25.1.442 C5300: Limitation: code size '<actualSize>' >'<limitSize>' bytes

[ERROR]

Description

You have a limited version of the compiler or reached the limitation specified in thelicense file. The actual demo limitation is 1024 bytes of code for 8/16bit targets and3KByte for 32bit targets (without a license file). Depending on the license configuration,the code size limit may be specified in the license file too.

Tips

Check if you have enough licenses if you are using a floating license configuration.Check for the correct location of the license file. Get a license for a full version of thecompiler, or for a code size upgrade.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 961

Page 962: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.443 C5302: Couldn't open the object file <Descr>

[FATAL]

Description

The compiler cannot open the object file for writing.

Tips

Check if there is already an object file with the same name but used by anotherapplication. Check if the object file is marked as read-only or locked by anotherapplication. Check if the output path does actually exist.

25.1.444 C5320: Cannot open logfile '<FileName>'

[FATAL]

Description

The compiler cannot open the logfile file for writing.

Tips

Check if there is already a file with the same name but used by another application.Check if the file is marked as read-only or locked by another application.

See also• Option -Ll

25.1.445 C5350: Wrong or invalid encrypted file '<File>'(<MagicValue>)

[FATAL]

Description

The compiler cannot read an encrypted file because the encrypted file magic value iswrong.

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

962 Freescale Semiconductor, Inc.

Page 963: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Check if the file is a valid encrypted file.

See also• Option -Eencrypt• Option -Ekey

25.1.446 C5351: Wrong encryption file version: '<File>'(<Version>)

[FATAL]

Description

The compiler cannot read the encrypted file because the encryption version does notmatch.

Tips

Check if you have a valid license for the given encryption version. Check if you use thesame license configuration for encryption and encrypted file usage.

See also• Option -Eencrypt• Option -Ekey

25.1.447 C5352: Cannot build encryption destination file:'<FileSpec>'

[FATAL]

Description

Building the encryption destination file name using the 'FileSpec' was not possible.

Tips

Check your FileSpec if it is legal.

See also• Option -Eencrypt• Option -Ekey

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 963

Page 964: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.448 C5353: Cannot open encryption source file: '<File>'

[FATAL]

Description

It was not possible to open the encryption source file.

Tips

Check if the source file exists.

See also• Option -Eencrypt• Option -Ekey

25.1.449 C5354: Cannot open encryption destination file: '<File>'

[FATAL]

Description

The compiler was not able to write to the encryption destination file.

Tips

Check if you have read/write access to the destination file. Check if the destination filename is a valid one. Check if the destination file is locked by another application.

See also• Option -Eencrypt• Option -Ekey

25.1.450 C5355: Encryption source '<SrcFile>' and destinationfile '<DstFile>' are the same

[FATAL]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

964 Freescale Semiconductor, Inc.

Page 965: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The encryption source file and the destination file are the same. Because it is not possibleto overwrite the source file with the destination file, encryption is aborted.

Tips

Change the encryption destination file name specification.

See also• Option -Eencrypt• Option -Ekey

25.1.451 C5356: No valid license for encryption support

[FATAL]

Description

It was not possible to check out the license for encryption support.

Tips

Check your license configuration. Check if you have a valid encryption license.

See also• Option -Lic

25.1.452 C5650: Too many locations, try to split up function

[FATAL]

Description

The function is too large so the internal data structure of the compiler cannot support it.

Tip

Split up the function that causes the message.

See Also

Limitations

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 965

Page 966: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.453 C5651: Local variable <variable> may be not initialized

{WARNING]

Description

The compiler issues this warning if no dominant definition is found for a local variablewhen it is referenced. Ignore this message if the local variable is defined implicitly (e.g.by inline assembly statements).

Example

int f(int param_i) {

int local_i;

if(param_i == 0) {

local_i = 1; // this definition for local_i does

// NOT dominate following usage

}

return local_i; // local_i referenced: no dominant

// definition for local_i found

}

\endcode

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

966 Freescale Semiconductor, Inc.

Page 967: CodeWarrior Development Studio for Microcontrollers V10.x RS08

\section tips Tips

Review the code and initialize local variables at their declaration (e.g. local_i = 0).

25.1.454 C5661: Not all control paths return a value

[WARNING]

Description

There are one or more control paths without a return 'value' statement. Your functiondoes not return a value in every case.

Example

int glob;

int test(void) {

if (glob) {

return 1;

}

}

Tips

Do return a value in all control flows.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 967

Page 968: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.455 C5662: Generic Inline Assembler Error <string>

[ERROR]

Description

An error occurred during intermediate code generation for inline assembly instructions.The particular error is described in textual form.

Example

The inline assembly code taking the address of a local variable, which is not allocated onthe stack.

25.1.456 C5663: Instruction or runtime call <Instruction>produces <Size> bytes of code

[WARNING]

Description

The compiler generated an especially slow code pattern. The actual limit is CPUdependent.

Tips

See if the C code can be rewritten so that faster code is generated.

See if powers of two can be used for dividends.

Try to use unsigned types.

Try to use smaller types.

25.1.457 C5664: Instruction or runtime call <Instruction>executes in <Cycles> cycles

[DISABLED]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

968 Freescale Semiconductor, Inc.

Page 969: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The compiler generated an especially slow code pattern. The actual limit is CPUdependent.

Tips• See if the C code can be rewritten so that faster code is generated.• See if powers of two can be used for dividends.• Try to use unsigned types.• Try to use smaller types.

25.1.458 C5680: HLI Error <Detail>

[DISABLE]

Description

This is a generic error message issued by the HLI.

25.1.459 C5681: Unexpected Token

{WARNING]

Description

The HLI issues this message for unexpected tokens during parsing.

25.1.460 C5682: Unknown fixup type

{ERROR]

Description

The HLI issues this message if the parser finds an unknown fixup type.

Tips

If this error occurs, check the list of available fixup types and make sure there are nospelling errors.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 969

Page 970: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.461 C5683: Illegal directive <Ident> ignored

{WARNING]

Description

The HLI issues this message for directives it knows of, but which are ignored.

25.1.462 C5684: Instruction or label expected

[ERROR]

Description

The HLI issues this message if the HLI parser expects an instruction (or directive) or alabel, but finds something else. This error shows up if the assembly line is syntacticallywrong, or if the assembly instruction or directive is not known.

25.1.463 C5685: Comment or end of line expected

[ERROR]

Description

The HLI issues this message if it finds unexpected tokens after the operands of anassembly instructions. This may be due to an error in the operand syntax or because thecomment is not properly delimited.

25.1.464 C5686: Undefined label <Ident>

[ERROR]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

970 Freescale Semiconductor, Inc.

Page 971: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The inline assembler issues this message if an undeclared ident is used but not defined asa label. Note that a spelling error in the name of a variable or register may result in thiserror as well.

Example

In the following code, the label loop is not defined

void example (void){

asm {

cmpwi r3,0

bne loop

jne loop

}

}

25.1.465 C5687: Label <Ident> defined more than once

[ERROR]

Description

The HLI issues this message for labels which are defined more than once within the samefunction.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 971

Page 972: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.466 C5688: Illegal operand

[ERROR]

Description

The HLI issues this message if an operand is syntactically correct, but it is out of range,or is not constant, the fixup type is not appropriate, etc.

Tip

This error message is relatively unspecific about the particular error. If the reason for thiserror is unclear, we suggest that you write the same instruction with simpler operands tofind out what caused the error.

25.1.467 C5689: Constant or object expected

[ERROR]

Description

The HLI issues this message if the HLI parser expects a constant or an object, but findsanother token.

25.1.468 C5690: Illegal fixup for constant

[ERROR]

Description

The HLI issues this message if a fixup for a constant is not possible or the constant is outof range.

25.1.469 C5691: Instruction operand mismatc

[ERROR]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

972 Freescale Semiconductor, Inc.

Page 973: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The HLI issues this message if an assembly instruction is not available. Note that theassembly instruction is still known and may be available for other operands.

Tip

This error message is relatively unspecific. It shows up if the type of operands does notmatch (e.g., a register instead of an immediate) or the number of operands is different, orthe overall operand syntax is wrong. If the error is not obvious, we suggest that you findthe error by comparison with a corresponding instruction, but with plain assemblyoperands.

25.1.470 C5692: Illegal fixup

[ERROR]

Description

The HLI issues this message if a particular fixup is illegal the way it is used.

25.1.471 C5693: Cannot generate code for <Error>

[ERROR]

Description

The compiler can not generate code because of the specified reason.

Possible reasons are:

• code for intrinsic function cannot be generated because of wrong arguments or otherpreconditions

• the compiler does not support a certain construct. Note: this is a generic message.

25.1.472 C5700: Internal Error <ErrorNumber> in '<Module>',please report to <Producer>

[FATAL]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 973

Page 974: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler is in an internal error state. Please report this type of error as described inthe chapter Bug Report This message is used while the compiler is not investigating aspecific function.

Example

no example known.

Tips

Sometimes these compiler bugs occur in wrong C Code. So look in your code forincorrect statements. Simplify the code as long as the bug exists. With a simpler example,it is often clear what is going wrong and how to avoid this situation. Try to avoidcompiler optimization by using the volatile keyword. Please report errors for which youdo have a work around.

See also• Chapter Bug Report

25.1.473 C5701: Internal Error #<ErrorNumber> in '<Module>'while compiling file '<File>, procedure '<Function>',please report to <Producer>

[FATAL]

Description

The Compiler is in an internal error state. Please report this type of error as described inthe chapter Bug Report. This message is used while the compiler is investigating aspecific function.

Example

no example known.

Tips

Sometimes these compiler bugs occur in wrong C Code. So look in your code forincorrect statements. Simplify the code as long as the bug exists. With a simpler example,it is often clear what is going wrong and how to avoid this situation. Try to avoidcompiler optimization by using the volatile keyword. Please report errors for which youdo have a work around.

See also• Chapter Bug Report

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

974 Freescale Semiconductor, Inc.

Page 975: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.474 C5702: Local variable '<Variable>' declared in function'<Function>' but not referenced

[INFORMATION]

Description

The Compiler has detected a local variable which is not used.

Example

void main(void) {

int i;

}

Tips

Remove the variable if it is never used. If it is used in some situations with conditionalcompilation, use the same conditions in the declaration as in the usages.

25.1.475 C5703: Parameter '<Parameter>' declared in function'<Function>' but not referenced

[INFORMATION]

Description

The Compiler has detected a named parameter which is not used. In C parameters infunction definitions must have names. In C++ parameters may have a name. If it has noname, this warning is not issued. This warning may occur in cases where the interface ofa function is given, but not all parameters of all functions are really used.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 975

Page 976: CodeWarrior Development Studio for Microcontrollers V10.x RS08

void main(int i) {

}

Tips

If you are using C++, remove the name in the parameter list. If you are using C, use aname which makes clear that this parameter is intentionally not used as, for example"dummy".

25.1.476 C5800: User requested stop

[ERROR]

Description

This message is used when the user presses the stop button in the graphical user interface.Also when the compiler is closed during a compilation, this message is issued.

Tips

By moving this message to a warning or less, the stop functionality can be disabled.

25.1.477 C5900: Result is zero

[WARNING]

Description

The Compiler has detected operation which results in zero and is optimized. Thismessage may be generated during tree optimizations (Option -Ont to switch it off).

Example

i = j-j; // optimized to i = 0;

Tips

If it is a programming error, correct the statement.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

976 Freescale Semiconductor, Inc.

Page 977: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.478 C5901: Result is one

[WARNING]

Description

The Compiler has detected an operation which results in one. This operation is optimized.This message may be generated during tree optimizations (Option -Ont to switch it off).

Example

i = j/j; // optimized to i = 1;

Tips

If it is a programming error, correct the statement.

25.1.479 C5902: Shift count is zero

[WARNING]

Description

The Compiler has detected an operation which results in a shift count of zero. Theoperation is optimized. This message may be generated during tree optimizations (Option-Ont to switch it off).

Example

i = j<<(j-j); // optimized to i = j;

Tips

If it is a programming error, correct the statement.

25.1.480 C5903: Zero modulus

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 977

Page 978: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

The Compiler has detected a % operation with zero. Because the modulus operationimplies also a division (division by zero), the compiler issues a warning. This messagemay be generated during tree optimizations (Option -Ont to switch it off).

Example

i = j%0; // error

Tips

Correct the statement.

25.1.481 C5904: Division by one

[WARNING]

Description

The Compiler has detected a division by one which is optimized. This message may begenerated during tree optimizations (Option -Ont to switch it off).

Example

i = j/1; // optimized to i = j;

Tips

If it is a programming error, correct the statement.

25.1.482 C5905: Multiplication with one

[WARNING]

Description

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

978 Freescale Semiconductor, Inc.

Page 979: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler has detected a multiplication with one which is optimized. This messagemay be generated during tree optimizations (Option -Ont to switch it off).

Example

i = j*1; // optimized to i = j;

Tips

If it is a programming error, correct the statement.

25.1.483 C5906: Subtraction with zero

[WARNING]

Description

The Compiler has detected a subtraction with zero which is optimized. This message maybe generated during tree optimizations (Option -Ont to switch it off).

Example

i = j-(j-j); // optimized to i = j;

Tips

If it is a programming error, correct the statement.

25.1.484 C5907: Addition replaced with shift

[INFORMATION]

Description

The Compiler has detected a addition with same left and right expression which isoptimized and replaced with a shift operation. This message may be generated during treeoptimizations (Option -Ont to switch it off).

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 979

Page 980: CodeWarrior Development Studio for Microcontrollers V10.x RS08

i = j+j; // optimized to i = j<<1;

Tips

If it is a programming error, correct the statement.

25.1.485 C5908: Constant switch expression

[WARNING]

Description

The Compiler has detected a constant switch expression. The compiler optimizes andreduces such a switch expression. This message may be generated during treeoptimizations (Option -Ont to switch it off).

Example

switch(2){

case 1: break;

case 2: i = 0; break;

case 3: i = 7; break;

}; // optimized to i = 0;

Tips

If it is a programming error, correct the statement.

25.1.486 C5909: Assignment in condition

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

980 Freescale Semiconductor, Inc.

Page 981: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[WARNING]

Description

The Compiler has detected an assignment in a condition. Such an assignment may resultfrom a missing '=' which is normally a programming error. This message may begenerated during tree optimizations (Option -Ont to switch it off).

Example

if (i = 0) // should be 'i == 0';

Tips

If it is a programming error, correct the statement.

25.1.487 C5910: Label removed

[INFORMATION]

Description

The Compiler has detected a label which can be optimized . This message may begenerated during tree optimizations (Option -Ont to switch it off).

Example

switch(i) {

Label: i = 0; // Labeled removed

...

if (cond) {

L2: // L2 not referenced: Label removed

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 981

Page 982: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

} else {

}

Tips

Do not use normal labels in switch statements. If it is a switch case label, do not forget toadd the 'case' keyword.

25.1.488 C5911: Division by zero at runtime

[WARNING]

Description

The Compiler has detected zero division. This is not necessarily an error (see below).This message may be generated during tree optimizations (Option -Ont to switch it off).

Example

void RaiseDivByZero(void) {

int i = i/0; // Division by zero!

}

Tips

Maybe the zero value the divisor results from other compiler optimizations or because amacro evaluates to zero. It is a good idea to map this warning to an error (see Option -WmsgSe ).

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

982 Freescale Semiconductor, Inc.

Page 983: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.489 C5912: Code in 'if' and 'else' part are the same

[INFORMATION]

Description

The Compiler has detected that the code in the `if' and the code in the `else' part of an `if-else' construct is the same. Because regardless of the condition in the `if' part, theexecuted code is the same, so the compiler replaces the condition with `TRUE' if thecondition does not have any side effects. There is always a couple of this message, onefor the `if' part and one for the `else' part. This message may be generated during treeoptimizations (Option -Ont to switch it off).

Example

if (condition) { // replaced with 'if (1) {'

statements; // message C5912 here ...

} else {

statements; // ... and here

}

Tips

Check your code why both parts are the same. Maybe different macros are used in bothparts which evaluates to the same values.

25.1.490 C5913: Conditions of 'if' and 'else if' are the same

[INFORMATION]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 983

Page 984: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler has detected that the condition in an `if' and a following `else if' expressionare the same. If the first condition is true, the second one is never evaluated. If the firstone is FALSE, the second one is useless, so the compiler replaces the second conditionwith `FALSE' if the condition does not have any side effects. There is always a couple ofthis message, one for the `if' part and one for the `if else' part. This message may begenerated during tree optimizations (Option -Ont to switch it off).

Example

if (condition) { // message C5913 here

...;

} else if(condition) { // here, condition replaced with 0

...

}

Tips

Check your code why both conditions are the same. Maybe different macros are used inboth conditions which evaluates to the same values.

25.1.491 C5914: Conditions of 'if' and 'else if' are inverted

[INFORMATION]

Description

The Compiler has detected that the condition in an 'if' and a following 'else if' expressionare just inverted. If the first condition is true, the second one is never evaluated (FALSE).If the first one is FALSE, the second one is TRUE, so the compiler replaces the secondcondition with 'TRUE' if the condition does not have any side effects. There is always acouple of this message, one for the 'if' condition and one for the 'if else' condition. Thismessage may be generated during tree optimizations (Option -Ont to switch it off).

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

984 Freescale Semiconductor, Inc.

Page 985: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

if (condition) { // message C5914 here ...

...;

} else if(!condition) {// here, condition replaced with 1

...

}

Tips

Check your code why both conditions are inverted. Maybe different macros are used inboth parts which evaluates to the same values.

25.1.492 C5915: Nested 'if' with same conditions

[INFORMATION]

Description

The Compiler has detected that the condition in an `if' and a nested `if' expression havethe same condition. If the first condition is true, the second one is always true. If the firstone is FALSE, the second one is FALSE too, so the compiler replaces the secondcondition with `TRUE' if the condition does not have any side effects. There is always acouple of this message, one for the first `if' condition and one for nested `if' condition.This message may be generated during tree optimizations (Option -Ont to switch it off.

Example

if (condition) { // message C5915 here ...

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 985

Page 986: CodeWarrior Development Studio for Microcontrollers V10.x RS08

if(!condition) { // here, condition replaced with 1

...

}

Tips

Check your code why both conditions are the same. Maybe different macros are used inboth parts which evaluates to the same values.

25.1.493 C5916: Nested 'if' with inverse conditions

[INFORMATION]

Description

The Compiler has detected that the condition in an `if' and a nested `if' expression havethe inverse condition. If the first condition is true, the second one is always false. If thefirst one is FALSE, the second one is TRUE, so the compiler replaces the secondcondition with `FALSE' if the condition does not have any side effects. There is always acouple of this message, one for the first `if' condition and one for nested `if' condition.This message may be generated during tree optimizations (Option -Ont to switch it off).

Example

if (condition) { // message C5916 here ...

if(!condition) { // here, condition replaced with 0

...

}

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

986 Freescale Semiconductor, Inc.

Page 987: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Check your code why both conditions are the same. Maybe different macros are used inboth parts which evaluates to the same values.

25.1.494 C5917: Removed dead assignment

[WARNING]

Description

The Compiler has detected that there is an assignment to a (local) variable which is notused afterwards. This message may be generated during tree optimizations (Option -Ontto switch it off).

Example

int a;

...

a = 3 // message C5917 here ...

} // end of function

Tips

If you want to avoid this optimization, you can declare the variable as volatile.

25.1.495 C5918: Removed dead goto

[WARNING]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 987

Page 988: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The Compiler has detected that there is goto jumping to a just following label. Thismessage may be generated during tree optimizations (Option -Ont to switch it off).

Example

goto Label; // message C5918 here ...

Label:

...

Tips

If you want to avoid this optimization, you can declare the variable as volatile.

25.1.496 C5919: Conversion of floating to unsigned integral

[WARNING]

Description

In ANSI-C the result of a conversion operation of a (signed) floating type to a unsignedintegral type is undefined. One implementation may return 0, another the maximum valueof the unsigned integral type or even something else. Because such behavior may causeporting problems to other compilers, a warning message is issued for this.

Example

float f = -2.0;

unsigned long uL = f; // message C5919 here

Tips

To avoid the undefined behavior, first assign/cast the floating type to a signed integraltype and then to a unsigned integral type.

See also

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

988 Freescale Semiconductor, Inc.

Page 989: CodeWarrior Development Studio for Microcontrollers V10.x RS08

• ISO/IEC 9899:1990 (E), page 35, chapter 6.2.1.3 Floating and integral: "When avalue of floating type is converted to integral type, the fractional part is discarded.The value of the integral part cannot be represented by the integral type, the behavioris undefined."

25.1.497 C5920: Optimize library function <function>

[INFORMATION]

Description

The compiler has optimized the indicated library function. Depending on the actualfunction and its arguments, the compiler does replace the function with a simpler one ordoes even replace the function with the actual code as if the ANSI-C function would havebeen called. If you want to your a certain actual implementation of this function, disablethis optimization with the -oilib option. There is a certain -oilib suboption for everysupported ANSI-C function.

See also• Option -OiLib

25.1.498 C5921: Shift count out of range

[WARNING]

Description

The compiler has detected that there is a shift count exceeding the object size of theobject to be shifted. This is normally not a problem, but can be optimized by thecompiler. For right shifts (>&gt;), the compiler will replace the shift count with(sizeOfObjectInBits-1), that is a shift of a 16bit object (e.g. a short value) with a rightshift by twenty is replaced with a right shift by 15. This message may be generatedduring tree optimizations (Option -Ont to switch it off).

Example

unsigned char uch, res;

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 989

Page 990: CodeWarrior Development Studio for Microcontrollers V10.x RS08

res = uch >> 9; // uch only has 8 bits, warning here

// will be optimized to 'res = uch>>7'

See also• Option -Ont

25.1.499 C6000: Creating Asm Include File <file>

[INFORMATION]

Description

A new file was created containing assembler directives. This file can be included into anyassembler file to automatically get information from C header files.

Tips

Use this feature when you have both assembler and C code in your project.

See also• Option -La• Create Assembler Include Files• pragma CREATE_ASM_LISTING

25.1.500 C6001: Could not Open Asm Include File because of<reason>

[WARNING]

Description

The Assembler Include file could not be opened. As reason either occurs the file name,which was tried to open or another description of the problem.

Tips

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

990 Freescale Semiconductor, Inc.

Page 991: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Try to specify the name directly. Check the usage of the file name modifiers. Check if thefile exists and is locked by another application

See also• Option -La• Create Assembler Include Files• pragma CREATE_ASM_LISTING

25.1.501 C6002: Illegal pragma CREATE_ASM_LISTING becauseof <reason>

[ERROR]

Description

The pragma CREATE_ASM_LISTING was used in a ill formed way.

Tips

After the pragma, the may only be a ON or OFF. ON and OFF are case sensitive andmust not be surrounded by double quotes.

Example

#pragma CREATE_ASM_LISTING ON

See also• Option -La• Create Assembler Include Files• pragma CREATE_ASM_LISTING

25.1.502 C10000: Nothing more expected

[ERROR]

Description

At the end of an assembly instruction additional text was found.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 991

Page 992: CodeWarrior Development Studio for Microcontrollers V10.x RS08

MOVI R1, 1 1

Tips

Use a C style comment to start comments.

Check if it is an illegal or unknown expression.

25.1.503 C10010: Symbol reserved

[ERROR]

Description

Usage of a reserved symbol to define a label.

Example

R0: ...

R15: ...

Tip

Use an other identifier.

25.1.504 C10011: ':' expected to delimit label

[ERROR]

Description

The identifier must be followed by a colon to define a label.

Example

aLabel ...

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

992 Freescale Semiconductor, Inc.

Page 993: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Tips

Add a colon at the end of the identifier.

25.1.505 C10012: Label multiply defined

[ERROR]

Description

The label is already defined.

Example

aLabel ...

...

aLabel: ...

Tips

Choose an other identifier for the label.

25.1.506 C10013: Label '%s' is undefined

[ERROR]

Description

The referenced label is not defined.

Example

BR notDefined

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 993

Page 994: CodeWarrior Development Studio for Microcontrollers V10.x RS08

...

Tips

Define this label or reference to an other one.

25.1.507 C10020: Illegal constant value

[ERROR]

Description

An integer is expected.

Example

MOVI R1, 1 + 2.3

Tips

Use an integral expression.

25.1.508 C10021: ')' expected to close parenthesis

[ERROR]

Description

A close parenthesis is expected to have a valid expression.

Example

MOVI R1, (1 + 2 * 3

Tips

Set a close parenthesis at the end of the expression.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

994 Freescale Semiconductor, Inc.

Page 995: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.509 C10022: Constant expression expected

[ERROR]

Description

A constant expression is expected.

Example

MOVI R1, (1 + 2 * / 3)

Tips

Use a valid constant expression.

25.1.510 C10023: '(' expected to open parenthesis

[ERROR]

Description

An open parenthesis must be used to define the cast with a C type.

Example

DC.W * int 0x1000

Tips

Add an open parenthesis.

25.1.511 C10024: Size is not valid

[ERROR]

Description

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 995

Page 996: CodeWarrior Development Studio for Microcontrollers V10.x RS08

The specified size is not a valid one.

Example

DC.W * (void) 0x1000

Tips

Use a valid size.

25.1.512 C10025: Cast size is too large

[ERROR]

Description

The specified size is too large.

Example

DC.W * (double) 0x1000

Tips

Use a smaller size.

25.1.513 C10026: Undefined field

[ERROR]

Description

The specified field does not exist in the corresponding structure.

Example

struct {

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

996 Freescale Semiconductor, Inc.

Page 997: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int aField1, aField2;

} aStructure;

...

DC.W aStructure.aField3

Tips

Use a defined field.

25.1.514 C10027: Identifier expected

[ERROR]

Description

An identifier is expected to define a field of a structure.

Example

DC.W aStructure.1

Tips

Use a defined field.

25.1.515 C10028: Corrupted array

[ERROR]

Description

The value used to index the array is too large.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 997

Page 998: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Example

int anArray[3];

...

DC.W anArray[5]

Tips

Use a smaller value as index.

25.1.516 C10029: ']' expected to close brackets

[ERROR]

Description

A close bracket is expected to specify a valid access to an array.

Example

DC.W anArray[1 + 2

Tips

Set a close bracket at the end of the expression.

25.1.517 C10030: Offset out of Object

[WARNING]

Description

The value used to offset the object is too large.

Example

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

998 Freescale Semiconductor, Inc.

Page 999: CodeWarrior Development Studio for Microcontrollers V10.x RS08

int anArray[3];

...

DC.W anArray:15

Tips• Use a smaller value as offset.• This message can be set as Warning or message with the message move options and

pragmas.

25.1.518 C10031: C type is expected

[ERROR]

Description

A valid C type is expected.

Example

DC.W * (signed float) 0x1000

Tip

Use a valid C type.

25.1.519 C10032: Integer type is expected

[ERROR]

Description

A integral C type is expected.

Example

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 999

Page 1000: CodeWarrior Development Studio for Microcontrollers V10.x RS08

DC.W * (const short signed) 0x1000

Tip

Use a integral C type.

25.1.520 C10033: '*' expected to have generic pointer

[ERROR]

Description

A star symbol is expected to define a generic pointer.

Example

DC.W * (void) 0x1000

Tip

Add a star symbol.

25.1.521 C10034: C or user type expected

[ERROR]

Description

A C type or an user type is expected.

Example

DC.W * (aVariable) 0x1000

Tip

Use a valid type.

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

1000 Freescale Semiconductor, Inc.

Page 1001: CodeWarrior Development Studio for Microcontrollers V10.x RS08

25.1.522 C10035: C object is expected

[ERROR]

Description

A C object is expected.

Example

DC.W aLabel.aField

Tip

Use a valid object.

Chapter 25 RS08 Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

Freescale Semiconductor, Inc. 1001

Page 1002: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Compiler Messages

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual, Rev.10.6, 01/2014

1002 Freescale Semiconductor, Inc.

Page 1003: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Index

__alignof__ 378__asm 381__far 371–373, 375, 376__near 377__OPTION_ACTIVE__, 802__RETADDR 446__va_sizeof__ 379_asm("sequence") 589-!: 168... 800`<NewValue>'. 668`<OldValue>', 668`include 150`no 598',' 682':' 992'...' 682'(' 944, 995')' 934, 944, 994']' 998'*' 1000'%s' 993'+' 890'<actualSize>' 961'<description>' 669'<DstFile>' 964'<File>, 974'<file>' 666'<File>' 962–964'<FileName>' 962'<FileSpec>' 963'<FuncName>' 810, 811'<Function>' 904, 975'<Function>', 974'<limitSize>' 961'<MacroName>' 927'<Module>' 974'<Module>', 973'<Object>' 904–906'<Parameter>' 975'<segmentName>' 909'<SrcFile>' 964'<Variable>' 975'>' 929, 930'case' 806'const 201'default' 808'else 983, 984'else' 983'far' 681'FileName' 960'if' 983–986'inline' 705

'int' 680'MacroName' 948'near' 681'ptrdiff_t' 320'size_t', 320'T*' 201'this' 790'void' 823, 851'wchar_t' 320".inc" 216"err.log" 284"error 600"File" 148"filename" 943"Illegal 600('-', 890(@address) 367($) 367(<Feature>) 776(<MagicValue>) 962(<Version>) 963(=0) 731(0b) 366(-ANSI 757(Application 76(-C++f, 176(Compiler 159(destination 900(enter 226(-F2, 206(FAQs), 595(incomplete 835(internal 601(-La 407(-Mb, 231(mcutools.ini) 140(missing 810(on|off) 922(option 224, 764, 774(or 820(-Os, 237(RAM): 903(recursive 894(ROM): 903(shared 117, 118(un)signed 854(use 764(usually 140(Version 102(void 703(with 122(-WmsgFbi, 291(-WmsgFiv, 293[<files>]) 226

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1003

Page 1004: CodeWarrior Development Studio for Microcontrollers V10.x RS08

[Editor] 613, 619[Options] 609[XXX_Compiler] 610, 619@"SegmentName" 369@bool 587@far 587@interrupt 584, 590@tiny 587*.prm 585#<ErrorNumber> 974#include 148#pragma 332, 335, 336, 338–340, 342–345, 347,348, 350–355, 357, 358, 360, 362#warning 367++/-- 718<= 951, 957<Character> 892<cmd> 666<Cycles> 968<Descr> 962<description> 920–922<Detail> 969<directive> 947<Error> 973<ErrorNumber> 955, 973<expression> 841, 845<file> 666, 947, 948, 990<File>' 150<FileName> 668<function> 989<FunctionKind> 701, 702, 711, 714<HashCode> 903<HashCode>, 903<Id> 667<ident> 714, 757, 882<Ident> 752, 882, 970, 971<Instruction> 968<kind> 665<message> 946, 953<Mode>, 903<Msg> 961<MsgNumber> 803<name> 918, 925, 944<Name> 670, 820, 856, 858<No> 702<Number>, 903<Option> 667<OptionName>. 668<PC> 905<Producer> 973, 974<reason> 990, 991<Reason> 802<ReturnType> 701<Size> 903, 968<Size>, 903<Special 693–695<State> 882<string> 968

<Symbol> 891<Type> 702<undeclared 778<variable> 966<Variable> 806, 808<variablename> 669-AddIncl: 168-Ansi: 169-ArgFile: 170-BfaB: 171-BfaGapLimitBits: 173-BfaTSR: 175-C++ 176-C++c): 176-C++e, 176-Cc: 177-Ccx: 179-Ci: 181-Cn: 184-Cni: 186-Cppc: 188-Cq: 189-CswMaxLF: 190-CswMinLB: 192-CswMinLF: 194-CswMinSLB: 195-Cu: 197-Cx: 199-D: 199-Ec: 201-Eencrypt: 202-Ekey: 204-Env: 205-F2o): 206-Fd: 207-H: 208-I: 209-IEA: 210-La: 210-Lasm: 212-Lasmc: 213-Ldf: 214-Li: 216-Lic: 217-LicA: 218-LicBorrow: 219-LicWait: 220-Ll: 221-Lm: 223-Lm) 224-LmCfg: 224-Lo: 226-Lp: 227-LpCfg: 228-LpX: 230-Ms): 231-N: 232-NoBeep: 233

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1004 Freescale Semiconductor, Inc.

Page 1005: CodeWarrior Development Studio for Microcontrollers V10.x RS08

-NoClrVol: 234-NoDebugInfo: 234-NoPath: 236-O[nf|f]: 239-Oa: 236-ObjN: 239-Obsr: 240-Od: 243-Odb: 244-OdocF: 246-Oi: 248, 419-OiLib: 250-Ona: 250-OnB: 252-Onbsr: 253-OnCopyDown: 253-OnCstVar: 255-Onp: 256-OnPMNC: 257-Onr: 258-Ont: 259-Ontc: 265-Ostk 421-Ostk: 268-Ot): 237-Pe: 269-Pio: 271-Prod: 273-Qvtp: 274-Qvtprom 764-Qvtpuni) 764-Rp[t|e]: 275-SIP2: 275-T: 276-Tpmo) 774-Tvtd) 764-V: 282-View: 283-W1: 313-W2: 314-WErrFile: 284-Wmsg8x3: 286-WmsgCE: 287-WmsgCF: 288-WmsgCI: 288-WmsgCU: 289-WmsgCW: 290-WmsgFb 291-WmsgFbm): 291-WmsgFi 293-WmsgFim): 293-WmsgFob: 294-WmsgFoi: 296-WmsgFonf: 298-WmsgFonp: 299-WmsgNe: 301-WmsgNi: 302-WmsgNu: 303

-WmsgNw: 304-WmsgSd: 305-WmsgSe: 306-WmsgSi: 307-WmsgSw: 308-WOutFile: 309-Wpd: 310-WStdout: 312

2008 10232767 9514092 954500.0 388, 3898.3 2869.0 102

A

Abbreviations, 605abort() 481abort(), 456abs() 428, 429, 482Absolute 269, 370, 390, 399abstract 734, 736, 738, 739Abstract 741Accepted: 757access 598, 691, 861, 862Access 847accessed 858Accessing 447Accompanying 49acos() 483acosf() 483actual 935added 761adding 600Addition 979address 210, 275, 446, 745, 764, 780, 797, 813, 833,843Address 367, 421, 917aggregate 877Aggregates 382alias 250Alias 236align 922Alignment 436all 117, 118, 599, 607, 967alloc.c, 455Allocate 177allocated 597, 757Allocating 593Allocation 171, 318, 323, 369, 439, 586allowed 722, 749, 758, 783, 789, 790, 794, 860,915, 926already 692, 710, 756, 819, 907, 908Already 134

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1005

Page 1006: CodeWarrior Development Studio for Microcontrollers V10.x RS08

also 434always 910, 912Always 240ambiguous 856Ambiguous 758ambiguous! 860Analysis 59, 60, 236anonymous 747another 766ANSI 169ANSI-C 188, 320, 363, 385, 449, 606any 754appears 600appears. 600Append 226Appendices 577application 596Application 283Application. 596Applications 595applied 834, 838, 842applies 750are 168, 600, 749, 772, 964, 983, 984area? 600argument 685, 736, 864, 871Argument 934argument(s) 952arguments 822, 824, 855, 863, 870, 873, 874, 932,942Arithmetic 386, 820, 829, 834, 835array 784, 796, 997Array 719, 721arrays 783, 789Arrays 372, 588array-size 958asctime() 483asin() 484asinf() 484Asked 595Asm 990Assembler 210, 335, 403, 406, 407, 443, 968Assembly 422, 443, 580, 582–584assert.h 477assert() 485assertion 601Assertion: 933assigned 852assignment 955, 987Assignment 980Assignments 399associated 132Associativity 606atan() 485atan2() 486atan2f() 486atanf() 485atexit() 487atexit(); 456

atof() 488atoi() 489atol() 489Attribute 909attributes 907, 908automatically 599available 787, 789, 852Available 220avoid 598

B

Backend 433, 723BANKED 434Bar 112, 113, 603Bareboard 55base 686, 692, 782, 861Base 692, 761bases 730Batch 108, 159, 291, 294because 990, 991been 776Beep 233beginning 599Behavior 381being 677big 895Bigraph 181, 633binary 716Binary 366, 630, 717bit 682, 724, 914, 916Bit 680, 722bitfield 721, 724, 917Bitfield 171, 173, 175, 323, 325, 727bitfields 723Bitfields 326, 391, 425, 436, 586BitSet/BitClr 914block 688Block 460Blocks 584body 697Boolean 425Borrow 219bounds 719Box 117, 124–126, 128–130, 133, 232brackets 998Brackets 603branch 98Branch 244, 252, 397, 441Break 840breakpoint 600breakpoint? 599bsearch() 490buffer 897, 898build 963Build 76, 78Byte 171

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1006 Freescale Semiconductor, Inc.

Page 1007: CodeWarrior Development Studio for Microcontrollers V10.x RS08

bytes 961, 968

C

C++ 102, 176, 188, 375, 376, 627, 745, 776, 795C1: 665C1000: 670C10000: 991C1001: 670C10010: 992C10011: 992C10012: 993C10013: 993C1002: 671C10020: 994C10021: 994C10022: 995C10023: 995C10024: 995C10025: 996C10026: 996C10027: 997C10028: 997C10029: 998C1003: 671C10030: 998C10031: 999C10032: 999C10033: 1000C10034: 1000C10035: 1001C1004: 672C1005: 672C1006: 673C1007: 673C1008: 673C1009: 674C1010: 675C1012: 675C1013: 676C1014: 677C1015: 677C1016: 678C1017: 678C1018: 679C1019: 679C1020: 680C1021: 680C1022: 681C1023: 681C1024: 682C1025: 682C1026: 683C1027: 683C1028: 684C1029: 684C1030: 685

C1031: 685C1032: 685C1033: 686C1034: 687C1035: 687C1036: 688C1037: 688C1038: 689C1039: 690C1040: 690C1041: 691C1042: 692C1043: 692C1044: 692C1045: 693C1046: 693C1047: 694C1048: 695C1049: 696C1050: 697C1051: 697C1052: 698C1053: 699C1054: 699C1055: 700C1056: 700C1057: 701C1058: 701C1059: 702C1060: 702C1061: 702C1062: 703C1063: 704C1064: 704C1065: 705C1066: 705C1067: 705C1068: 706C1069: 706C1070: 707C1071: 707C1072: 708C1073: 708C1074: 709C1075: 710C1076: 710C1077: 711C1078: 711C1080: 712C1081: 713C1082: 714C1084: 714C1085: 714C1086: 715C1087: 715C1088: 716C1089: 716C1090: 716

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1007

Page 1008: CodeWarrior Development Studio for Microcontrollers V10.x RS08

C1091: 717C1092: 717C1093: 717C1094: 718C1095: 718C1096: 718C1097: 719C1098: 719C1099: 720C1100: 720C1101: 721C1102: 721C1103: 722C1104: 722C1105: 723C1106: 724C1107: 724C1108: 725C1109: 725C1110: 726C1111: 727C1112: 727C1113: 728C1114: 728C1115: 729C1116: 729C1117: 730C1118: 730C1119: 731C1120: 732C1121: 733C1122: 734C1123: 736C1124: 738C1125: 739C1126: 741C1127: 742C1128: 743C1129: 743C1130: 745C1131: 745C1132: 747C1133: 747C1134: 749C1135: 750C1136: 752C1137: 752C1138: 753C1139: 754C1140: 756C1141: 757C1142: 757C1143: 758C1144: 758C1390: 758C1391: 761C1392: 764C1393: 764

C1395: 766C1396: 770C1397: 772C1398: 774C1400: 775C1401: 776C1402: 776C1403: 777C1404: 777C1405: 778C1406: 778C1407: 779C1408: 779C1409: 779C1410: 780C1411: 780C1412: 780C1413: 781C1414: 782C1415: 782C1416: 783C1417: 783C1418: 784C1419: 784C1420: 785C1421: 786C1422: 787C1423: 788C1424: 789C1425: 789C1426: 789C1427: 790C1428: 790C1429: 791C1430: 791C1431: 792C1432: 793C1433: 794C1434: 795C1435: 795C1436: 796C1437: 797C1438: 800C1439: 802C1440: 803C1441: 804C1442: 805C1443: 805C1444: 806C1445: 808C1800: 810C1801: 811C1802: 812C1803: 813C1804: 813C1805: 813C1806: 814C1807: 815

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1008 Freescale Semiconductor, Inc.

Page 1009: CodeWarrior Development Studio for Microcontrollers V10.x RS08

C1808: 816C1809: 817C1810: 818C1811: 818C1812: 819C1813: 819C1814: 820C1815: 820C1816: 821C1817: 822C1819: 822C1820: 823C1821: 824C1822: 825C1823: 826C1824: 827C1825: 827C1826: 828C1827: 829C1828: 829C1829: 830C1830: 831C1831: 832C1832: 832C1833: 833C1834: 834C1835: 834C1836: 835C1837: 835C1838: 835C1839: 836C1840: 836C1842: 836C1843: 837C1844: 838C1845: 838C1846: 839C1847: 840C1848: 841C1849: 841C1850: 841C1851: 842C1852: 842C1853: 842C1854: 843C1855: 844C1856: 845C1857: 847C1858: 848C1859: 848C1860: 850C1861: 851C2: 665C2000: 852C2001: 852C2004: 853C2005: 853C2006: 854

C2007: 854C2008: 855C2009: 856C2010: 856C2011: 858C2012: 860C2013: 861C2014: 862C2015: 863C2016: 864C2017: 864C2018: 865C2019: 865C2020: 867C2021: 867C2022: 868C2023: 870C2024: 870C2025: 871C2200: 872C2201: 872C2202: 873C2203: 874C2204: 876C2205: 877C2206: 877C2207: 878C2209: 879C2210: 880C2211: 880C2212: 881C2401: 882C2402: 882C2450: 883C2550: 884C2700: 884C2701: 885C2702: 886C2703: 886C2704: 887C2705: 887C2706: 888C2707: 889C2708: 890C2709: 890C2800: 890C2801: 891C2802: 892C2803: 892C2900: 893C2901: 893C3000: 894C3100: 895C3200: 895C3201: 896C3202: 896C3300: 897C3301: 897

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1009

Page 1010: CodeWarrior Development Studio for Microcontrollers V10.x RS08

C3302: 898C3303: 899C3304: 899C3400: 900C3401: 901C3500: 901C3501: 902C3600: 902C3601: 903C3602: 903C3603: 904C3604: 904C3605: 905C3606: 906C3700: 906C3701: 907C3800: 907C3801: 908C3802: 908C3803: 909C3804: 909C3900: 910C4000: 910C4001: 912C4002: 913C4003: 913C4004: 914C4006: 914C4007: 915C4100: 916C4101: 917C4200: 918C4201: 918C4202: 919C4203: 920C4204: 920C4205: 921C4206: 921C4207: 921C4208: 922C4209: 922C4300: 922C4301: 923C4302: 924C4303: 925C4400: 926C4401: 926C4402: 927C4403: 928C4404: 928C4405: 929C4406: 929C4407: 930C4408: 930C4409: 931C4410: 931C4411: 932C4412: 932

C4413: 933C4414: 934C4415: 934C4416: 935C4417: 935C4418: 936C4419: 937C4420: 938C4421: 938C4422: 938C4423: 939C4424: 939C4425: 940C4426: 941C4427: 941C4428: 942C4429: 942C4430: 943C4431: 943C4432: 944C4433: 944C4434: 944C4435: 945C4436: 945C4437: 946C4438: 946C4439: 947C4440: 947C4441: 948C4442: 948C4443: 948C4444: 951C4445: 951C4446: 952C4447: 953C4448: 953C4449: 954C4700: 954C4701: 955C4800: 955C4801: 955C4802: 956C4900: 956C50: 666C5000: 957C5001: 957C5002: 958C5003: 958C5004: 958C5005: 959C5006: 959C51: 666C5100: 960C52: 666C5200: 960C5250: 961C53: 667C5300: 961

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1010 Freescale Semiconductor, Inc.

Page 1011: CodeWarrior Development Studio for Microcontrollers V10.x RS08

C5302: 962C5320: 962C5350: 962C5351: 963C5352: 963C5353: 964C5354: 964C5355: 964C5356: 965C54: 667C56: 668C5650: 965C5651: 966C5661: 967C5662: 968C5663: 968C5664: 968C5680: 969C5681: 969C5682: 969C5683: 970C5684: 970C5685: 970C5686: 970C5687: 971C5688: 972C5689: 972C5690: 972C5691: 972C5692: 973C5693: 973C5700: 973C5701: 974C5702: 975C5703: 975C5800: 976C5900: 976C5901: 977C5902: 977C5903: 977C5904: 978C5905: 978C5906: 979C5907: 979C5908: 980C5909: 980C5910: 981C5911: 982C5912: 983C5913: 983C5914: 984C5915: 985C5916: 986C5917: 987C5918: 987C5919: 988C5920: 989C5921: 989

C6000: 990C6001: 990C6002: 991C64: 668C65: 669C66: 670Calculation 582call 253, 265, 725, 789, 792, 794, 822, 823, 844,856, 923, 924, 968Call 922call, 780called 599, 733, 868Caller/Callee 445calloc() 491calloc(), 455Call-operator 838Calls 240can 597–600, 703, 730, 732, 783, 858, 868, 871,877Carriage-Return 896Case 232, 233Case-label-value 819cast 955Cast 996Casting 782cast-operation 814cause 741, 750causing 803cC++/EC++ 745ceil() 492ceilf() 492Changing 132char 382, 587, 854, 913, 914character 805, 886, 892, 930, 938characters 790Characters 456Check 257, 360checking 250Checking 319class 672, 673, 684, 686, 687, 692, 693, 697, 699,700, 704–706, 729, 730, 734, 736, 738, 739, 741,752, 761, 782, 815, 861, 862, 864, 867Class 132, 633, 743, 750, 752, 761class/struct 698, 714, 725, 791, 854, 865class/struct/union 699, 786classes 749Classes 375, 766classic 770classname 690, 793ClassName 690clearerr() 493clicking 597Clipped 168clock() 493close 994, 998closed 926, 928closing 930, 938Closing 929, 937, 944

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1011

Page 1012: CodeWarrior Development Studio for Microcontrollers V10.x RS08

CLR 234code: 902code? 599Code. 595Color 287–290COM) 122combination 671, 779Combined 78, 399Comma 935command 170, 666Command 119, 133Command-Line 76Commands 592Comment 926, 970comments 926Comments 188, 416, 589Common 239, 452communication 601communication. 601Compact 419compactC++ 184CompactC++ 88comparison 916Compatibility 179, 378, 580compatible 772compilation 899Compile 134compiled 813Compiled 134compiler 585, 598–600, 693–695Compiler 51, 53, 62, 78–83, 87–89, 91–93, 95, 96,98–100, 107, 109, 113, 115, 135, 143, 159, 161,163, 282, 317, 319, 331, 407, 419, 585, 595, 665compiler? 600Compilers 627compiling 974Compiling 67, 133, 134complex 914Complex 424COMPOPTIONS: 143composition 679Con/Destructor/Assign-Operator 698Concatenated 897concatenation 899, 931Concatenation 353condition 893, 957, 980Condition 910, 912conditional 945Conditional 584conditions 985, 986Conditions 983, 984configuration 598, 600, 745Configuration 82, 124, 125, 140, 224, 228, 246,609, 617Configure 81, 213configured 600Configuring 62const 189, 670, 854, 872

Const 177, 832, 903CONST 255, 747CONST_SEG: 332Const/volatile 783constant 446, 597, 804, 853, 878, 881, 972, 994Constant 255, 332, 421, 441, 447, 683, 742, 788,804, 838, 893, 972, 980, 995constants 367, 871Constants 366, 382, 582Constant-Variable 397constructor 852Constructor 640, 692, 704, 725, 794, 822Constructor/destructor: 712Constructors 705contain 871containing 698Containing 403contains 743context 681Continuation 142, 668Continue 839contradicts 708control 967Control 129Conventions 605conversion 646, 739, 813, 815Conversion 201, 466, 644, 647, 702, 988conversion: 850Conversions 386, 458converted 822, 913, 914Converted 916Copy 253, 725Copyright 144COPYRIGHT: 144correct 752correct, 596corresponding 921Corrupted 997cos() 493cosf() 493cosh() 494coshf() 494Cosmic 179, 579, 580, 585, 757, 758could 600, 948Could 924, 990Couldn't 962count 913, 977, 989create 693, 854Create 239, 284, 309, 335CREATE_ASM_LISTING 991CREATE_ASM_LISTING: 335Creating 54, 55, 990Creation 149ctime() 495Ctor 787, 873, 874ctype 458ctype.h 478current 745

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1012 Freescale Semiconductor, Inc.

Page 1013: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Current 138, 145CurrentCommandLine 620custom 599Cut 286cycles 968

D

data 600, 686, 700, 726, 727, 749, 850, 887Data 318, 332, 336, 420, 428, 431, 434, 903DATA_SEG: 336DDE 120dead 987Dead-Code 397Debug 234debugger 598, 599Debugger, 600decl 705declaration 670, 671, 676, 678–680, 687, 692, 710,727, 729, 758, 780, 791, 918, 942Declaration 310declarations 700, 726declared 687, 692, 756, 820, 975default 787, 870Default 143, 145, 871default.env 600DefaultDir 609DEFAULTDIR: 145Default-label 818define 747Define 446defined 677, 692, 695, 818, 904, 971, 993Defined 944Defines 214, 317–320, 323, 327, 329Defining 403, 404, 590, 591, 593definition 350, 675, 709, 805Definition 199, 332, 336, 338, 339, 358, 733delete 784, 796Delete 703delimit 992Delta 764derive 766Description 165Designing 54destination 963, 964destructor 791, 792Destructor 640, 705, 706, 789, 823Detail 165Details 143, 163, 331detected 896detected" 600did 955different 756, 827, 908differs 956difftime() 496digit 890dimensions 872

direct 234directive 367, 951, 953, 970directive: 947Directives 364Directory 138, 145, 153, 218, 451Disable 92, 184, 243, 244, 250, 252, 253, 255–259,265, 303, 305, 351disabled 745Display 595div() 496Division 322, 382, 819, 978, 982Documentation 49does 596, 670, 723, 764, 774, 943Does 595done 600, 601, 923DOS 168, 269double 597Double 207double) 957DREF 915DWARF2.0 907Dynamic 246

E

earlier 708EBNF 601, 604Edition 102Editor 117–120, 135Editor_Exe 613, 618Editor_Name 613, 617Editor_Opts 614, 618editor? 600EditorCommandLine 623EditorDDEClientName 623EditorDDEServiceName 624EditorDDETopicName 624EditorType 622elements 796ELF 902ELF/DWARF 105ELF-Output 901Elimination 397empty 922Empty 678Encrypt 202encrypted 962encryption 963–965Encryption 204, 964end 970End 604Endif-directive 946, 948entire 596Entries 609, 617entry 144Entry 134, 343, 345, 437enum 675, 677, 722

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1013

Page 1014: CodeWarrior Development Studio for Microcontrollers V10.x RS08

enums 412Environment 53, 125, 137, 139, 143, 146, 154, 205,669ENVIRONMENT: 146Equality 632Equates 580errno.h 469Error, 595error)? 601Error-directive 946ERRORFILE: 147Errors 232, 649escape 936Escape 269, 607etc. 611Evaluation 386every 218, 598exact 860Example 409, 424, 444, 614, 619, 625Examples 166, 387Examples: 120Exceeded 954executes 968exist 670existing 927exit 210Exit 347, 437exit() 497exit(), 456exp() 497expand 943expansion 669, 923, 924, 932expected 673, 677, 682, 690, 777, 782, 784, 795,797, 813, 817, 820, 828, 829, 831, 834–836, 838,841, 845, 882, 903, 934, 935, 941–945, 951, 953,970, 972, 991, 992, 994, 995, 997–1001Expected: 883expected) 890expects 944expf() 497explicit 733, 739, 789, 868Explicit 647, 789, 794explorer. 597exponent 890Express 102expression 685, 804, 871, 945, 980, 995Expression 914Expressions 424, 447Extensions 365, 604extern 688, 696, 707, 708External 102, 700

F

fabs() 498fabsf() 498Factor 190, 194

failed 933fails: 957FALSE 912FAQs 579far 253far/near/rom/uni/paged 706Fatal 288fclose() 499feature 745, 776, 795Feature 218, 219features 88, 184Features 363, 445, 455, 642, 644, 648, 652Feedback 134feof() 499ferror() 500fflush() 500fgetc() 501fgetpos() 502fgets() 503field 680, 682, 722, 916, 996fields 724file: 963, 964file. 596–598File. 595filename 147Filename 930Filenames 168files 82Files 60, 66, 67, 157, 158, 202, 216, 223, 224, 271,407, 451–453, 632File-stack-overflow 894find 598Find 595first 704, 725fit 764, 774fixup 969, 972, 973fixup-type 901flag 895Flag 895Flexible 276float 886float.h 469floating 988Floating 220, 435floating-point 885, 890Floating-Point 388Floating-Type 388floor() 503floorf() 503fmod() 504fmodf() 504Folding 441followed 929, 939, 940fopen() 505for 585Force 342formal 823, 939formal, 935

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1014 Freescale Semiconductor, Inc.

Page 1015: CodeWarrior Development Studio for Microcontrollers V10.x RS08

format 82Format 105, 206, 223, 224, 286, 291, 293, 294, 296,298, 299, 323, 389, 959Formats 105, 388, 605found 666, 921, 947, 960found, 893found: 892, 946, 953found! 856fprintf() 506fputc() 507fputs() 507Frame 268, 348fread() 508free() 509free(), 455freopen() 509Frequently 595frexp() 510frexpf() 510friend 689Friend 687, 697, 700Frontend 363fscanf() 510fseek() 511fsetpos() 512ftell() 513function 350, 362, 599, 675, 697, 699, 709, 711,722, 728, 729, 731, 743, 756, 758, 775, 778, 780,805, 813, 844, 865, 867, 880, 922–924, 965, 975,989Function 100, 338, 343, 421, 435, 591, 593, 902,956Function, 590function(s) 741function> 693–695function>=""> 693function-call 785function-definition 779Function-definition 780FunctionKind 701function-redefinition 779functions 684, 688, 699, 719, 730, 732, 790Functions 246, 250, 370, 376, 414, 419, 439, 459,460, 464–466, 481, 590, 640fwrite() 513

G

Gap 173General 96, 408, 594generate 924, 973Generate 210, 212, 234, 240, 253, 595, 695, 725,865, 867generated 693, 694Generated 360Generating 406, 407, 419, 452Generation 89, 199, 257

generic 1000Generic 968GENPATH: 148get 601, 832getc() 514getchar() 515getenv() 515gets() 515Getting 579given 774, 903global 745, 757, 871, 873Global 117, 140, 367, 373, 609, 704, 715–717, 903global, 703gmtime() 516going 892goto 987Goto 778Graphical 107Groups 59, 163Guidelines 417, 421

H

handle 596handled 918Handlers 179Handling 459happens 601has 756, 776, 902hashcode 903have 698, 699, 702, 704, 705, 711, 715–718, 725,727, 754, 823, 870, 872, 1000head 775Header 632heap.c 455help 597, 601Help 116, 208here 789, 794Hexadecimal 367High-Level 443Highlights 77Hints 441, 579, 594HIWARE 959HLI 403, 406, 422, 443, 969HLL 443Host 89How 597–601

I

I/O 456, 466ICD 600IDE 54, 343ident 800Ident 686, 757, 813, 896identifier 670Identifier 997

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1015

Page 1016: CodeWarrior Development Studio for Microcontrollers V10.x RS08

identifierList 778identifier-list 780Identifiers 580identlist 779ids, 899IEEE 388IEEE32 207, 389if' 983, 984Ignore 750ignored 785, 895, 970ignored. 667illegal 681, 685, 691, 700, 719–721, 726, 727, 752,848, 853, 917, 929, 959Illegal 670–673, 675, 679, 682, 688, 706, 710, 718,728, 730, 745, 753, 778, 779, 781, 802, 805, 813,814, 829, 842, 851, 852, 876, 877, 879, 880,885–887, 890, 892, 909, 925, 930, 936, 938, 945,954, 958, 959, 970, 972, 973, 991, 994Immediate-Addressing 406Implementation 363Implementation-Defined 381implemented 776, 795implicit 646, 826, 848Implicit 310, 758, 810, 811, 899, 955Include 157, 168, 209, 210, 271, 335, 354, 407, 943,990include?) 894included 82Included 216, 223, 224Include-directive 929INCLUDETIME: 149incompatible 780, 830, 836Incompatible 679, 680, 841, 842incomplete 707, 864Incomplete 699, 877incorrect 908Incorrect 595, 779incremented 832index 718Index 582indirection 727Indirection 827, 834, 848Info 236inheriting 741initialization 688, 747, 853, 855, 877, 879, 880Initialization 140, 382, 648, 806, 808, 880initialize 900initialized 600, 683, 684, 877, 966initializer 783, 788, 789Initializer 878, 881initializers 873, 874, 955Initializers 872Initializing 592, 906inline 924Inline 338, 350, 419, 443, 580, 582–584, 726, 923,968INLINE: 338Inlining 248

Input 66, 83, 133, 157, 666Installations 78instantiate 734, 736, 738, 739Instruction 352, 440, 968, 970, 972integer 718, 837Integer 817, 999Integer-expression 828Integer-operand 835Integers 385integer-value 838integral 722, 804, 988Integral 186, 385, 677INTEGRAL 747Integration 78, 102, 103Interactive 108, 159, 293, 296Interface 107internal 899Internal 973, 974interrupt 210, 362, 380, 591, 592, 728Interrupt 179, 275, 439, 590, 591, 593, 727, 728,754INTO_ROM: 339invalid 962Invalid 674, 685, 697, 757, 919–922inverse 986inverted 984isalnum(), 517isalpha(), 517iscntrl(), 517isdigit(), 517isgraph(), 517islower(), 517isprint(), 517ispunct(), 517isspace(), 517Issues 627, 633, 636isupper(), 517isxdigit() 517it! 902it. 595iteration-statement 839, 840

K

Key 204keyword 378–380, 591, 702Keyword 371, 372, 376, 377, 381, 592, 636Keywords 363, 366, 433kind 687, 772Kind 772Known 627, 633, 649

L

label 806, 808, 970, 992Label 818, 971, 981, 993label>=""> 778

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1016 Freescale Semiconductor, Inc.

Page 1017: CodeWarrior Development Studio for Microcontrollers V10.x RS08

label-redeclaration 781Labels 192, 195, 406labs() 428, 429, 518Language 87, 88, 365large 886, 889, 906, 910, 956, 960, 996Large 275later) 102Launching 107Lazy 440ldexp() 519ldexpf() 519ldiv() 519legal 705, 931Length 168level 98, 932, 954Lexical 605LIBPATH 154library 989Library 100, 250, 449, 451–453, 459, 469LIBRARYPATH: 150license 965License 217–220Limit 173Limitation: 892, 961Limitations 383limits.h 470Line-Feed 896LINK_INFO, 921LINK_INFO: 340linkage 687, 700, 722Linkage 708linker 596Linker 340, 585, 592linking? 598list 82, 670, 692, 743, 788, 823, 867, 939, 940List 216, 223, 224, 226, 343, 607Listing 81, 159, 212, 213, 309, 335Load 190, 194loaded 598, 599local 675, 706, 749, 843Local 118, 140, 427, 617, 694, 966, 975Locale 465locale.* 458locale.h 471localeconv() 520Locales 458Locals 268localtime() 521location 446locations, 965log 666Log 214log() 521log10() 522log10f() 522logf() 521logfile 962long 724, 896, 897, 930, 938, 939, 957

Long 724long) 957longjmp() 523loop 893Loop 197, 342, 351LOOP_UNROLL: 342losing 601loss 850, 887lvalue 831, 832

M

macro 669, 927, 932, 934, 942, 943, 952Macro 199, 404, 405, 928, 941, 942, 944, 948Macro-buffer 928Macros 139, 317, 322, 323, 327, 403, 406, 410, 444,469Main 109, 237main() 599make 82, 596, 597Make 223, 224, 596makes 670, 671, 692, 742, 758Making 595malloc() 523malloc(), 455Management 276, 455, 462manager 597Managing 54many 816, 855, 872–874, 884, 899, 907, 955, 965mapping 667Mark 362mark: 343match 860math.h 473Mathematical 460Maximum 190, 301, 302, 304, 932, 942may 881, 966mblen() 524mblen(), 456mbstowcs() 524mbstowcs(), 456mbtowc() 525mbtowc(), 456member 686, 688, 693–695, 699, 709, 710, 713,714, 719, 730, 743, 747, 772, 774, 788, 790, 800,812, 855, 861, 862Member 257, 636, 684, 797, 848member: 770member="" 693members 698, 700, 743, 749Members 696memchr() 526memcmp() 526memcpy() 430, 527memcpy2() 430memmove() 527memory 598, 777

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1017

Page 1018: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Memory 231, 433, 434, 455, 460, 462, 593memory' 598memset() 528Menu 113, 115, 116, 134MESSAGE, 920MESSAGE: 344message? 601Message/Error 134messages 92, 665Messages 91, 92, 287–290, 301–304, 313, 314, 665methods 764Microsoft 102, 286Mid 98Mid-level 243, 244Migration 579Minimum 192, 194, 195mismatc 972mismatch 673, 780, 825Mismatch 935missing 705, 712, 719, 743, 929, 930, 937, 938,944, 946, 948Missing 589, 775, 870, 952missing" 891Mixing 105, 443mktime() 529mode 903Mode 108, 159, 179, 291, 293, 294, 296, 406, 580Model 231, 433, 434Models 433modf() 529modff() 529Modifiable 831modifier 745Modifier 367modifier. 757, 758Modifiers 123, 166, 179, 719modulus 977Modulus 322, 382more 971, 991Multi-byte 456Multiple 670, 671, 691, 692, 758Multiplication 978multiply 993must 683, 687, 697, 701, 702, 704, 705, 711,714–718, 729, 788, 823, 854, 872, 878, 939–941,951Must 812myself 689

N

name 599, 673, 752, 775, 907, 939, 941, 942Name 155, 226, 239, 945nameless 693Nameless 699Names 286, 373needed 733

needs 729, 796neither 722nested 752, 816, 884Nested 985, 986new 668, 783New 55, 134newline 953next 350Next 338, 339NO_ENTRY 439NO_ENTRY: 345NO_EXIT 439NO_EXIT: 347NO_FRAME: 348NO_INLINE: 350NO_LOOP_UNROLL: 351NO_RETURN: 352NO_STRING_CONSTR: 353non 382, 782Non 813non-aggregate 880Non-ANSI 433non-base 815non-constant 822Non-constant 784, 853non-function 838non-int 723non-member 719non-pointer 834Non-standard 724non-static 714Non-Terminal 603Non-volatile 853nor 722, 754not 159, 234, 350, 595, 596, 666, 667, 670, 678,680, 693, 694, 700, 702, 704, 705, 711, 714,722–724, 749, 752, 754, 764, 772, 774, 776, 783,789, 794, 795, 800, 820, 832, 858, 867, 877, 881,901, 904, 913, 918, 924, 926, 928, 931, 943, 947,948, 955, 960, 966, 975, 990, 995Not 234, 269, 313, 314, 713, 714, 720, 780, 791,901, 967NOT 915Notation 601Nothing 991Notification 232NULL 257NULL-check 867number 702, 728, 796, 822, 824, 863, 885–887,914, 932, 935, 951Number 192, 195, 301, 302, 304, 605, 886, 888,889, 939numberfor 951numbers 884

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1018 Freescale Semiconductor, Inc.

Page 1019: CodeWarrior Development Studio for Microcontrollers V10.x RS08

O

object 144, 596, 698, 710, 734, 832, 833, 872, 877,900, 905, 906, 962, 972, 1001Object 149, 151, 155, 158, 206, 226, 239, 357, 705,707, 959, 998Object-File 105, 323objects 597, 750, 871Objects 177, 390, 441objects: 903object-size: 835OBJPATH: 151occur 955occurred 665, 668, 901Occurrence 283Octal 888off) 757offset 774Offset 998Old 668, 676once 971Once 271, 354ONCE: 354one 715, 717, 718, 758, 766, 977, 978only 703, 705, 725, 743, 750, 790, 868, 871, 956Only 271, 730, 732, 758, 860opcode 906open 666, 962, 964, 995Open 990opened 597, 948operand 834, 842, 972Operand 386operands 841, 848operator 387, 702, 715–718, 783, 784, 842, 848,890operators 631, 704, 870Operators 583, 606, 629, 630, 632optimization 253, 265Optimization 96, 98–100, 237, 258, 397, 594optimizations 98Optimizations 243, 244, 396, 397, 440, 441Optimize 100, 250, 989optimizer 99Optimizer 252, 256, 259, 396option 668Option 128, 163–165, 246, 319, 667, 668OPTION, 919OPTION: 355option? 601Option) 407options 170, 599Options 76, 143, 161, 236, 355, 419, 622options" 600Order 386Other 652, 918out 677, 847, 892, 989, 998Out 777output 948

Output 80–82, 158, 221, 227, 228, 312, 907overflow 895, 897, 898, 928overflow, 665Overload 642overloaded 722Overloaded 870overriden 668overriding 741overview 599Overview 49own 725

P

PACE 959Panels 78parameter 702–704, 715–718, 720, 725, 754, 775,823, 867, 870, 939Parameter 310, 428, 437, 678, 702, 743, 822, 941,975parameter-declaration 810, 811, 826, 848Parameter-declaration 780parameterlist 779parameters 702, 711, 716, 717, 935Parameters 405parentheses 747Parentheses 603, 931parenthesis 994, 995Parenthesis 712parents 928Parser 892part 983Partial 848Pass 340Passing 428, 437path 670Path 148, 150–152, 209, 236paths 967Paths 142, 269Peephole 256, 396Pending 275permitted 678perror() 530Placing 593Plain 326please 973, 974Point 435pointer 743, 770, 772, 782, 784, 800, 835, 841, 867,1000Pointer 257, 365, 435, 685, 764, 774, 836, 848, 850,915pointer-expression 820Pointers 274, 372, 400, 435pointer-subtraction 829pop 921pop, 921Porting 579

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1019

Page 1020: CodeWarrior Development Studio for Microcontrollers V10.x RS08

pos 933Position 299possible 700, 850Possible 887Post- 424Postfix 718pow() 531powf() 531pragma 802, 813, 908, 918–922, 925, 954, 955, 991Pragma 331, 581, 591, 882, 903Pragmas 331, 438preceded 940precedence 387Precedence 606Predefined 214, 317, 909Pre-Operators 424Preprocess 269preprocessing 353preprocessor 953, 954Preprocessor 93, 227, 228, 230, 364, 948Preprocessor-number 898present 819previous 679, 680, 780, 803, 918Print 313, 314printf.c 456printf() 425, 466, 532Prints 282private 743probably 742Problems 601procedure 974Processing 159produced? 599produces 968Product 318Production 604program 599Program 456Programming 421, 441Programs 595Programs) 76project.ini) 140projects) 117Promotion 186Promotions 385Propagate 189prototype 756Prototype 589prototype) 810Pseudo 761Pseudo-Opcodes 446pure 732, 741Pure 731, 868push 921push, 922Put 339putc() 532putchar() 533

puts() 533

Q

qsort() 534qualified 764qualifier 731Qualifier 274, 587qualifiers 189, 671Qualifiers 365, 400, 431Questions 595

R

raise() 535rand() 535range 677, 764, 774, 847, 989Ranking 646reached 932, 942read 170REALLOC_OBJ, 920REALLOC_OBJ: 357realloc() 536realloc(); 455Reallocation 357RecentCommandLineX 619RecentProject0, 611RecentProject1, 611Recommendation 163Recommendations 392re-compiles 597Recursive 589, 844, 926redeclaration 674, 675, 678, 730Redefined 707, 708Redefinition 672, 927Reduction 175, 325, 396reference 685, 721, 822, 853, 854, 879Reference 449, 683, 685, 720, 721, 872reference. 852referenced 904, 975References 376REG_PROTOTYPE 813register 210, 275, 757Register 258, 436Registers 445reinitialization 876Reload 258Relocatable 420remove 902remove() 537removed 922, 981Removed 987removing 893rename() 537replaced 979Replacement 255report 973, 974

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1020 Freescale Semiconductor, Inc.

Page 1021: CodeWarrior Development Studio for Microcontrollers V10.x RS08

Reports 595Representation 388, 389requested 976required 692, 837requires 747reserved 992Reserved 445reset 599reset? 599resolution 710, 733, 868Resources 50restrict 758Result 785, 841, 913, 976, 977Resulting 901Retrieving 132return 275, 446, 701, 702, 704, 705, 738, 754, 956,967Return 352, 701, 777, 795, 841, 845, 910returned 841Returning 843Returns 426Reuse 268rewind() 538Rewriting 398RGB 287–290Right 381ROM 177, 339, 600ROM? 597routine 754RS08 78–83, 87–89, 91–93, 95, 96, 98–100, 322,323, 327, 433, 443, 627, 665RS08-Specific 329Rules 387runtime 968, 982Runtime 905

S

same 598, 728, 766, 964, 983, 985SaveAppearance 610Saved 445saved? 600SaveEditor 610SaveOnExit 610SaveOptions 611Scalar 434scanf() 425, 466, 539scope 688, 706, 710, 733, 868scopes 884Scopes 164Search 195, 670Searching 463Second 722Section 593, 609, 610, 613, 619Sections 581See 434seems 596

Seems 595segment 752, 753, 909, 918Segment 332, 336, 358, 593, 907–909Segmentation 392, 439Segments 431Selecting 66Selection 440sense 670, 671, 692, 742, 758Separated 78sequence 936sequences 646Sequences 269, 607, 644Server 220set 599Set 205, 291, 293setbuf() 539setjmp.h 473setjmp() 540setlocale() 540Setting 305–308, 344settings 600, 959Settings 78, 117, 126, 128, 130, 319settings: 961setvbuf() 541shall 804shift 979Shift 397, 913, 977, 989Shifts 381Short 208, 431should 600, 601, 686, 731, 754, 766Show 232ShowTipOfDay 612Sign 326, 382, 587signal.c 456signal.h 473signal() 542Signals 456signed 916Signed 385, 391simulator 598, 599sin() 543sinf() 543sinh() 544sinhf() 544size 903, 960, 961, 996Size 588, 903, 995sizeof 835, 842sizeof(char) 957sizeof(double) 957sizeof(float) 957sizeof(int) 957sizeof(long 957sizeof(long) 957sizeof(short) 957Sizes 95, 387, 587skipped 806, 808skipping 665SMALL 433

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1021

Page 1022: CodeWarrior Development Studio for Microcontrollers V10.x RS08

small) 900smart 598Smart 129Some 595Sorting 463source 598, 964Source 67, 157, 452, 895, 947space 758, 764Space 179special 861, 862Special 166, 366, 445, 455, 593, 906Specific 421, 593specification 708Specification 146, 147, 239specifier 673, 700, 726–728Specifier 750specifiers 691, 705specify 789Specify 170, 210, 273, 275, 446Specifying 133split 899, 965sprintf() 545sqrt() 548sqrtf() 548srand() 549sscanf() 549stack 895Stack 268Standalone 62standard 813Standard 126, 283, 312, 320, 385, 469, 481, 644Standard-Type 387started 599Started 119, 120, 579started? 598starting 600startup 599Startup 76, 273, 452Statements 398static 707, 708, 713, 719, 812, 871Static 688, 715–717, 749, 904STATIC 747, 770static-member 704statistic 666Statistics 221Status 112StatusbarEnabled 620stdarg.h 477stddef.h 474stdio.h 474stdlib.c 456, 458stdlib.h 475stop 599, 976Stop 230storage 672, 673, 705, 706Storage 750strcat() 553strchr() 553

strcmp() 554strcoll() 555strcpy() 555strcspn() 556Strength 396strerror() 556strftime() 557Strict 169string 897, 901, 930, 938, 943String 353, 358, 458, 459, 897, 938STRING_SEG: 358string.h 477String-initializer 956strings 899Strings 269Strip 236strlen() 558strncat() 559strncmp() 559strncpy() 560strpbrk() 561strrchr() 561strspn() 562strstr() 562strtod() 563strtod(), 458strtok() 564strtol() 565strtol(), 458strtoul() 566strtoul(), 458struct 836Struct 426struct- 821struct/union, 877structs 189struct-union-size 958Structure 451, 459Structured 436strxfrm() 567Studio 103style 676Sub-Functions 239substitution 939, 940Subtraction 979Such 747support 723, 965Support 176, 181, 633, 636supported 694, 724, 790, 901switch 598, 840, 980Switch 190, 192, 194, 195, 199, 398, 580switch-expression 817Switch-expression: 837switch-statement 818switch-statements 816symbol 929, 931, 940Symbol 992Symbols 602, 603

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1022 Freescale Semiconductor, Inc.

Page 1023: CodeWarrior Development Studio for Microcontrollers V10.x RS08

sync! 892Syntax 443, 604System 275, 464system() 568

T

T*' 201table 764Table 274, 439, 592Tables 190, 192, 194, 195Tabs 583tag 710, 729tail 265take 833taken 948tan() 568tanf() 568tanh() 569tanhf() 569target 856Target 237template 864, 865Template 627, 729, 863, 867template/non-template 730temporary 854Temporary 153Terminal 602terminated 901Termination 456TEST_CODE: 360, 903TEST_ERROR 954TEST_ERROR: 955Text 152TEXTPATH: 152this 585, 667, 761, 778, 833, 924This 745, 756, 776, 795, 803time 598Time 149, 465time.h 476time() 570Tiny 431TipFilePos 611Tips 101, 579TipTimeStamp 612Title 110TMP: 153tmpfile() 570tmpnam() 571Token 969tokens 953tolower() 571too 872, 886, 889, 895–897, 900, 906, 910, 914,930, 938, 939, 956, 960, 996Too 816, 855, 873, 874, 884, 899, 907, 955, 965Toolbar 103, 111, 133ToolbarEnabled 621

tools 117Tools 76, 78, 102tools) 118toupper() 572Translation 383TRAP_PROC 438, 591TRAP_PROC: 362Tree 99, 259, 398Tricks 101Trigraph 181, 633Troubleshooting 595TRUE 910try 965twice 728, 818two 716, 717type 677, 679, 680, 699, 701, 702, 704, 705, 707,720, 722, 724, 725, 736, 738, 739, 742, 743, 747,753, 774, 783, 832, 835, 836, 842, 851, 852, 864,872, 877, 880, 956, 958, 959, 961, 969, 999, 1000Type 95, 275, 276, 325, 327, 587, 647, 673, 677,782, 825type) 835typedef 373Typedef 673, 710, 805Typedef-name 690typename) 820types 827, 829, 836, 842Types 126, 320, 412, 425, 428, 431, 434, 435, 469,830Types, 436Type-Size 175

U

unary 715Unary 631, 716, 842unary/binary 717Unary/binary 718Unbalanced 931undefined 993Undefined 684, 786, 948, 970, 996Undefining 826Unexpected 953, 969ungetc() 572union 836union-member 821Unions 698Unique 406unit 899Unknown 588, 665, 687, 752, 821, 835, 947, 958,969unnecessarily 597Unrolling 197, 342, 351, 893unsigned 842, 913, 914, 988Unsigned 385, 428Usage 436Usage: 922

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

Freescale Semiconductor, Inc. 1023

Page 1024: CodeWarrior Development Studio for Microcontrollers V10.x RS08

use 234, 706, 745, 770, 778, 813, 851Use 135, 864used 667, 681, 710, 728, 805, 813, 863, 867, 905,907–909, 913used? 599USELIBPATH: 154user 92, 1000User 107, 155, 289, 303, 692, 976USERNAME: 155utility 597Utility 596

V

va_arg(), 573va_end(), 573va_start() 573valid 690, 793, 965, 995value 668, 677, 718, 754, 764, 817, 910, 967, 994Value 275Values 253, 399variable 688, 745, 843, 966, 975Variable 143, 154, 205, 255, 339, 367, 369, 836,882variables 234Variables 370, 373, 390, 415, 427, 447, 587Various 319vector 599Vector 439, 592Vendor 317Version 282version: 963version. 667Vertical 603vfprintf(), 574View 59, 60, 115virtual 688, 692, 730–732, 741, 758, 764, 868Virtual 274Visual 102, 103void 720, 742void-result-function 841volatile 189, 234, 671, 853Volatile 390, 441vprintf(), 574vsprintf() 574

W

Wait 220Warning 290, 304, 308, 314warning? 598Warning-directive 953Warnings 585was 892, 896, 904, 918wcstombs() 576wcstombs(); 456wctomb() 575

wctomb(), 456What 598, 600, 601when 600Where 600while 600, 974Why 600wide 790, 805width 682will 170Window 109, 110, 135, 159WindowFont 622WindowPos 621WinEdit 595Wizard 55Words 445work. 596Write 221, 312written 600wrong 702, 822, 863Wrong 701, 706, 709, 792, 824, 832, 864, 962, 963wrong? 598, 600

Y

yet 724, 776, 795, 860your 745

Z

zero 819, 901, 976, 977, 979, 982Zero 253, 977

Index

CodeWarrior Development Studio for Microcontrollers V10.x RS08 Build Tools Reference Manual

1024 Freescale Semiconductor, Inc.

Page 1025: CodeWarrior Development Studio for Microcontrollers V10.x RS08

How to Reach Us:

Home Page:freescale.com

Web Support:freescale.com/support

Information in this document is provided solely to enable system andsoftware implementers to use Freescale products. There are no expressor implied copyright licenses granted hereunder to design or fabricateany integrated circuits based on the information in this document.Freescale reserves the right to make changes without further notice toany products herein.

Freescale makes no warranty, representation, or guarantee regardingthe suitability of its products for any particular purpose, nor doesFreescale assume any liability arising out of the application or use ofany product or circuit, and specifically disclaims any and all liability,including without limitation consequential or incidental damages.“Typical” parameters that may be provided in Freescale data sheetsand/or specifications can and do vary in different applications, andactual performance may vary over time. All operating parameters,including “typicals,” must be validated for each customer application bycustomer's technical experts. Freescale does not convey any licenseunder its patent rights nor the rights of others. Freescale sells productspursuant to standard terms and conditions of sale, which can be foundat the following address: freescale.com/SalesTermsandConditions.

Freescale, and the Freescale logo are trademarks of FreescaleSemiconductor, Inc., Reg. U.S. Pat. & Tm. Off. All other product orservice names are the property of their respective owners.

© 2010–2014 Freescale Semiconductor, Inc.

Document Number CWMCURS08CMPREFRevision 10.6, 01/2014