cancel
Showing results for 
Search instead for 
Did you mean: 

PIL mode with STM32 Embedded Target, IAR, and J-LINK

daryl
Associate II
Posted on January 13, 2014 at 13:31

Hi

I've recently been playing the with STM32 Discovery using IAR and J-LINK and Simulink.  I've managed to set everything up okay, and can deploy some of the test Simulink models that ship with the STM32 Embedded Target software (e.g. blinking LED).  This all works fine.

When I try to run the IIR filter PIL model, however, I run into a problem.  After setting the ''reference'' model up with my toolchain and selecting PIL mode, I attempt to run the top level model.  It get's through code generation okay, but errors out when running the generated makefile for the model reference PIL block. I've attached the output (modified to shorten paths) below:

♯♯♯ IIR_Filter_int32.mk which is generated from <STMPATH>\rtw\stm32F4xx.tmf is up to date

♯♯♯ Building IIR_Filter_int32: .\IIR_Filter_int32.bat

 <STMPATH>\STM32F4xxdemos\CodeGeneration\slprj\stm32F4xx\IIR_Filter_int32>set MATLAB=C:\MATLAB\R2013b 

<STMPATH>\STM32F4xxdemos\CodeGeneration\slprj\stm32F4xx\IIR_Filter_int32>''C:\MATLAB\R2013b\bin\win64\gmake'' -f IIR_Filter_int32.mk  GENERATE_ASAP2=0 STM32TARGET=''STM32F4xxx'' TOOLPATHFROMREGISTRY=1 DONGLE=''J-Link'' COMPILERSETTINGS=''--cpu Cortex-M4 --debug -D ARM_MATH_CM4 -D STM32F4XX -D USE_STDPERIPH_DRIVER --endian=little'' LINKERSETTINGS=''--map $(MODEL)_IAR_$(BOOT_MODE).map --config $(LDDIR)\$(STM32TARGET)_$(BOOT_MODE).icf --search .. --search $(TOOLPATH)\..\lib'' ASSEMBLERSETTINGS=''-s+ -w+ -r --cpu cortex-M3 --fpu None --endian little'' DOWNLOADAPPLICATION=0 SIMULATION_MODE_RP=''PIL'' TARGET_SRCS=''system_stm32f4xx.c stm32f4xx_gpio.c stm32f4xx_rcc.c stm32f4xx_flash.c stm32f4xx_pwr.c '' SYSTEM_SRCS=''stm32f4xx_it.c '' STARTUP_SRCS=''startup_stm32f4xx.s'' 

♯♯&sharpMakefile for IAR

♯♯&sharpBuildMode : model_reference MODELREF_TARGET_TYPE=RTW SIMULATION_MODE_RP=PIL MAKEFILEBUILDER_TGT=0 STANDALONE_SUPPRESS_EXE=0

♯♯&sharpStartup file: startup_stm32f4xx.o 

♯♯&sharpStartup path: ''C:\MATLAB\SUPPOR~1\STMICR~1\STM32F~1\STM32F~1''\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates\iar 

gmake: *** No rule to make target `startup_stm32f4xx.o', needed by `IIR_Filter_int32_rtwlib.lib'.  Stop.

♯♯♯ Real-Time Workshop build procedure for method: 'error

♯♯♯ Real-Time Workshop build procedure for model: 'IIR_Filter_int32' aborted due to an error.

Any pointers would be appreciated.

#stm32-simulink-pil-jlink
13 REPLIES 13
daryl
Associate II
Posted on January 17, 2014 at 00:02

Hi Pascal.

Thank you!  That has solved the compilation of the PIL code generation problem.

Another question (sorry but I'm a complete newbie to this).  I've connected the J-Link to the Discovery board as per the instructions on this application note: 

http://www.segger.com/admin/uploads/evalBoardDocs/AN00014_ConnectingJLinkToSTM32F407Discovery.pdf

Do you know if the J-LINK have a serial connection capability or will I have I to connect to the USART pins on the discovery board using a separate serial device?

Thanks again

Daryl.

daryl
Associate II
Posted on January 17, 2014 at 06:45

Hi Pascal

As a follow on to my previous question, if I do need to use a separate serial device, do you have any specific recommendations or requirements for the Discovery board?

Daryl.

Posted on January 17, 2014 at 10:04

Hi Daryl,

there is not DB9 connector on Discovery board (no level shifter).

You can not directly connect a serial com cable.

But, you can use a USB convertor like this one (for example):

http://www.amazon.fr/PL2303HX-Convertisseur-vers-c%C3%A2ble-module/dp/B00ATALGI6

Then, you can connect Rx/Tx to discovery Pin.

There is a popup windows during build to select Discovery port.

PC COM port used must be enter as a preference  using cmd:

getpref('STM32F4xx','COMPort') to know selected COM port.

setpref('STM32F4xx','COMPort','COM5') to set COM port used (here COM5 for example).

Best regards

Pascal

daryl
Associate II
Posted on January 28, 2014 at 23:51

Sorry for the late response, but I have been away.  Thanks for all your support and advice.  It has been very helpful.

Daryl.