Hi dynexdave,
Lets break down the thread and address each of the questions.
I have a Matlab Simulink model from which I generate C code using Matlab Embedded coder. I'd like to run processor in the loop (PIL) simulations using my target MCU (NXP 5643L) from Matlab using the auto-generated code. The compiler I'm using for the target is CodeWarrior Development Studio for MPC55xx/MPC56xx (Classic IDE) v2.10 (from within software it's version 5.9.0, build 3510), I believe this also needs to be used in the process to build the generated code?
Any code that needs to be executed on MPC5643L must be cross compiled with one of the 4 compilers supported by the NXP MATLAB Toolbox. These compilers are:
- GHS_TOOL = C:/ghs/multi517
- DIAB_TOOL = C:/WindRiver/diab
- MW_TOOL = C:/"Program Files"/Freescale/"CW for MPC55xx and MPC56xx 2.8"
- CW_TOOL = C:/Freescale/"CW MCU v10.6"
where <COMPILER_STRING>_TOOL is a system variable
Therefore, the answer for your first question is - YES - you will need to ensure a proper compiler is set in order to build the generated code from MATLAB to obtain the ELF/MOT/BIN or HEX file that must be loaded into the MPC5643L FLASH or RAM memory.
I've done some on target testing previously using the 5643L, in that case I set up a project in CodeWarrior, then the auto-generated files would overwrite the project source files and I initiated build and execute processes using a batch file.This doesn't constitute PIL though, I'm struggling to see how to set it up to work from Matlab
You will need to clarify this a little bit more.
So, you have a project that contains some C-source file and now you wish to include the C-files generated from MATLAB into this CodeWarrrior project ?
Do you want to achieve something like a hybrid project (part of the sources are custom + part of the source generated from MATLAB ?
You should be aware that the NXP Toolbox is configure to generated a standalone project ready to run on the target. All you can do is to have an intermediate step that will copy the files from the generated folder into the CW project folder. Most likely you can do that automatically as a prebuild command using the makefile.
Does anyone have any experience of setting up a Matlab PIL simulation for a 5643L or similar?
Converting any Simulink Model to run as PIL should not be an issue. You could find examples on Mathworks or you can watch this video Video Link : 7845 to see the main steps of START to PIL model conversion. Please note that is for a slightly different processor and toolbox but the "philosophy" behind is the same.
How can I integrate CodeWarrior into the process to re-build the project using the new auto-generated code? I assume this all needs to be set up from the Matlab side? Does anybody have any material that would help that they could possibly share with me? I was thinking to save some time I'd use the Lauterbach TRACE32 simulator instead of the actual target initially.
PIL is a co-simulation. Part of the simulink model will be executed on the Host PC and part of it will be executed on the real HW: MPC5643L. The NXP's Matlab Toolbox will generate the appropriate files for the XIL interface (Serial Comm between MATLAB and the MPC5643L) and the Linker files needed to compile the project. Then will download the ELF to the target and finally the MATLAB will control the simulation via XIL interface.
In the c:\MCToolbox\rappid564xl\Examples\ folder you can find an example ready to be run on the MPC5643L for PIL simulation.
Please keep in mind that the toolbox was designed to use the real HW for the PIL simulation - therefore using a simulator will not help you.
Hope this helps!
Daniel