EcoCoder


EcoCoder is an enhanced auto-code generation library sitting on top of the generic Matlab/Simulink. It links directly to the target controller. It integrates the code generation, the compiling, and the executable genreation in one click.

System support: Windows XP & Windows 7 & Windows 10

Supported versions of MATLAB: EcoCoder supports MATLAB2010b and above

MATLAB component requirements: ① MATLAB, ② Simulink, ③ MATLAB Coder, ④ Simulink Coder,
⑤ Embedded Coder, ⑥ Stateflow, ⑦ Stateflow Coder

Basic EcoCoder library and S-Function
1

When you install EcoCoder, it will automatically add all EcoCoder’s library blocks and S-functions to Simulink.

It will capture all the hardware drivers with EcoCoder S-functions, including ADC drivers, CAN drivers, digital IO drivers, PWM drivers etc. It’ll also capture the real-time operating systems with EcoCoder task scheduler S-function.

It links the application software, i.e. Simulink model, to the hardware drivers via EcoCoder library blocks and S-functions in Simulink environment.

When you run simulation in Simulink, it verifies model and software integrity.

After you click “code generation” button, EcoCoder will generate the microprocessor compatible codes automatically, which will invoke compiling and linking process, running in the background using a compiler, e.g. CodeWarrior, to compile the application code and hardware driver code together and generate the executable codes.

 

3 Files Generated by EcoCoder Compiling Process

  • Machine executable file, e.g. .MOT and .HEX file for NXP MPC57xx/56xx series and Infineon TC27xT microprocessors;
  • .A2L file, which is a descriptive file containing all the necessary info for the calibration tool to interpret the controller protocols and compatible with calibration software such as INCA/CANape;
  • .CAL file, containing only calibration data, without the program.

 

3.1 EcoCoder Target Definition

EcoCoder Target Definition is used to select the target controller model. After you drag this block into the Simulink model, EcoCoder will automatically configure the model parameters according to the target you’ve selected.

2

3.2 ADC

ADC(Analog-Digital-Converter) block is used to collect the input of the analog signal. There are three versions of ADC blocks for collecting the original AD value, the fixed point voltage value, and the floating point voltage value.

3.3 CAN

CAN block is used to define CAN communication, including CAN channel configuration, data interpretation, data packing, message receiving and sending, CAN wake-up configuration and CAN diagnostics etc.

3.4 Digital IN/OUT

Digital IN/OUT blocks can manage digital input and output signals, including digital input and output, frequency (PWM) signal input and output, wake-up signal input and H-bridge output control.

3.5 LIN

LIN communication block is used to define LIN channel parameters, including LIN bus status and data sending and receiving.

3.6 Task Scheduler

Task Scheduler is used to define task type and priority and monitor the tasks.

3.7 Non-Volatile Memory

Non-Volatile Memory block is used to define fixed NVM variables and non-fixed NVM variables, including variable type definition, variable initialization, data read/write, data initial value definition, variable address acquisition.

3.8 Diagnostic

Diagnostic block is used to enable the user to perform hardware level troubleshooting, including the diagnostic info of high/low side driver, power block, and H-bridge.

3.9 Calibration & Measurement

Calibration & Measurement block is used to define calibration and measurement variables. Calibration variables can be single value, 1-D array and 2-D array.

3.10 System Management

System Management blocks mainly include system power management, watchdog operation, system free running counter operations etc.

3.11 CCP

CCP block is used for CCP initialization, SeedKey definition (calibration, measurement and flashing) and seed task trigger and sending。

3.12 Programming

Programming block is used for online programming function definition, programming parameter definition etc.

3.13 Advanced Data

Advanced Data blocks mainly include special memory operation blocks, including OTP operation, flash analog EEPROM, and read data by address.

3.14 Application Base Block

Application Base blocks mainly include basic algorithm blocks that might be used for application model design.

3.15 XCP

XCP blocks mainly include XCP initialization and parameter configurations.

3.16 FlexRay

FlexRay blocks mainly include FlexRay communication definition, status acquisition, status restoration, message sending and receiving.

4 CAN protocol implementation

You can convert DBC file to .m file through EcoCAN, then select the .m file and the CAN message in the .m file in the CAN block in EcoCoder. CAN signals will be displayed when selecting and it will be connected to the signal in the model after selected.

4

5 User Defined Variable

User Defined Variables can be defined either by EcoObj in .m file, or by Model Explorer in MATLAB. You can click “Simulink NumericType” in Model Explorer->Base Workspace to define User Defined Variables.

5

Auto-Code Generation

After the model simulation passes, you can generate executable files by using shortcut “Ctrl+B” or clicking on the button below.

6