Sei sulla pagina 1di 34

Workflow Using CubeMx/DaVE,

Simulink, Code Generator and Third-


party IDE

(c) Professor Salem HASNAOUI -


4/2/17 1
2017
Workflow Using CubeMx/DaVE,
Simulink, Code Generator and Third-
party IDE

(c) Professor Salem HASNAOUI -


4/2/17 2
2017
Workflow Using DaVE, Simulink,
Code Generator and Third-party
IDE

HIL
MIL Test
Test
PIL
SIL Test
Test

(c) Professor Salem HASNAOUI -


4/2/17 3
2017
Workflow Using CubeMx, Simulink,
Code Generator and Third-party
IDE

+
HIL
Test
MIL
Test
SIL
Test
PIL Test +

Code Generators

STM32CubeMx

(c) Professor Salem HASNAOUI -


4/2/17 4
2017
HIL Hardware in the Loop
Simulation

(c) Professor Salem HASNAOUI -


4/2/17 5
2017
Workflow and Models (System,
Platform, Plant & Environment)
Domain
experts as
developers 3. Plant &
1. System models Environment
Controller models
Power supply, (ECU)
Network,

Realistic system test


results, early Device

Realistic functional
test results, early
Supplier(s)
2. Platform models Platform
independence?

(c) Professor Salem HASNAOUI -


4/2/17 6
2017
Workflow Using CubeMx, Simulink,
Code Generator and IAR IDE

Steps (18) for generating C


codes for the STM32F4
platform using the MBD
approach
e of the tools:
Simulink build tool (C code of the algorithm)
CubeMx for hardware initialization and drivers genera
AR IDE for the development process

(c) Professor Salem HASNAOUI -


4/2/17 7
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

1.Create a folder to will contain:


a. The CubeMx Project (ex.
GI3_GM3 as a subfolder)
b. Run Matlab and change to the
folder early created
2. Run Simulink and choose Blank
Model

(c) Professor Salem HASNAOUI -


4/2/17 8
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

b. Change to the folder early created

(c) Professor Salem HASNAOUI -


4/2/17 9
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
2. Lunch Simulink Black Model and then the library browser

a step by step guide

(c) Professor Salem HASNAOUI -


4/2/17 10
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

3. Go to Target Support Package STM32 Adapter


(c) Professor Salem HASNAOUI -
4/2/17 and double click on it 11
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

4. Double clic sur MCU Config

(c) Professor Salem HASNAOUI -


4/2/17 12
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

5. Drag
STM32_Config
from Simulink
Library browser
to the new
simulink model

(c) Professor Salem HASNAOUI -


4/2/17 13
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

6. Drag STM32_Config

(c) Professor Salem HASNAOUI -


4/2/17 14
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

7. Go to Model
Configuration
Parameters and choice
Code Generator
(c) Professor Salem HASNAOUI -
4/2/17 15
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

Initialization of
Simulation
Target Pane

(c) Professor Salem HASNAOUI -


4/2/17 16
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

8. Go to Model Configuration
Parameters and
choice the discrete solver
(and Apply)
Go to Code Generation
(c) Professor Salem HASNAOUI -
4/2/17 17
2017
Simulink Model setting to take account
STM32CubeMx
a step by step guide

9. Choice the
stm32.tlc as
target language
compiler by
clicking the
browse button

(c) Professor Salem HASNAOUI -


4/2/17 18
2017
Simulink Model setting to take account
STM32CubeMx
a step by step guide (see to following 3
pages)

(c) Professor Salem HASNAOUI -


4/2/17 19
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

10. The STM32 Options


appears. Click and
check STM32 CubeMx
path update and click
on the Update
4/2/17
(c) Installed
Professor Salem HASNAOUI - path 20
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

11. Double Click on the


STM32_Config block
and select the STM32
Configuration file
within the .ioc file is
saved
(c) Professor Salem HASNAOUI -
4/2/17 21
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

Allez au
11. Double Click on the
rpertoire o seblock and
STM32_Config
trouve
selectlethe
fichier
STM32
iocConfiguration
(ISI-MBD.ioc, file within
dans
thenotre cas),
.ioc file is saved (just
an"Apply"
puis example)et
"OK"
(c) Professor Salem HASNAOUI -
4/2/17 22
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

12. Go to Target
Support Package-
STM32 Adapter
and double click
on GPIO Library
and
dragGPIO_Write

(c) Professor Salem HASNAOUI -


4/2/17 23
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

13.Double click on
GPIO_Write and
Select GPIOD (LEDs
of the Discovery
board

(c) Professor Salem HASNAOUI -


4/2/17 24
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

14.Select GPIOD et
check Toggle Pin12
until pin 15, then
Apply and "OK"

(c) Professor Salem HASNAOUI -


4/2/17 25
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

15.Save the Simulink


Project under the
first created
folder

(c) Professor Salem HASNAOUI -


4/2/17 26
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

16.Include comments

(c) Professor Salem HASNAOUI -


4/2/17 27
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

17.Execute the
model (if there
scope for
example)

(c) Professor Salem HASNAOUI -


4/2/17 28
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator
a step by step guide

18.Build Model (last step) Generation of C


code as Matlab middleware and an IAR
project
(c) Professor Salem HASNAOUI -
4/2/17 29
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator

(c) Professor Salem HASNAOUI -


4/2/17 30
2017
(c) Professor Salem HASNAOUI -
4/2/17 31
2017
(c) Professor Salem HASNAOUI -
4/2/17 32
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator

(c) Professor Salem HASNAOUI -


4/2/17 33
2017
Workflow Using CubeMx, IAR Embedded
WorkBench, Simulink et Code Generator

(c) Professor Salem HASNAOUI -


4/2/17 34
2017

Potrebbero piacerti anche