• PICCl8 compiler command line actuation and application

    The abstract integrated development environment uses when micro core company MPLAB under the IDE the PICCl8C language carries on the development, meets the compilation procedure code not to surpass the chip word length, but translation not successful question. Presents the article to introduce that HI-TECH Corporation C compiler’s principle and the PICCl8 command line driver’s work process, and take solves the procedure code limit and the storehouse document production, the use as an example, explained that it realizes the method specifically, the solution uses PICCl8 to carry on the application the actual project question.
    Key word PICCl8 compiler command line actuation

    Introduction
        The PICl8F serial products was the American micro core science and technology company’s high-grade product, the user uses the C language to carry on the programming design, HI-TECH SoftwarePty.Ltd. Corporation’s PICCl8 compiler obtained the widespread application. The majority of application use MPLAB integration environment carries on the programming (to see reference [1]), has some questions in some important or in the large-scale application’s development. For example, how to compile the C language the storehouse document, how to have the procedure which the code limits to carry on the translation and so on, if only uses the traditional way programming, then cannot achieve the proper effect. This article elaborated HI-TECH C compiler’s PICCl8 command line actuation, is precisely needs to solve these problems.

    1 HI-TECH C compiler
        HI-TECH the C compiler has provided the C language standard characteristic, meanwhile adds on many to adapt the extended function which the PIC series monolithic integrated circuit’s specific hardware characteristic designs, and integrates with the assembler is providing the sharing link together and the storehouse management tool, thus applies is more widespread.
        When translates a procedure, has many operations already to be possible by command line driver CLD (command-line driver), may also (wizard in be HI-TIDE) completes independently by the HPD integration environment driver. In any situation, HPD either CLD (under the HPD menu option, or the CLD command line) uses the option which the programmer assigns to decide that which internal application does need to carry out, as well as any option needs to transmit for each application.
        The user provides suiting in target system’s C language source program, the assembly language procedure, may use CLD or HPD carries on the operation. When with CLD, any orders the selecting operation way with the command line; When uses HPD, enters the document which in the source listed files dialog box needs.
        Usually the use source program may translate to a storehouse document, such document may process conveniently by the compiler, visits fast. The compiler may look like other source document equally direct receive storehouse document, and assigns the document with the .lib extension the type, thus the storehouse document must according to this way naming. The storehouse document when uses CLD, any orders the selecting operation way with the command line; When or uses HPD, in “source listed files…”In the dialog box enters the storehouse document which needs.
        In fact, when uses MPLAB the IDE integration environment carries on the development, has used CLD, is only has not noted in the ordinary application. Below is carries on the translation in MPLAB IDE to the C source document the result:


        May see from the above result, the compiler has used the CLD order, the two are may unify. Only then after having understood CLD, can have a more thorough understanding to the HI-TECHC compiler and grasp.

    2 PICCl8 command line driver
        PICCl8 transfers the DOS command line the driver, uses for to translate and/or links the C language procedure. The PICCl8 basic command form is:
        piccl8 [option] files [document storehouse]
        Usually before the filename “- -” distinguishes with the dash, in fact this is not to. The document may be the source document (C or the assembly program) and the object file mix. The document storehouse is a storehouse name tabulation, or a L option source document. The object file and the storehouse document through the document type or the extension by the PICCl8 discrimination, type like table 1 are arranged in order.

        PICCl8 will inspect each document and completes the suitable operation. The C document will be translated, the assembling file will be assembled. Finally, possesses the object file which or the object file which obtains through the translation or the assembly lists explicitly in the command line, will assign the storehouse link with the standard movement code storehouse and any user, only if they are forbidden by some kind of option. Only works as the quotation source code, in the storehouse the function can link the result output file. Only uses the object file (for example not to have source document) the achievement to wither with PICCl8, means that only carries out the link stage, this is one typical usage. Translates the source document which with the PICC18 C option several compile to take the object file, then only uses the production the object file and the suitable storehouse (and suitable option) transfers PICCl8 to found the final procedure.
    2.1 longevities issue an order
        The PICCl8 driver is 32 Windows soft assorted, may process surpasses 128 character long command lines. The driver may transfer through a DOS batch of document, or through command file transmission option. When uses approves the document, sends in PICCl8 the command line to arrange in order becomes a line. In the command file, the driver option may transmit at most good, this is follows closely a backlash through a space bar “\” to meet a carriage return key to separate each line again to realize. For example, a command file may include:

       
        Because has not provided the command line instruction, therefore PICC18 will read xyz.cmd to obtain its command line instruction. The command file may also through the @ mark sensing.
    For example:
        PICCl8@xyz.cmd
    2.2 PICCl8 compiler option
        Compiler’s hypothesis mainly based on ROM code production. Table 2 have listed PICCl8 compiler’s several commonly used important options.

        ①Definition processor type: - processor.

        This option had decided which processor is used. For example, arranges Ze PICl8C452 with command line - 18c452. The user may also increase own processor to the compiler.
        ②Assigns ROM to displace the quantity: - Aaddress.
        - A option uses for is the ROM reflection area assigns the base address. If this option request guidance inputs such debugging aids, then this word tries the tool to expect that the ROM mapping address begins in the nonzero address. This option influence possesses based on the ROM part, including replacement and interrupt vector, as well as laying aside code and constant data link classification. If the base address assigns the exterior memory, then must use - the ROM option to assign the exterior memory’s available address range.
        ③Optimizer and optimized priority option: - O and - Zg.
        - The O expression transfers PICC18 the optimizer, - the Zg option transfers the overall situation priority in the code generation way. This has the important meaning regarding word length’s deflation and the internal RAM use. This priority has not transmitted the priority to be harsh, but is very meaningful to word length’s deflation. In carries out in the function foundation, the overall situation priority may optimize register’s use. It also Chang Zui the transmission avoids the nonessential memory visit using the code.
        This option default’s level is 1 (the lowest priority). The priority may establish is l~9 willfully first-level (9 for the highest priority). The digit indicated that the priority attempts to reduce the code the degree. Regarding PICCl8, is higher than 3 priorities usually not to have what use.
        Had understood after command line actuation, carried on the translation to 1st in MPLAB IDE to the C source document the example to have a more thorough understanding.

    3 command line actuation application
        Following introduction command line actuation in practical application some examples. Through these examples, may have a preliminary understanding to the command line actuation application, and may this be the foundation, carries on the thorough study and the application to the PICCl8 compiler.
    3.1 command line actuation translation source document
        Carries on the following operation under Win2000: Execution “start” -> “movement” order, then input “CMD”; Or the execution “the start” -> “the procedure” -> “the appendix” -> “the order prompt symbol” the order, springs cmd.exe the contact surface, as shown in Figure 1. If in cmd.exe appears the current directory is not under the C packing table of contents, then needs through the input order “cd c: \” enters the C packing table of contents. The input “cd htsoft \ picl8 \ bin” the order, enters the PICCl8.exe software when the table of contents (default installs the table of contents), as shown in Figure 2.

        
    (1) translates Izqmwyz.c
        The input “piccl8-18f458 lzqmwyz.c”, the meaning is uses the piccl8.exe compiler to carry on the translation to the lzqmwyz.c source document, the monolithic integrated circuit model is 18f458 (i.e. the PIC18F458 monolithic integrated circuit). By now will output the translation result which needed, in the production document, as extension lzqmwyz.hex is more important take hex. If the source program has the grammatical error, will also demonstrate the error message and will be at line.
        Attention: Carries on the operation when the cmd.exe contact surface, all source document deposits under the PICC18.exe identical catalog (the PICCl8.exe default installs the table of contents is c: \ HTSOFT \ PIC18 \ Bin). In this paper, PICC18 uses this default to install the table of contents. Here lzqmwyz.c deposits in c: Under \ HTSOFT \ PICl8 \ Bin.
    (2)-noerrata option
        “- noerrata” the option does not enable the output code the wrong revision, but default time, will have the revision to compiler’s output code. Some chips have not corrected errors the table, will not use the compiler to revise regarding this. This option may use the compiler to forbid any error correction table position. When error correction table change, will forbid safely. To some chips (for example PIC18F458 and so on), PICCl8 carried on the limit to the procedure word length (to limit generally in 0×4000, namely in 16KB). This is with on PICl8 application forum. Some net friends proposed that the code has the limit reason. Some programmers have compiled the following attention program in the procedure:


        If translates the procedure code has surpassed this scope, will list the error message.
        When Figure 3 is to the solar050408.c source document translation, the code has surpassed when the Ox4000 length appears prompting message.

        When use - noerrata option, the solar050408.c source document translation will obtain the correct translation result, the order will be “piccl8-18f458solar050408.c-o-zgl-noerrata”. In the order “- o” the expression transfers PICCl8 the optimizer, “- zg1″ when expression transfer optimizer uses the priority is 1 level.
    3.2 storehouse file generation and application
    3.2.1 C source document
    (1) contains main the function the lzqmwyzl.c source document


    (2) contains function_X3 the function the funcx3.c source document

     
    3.2.2 production storehouse document
        Found an application procedure directly with 3.2.1 two documents, this is uses frequently in the usual application. Here introduced that the funcx3.c source file generation storehouse document, again the method which transfers by lzqmwyz.c, is also manufactures the storehouse document to carry on the use.
    (1) produces the obj document
        Deposits the funcx3.c source document under the PICCl8.exe identical catalog, then inputs “PICCl8-18f458-C funcx3.c” in cmd.exe. - The C option is translates several source documents the object file (the .obj document). Here is translates the funcx3.c source document the funcx3.obj document, then may in c: \ HTSOFT \ PICl8 \ under the Bin table of contents found the funcx3.obj document.
    (2) produces the lib storehouse document
        Inputs “libr r fun.lib runcx3.obj” in cmd.exe. And r option for replace module. fun.lib is by the function funcx3.c manufacture storehouse document filename, as shown in Figure 4.

    3.2.3 storehouse document application
        Figure 5 is uses 3.2.1 lzqmwyzl.c source document and transfers 3.2.2 manufactures the storehouse document fun.1ib project. By now used on only then the lzqmwyzl.c source document and the fun.1ib document, but does not need to apply again contains runetton_X3 the function the funcx3.c source document.

    Conclusion
        The PICCl8 compiler command line actuation has many applications in reality, only then has understood it, can have to the C compiler are more, a more thorough understanding. As space is limited, this article only plays the role which offers a few ordinary introductory remarks so that others may offer their valuable ideas, provides one kind of mentality to refer for the general programmers; At the same time, also has the corresponding reference value regarding PICC.

    Share/Save/Bookmark

    Friday, September 19th, 2008 at 16:10
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3