- Run the EcoCoder installation, which automatically adds all EcoCoder’s library blocks and S-functions to Simulink;
- Encapsulate all the hardware diver software with EcoCoder’s S-functions, including ADC drivers, CAN drivers, digital IO drivers, PWM drivers, etc; also encapsulate the real-time operating systems with EcoCoder’s Task Scheduler S-functions.
- In Simulink environment, link your application software, aka, Simulink blocks, to the hardware driver software via EcoCoder’s library blocks and S-functions;
- Run simulations in Simulink, verify models, and software integrity.
- Define the signal properties and parameter properties in Simulink, which will be output to the generated A2L file.
- Click “code generation” button, EcoCoder will generate the microprocessor compatible codes;
- Click “compile” button, will invoke the compiling and linking process, running at the background, which will run the compiler, like CodeWarrior, to compile the application code and hardware driver code together and generates the executable codes.
- Machine executable file, for example MOT file for Freescale MPC56xx, 57xx series microprocessors;
- A2l file, which a descriptive file contain all necessary info for the calibration tool to interpret the Controller protocols;
- CAL file, containing only calibration data, not the code
Automatic code generation process
EcoCoder has various library blocks and S-Function modules: System initialization setting module (HCU_Settings), ADC analog signal processing module (ADC), CAN bus data processing module (CAN),Task scheduling module (Task_Schedeuler), IO driver module (Digital Port IN / OUT).
System settings include CAN initialization, task scheduling initialization and EMIOS_PWM_Conf initialization. When starting a new project, first you need to configure the initialization modules, for example, determining CAN bus baud rates etc., timers for task scheduling modules.
ADC modules need to be configured for channels, and linked to the specific signals to the application software.
- Digital IN/OUT
Digital IO modules contain four functions: PWM output, PWM input, digital signal output, and digital signal input.
CAN modules have: CAN_RxData (CAN data receiving), CAN_TxData (CAN data transmitting), CAN_RxDataFilter (CAN ID filter), CAN_UnpackData (CAN bus data parsing), CAN_PackData (CAN bus data packing).
- Task Scheduler
Task scheduling module provides two types of task scheduling, high-priority tasks and low priority task. High priority tasks have short task execution intervals, but the task itself must be as small as possible, to save the run time, such PIT_10ms. Low priority tasks can have longer execution time, such task_100ms.
In addition, task scheduling modules also provide the additional functions: monitoring each task’s execution time, and report task time overflow. If the task execution time is too long, the user needs to adjust the control software and redistribute the heavy computation blocks to lower priority tasks.