首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

关于Processor Expert 的一些资料,希望对大家有所帮助

关于Processor Expert 的一些资料,希望对大家有所帮助

Code Generation

This chapter informs the user about principles and results of the Processor Expert code generation process and the correct ways and possibilities of using this code in the user application.

Please follow to the subchapters for more information.

This chapter informs the user about principles and results of the Processor Expert code generation process and the correct ways and possibilities of using this code in the user application.

Please follow to the subchapters for more information.

This chapter informs the user about principles and results of the Processor Expert code generation process and the correct ways and possibilities of using this code in the user application.

Please follow to the subchapters for more information.

[此贴子已经被作者于2009-1-7 11:16:33编辑过]

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 MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/SmartBeanModules.html">User Changes in Generated Code for details.
    Processor Expert also allows to track and review changes in the generated modules. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/trackchanges.html">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 ( MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanCategoriesInfo.html#LevelAbstraction">Peripheral Initialization Beans). Generation of the ISRs is controlled by the project option MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/options.html#GenerateISR">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 MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/SignalNames.html">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 MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/projectpanel.html">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 MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/resetscenario.html">Reset Scenario

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 MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/SmartBeanModules.html">User Changes in Generated Code for details.
    Processor Expert also allows to track and review changes in the generated modules. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/trackchanges.html">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 ( MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanCategoriesInfo.html#LevelAbstraction">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
Predefined Types, Macros and Constants

Processor Expert generates definitions of all hardware register structures to the file IO_Map.h. The Processor Expert type definitions are generated to the file PE_Types.h containing also definitions of macros used for a peripheral register access. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/registermacros.html">Registers Access for details.

Types

TypeDescriptionSupported for
int8_t8-bit signed integerall
int16_t16-bit signed integerall
int32_t32-bit signed integerall
int64_t32-bit signed integer56800/E
uint8_t8-bit unsigned integerall
uint16_t16-bit unsigned integerall
uint32_t32-bit unsigned integerall
uint64_t64-bit unsigned integer56800/E
TPE_ErrCodeError code (uint8_t)all except MPC55xx
byte8-bit unsigned integer (unsigned char)all
boolBoolean value (unsigned char) (TRUE = any non-zero value / FALSE = 0)all
word16-bit unsigned integer (unsigned int)all
dword32-bit unsigned integer (unsigned long)all
dlongarray of two 32-bit unsigned integers (unsigned long)all

Structure for images

typedef struct {          /* Black&White Image  */
    word width;             /* Image width  */
    word height;            /* Image height */
    byte *pixmap;           /* Image pixel bitmap */
    word size;              /* Image size   */
    char *name;             /* Image name   */
  } TIMAGE;
  typedef TIMAGE* PIMAGE ;  /* Pointer to image */
  

Structure for 16-bit register:

/* 16-bit register (big endian format) */
  typedef union {
     word w;
     struct {
       byte high,low;
     } b;
  } TWREG;
  

Macros

  __DI()             - Disable global interrupts
  __EI()             - Enable global interrupts
  
  EnterCritical()    - It saves CCR register and disable
                       global interrupts
  ExitCritical()     - It restores CCR register saved
                       in EnterCritical()
  
For the list of macros available for Peripheral registers access please see the chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/registermacros.html">Registers Access.

Constants

Methods Error Codes

The error codes are defined in PE_Error module. Error code value is 8bit unsigned byte. Range 0 - 127 is reserved for PE, 128 - 255 for user

ERR_OK0OK
ERR_SPEED1This device does not work in the active speed mode
ERR_RANGE2Parameter out of range
ERR_VALUE3Parameter of incorrect value
ERR_OVERFLOW4Timer overflow
ERR_MATH5Overflow during evaluation
ERR_ENABLED6Device is enabled
ERR_DISABLED7Device is disabled
ERR_BUSY8Device is busy
ERR_NOTAVAIL9Requested value not available
ERR_RXEMPTY10No data in receiver
ERR_TXFULL11Transmitter is full
ERR_BUSOFF12Bus not available
ERR_OVERRUN13Overrun is present
ERR_FRAMING14Framing error is detected
ERR_PARITY15Parity error is detected
ERR_NOISE16Noise error is detected
ERR_IDLE17Idle error is detected
ERR_FAULT18Fault error is detected
ERR_BREAK19Break char is received during communication
ERR_CRC20CRC error is detected
ERR_ARBITR21A node loses arbitration. This error occurs if two nodes start transmission at the same time
ERR_PROTECT 22Protection error is detected.
ERR_UNDERFLOW 23Underflow error is detected.
ERR_UNDERRUN 24Underrun error is detected.
ERR_COMMON 25General unspecified error of a device. The user can get a specific error code using the method GetError.

Processor Expert generates definitions of all hardware register structures to the file IO_Map.h. The Processor Expert type definitions are generated to the file PE_Types.h containing also definitions of macros used for a peripheral register access. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/registermacros.html">Registers Access for details.

Types

TypeDescriptionSupported for
int8_t8-bit signed integerall
int16_t16-bit signed integerall
int32_t32-bit signed integerall
int64_t32-bit signed integer56800/E
uint8_t8-bit unsigned integerall
uint16_t16-bit unsigned integerall
uint32_t32-bit unsigned integerall
uint64_t64-bit unsigned integer56800/E
TPE_ErrCodeError code (uint8_t)all except MPC55xx
byte8-bit unsigned integer (unsigned char)all
boolBoolean value (unsigned char) (TRUE = any non-zero value / FALSE = 0)all
word16-bit unsigned integer (unsigned int)all
dword32-bit unsigned integer (unsigned long)all
dlongarray of two 32-bit unsigned integers (unsigned long)all

Structure for images

typedef struct {          /* Black&White Image  */
    word width;             /* Image width  */
    word height;            /* Image height */
    byte *pixmap;           /* Image pixel bitmap */
    word size;              /* Image size   */
    char *name;             /* Image name   */
  } TIMAGE;
  typedef TIMAGE* PIMAGE ;  /* Pointer to image */
  

Structure for 16-bit register:

/* 16-bit register (big endian format) */
  typedef union {
     word w;
     struct {
       byte high,low;
     } b;
  } TWREG;
  

Macros

  __DI()             - Disable global interrupts
  __EI()             - Enable global interrupts
  
  EnterCritical()    - It saves CCR register and disable
                       global interrupts
  ExitCritical()     - It restores CCR register saved
                       in EnterCritical()
  
For the list of macros available for Peripheral registers access please see the chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/registermacros.html">Registers Access.

Constants

Methods Error Codes

The error codes are defined in PE_Error module. Error code value is 8bit unsigned byte. Range 0 - 127 is reserved for PE, 128 - 255 for user

ERR_OK0OK
ERR_SPEED1This device does not work in the active speed mode
ERR_RANGE2Parameter out of range
ERR_VALUE3Parameter of incorrect value
ERR_OVERFLOW4Timer overflow
ERR_MATH5Overflow during evaluation
ERR_ENABLED6Device is enabled
ERR_DISABLED7Device is disabled
ERR_BUSY8Device is busy
ERR_NOTAVAIL9Requested value not available
ERR_RXEMPTY10No data in receiver
ERR_TXFULL11Transmitter is full
ERR_BUSOFF12Bus not available
ERR_OVERRUN13Overrun is present
ERR_FRAMING14Framing error is detected
ERR_PARITY15Parity error is detected
ERR_NOISE16Noise error is detected
ERR_IDLE17Idle error is detected
ERR_FAULT18Fault error is detected
ERR_BREAK19Break char is received during communication
ERR_CRC20CRC error is detected
ERR_ARBITR21A node loses arbitration. This error occurs if two nodes start transmission at the same time
ERR_PROTECT 22Protection error is detected.
ERR_UNDERFLOW 23Underflow error is detected.
ERR_UNDERRUN 24Underrun error is detected.
ERR_COMMON 25General unspecified error of a device. The user can get a specific error code using the method GetError.

Typical Usage of the Bean in the User Code

This chapter describes usage of methods and events that are defined in most hardware beans. Usage of other bean specific methods is described in the bean documentation, in the section "Typical Usage" (if supported).

In the following examples please assume a bean named "B1".

Peripheral Initialization Beans

MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanCategoriesInfo.html#LevelAbstraction">Peripheral Initialization Beans are the beans of the lowest level of peripheral abstraction. These beans contain only one method Init providing the initialization of the used peripheral. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanInitUsage.html">Typical Peripheral Initialization Beans Usage for details.

Methods Enable, Disable

Most of the hardware beans support the methods Enable and Disable. These methods enable or disable peripheral functionality, which causes disabling of functionality of the bean as well.
Hint: Disabling of the peripheral functionality may save CPU resources.

Overview of the method behavior according to the bean type:

  • Timer beans: timer counter is stopped if it is not shared with another bean. If the timer is shared, the interrupt may be disabled (if it is not also shared).
  • Communication beans (like serial or CAN communication): peripheral is disabled.
  • Conversion beans (A/D, D/A): converter is disabled. The conversion is restarted by Enable.

If the bean is disabled, some methods may not be used. Please refer to beans documentation for details.

MAIN.C

  void main(void)
  {
    ...
    B1_Enable();   /* enable the bean functionality */
                /* handle the bean data or settings */
    B1_Disable(); /* disable the bean functionality */
    ...
  }
  

Methods EnableEvent, DisableEvent

These methods enable or disable invocation of all bean events. These methods are usually supported only if the bean services any interrupt vector.

The method DisableEvent may cause disabling of the interrupt, if it is not required by the bean functionality or shared with another bean. The method usually does not disable either peripheral or the bean functionality.

MAIN.C

  void main(void)
  {
    ...
    B1_EnableEvent();  /* enable the bean events */
                       /* bean events may be invoked */
    B1_DisableEvent(); /* disable the bean events */
                       /* bean events are disabled */
    ...
  }
  

Events BeforeNewSpeed, AfterNewSpeed

Timed beans which depends on the CPU clock (such as timer, communication and conversion beans), may support speed modes defined in the CPU bean (in EXPERT view level). The event BeforeNewSpeed is invoked before the speed mode change and AfterNewSpeed is invoked after the speed mode change. Speed mode may be changed using CPU bean methods SetHigh, SetLow or SetSlow.

EVENT.C

  int changing_speed_mode = 0;

  void B1_BeforeNewSpeed(void)
  {
    ++changing_speed_mode;
  }

  void B1_AfterNewSpeed(void)
  {
    --changing_speed_mode;
  }
  

Note: If the speed mode is not supported by the bean, the bean functionality is disabled (as if the method Disable is used). If the supported speed mode is selected again, the bean status is restored.

TRUE and FALSE values of the bool type

Processor Expert defines the TRUE symbol as 1, however true and false logical values in C language are defined according to ANSI-C:

  • False is defined as 0 (zero)
  • True is any non-zero value.

It follows from this definition, that the bool value cannot be tested using the expressions like if (value == TRUE) ...
Processor Expert methods returning bool value often benefit from this definition and they return any non-zero value as TRUE value instead of 1. The correct C expression for such test is: if (value) ....

In our documentation, the "true" or "false" are considered as logical states, not any particular numeric values. The capitalized "TRUE" and "FALSE" are constants defined as FALSE=0 and TRUE=1.

This chapter describes usage of methods and events that are defined in most hardware beans. Usage of other bean specific methods is described in the bean documentation, in the section "Typical Usage" (if supported).

In the following examples please assume a bean named "B1".

Peripheral Initialization Beans

MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanCategoriesInfo.html#LevelAbstraction">Peripheral Initialization Beans are the beans of the lowest level of peripheral abstraction. These beans contain only one method Init providing the initialization of the used peripheral. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/BeanInitUsage.html">Typical Peripheral Initialization Beans Usage for details.

Methods Enable, Disable

Most of the hardware beans support the methods Enable and Disable. These methods enable or disable peripheral functionality, which causes disabling of functionality of the bean as well.
Hint: Disabling of the peripheral functionality may save CPU resources.

Overview of the method behavior according to the bean type:

  • Timer beans: timer counter is stopped if it is not shared with another bean. If the timer is shared, the interrupt may be disabled (if it is not also shared).
  • Communication beans (like serial or CAN communication): peripheral is disabled.
  • Conversion beans (A/D, D/A): converter is disabled. The conversion is restarted by Enable.

If the bean is disabled, some methods may not be used. Please refer to beans documentation for details.

MAIN.C

  void main(void)
  {
    ...
    B1_Enable();   /* enable the bean functionality */
                /* handle the bean data or settings */
    B1_Disable(); /* disable the bean functionality */
    ...
  }
  

Methods EnableEvent, DisableEvent

These methods enable or disable invocation of all bean events. These methods are usually supported only if the bean services any interrupt vector.

The method DisableEvent may cause disabling of the interrupt, if it is not required by the bean functionality or shared with another bean. The method usually does not disable either peripheral or the bean functionality.

MAIN.C

  void main(void)
  {
    ...
    B1_EnableEvent();  /* enable the bean events */
                       /* bean events may be invoked */
    B1_DisableEvent(); /* disable the bean events */
                       /* bean events are disabled */
    ...
  }
  

Events BeforeNewSpeed, AfterNewSpeed

Timed beans which depends on the CPU clock (such as timer, communication and conversion beans), may support speed modes defined in the CPU bean (in EXPERT view level). The event BeforeNewSpeed is invoked before the speed mode change and AfterNewSpeed is invoked after the speed mode change. Speed mode may be changed using CPU bean methods SetHigh, SetLow or SetSlow.

EVENT.C

  int changing_speed_mode = 0;

  void B1_BeforeNewSpeed(void)
  {
    ++changing_speed_mode;
  }

  void B1_AfterNewSpeed(void)
  {
    --changing_speed_mode;
  }
  

Note: If the speed mode is not supported by the bean, the bean functionality is disabled (as if the method Disable is used). If the supported speed mode is selected again, the bean status is restored.

TRUE and FALSE values of the bool type

Processor Expert defines the TRUE symbol as 1, however true and false logical values in C language are defined according to ANSI-C:

  • False is defined as 0 (zero)
  • True is any non-zero value.

It follows from this definition, that the bool value cannot be tested using the expressions like if (value == TRUE) ...
Processor Expert methods returning bool value often benefit from this definition and they return any non-zero value as TRUE value instead of 1. The correct C expression for such test is: if (value) ....

In our documentation, the "true" or "false" are considered as logical states, not any particular numeric values. The capitalized "TRUE" and "FALSE" are constants defined as FALSE=0 and TRUE=1.

User Changes in Generated Code

It's necessary to say at the beginning of the chapter, that modification of the generated code may be done only at user's own risk. Generated code was thoroughly tested by the skilled developers and the functionality of the modified code cannot be guaranteed. We strongly don't recommend modification of the generated code to the beginners. See more information for generated modules in chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/codesign.html">Code Generation.

To support user changes in the bean modules, Processor Expert supports the following features:

1. CH file - manifest constants

Processor Expert automatically produce list of manifest constants for all beans, which encapsulate any CPU peripheral and modifies any of the CPU control registers. The name of each manifest constant is in the following format:

C_[bean+method]_reg_[register name][additional-info]

where

  • [bean+method] is name of bean (and optionally also bean's method),
  • [register name] is name of the control register,
  • [additional-info] is additional information about usage of the value (modification of one bit, bits mask or whole value).

These constants may be used to write user code, which reflects the bean settings. Once the constant is generated into the CH file, it is preserved there even it is already not used in the bean module. The most important advantage of these constants is, that small changes in the bean settings (for example timing) does not cause change of the bean module, but the only CH file is changed.

The name of the CH file is derived from the CPU bean name ([CPUbean].CH). To generate CH file it is necessary to set the following option: MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/options.html#Generatemanifestconstants">Project Options | Generate manifest constants. CH file is generated also while smart generation of bean modules code, see paragraph 3 for details. CH file is always overwritten during the code generation.

2. Mode of code generation for bean modules

It's possible to select mode of the code generation for each bean, the following options can be found in the MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/beanlocalmenu.html">bean's pop-up menu in the project panel:

Code Generation

  • MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/images/umchanges1.png" width="16" alt=""/> Always Write Generated Bean Modules (default) - generated bean modules are always written to disk and any existing previous module is overwritten
  • MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/images/umchanges2.png" width="16" alt=""/> Preserve User Changed in Generated Bean Modules - smart detection of user changes.
    Notice: Smart user changes preservation is not available in this version.
  • MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/images/umchanges3.png" width="16" alt=""/> Don't Write Generated Bean Modules - the code from bean is not generated. Any initialization code of the bean, which resides in the CPU bean, interrupt vector table and shared modules are updated.

The mode of code generation is indicated as a bean's status in the project panel. This mode influences only the generation of bean modules (bean.c, bean.h).

3. Mode of code generation for non-bean modules

Processor Expert also allows to enable/disable generation of the modules that not related to a specific bean or that are common for several beans. This option can be configured in the MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/moduleslocalmenu.html#generated">pop-up menu of the module in the Project Panel. Current enable/disable state of this option is signalled by the icon near the bean module name in the Project Panel (MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/images/umchanges1.png" width="16" alt=""/> - enabled, MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/images/umchanges3.png" width="16" alt=""/> - disabled).

Code Generation
  • Always Write (default) - generated bean modules are always written to disk and any existing previous module is overwritten
  • Don't Write - the content of the module is not overwritten. Please notice that this can lead to malfunction of beans dependent on the module when the module update is required due to bean's settings change.

Viewing User Changes in a Bean Module

The user changes done in a bean module or bean header module can be viewed using a bean pop-up menu commands Compare With Previously Generated Module and Compare With Previously Generated Header Module. See chapter MSITStore:C:\Program%20Files\Freescale\CodeWarrior%20for%20HCS12%20V4.7\Help\ProcessorExpert.chm::/beanlocalmenu.html#Bean">Beans Pop-up Menus for details. The user can also enable reviewing all changes done into the generated code after each code generation. See chapter Tracking Changes in Generated Code for details.


It's necessary to say at the beginning of the chapter, that modification of the generated code may be done only at user's own risk. Generated code was thoroughly tested by the skilled developers and the functionality of the modified code cannot be guaranteed. We strongly don't recommend modification of the generated code to the beginners. See more information for generated modules in chapter Code Generation.

To support user changes in the bean modules, Processor Expert supports the following features:

1. CH file - manifest constants

Processor Expert automatically produce list of manifest constants for all beans, which encapsulate any CPU peripheral and modifies any of the CPU control registers. The name of each manifest constant is in the following format:

C_[bean+method]_reg_[register name][additional-info]

where

  • [bean+method] is name of bean (and optionally also bean's method),
  • [register name] is name of the control register,
  • [additional-info] is additional information about usage of the value (modification of one bit, bits mask or whole value).

These constants may be used to write user code, which reflects the bean settings. Once the constant is generated into the CH file, it is preserved there even it is already not used in the bean module. The most important advantage of these constants is, that small changes in the bean settings (for example timing) does not cause change of the bean module, but the only CH file is changed.

The name of the CH file is derived from the CPU bean name ([CPUbean].CH). To generate CH file it is necessary to set the following option: Project Options | Generate manifest constants. CH file is generated also while smart generation of bean modules code, see paragraph 3 for details. CH file is always overwritten during the code generation.

2. Mode of code generation for bean modules

It's possible to select mode of the code generation for each bean, the following options can be found in the bean's pop-up menu in the project panel:

Code Generation

  • Always Write Generated Bean Modules (default) - generated bean modules are always written to disk and any existing previous module is overwritten
  • Preserve User Changed in Generated Bean Modules - smart detection of user changes.
    Notice: Smart user changes preservation is not available in this version.
  • Don't Write Generated Bean Modules - the code from bean is not generated. Any initialization code of the bean, which resides in the CPU bean, interrupt vector table and shared modules are updated.

The mode of code generation is indicated as a bean's status in the project panel. This mode influences only the generation of bean modules (bean.c, bean.h).

3. Mode of code generation for non-bean modules

Processor Expert also allows to enable/disable generation of the modules that not related to a specific bean or that are common for several beans. This option can be configured in the pop-up menu of the module in the Project Panel. Current enable/disable state of this option is signalled by the icon near the bean module name in the Project Panel ( - enabled, - disabled).

Code Generation
  • Always Write (default) - generated bean modules are always written to disk and any existing previous module is overwritten
  • Don't Write - the content of the module is not overwritten. Please notice that this can lead to malfunction of beans dependent on the module when the module update is required due to bean's settings change.

Viewing User Changes in a Bean Module

The user changes done in a bean module or bean header module can be viewed using a bean pop-up menu commands Compare With Previously Generated Module and Compare With Previously Generated Header Module. See chapter Beans Pop-up Menus for details. The user can also enable reviewing all changes done into the generated code after each code generation. See chapter Tracking Changes in Generated Code for details.


这是PE的帮助PDF中的东西吧,不过能传上来很好。谢谢。

返回列表