How to create Code Warrior project with code generated by Motor Control Development Toolbox in Simulink?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create Code Warrior project with code generated by Motor Control Development Toolbox in Simulink?

Jump to solution
5,357 Views
zili
Contributor II

Hi,

I'm using Motor Control Development Toolbox in Simulink for MPC5643L and trying to download the code into the MCU. For some reason, code downloading by RAppID doesn't work. Thus, I'm trying to create a code warrior project (CodeWarrior 10.7) with the generated code. Should I use the makefile importer wizard in CW or create a CW project and add files? What is the right procedure to do this work? Many thanks.

1 Solution
3,820 Views
raduivan
NXP Employee
NXP Employee

Hi Zili,

   To be able to download the application using the toolbox you have to flash the rbf file first, please see where to look for MPC564xL.rbf file ? 

Regarding the second question you can use CW elf importer to load the executable info and to make a debug session.

pastedImage_2.png

pastedImage_3.png

Best regards,

Radu

View solution in original post

0 Kudos
22 Replies
3,821 Views
raduivan
NXP Employee
NXP Employee

Hi Zili,

   To be able to download the application using the toolbox you have to flash the rbf file first, please see where to look for MPC564xL.rbf file ? 

Regarding the second question you can use CW elf importer to load the executable info and to make a debug session.

pastedImage_2.png

pastedImage_3.png

Best regards,

Radu

0 Kudos
3,643 Views
fengwang
Contributor I

Hi Radu,

I am using MCToolbox in simulink for S32k144 and trying to generate from the model and download the code into the MCU.

For some reason ,code downloading by RAppID doesn't work . Building the example  model , occur the error in matlab , like this:

pastedImage_1.pngpastedImage_2.png

      

I can't find a good way to solve this . what is the right procedue to do this work ? I need you help !!

Many thanks .

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Feng,

From the error message it looks like you don't have the Toolbox "Embedded Coder" installed or a license for that Toolbox. Can you please type 'ver' in MATLAB command window and send me the output?

Best regards,

Radu

0 Kudos
3,643 Views
fengwang
Contributor I

Hi Radu,

Do it as you like :

### Starting build procedure for model: ftm_s32k14_input_capture
### Build procedure for model: 'ftm_s32k14_input_capture' aborted due to an error.

ME =

MException with properties:

identifier: 'RTW:makertw:licenseUnavailable'
message: [1x136 char]
cause: {}
stack: [13x1 struct]

exception id RTW:makertw:licenseUnavailable message Embedded Coder is not licensed or not installed. The current target is: C:\MCToolbox\mctbx_S32K\mctbx_s32k14\mctbx_s32k14\mcd_s32k14.tlc >>
>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
MATLAB License Number: unknown
Operating System: Microsoft Windows 8 Version 6.2 (Build 9200)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.2 (R2013b)
Simulink Version 8.2 (R2013b)
Bioinformatics Toolbox Version 4.3.1 (R2013b)
Communications System Toolbox Version 5.5 (R2013b)
Computer Vision System Toolbox Version 5.3 (R2013b)
Control System Toolbox Version 9.6 (R2013b)
Curve Fitting Toolbox Version 3.4 (R2013b)
DSP System Toolbox Version 8.5 (R2013b)
Data Acquisition Toolbox Version 3.4 (R2013b)
Database Toolbox Version 5.0 (R2013b)
Econometrics Toolbox Version 2.4 (R2013b)
Financial Toolbox Version 5.2 (R2013b)
Fixed-Point Designer Version 4.1 (R2013b)
Fuzzy Logic Toolbox Version 2.2.18 (R2013b)
Global Optimization Toolbox Version 3.2.4 (R2013b)
Image Acquisition Toolbox Version 4.6 (R2013b)
Image Processing Toolbox Version 8.3 (R2013b)
Instrument Control Toolbox Version 3.4 (R2013b)
MATLAB Builder EX Version 2.4 (R2013b)
MATLAB Builder JA Version 2.3 (R2013b)
MATLAB Builder NE Version 4.2 (R2013b)
MATLAB Coder Version 2.5 (R2013b)
MATLAB Compiler Version 5.0 (R2013b)
MATLAB Report Generator Version 3.15 (R2013b)
MCD Toolbox Samples for S32K14x Version 1.0 (R2013a-R2016a)
Mapping Toolbox Version 4.0 (R2013b)
Motor Control Development Toolbox for S32K Series Version 1.0 (R2013a-R2016a)
Neural Network Toolbox Version 8.1 (R2013b)
Optimization Toolbox Version 6.4 (R2013b)
Parallel Computing Toolbox Version 6.3 (R2013b)
Partial Differential Equation Toolbox Version 1.3 (R2013b)
Real-Time Windows Target Version 4.3 (R2013b)
Robust Control Toolbox Version 5.0 (R2013b)
Signal Processing Toolbox Version 6.20 (R2013b)
SimBiology Version 4.3.1 (R2013b)
SimHydraulics Version 1.13 (R2013b)
SimMechanics Version 4.3 (R2013b)
SimPowerSystems Version 6.0 (R2013b)
Simscape Version 3.10 (R2013b)
Simulink Coder Version 8.5 (R2013b)
Simulink Control Design Version 3.8 (R2013b)
Spreadsheet Link EX Version 3.2 (R2013b)
Stateflow Version 8.2 (R2013b)
Statistics Toolbox Version 8.3 (R2013b)
Symbolic Math Toolbox Version 5.11 (R2013b)
System Identification Toolbox Version 8.3 (R2013b)
Wavelet Toolbox Version 4.12 (R2013b)
xPC Target Version 5.5 (R2013b)
xPC Target Embedded Option Version 5.5 (R2013b)
>>

Best regards,

Feng

0 Kudos
3,643 Views
fengwang
Contributor I

Hi Radu,

yes, you are right,thank you

but i  installed the Toolbox "Embedded Coder" , occur the this issue:

Warning: The following error was caught while executing 'coder.internal.ModelBuilder' class destructor:
Error: File: execstring Line: 1 Column: 27
Unterminated string

ME =

MException with properties:

identifier: ''
message: 'Error: File: execstring Line: 1 Column: 27
Unterminated string
'
cause: {0x1 cell}
stack: [15x1 struct]

exception id message Error: File: execstring Line: 1 Column: 27
Unterminated string

 I can't find the way to kill this trouble, can you help me ?

Best regards,

Feng

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Feng,

   This seems to be rated to a MATLAB issue(Why do I get an error when I try to assign a string value which contains blanks to a TLC variable wi... ) Can you please try a newer version of MATLAB?

Regards,

Radu

0 Kudos
3,643 Views
fengwang
Contributor I

Hi Radu,

     Thank you do this for me , I find the reassion occur the error . Building  is ok , i find the ".mot". I use the RAppID to download the code into the MCU.

Occur this error :

pastedImage_1.png

I need you help again !

Many thanks 

Best regards,

Feng

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Feng,

In order to use the Bootloader you need to write the rbf file but it is an easier way to put the application on the target. Double click on MCD_S32K14x_Config_Information block, select PIL and Download Config and use the OpenSDA interface and set your Drive Name .

pastedImage_2.png

Best regards,

Radu

0 Kudos
3,643 Views
fengwang
Contributor I

Hi Radu,

my model set as you said , but the error is not change ~

pastedImage_2.png

pastedImage_3.png

0 Kudos
3,639 Views
fengwang
Contributor I

Hi Radu,

Why i can't the message about "[No rbl File Loaded ]" in the RAppID BL Tool ?

pastedImage_2.png

Best regards,

Feng

0 Kudos
3,639 Views
fengwang
Contributor I

Hi Radu,

I can't solve this error , I need you help , please !

Best regards,

Feng

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Feng,

   Please make sure your OpenSDA drive is E: and second the application is automatically moved to the target after build so you will have to rebuild the application. Bootloader is not used in this scenario.

Best regards,

Radu

0 Kudos
3,640 Views
fengwang
Contributor I

Hi Radu,

OpenSDA Driver Name:how could I to choose , or it must be E ?

Best regards,

Feng

0 Kudos
3,643 Views
zili
Contributor II

Hi Radu,

Thanks for the reply. But after building the model in Simulink, I didn't see .elf generated in the "_rappid_rwt" folder?

The setting of code generation is as below

pastedImage_1.png

Thanks.

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Zili,

   Can you please archive your rtw folder and sent it to me? Maybe I can see something related to the build/elf generation.

Regards,

Radu

0 Kudos
3,643 Views
zili
Contributor II

Yes, the attached file contains one example provided in rappid564xl folder. I only changed some configurations in the block of RAppID_564xL_Config to make it compliant with the dev board. As you can see in the model configuration, under the tab of code generation, there is only option of tlc file to choose from, but no options of toolchain. Thanks.

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Zili,

   I found the issue, you have the option 'Generated code only' enabled, please see below. By default the examples don't have that option selected.

Regards,

Radu

pastedImage_2.png

0 Kudos
3,643 Views
zili
Contributor II

Hi Radu,

I tried to deselect the option of 'Generate code only', but .elf file is still not generated.

Kind regards,

Zili

0 Kudos
3,643 Views
raduivan
NXP Employee
NXP Employee

Hi Zili,

   What type of error do you have? Please send the "Diagnostics View" output. If you see in the console the message listed below you need to updated the tmf file and add the following line at the beginning: SHELL = cmd

File:"MCToolbox\rappid564xl\rappid564xl\rappid_564xl_cw_flash.tmf"

Console error message:

==== Removing object files from build directory ====
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
gmake: *** [clean] Error 1

Regards,

Radu

0 Kudos
3,644 Views
zili
Contributor II

Hi Radu, 

I wasn't aware of the diagnostic viewer. The error is not like you mentioned. I guess there is something wrong with the Assembler details.

I have both CW2.1 and CW10.7 installed. In order to make the embedded coder find CW10.7. I deleted the environment variable of MW_TOOL for CW2.1 and created CW_TOOL for CW10.7 with the value of D:/Freescale/"CW MCU v10.7".

=== Build (Elapsed: 15 sec) ===
### Starting build procedure for model: SineWave_block
### Generating code into build folder: C:\Freescale\Sin_Gen\SineWave_block_rappid_rtw
### Invoking Target Language Compiler on SineWave_block.rtw
### Using System Target File: C:\Program Files (x86)\Freescale\MCToolbox\rappid564xl\rappid564xl\rappid564xl.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing source file SineWave_block.c
.
### Writing header file SineWave_block_private.h
### Writing header file SineWave_block.h
### Writing header file SineWave_block_types.h
### Writing header file rtwtypes.h
### Writing source file rappid_main.c
.
### Writing source file intc_sw_vectable.c
### Writing source file intc_init.c
### Writing header file sysclk.h
### Writing source file linflex_init.c
### Writing source file linflex_siu_init.c
.
### Writing header file freemaster_device.h
### Writing header file target.h
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
.
### Processing Template Makefile: C:\Program Files (x86)\Freescale\MCToolbox\rappid564xl\rappid564xl\rappid_564xl_cw.tmf
### SineWave_block.mk which is generated from C:\Program Files (x86)\Freescale\MCToolbox\rappid564xl\rappid564xl\rappid_564xl_cw.tmf is up to date
### Building SineWave_block: .\SineWave_block.bat

C:\Freescale\Sin_Gen\SineWave_block_rappid_rtw>set MATLAB=C:\MATLAB\R2016a

C:\Freescale\Sin_Gen\SineWave_block_rappid_rtw>"C:\MATLAB\R2016a\bin\win64\gmake" -f SineWave_block.mk GENERATE_ERT_S_FUNCTION=0 INCLUDE_MDL_TERMINATE_FCN=1 COMBINE_OUTPUT_UPDATE_FCNS=1 MULTI_INSTANCE_CODE=0 INTEGER_CODE=0 ISPROTECTINGMODEL=NOTPROTECTING
clean
RELATIVE_PATH_TO_ANCHOR is ..
==== Removing object files from build directory ====
Copying necessary files to build directory...
Compiler details : "D:/Freescale/"CW MCU v10.7"/MCU/PA_Tools/Command_Line_Tools/mwcceppc" -vle -DVLE_IS_ON -gdwarf-2 -fp spfp_only -spe_vector -char unsigned -proc Zen -gccincludes -nostdinc -nosyspath -ansi off -opt all -bool on -Cpp_exceptions off -prefix "D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/EWL_C/include/lib_ewl.prefix" -I. -I.. -I"C:\MATLAB\R2016a"\simulink\include -I"C:\MATLAB\R2016a"\extern\include -I"C:\MATLAB\R2016a"\rtw\c\src -I"C:\MATLAB\R2016a"\rtw\c\libsrc -I"C:\MATLAB\R2016a"\rtw\c\src\ext_mode\common -I"C:\MATLAB\R2016a"\rtw\c\src\ext_mode\tcpip -I"C:\MATLAB\R2016a"\rtw\c\src\ext_mode\serial -I"C:\MATLAB\R2016a"\rtw\c\src\ext_mode\custom -I"D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/EWL_Runtime/Runtime_PA/Include" -I"D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/EWL_Runtime/Runtime_PA/Source" -I"D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/lib" -I"D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/EWL_C/include" -I"D:/Freescale/"CW MCU v10.7"/MCU/PA_Support/ewl/EWL_C++/include" -IC:\MATLAB\R2016a\simulink\include\sf_runtime -IC:\Freescale\Sin_Gen\SineWave_block_rappid_rtw -IC:\Freescale\Sin_Gen -DUSE_RTMODEL -DMODEL=SineWave_block -DREAL_T=float -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -c
Assembler details : "D:/Freescale/"CW MCU v10.7"/MCU/PA_Tools/Command_Line_Tools/mwasmeppc" -vle -DVLE_IS_ON -proc Zen -list -gccincludes -nostdinc -c
Building assembly file crt0.o...
'"D:/Freescale/"CW' is not recoginzed as internal or external command 
operable program or batch file.
gmake: *** [crt0.o] Error 1
### Build procedure for model: 'SineWave_block' aborted due to an error.
Build process completed successfully

As instructed in the MCT Installation quick start manual, I use '' '' around any directory that have spaces in the names. Is it wrong?

pastedImage_4.png

Kind regards,

Zili

0 Kudos