C&M Development Team Calm16Driver Title Document Number Abstract Calm16Driver TN_CNM_Calm16Driver_20040107 The document gives details regarding the CalmSHINE16 compiler driver, its invocation and command line options. C&M Development Team / System LSI Division Confidential Property of C&M Development Team C&M Development Team Copyright © 2003 Samsung Electronics Co, Ltd. All Rights Reserved. Though every care has been taken to ensure the accuracy of this document, Samsung Electronics Co, Ltd. cannot accept responsibility for any errors or omissions or for any loss occasioned to any person, whether legal or natural, from acting, or refraining from action, as a result of the information contained herein. Information in this document is subject to change at any time without obligation to notify any person of such changes. Samsung Electronics Co, Ltd. may have patents or patent pending applications, trademarks copyrights or other intellectual property rights covering subject matter in this document. The furnishing of this document does not give the recipient or reader any license to these patents, trademarks copyrights or other intellectual property rights. No part of this document may be communicated, distributed, reproduced or transmitted in any form or by any means, electronic or mechanical or otherwise, for any purpose, without the prior written permission of Samsung Electronics Co, Ltd. The document is subject to revision without further notice. All brand names and product names mentioned in this document are trademarks or registered trademarks of their respective owners. Contact Address Samsung Electronics Co., Ltd. San#24 Nongseo-Ri, Giheung-Eup, Yongin-City, Gyeonggi-Do, Korea 449-711 Tel: (82)-(31)-209-3199 Fax: (82)-(31)-209- 6494 Home Page: Contact us: http://www.samsungsemi.com soohwan.lee@samsung.com jp.subhash@samsung.com MCU Tool Work Group C&M Business enabling P/J C&M Development Team System LSI Division, Device Solution Network C&M Development Team Confidential Property of Samsung Electronics Co., Ltd. II C&M Development Team Revision History Date 7thJan, 2004 31thMar, 2004 C&M Development Team Version 1.0 1.1 Author Jaydeep Patil Jaydeep Patil Amendment Created Added section 8 and changed individual tool’s option. Confidential Property of Samsung Electronics Co., Ltd. III C&M Development Team Contents 1 2 3 4 5 6 7 8 Overview ..................................................................................................1 Notation...................................................................................................1 User interface ............................................................................................1 Configuration file format...............................................................................2 Environment variables ..................................................................................3 Examples ..................................................................................................3 Specific tool options ....................................................................................4 Invoking individual tools................................................................................7 C&M Development Team Confidential Property of Samsung Electronics Co., Ltd. IV C&M Development Team 1 Overview Most of the compiler comes with the compiler driver. The driver takes any file either C, assembly or object file as an input and generates the executable file. This behavior prevents user from writing messy batch files, which invokes each tools separately. The driver can be effectively used in test and performance evaluation tools also with any combinations of input files. The Calm16driver takes any combination and any number of input files. C, S, Z, O, and I are supported input files (See section 8 for more details). The driver invokes required CalmSHINE16 tools to generate the corresponding hex file. 2 Notation Tool Calm16Driver CalmSHINE16 compiler driver 3 User interface The driver provides the following command line options. Calm16Driver [Options] [[Filename]…] The options are: -pre [Pre-Processor options] To specify pre-processor options –pre should be used. Valid pre-processor options should be included in square brackets. -cc [Compiler options] To specify compiler options –cc should be used. Valid compiler options should be included in square brackets. -opt [Optimizer options] To specify optimizer options –opt should be used. Valid optimizer options should be included in square brackets. -asm [Assembler options] To specify assembler options –asm should be used. Valid assembler options should be included in square brackets. -lnk [Linker options] To specify linker options –lnk should be used. Valid linker options should be included in square brackets. -f filename Where the file “filename” holds command line options. All command line options can be kept in a file, and this file can be given as an input to the driver. The driver also accepts all command line options found after –f filename. Options for a specific tool are gathered from input file and command line. White space, tab or a new line character should separate the options in the file. (Format of this command file is same as driver.ini. Please refer driver.ini file.) C&M Development team Confidential Property of C&M Development Team. 1 C&M Development Team -h Prints help. If driver is invoked without any command line argument then also the help is printed. -v Verbose mode. The driver prints version and progress report on the console. -q Quite mode. -p Pre-process only. Driver stops after invoking pre-processor. -t Do not assemble. Driver stops after invoking optimizer. -a Do not link. Driver stops after invoking assembler. -d Do not optimize. Driver stops after invoking compiler. -k Keep intermediate files. This prevents the driver from deleting generated intermediate files. -c This option informs driver to use default configuration file. The configuration file contains default arguments for the CalmSHINE16 tools. The configuration file can be kept at some known place, from where the driver can read this file. It should be kept in folder C:\Program Files\CalmSHINE16\driver.ini. If –c option is used then –pre, -cc, -asm, -opt, -lnk are ignored form the command line. (For more information on configuration file read Configuration file format section. Please refer driver.ini file) -o hexfile name This option can be used along with –c option only. It specifies the name of output hex file. When the driver is informed to use configuration file (i.e. –c option is used) then the name of the output file is taken from this option. In all other cases this option is ignored. Filename Name of the input file, it can be C, I, S, Z or O file. -b <object directory> Calm16Driver keep object files in the <object directory>. None of these command line options are compulsory. If driver is invoked without any command line arguments then the help message is printed. All options are case sensitive. The command line options can be given in any order. White space or a tab should separate each option on the command line. 4 Configuration file format The –c option enables driver to read all default command line arguments for CalmSHINE16 tools form C:\Program Files\CalmSHINE16\driver.ini file. The default argument list will not contain name of output hex file. It should be explicitly mentioned by the user by using –o option at command line. The configuration file provides easy way to invoke the driver. The configuration file is nothing but list of commands. The commands should be separated by space, tab or new C&M Development team Confidential Property of C&M Development Team. 2 C&M Development Team line character. The difference between –c and –f options is, each time user can give different file with –f option. (See Examples for invocation with –c option) User can add comments to the configuration and command file. The comment should start with ‘#’ sign and from the first column of the line. # Compiler options -cc [ -w –target=calmlittle] # Optimizer options – FULL -opt [ -g –XF] 5 Environment variables To invoke the driver without any command line options for tools and providing only file names as command line options, two environment variables need to be set. The driver reads include header path from CALM16HEADER environment variable. Also it reads library path from CALM16LIB environment variable. In this case driver takes calmlittle as default target and –X0 as the optimization level to generate the output hex file. [See the last example] 6 Examples Calm16Driver -pre[-IC:\include] –cc[-target=calmlittle –pseudo] –opt[-X2] –lnk[-z c:\virtual.mem –o stone] abc.c xyz.i tuv.z def.s ijk.o –k Here stone.hex is generated from abc.o, xyz.o, tuv.o, def.o and ijk.o. The –k option keeps the intermediate files generated during the process. Calm16Driver –lnk[-o plum] lang.c lib.c Cstartup_S3CC410.o The plum.hex is generated from lang.o, Cstartup_S3CC410.o and lib.o Calm16Driver –c –o stone lang.c c61.c c62.c c63.c Cstartup_S3CC410.o In this case driver uses default options present in a configuration file. It generates stone.hex from Cstartup_S3CC410.o, lang.o, c61.o, c62.o and c63.o Calm16Driver –f cmd.txt Here driver takes all options form cmd.txt. Calm16Driver main.c sum.c Cstartup_S3CC410.o Here driver reads CALM16HEADR and CALM16LIB environment variables, also it assumes target as calmlittle and generates the output hex file. C&M Development team Confidential Property of C&M Development Team. 3 C&M Development Team 7 Specific tool options Pre-processor Usage Filename Options -I<path> -D<name> -f file -E -G -H file -J -K -T tgt -P -q Cprep16 [Options…] Filename Valid C file Set include path Defile a symbol Read all arguments from "file". -f should be the first argument. The preprocessor outputs one make rule containing the object file name for that source file, a colon, and the names of all the included files. Like -E but do not mention header files that are found in system header directories or header files that are included directly or indirectly from such a header. Specifies a file to write the dependencies to -J says to treat missing header files as generated files and assume they live in the same directory as the source file Same as -E -H file, the CPP determines file based on whether an output file is given. If it is, the CPP uses its argument but with a suffix of .d, otherwise it takes the base-name of the input file and applies a .d suffix Changes the default target (input file name) to given <tgt> string This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing Quiet mode Compiler Usage Filename Options -target=tname -code -SC -ar -ms -Nb -pseudo -sm(-iseep) -pi -SWI C&M Development team Calmcc16 [Options…] Filename Valid I file Specify the target name. (calmlittle is supported) Const is regarded as code. Generates stack overflow check function calls in each function. Array access optimization, to reduce code size when one dimension array is accessed. It has following limitations. - The index values of one-dimension arrays always have positive value. - The each size of all arrays in program is less than 64K byte. Small RAM option, to reduce code size when a scalar global variable is accessed. It has following limitations. - The total size of data memory that is used in program linearly must be less than 64K byte. [Note: If you use this option, the external variable which is defined with #prama eep_seg() directive must be declared with #prama eep_seg() directive.] Do not generate jump tables for switch statement Generate optimized output. Required if optimization level 1 or above is selected for optimizer. If high 6-bit address of both data memory and EEP/FLASH Memory is always same value, then you can check this option. Pointer index always positive This option is related with prolog and epilog of function for push, pop registers. This option use SWI(2,3) interrupt for push and pop registers Confidential Property of C&M Development Team. 4 C&M Development Team -Nologo -g1 -g -nAn -udata -flash -flashSEGNAME -igcode -iggeneric -udata -GLBoff -memSTART,SIZE -A1 -w Optimizer Usage Filename Options -B -g1 -g -gl -q -s -X[N] instead of library call. (Should not be given with –g option). Do not display build message Generates debug information without “call stack view” Generates debug information with “call stack view” Support Non ANSI-C standard Don’t initialize un-initialized global in EEP section (default: initialize with zero value) Every CODE areas are located in EEP section Every CODE areas are located in EEP section with SEGNAME Ignore code keyword in code generation not in data section If you define a variable with code keyword, then the variable is located in CDATA section but LDC isn’t generated when you access the variable. Ignore generic keyword in code generation Doesn't initialize uninitialized global in EEP section (default: initialize with zero value) Turn off Global optimization with base register CONTROLAREA START address and SIZE setting (start and size are decimal value). Compiler generates code in case of access control area using A8 register. Warning level 1 (default is level 2) Warnings off Calmopt16 [Options...] Filename Valid Z file BSRD optimization Generates debug information without “call stack view” Generates debug information with “call stack view” For optimizer –g/-g1 option must same as compiler. Generate local variable information [Only in V1.54 and above] Suppresses the copyright message and version number (Since Calmopt16 V1.54a) Required if compiler is invoked with -SWI Choose optimizing level, where N is one of the following, 0, turn off optimize 1, turn off optimize except register allocation 2, use all optimize methods except procedural abstraction 3, use all optimize and fast procedural abstraction F, use all optimize and full procedural abstraction. For –X1, -X2, -X3 and –XF, compiler needs to be invoked with –pseudo. For –X3 and –XF none of the –g, -g1, -gl options are required. Assembler Usage Filename Options -2 -C -D var{=value} -e number -E filename -f filename C&M Development team Calmasm16 [Options…] Filename Valid S file Install coprocessor MAC24 instruction set Turn off case sensitivity for user defined symbols Define a variable symbol var with a value. (Default value is zero) Set maximum number of errors (Default value is 9999) Output error message written into specified file Specify a different name for the list file. Default is output Confidential Property of C&M Development Team. 5 C&M Development Team -F -g -h -l -L -m num -N -q -S -p -W -o filename -V Linker Usage Filename Options -b -X -bif -B file -c -C value -A value -d sym -e addr -f file -g -h -I -L segname -l libname -m -M -n -N -o file -p -q -V -Q -R file -S -S28 / -5 -3/-str <addr> -4/-end <addr> -x num -v -z file -Z -E hex_value -F hex_value -G hex_value C&M Development team filename. Do not show unassembled lines in list file Write assembly debug information file Display command line option usage Do not generate .l list file Assembly the source file to a library file Set macro expanding level Do not generate messages except error/warning message Bypass all assembling processing information Write symbol information in list file Set include file searching directory Turn off warning message Specify a name for object file Show the version Calmlink16 [Options…] [Filename…] Valid O file Generate binary file (.b for code, .bdt for data) Generate binary file (.b for ROM, .bdt for EEP) [Only in V1.54 and above] Generate browse information file (.bif) [Only in V1.54 and above] Read library names from file Symbol name case insensitive Fill binary file (ROM) blank with hex value(0~FF) Fill binary file (EEP) blank with hex value(0~FF) Set program entry address using global symbol Set program entry address using hexadecimal Read input object file names from file Output debugging information file Display command line help information Generate Intel Hex Format hex file Map Compiler Library into the segment 'segment_name' Link with a library Generate map file (.map) Generate merged list file (.lst) Link relocatable sections with source file order Do not generate messages except error/warning message Specify output file name All initialized data locate to EEP area Quiet mode, runtime info stored in file 'Link___.out' Show version Generate symbol information file (.smap) Link with specified symbol information file Using small program memory model (<64k, Mid only) Generate Motorola hex file (S28 records) Start of EEPROM dump in .eep file End of EEPROM dump in .eep file Length of hex file record line (even decimal number) Generate hex/hxd file filled with blank (default 0x00) Set memory description file Generate merged hex file suitable for memory writing Set program memory base address Set program memory size Set data memory base address Confidential Property of C&M Development Team. 6 C&M Development Team -H hex_value -I hex_value -J hex_value -K hex_value -T hex_value -U hex_value -W hex_value Set data memory size Set cdata base in program memory Set cdata base in data memory Set cdata size in data memory Set C stack limit Set C stack base Set C stack size 8 Invoking individual tools The CalmSHINE16 language includes pre-processor (Cprep16), compiler (Calmcc16), optimizer (Calmopt16), assembler (Calmasm16) and linker (Calmlink16). Each of these tools can be invoked separately or through Calm16Driver. Various intermediate files generated by each tools are, Cprep16 Calmcc16 Calmopt16 Calmasm16 Calmlink16 : Input C source, output I file : Input I file, output Z file : Input Z file, output S file : Input S file, output O file : Input O file, output Hex file Example: Cprep16 -IC:\CalmSHINE16\Include\Header main.c main.i The above command will generate main.i in the same directory Calmcc16 -target=calmlittle -g main.i main.z Compiler generates main.z from main.i. Calmopt16 -g -X0 main.z main.s Optimizer generates main.s from main.z Calmasm16 -g -o main main.s Assemble the S file to main.o Calmlink16 -g -m -B lib.txt -zC:\CalmSHINE16\S3CC9AB.mem main.o cstartup_S3CC9AB.o Linker will generate main.dbg main.hex and main.hxd C&M Development team Confidential Property of C&M Development Team. 7