![]() |
![]() |
![]() |
![]() |
![]() |
Targeting using the Cmicro Package
Directory Structure
At first it is necessary to know the directory structure the Cmicro Package is stored in.
On UNIX, the Cmicro Package is contained in $sdtdir/cmicro.
In Windows, the Cmicro Package is contained in %SDTDIR%\cmicro.
- cmicro
- +-- include
- +-- kernel
- +-- mcod
- +-- template
- +-- commlink
- +-- tester
Furthermore all files, which are used when targeting Cmicro, are definitely stored in this directory tree. Otherwise the files are generated by the Cmicro SDL to C Compiler or by the Targeting Expert.
Prerequisites
Before starting the targeting with Cmicro it is necessary to have an SDL system designed and already tested with the help of the Simulator.
This means targeting begins when the first testing phase is finished.
All steps of targeting will be discussed in the following sub-sections.
Different Steps in the Work Flow
All the different operation steps listed here will completely supported by the Targeting Expert (see The Targeting Expert).
- To start the Targeting Expert, select the entry Targeting Expert in the Organizer's Generate menu.
- Select pre-defined integration settings or <user defined> for a new integration. See Pre-defined Integration Settings.
- Specify the compiler, linker and make settings (if not automatically done).
- Please view Configure Compiler, Linker and Make.
- Configure and scale the generated C code and the Cmicro Library.
- For information about the compilation flags and their interdependencies please view Compilation Flags.
- For more details how to use the Targeting Expert please view Configure and Scale the Target Library.
- Copy template files.
- Several files of the Cmicro Package are delivered as template files. This is done because lots of things can only be done by the user as they must fit to the user's SDL system. The template files give easy to use C functions including help to adapt them to the user's needs.
- All the files mk_stim.c, mk_user.c and mk_cpu.c should be copied into the project's directory tree (generated by the Targeting Expert). All these files are stored in the template directory.
- If the SDL Target Tester should also be used it is necessary to copy the files mg_dl.c and the files describing the preferred communications link (e.g. the file 8051_v24.[ch] if an 8051 micro controller and a V.24 interface should be used) into the project directory, too. The file mg_dl.c is stored in the template directory and the communications link files are stored in template/commlink if contained in the Cmicro Package delivery. Please view the sub-section The Communications Link's Target Site to get information about how to create an own communication link.
- Please view also Source Files to get information on how to add more files to the list of files to be compiled. The Targeting Expert will automatically add these files to the makefile.
- Full make the complete system.
- It is probably necessary to do an environment connection first (see Connecting the SDL Environment).
- Download and execute the executable.
- The following sections in the Targeting Expert's manual (The Targeting Expert) should be checked to find out how these steps can be eased:
- Download Application
- Test Application (which is probably the target executable itself)
Connecting the SDL Environment
From the Cmicro Package's point of view the SDL environment is represented in template C functions. A short overview of this C functions is given here. For further information please view Bare Integration.
- xInitEnv():
This function is given as a template in the file env.c. It needs to be filled any time it is necessary to initialize specific hardware components on the target.- xCloseEnv():
xCloseEnv() is given as a template in env.c, too. It is only necessary to fill this function if the SDL system can perform a system stop.- xInEnv():
xInEnv() is basically generated by the Targeting Expert into the file env.c. This means that all the signals coming from the environment are already inserted into the C code of this function.
All the modifications of env.c should only be done between the comments /* BEGIN User Code */ and /* END User Code */. All the other modifications will be lost when re-generating the env.c file.
- xOutEnv():
For all the signals to the environment the Targeting Expert generates the C function xOutEnv() into the file env.c. All the signals to the environment are included into the C code.
All the modifications of env.c should only be done between the comments /* BEGIN User Code */ and /* END User Code */. All the other modifications will be lost when re-generating the env.c file.
- User Defined Actions for System Errors - the ErrorHandler:
The Cmicro Package supports the handling of detected errors by calling the C function ErrorHandler() in the module mk_user.c.
The user needs to redirect the error messages to his target hardware. I.e. display the errors on the hardware.The compilation and linkage of the environment functions can be prevented by using the flags given in Compilation Flags.
Different Forms of Target Integration
Different forms of target integration, that is, integrating generated C code, are distinguished:
- Bare Integration: There is no operating system available on the target machine. The main() function of Cmicro can be used.
- Light Integration: An operating system is used and the complete SDL system executes in one operating system task. The SDL task communicates with the environment by using the communication resources of the operating system.
- System partitioning: An operating system is used, the SDL system may execute in different CPUs, or the processes of the SDL system execute in different OS tasks.
- Tight Integration: An operating system is used, the SDL system executes in one CPU, and the processes of the SDL system execute in different tasks.
Bare and Light integration represent the most easiest form of integration.
Bare integration is described in Bare Integration.
Light integration is described in Light Integration.
Tight integration can be performed with Cmicro, but the complexity makes it difficult to describe the integration in this section. It is a generic solution available, which guides thought the integration.
Please contact IBM Rational local sales office/Professional Services for further information.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |