2014-01-13 04:31 AM
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-jlink2014-01-13 06:13 AM
Hi
Looks to me like there is no target (ie processor) set for the build. ''model_reference MODELREF_TARGET_TYPE=RTW SIMULATION_MODE_RP=PIL MAKEFILEBUILDER_TGT=0 '' You need to select a processor so that the correct libraries for that processor are used.2014-01-14 01:38 AM
Hi Daryln,
I think you didn't set toolchain (configuration parameters) for both models. You must set exactly same parameters for top model and referenced model. ie: same toolchain etc.. Then, for PIL simulation: 1) You must set IIR_Filter_int32 model (or reference model you want to run PIL) ''simulation mode'' to Processor-in-the-loop. This is to be able to generate STM32 code for this model. 1) You must set ''Bloock Parameters (ModelReference )'' (Rigth click on model Reference on top level model) ''Simulation mode:'' parameter to Processor-in-the-loop (PIL) too. This is to automatically wrap RTIOstream code to C generated code. Finally, you set simulation time you want to do (take care PIL com is 115200bps and can take long time) and press RUN button. Hope it helps. Best regards Pascal2014-01-14 02:20 PM
Hi Pascal,
Thanks for the tips. I've actually followed what you said. I modified both configuration parameter properties in the top model and the model reference. I even created a reference configuration object from the top model, and shared it with the reference model to ensure they were the same. But I still get the same error when executing the generated makefile. Any other ideas?Daryl2014-01-15 01:52 AM
Hi
Are you building using the command line? Or is this a IAR Workbench project? Workbench has a fairly good IDE, you can find the device type and family somewhere in the project properties.2014-01-15 03:53 AM
Hi Daryln,
I forgot to say you that you have to remove generated files when you modify parameters before you RUN it again. Please remove slprj generated repository and try to RUN again. If KO, copy all command window contents. Best regards Pascal2014-01-15 01:50 PM
2014-01-15 02:07 PM
Hi Pascal,
Even when I removed the slprj folder, I get the same error. Here is the full output from my command window and I've also attached the generated Make file: ### Model reference SIM target (IIR_Filter_int32_msf.mexw64) for model IIR_Filter_int32 is out of date because the binary information cache does not contain necessary information. This may be caused by the slprj directory having been removed or by a previous build of this model not succeeding. ### Updating model reference SIM target for model: IIR_Filter_int32 ### Successfully updated the model reference SIM target for model: IIR_Filter_int32 ### Model reference RTW target (IIR_Filter_intc) for model IIR_Filter_int32 is out of date because IIR_Filter_intc does not exist. ### Real-Time Workshop build procedure for method: 'entry ### Starting build procedure for model: IIR_Filter_int32 ### Starting Real-Time Workshop build procedure for model: IIR_Filter_int32 ### Model connectivity is: processor-in-the-loop (pil) ### Create verification block: PIL ### Check Current Directory for building application. ### Directory Check succeeded. ### Generating code into build folder: C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\CodeGeneration\slprj\stm32F4xx\IIR_Filter_int32 ### Real-Time Workshop build procedure for method: 'before_tlc ### before_tlc ### Top model: 'IIR_Filter_int32 ### Model: 'IIR_Filter_int32 ### Invoking Target Language Compiler on IIR_Filter_intrtw ### Using System Target File: C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tlc ### Loading TLC function libraries ..... ### Initial pass through model to cache user defined code . ### Caching model source code ...................... Warning: simMode value is 1.0 Warning: Create main.c for PIL ### Writing header file IIR_Filter_inth . ### Writing header file IIR_Filter_int32_types.h ### Writing header file rtwtypes.h ### Writing header file model_reference_types.h . ### Writing source file IIR_Filter_intc ### Writing header file IIR_Filter_int32_private.h . ### Writing source file main.c ### Writing header file rtw_shared_utils.h . ### TLC code generation complete. ### Real-Time Workshop build procedure for method: 'after_tlc ### after_tlc ### Creating HTML report file IIR_Filter_int32_codegen_rpt.html ### Creating project marker file: rtw_proj.tmw ### Real-Time Workshop build procedure for method: 'before_make ### Code Format : Embedded-C . ### Processing Template Makefile: C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tmf ### Wrapping unrecognized make command (angle brackets added) ### <''%MATLAB%\bin\%MATLAB_WIN_VER%\gmake''> ### in default batch file ### Creating IIR_Filter_intmk from C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tmf ### Building IIR_Filter_int32: .\IIR_Filter_intbat C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\CodeGeneration\slprj\stm32F4xx\IIR_Filter_int32>set MATLAB=C:\MATLAB\R2013b C:\MATLAB\SupportPackages\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\CodeGeneration\slprj\stm32F4xx\IIR_Filter_int32>''C:\MATLAB\R2013b\bin\win64\gmake'' -f IIR_Filter_intmk 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=1 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'' ###Makefile for IAR ###BuildMode : model_reference MODELREF_TARGET_TYPE=RTW SIMULATION_MODE_RP=PIL MAKEFILEBUILDER_TGT=0 STANDALONE_SUPPRESS_EXE=0 ###Startup file: startup_stm32f4xx.o ###Startup 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. Thanks for your help. Daryl. ________________ Attachments : IIR_Filter_int32.mk : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzuF&d=%2Fa%2F0X0000000bR1%2F2wwti5mW2Mt28_wpAZnKtRzIzX3RbOXkFHYyVunHVIE&asPdf=false2014-01-16 05:03 AM
Hi Daryln,
I'm very sorry, it is a bug I didn't remember and I have fixed for next release (end of February). Please, modify ...\STM32F4xx\rtw\stm32F4xx.tmf file Remove blanck char at the end of line: PATHSTARTUP = $(TARGET_PATH)\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates\iar (Line 198) Then, it will be ok. Best regards Pascal2014-01-16 05:05 AM
Hi Daryln,
I'm very sorry, it is a bug I didn't remember and I have fixed for next release (end of February). Please, modify ...\STM32F4xx\rtw\stm32F4xx.tmf file Remove blanck char at the end of line: PATHSTARTUP = $(TARGET_PATH)\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates\iar (Line 198) Then, it will be ok. Best regards Pascal