Code Generation

Processor Expert | Generate Code '{ProjectName.mcp}'

Generate Code command initiates the code generation process. During this process source code modules containing functionality of the beans contained in the project are generated. The project must be set-up correctly for successful code generation. If the generation is error-free all generated source code files are saved to the destination directory.

Processor Expert produces these files:

The existence of the files can be conditional to project or Processor Expert environment settings and their usage by the beans.

  • Bean module
    This module with its header file is generated for every bean in the project with exception of some beans that generate only an initialization code or special source code modules. Name of this file is the same as the name of the bean.
    Header file (.h) contains definitions of all public symbols, which are implemented in the bean module and can be used in the user modules.
    The module contains implementation of all enabled methods and may also contain some subroutines for internal usage only. This module could be modified manually under certain conditions, but it is recommended for experienced users only. See chapter User Changes in Generated Code for details.
    Processor Expert also allows to track and review changes in the generated modules. See chapter Tracking Changes in Generated Code for details.
  • CPU module
    The CPU module is generated according to the currently active target CPU bean. The CPU module contains additionally:
    • CPU initialization code
    • interrupt processing

  • Main module
    The main module is generated only if it does not already exist (if it exists it is not changed). Name of this module is the same as the name of the project.
    The main module contains the main function, which is called after initialization of the CPU (from the CPU module). By default this function is generated empty (without any reasonable code). It is designed so that the user will write his/her own particular code here.
  • Event module
    The event module is generated only if it does not exist. If it exists, only new events are added into the module; user written code is not changed.
    The event module contains all events selected in the beans. By default these event handler routines are generated empty (without any meaningful code). It is considered that user will write his/her own particular code here.
    Event module can also contain the generated ISRs for the beans that require a direct interrupt handling ( Peripheral Initialization Beans). Generation of the ISRs is controlled by the project option Project Options | Generate ISR.
    Note: It is possible to change a name of the event module in ADVANCED view mode of the Bean Inspector.
  • Method list file with description of all beans, methods and events generated from your project. The name of the file is {projectname}.txt or {projectname}.doc. This documentation can be found in the Documentation folder of the Project Panel.
  • Signal names
    This is a simple text file {projectname}_SIGNALS.txt or {projectname}_SIGNALS.doc with a list of all used signal names. The signal name can be assigned to an allocated pin in the bean properties (available in ADVANCED view mode). This documentation can be found in the Documentation folder of the Project Panel. See chapter Signal names for details.
  • XML documentation containing the project information and settings of all beans in XML format. The generated file {projectname}_Settings.xml can be found in the Documentation folder of the Project Panel. It is updated after each successful code generation.
  • Shared modules with shared code (the code which is called from several beans). Complete list of generated shared modules depends on selected CPU, language, compiler and on the current configuration of your project. Typical shared modules are:
    • IO_Map.h
      Control registers and bit structures names and types definitions in C language.
    • IO_Map.c
      Control registers variable declarations in C language. This file is generated only for the HC(S)08/HC(S)12 versions.
    • Vectors.c
      A source code of the interrupt vector table content.
    • PE_Const.h
      Definition of the constants (speed modes, reset reasons). This file is included in every driver of the bean.
    • PE_Types.h
      Definition of the C types (bool, byte, word, ...). This file is included in every driver of the bean.
    • PE_Error.h
      Common error codes. This file contains definition of return error codes of bean's methods. See the generated module for detailed description of the error codes. This file is included in every driver of the bean.
    • PE_Timer
      This file contains shared procedures for runtime support of calculations of timing constants.
    • {startupfile}.c
      This external module (visible in the External Modules folder of the Project Panel) contains a platform specific startup code and is linked to the application. The name of the file is different for the Processor Expert versions. For datils on the use of the startupfile during the reset see chapter Reset Scenario
    • "PESL".h
      PESL include file. This file can be included by the user in his/her application to use the PESL library. See chapter PESL for details.

See also chapter Predefined types, macros and constants.


 

 

[top of page]