cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-MAT/Target Processor-in-the-Loop (PIL). Keil error compiling.

selector47
Associate II
Posted on May 29, 2016 at 21:33

Hi,

I have some problem with my Simulink model when I use her in PIL simulation mode with the STM32F4 Discovery Board via ST-Link debugger (SWD port).

My system configuration

:

- Windows 7 Professional x64;

- MatLab R2014a x64;

- Keil uVision v4.73 or v5.16;

- STM32CubeMX v4.15.0 (Firware packege STM32Cube FW_F4 V1.12.0);

- STM-32 MAT/TARGET v4.2.0.

MatLab directory:

C:\Program Files\MATLAB\R2014a

Keil directory:

C:\Program Files (x86)\Keil_v5

 or C:\Program Files (x86)\Keil_v473

STM32Cube directory:

C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeMX

STM-32 MAT/TARGET directory:

C:\MATLAB\STM32-MAT

I create simple Simulink model, build and run project on my STM32F4 Discovery board:

1.

https://drive.google.com/open?id=0B1LzDTmWWv9YdlMxNzhCT0o0TFE

2.

https://drive.google.com/open?id=0B1LzDTmWWv9YN3ZSQmNLR2tPbTA

3.

https://drive.google.com/open?id=0B1LzDTmWWv9YRjBqbzdDR3pKNHM

Then I switch on PIL mode and run Simulink model, got a compilation problem:

- PIL mode

https://drive.google.com/open?id=0B1LzDTmWWv9YeHg5dkhFR08zelk

- Diagnostic Viewer

https://drive.google.com/open?id=0B1LzDTmWWv9YQ0ZUWVlGOWVYdEU

https://drive.google.com/open?id=0B1LzDTmWWv9YVXRLMEZWMWlCNzA

https://drive.google.com/open?id=0B1LzDTmWWv9YZGFUMjZ5cHhrNDQ

https://drive.google.com/open?id=0B1LzDTmWWv9YdWpRQ1picmdmaU0

- CubeMX

https://drive.google.com/open?id=0B1LzDTmWWv9YRmF0ak1ZV1Fmb2M

- Keil v4.73

https://drive.google.com/open?id=0B1LzDTmWWv9YQlRXZUJXNzhzZzg

The problem is shown when I compile the project in the rt_main.c file. File rt_main.h is missing. How to correct these errors:

♯ error Must specify a model name.  Define MODEL=name.

♯ error Must specify the number of sample times.  Define NUMST=number

&sharperror Separate output and update functions are not supported by rt_main.c. \

You must update rt_main.c to suit your application needs, or select \

the 'Single output/update function' option.

Thanks.

#stm32-mat/target #matlab
5 REPLIES 5
Posted on June 02, 2016 at 16:28

Hello,

can you please verify model configuration parameters.

open configuration parameters window

code generation>System target file

You must select stm32.tlc (click browse and select stm32.tlc)

Set STM32 parameters and click ok.

You should not have rt_main.c generated file but main.c

Best regards

Pascal

selector47
Associate II
Posted on June 02, 2016 at 23:38

Hi,

I was doing these steps.

- First of all, I opend MatLab and joint the working directory of my project (�?¡:\test).

- Then, I create a new Simulink-file in this directory (�?¡:\test\test.slx).

- I open STM32Cube and create new .io file  for STM32F407VG, then I generated project for Keil v4 (�?¡:\test\test\test.io, �?¡:\test\test\Drivers, �?¡:\test\test\Inc, �?¡:\test\test\MDK-ARM, �?¡:\test\test\Src, �?¡:\test\test\test).

- In my Simulink model (test.slx) I configure Code Generation parameters: select stm32.tcl file in the Cedo Generation->System target file

- Set STM32 options (Download Application, STM32Cube path update), then click apply button.

-  Switched simulink model in PIL mode

- Add to the model STM32_Config block

- In this block I chose my test.io file

- Then I add GPIO_Write block, Pulse Generation block

- Connect my STM32 Discovery board to PC across SWD debugger and USB to UART converter.

- Click to Run button in Simulink model window

- Follow step-by-step on-screen instructions

- Reconfigure STM32Cube project

- Generate new Keil v4 project

- In the Keil v4.73 I open last generation project and get again the problems described above.

In the latest Keil project has both a main.c file and rt_main.c file.

Keil can'n compile rt_main.c file.

Posted on June 03, 2016 at 11:24

Hi,

You wrote:

I open STM32Cube and create new .io file  for STM32F407VG, then I generated project for Keil v4 (�?¡:\test\test\test.io, �?¡:\test\test\Drivers, �?¡:\test\test\Inc, �?¡:\test\test\MDK-ARM, �?¡:\test\test\Src, �?¡:\test\test\test).

 It is not necessary to generate project. Just create ioc that will be used from Simulink.

But this is not a pb.

- Then I add GPIO_Write block, Pulse Generation block

This is a problem because STM32 drivers are not allowed during PIL

PIL is only used to do processing without any STM32 peripheral inputs

Sorry, but this will be available for next release of STM32 toolset. It is ''external mode'' planned for end of June.

Best regards

Pascal

selector47
Associate II
Posted on June 03, 2016 at 12:25

Thank you for your response.

xiangxlhit
Associate
Posted on August 29, 2016 at 04:19

 have 

 ,