Share via


Cesysgen Conditional Statements [Optimization] (Compact 2013)

3/26/2014

You can use Cesysgen Conditional Statements to control whether the final ROM image contains particular files, based on whether a variable is set. (You can also use them to conditionally set registry keys and values, but that is beyond the scope of this guide.) This topic provides a brief overview of the Cesysgen conditional statements and how the build processes them.

Note

Cesysgen conditional statements generally apply to board support packages (BSPs) that can build in a variety of configurations. Although you will rarely use Cesysgen conditional statements as a primary mechanism for optimization unless you write BSPs, it is helpful to understand it.

Cesysgen Conditional Statement Syntax

Conditional statements use the following syntax, where [condition] specifies the variable to test, and [statements] consists of a list of one or more files (one per line) to include in nk.bin:

@CESYSGEN IF [condition] [statements] @CESYSGEN ENDIF

The following excerpt from the OS services .bib file (ossvcs.bib) shows how to use a conditional statement to control whether the file bthutil.dll is included in nk.bin:

; @CESYSGEN IF OSSVCS_MODULES_BTHUTIL
  bthutil.dll    $(_FLATRELEASEDIR)\bthutil.dll                   NK  SH
; @CESYSGEN ENDIF OSSVCS_MODULES_BTHUTIL

 

Format in Ce.bib File

Files and modules that are included in the OS are listed between the opening @CESYSGEN IF statement and the closing @CESYSGEN ENDIF statement for the corresponding feature. If the @CESYSGEN IF and @CESYSGEN ENDIF statements appear without a line between them, the code and data for that feature are not included in the OS because the feature is not enabled for this build.

In the following example, the modules that correspond to Cryptdll and Winsock are included in nk.bin, but the modules for Bluetooth utilities and Bluetooth settings are not. The code excerpt shows the result of conditional statements after the build merges all .bib files into ce.bib. Note that the postprocessing of the ce.bib file stripped out the statement that specified bthutil.dll, which appears in the original ossvcs.bib file.

; @CESYSGEN IF CE_MODULES_CRYPT32
  crypt32.dll     C:\WINCE800\OSDesigns\RelDir\ VirtualPC_x86_Release\crypt32.dll    NK  SHQ
; @CESYSGEN ENDIF

; @CESYSGEN IF CE_MODULES_WINSOCK
  winsock.dll     C:\WINCE800\OSDesigns\RelDir\VirtualPC_x86_Release\winsock.dll     NK  SHQ
; @CESYSGEN ENDIF

; @CESYSGEN IF OSSVCS_MODULES_BTHUTIL
; @CESYSGEN ENDIF OSSVCS_MODULES_BTHUTIL

; @CESYSGEN IF OSSVCS_MODULES_BTHSETTINGS
; @CESYSGEN ENDIF OSSVCS_MODULES_BTHSETTINGS

See Also

Concepts

Understand ROM Size and Structure