Trim.exe

Name

Trim.exe or Trim.py - Convert the preprocessed source files by C compiler to the expected style file to be processed further by EDKII tool.

Synopsis

trim [-s|-r|-a|-8] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>
trim -h
trim --version

Description

Trim tool process the preprocessed file by a Compiler to remove the unused content and generate the file to be processed further by EDKII tools.

Trim tool can also be used generate the expected source file to work with EDKII build system and EDKII core code. It extends the EDKII build system to support more source file types.

Options

-s, --source-code The input file is preprocessed source code, including
C or assembly code
-r, --vfr-file The input file is preprocessed VFR file
-a, --asl-file The input file is ASL file
-8, --Edk-source-code
The input file is source code for Edk to be trimmed
for ECP
-c, --convert-hex Convert standard hex format (0xabcd) to MASM format
(abcdh)
-l, --trim-long Remove postfix of long number
-i INCLUDEPATHFILE, --include-path-file=INCLUDEPATHFILE
The input file is include path list to search for ASL
include file
-o OUTPUTFILE, --output=OUTPUTFILE
File to store the trimmed content
-v, --verbose Run verbosely
-d LOGLEVEL, --debug=LOGLEVEL
Run with debug information
-q, --quiet Run quietly
-? show this help message and exit
--version show program's version number and exit
-h, --help show this help message and exit

Status codes returned

Return Code

Description

0

The action was completed as requested.

1

The action failed.

Example

  1. Trim the preprocessed source file (test.i) by C compiler to remove all generated codes from the include header files by this source file (test.s) to the output file test.iii, which only contains the content in this source file (test.s).

    Trim --source-code -o test.iii test.i
  2. Trim the preprocessed source file (test.i) by a C compiler to remove all generated codes from the include header files by this source file (test.asm) and convert standard hex format (0xabcd) to MASM format (abcdh) to the output file test.iii, which only contains the content in this source file (test.s).

    Trim --source-code --convert-hex -o test.iii test.i
  3. Trim the preprocessed source file (test.i) by a C compiler to remove all generated codes from the include header files by this source file (test.vfr) except for the typedef structures to the output file (test.iii).

    Trim --vfr-file -o test.iii test.i
  4. Trim the ASL source file (test.asl) to convert the ASL style Include(.asi) to the C style #include .asi. The updated ASL will output to test.i.

Trim --asl-file -o test.i test.asl
  1. Modify an EDK style framework source file to work with EDKII thunk and core drivers.

    Trim --r8-source-code -o test.c test.c
  2. Modify all EDK style framework source files (.c and .h) in current directory to work with EDKII thunk and core drivers by the script ImportTool.bat.

    ImportTool *.c
    ImportTool *.h

Bugs

No known issues.

Report bugs to [email protected]

Files

None

See also

None

License

Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at

http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.