1 \newcommand{\superscript}[1]{\ensuremath{^{\textrm{\small#1}}}}
2 \newcommand{\subscript}[1]{\ensuremath{_{\textrm{\small#1}}}}
4 \documentclass{article}
6 \usepackage{graphicx} % images and graphics
7 \usepackage{paralist} % needed for compact lists
8 \usepackage[normalem]{ulem} % needed by strike
9 \usepackage{listings} % required for code blocks
10 \usepackage[urlcolor=blue,colorlinks=true,hyperfootnotes=false]{hyperref} % links
11 \usepackage[utf8]{inputenc} % char encoding
12 \usepackage[bottom]{footmisc} % footnotes
15 \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
16 \usepackage{float} % To fix images position
18 % Prettify code documentation
20 \definecolor{gray97}{gray}{.97}
21 \definecolor{gray75}{gray}{.75}
22 \definecolor{gray45}{gray}{.45}
27 framexbottommargin=3pt,
28 framexleftmargin=0.4cm,
31 backgroundcolor=\color{gray97},
32 rulesepcolor=\color{black},
34 stringstyle=\ttfamily,
35 showstringspaces = false,
36 basicstyle=\small\ttfamily,
37 commentstyle=\color{gray45},
38 keywordstyle=\bfseries,
43 numberfirstline = false,
49 \addtolength{\parskip}{\baselineskip} % Paragraph spacing
50 \linespread{1.15} % Lines spacing
51 \setlength{\plitemsep}{0.5\baselineskip} % List items spacing
52 \definecolor{deepblue}{RGB}{0,0,61}
53 \hypersetup{linkcolor=deepblue,}
55 % Table of content depth
56 \setcounter{tocdepth}{4}
60 \usepackage{pdflscape}
63 \usepackage{changepage}
67 % \renewcommand{\familydefault}{\sfdefault}
77 \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
82 % Upper part of the page
83 \includegraphics[width=0.70\textwidth]{media/images/logos.png}\\[1cm]
84 \textsc{\LARGE Costa Rica Institute of Technology}\\[0.5cm]
85 \textsc{\LARGE Czech Technical University in Prague}\\[1.5cm]
86 \textsc{\Large Undergraduate project}\\[0.5cm]
91 { \huge \bfseries Progress report 1}\\[0.4cm]
97 Carlos \textsc{Jenkins}\\
112 \hypertarget{introduction}{}
113 \section{Introduction}
115 This document describes the first progress report for the project ``Code generation for automotive
116 rapid prototyping platform using Matlab/Simulink" executed on the first semester of 2013 at the
117 Department of Control Engineering, Faculty of Electrical Engineering, Czech Technical University,
118 as part of the specialty practice for applying for the Computer Engineering Bachelor degree at the
119 Costa Rica Institute of Technology.
121 This report aims to outline the context, risks, goals and scope of the project and to describe
122 the system to develop.
124 \hypertarget{project_context}{}
125 \section{Project context}
127 This section describes the institution where the project is held and the background of the project.
129 \hypertarget{institution}{}
130 \subsection{Institution}
132 The project is being held at the Real-Time Systems group, Department of Control Engineering,
133 Faculty of Electrical Engineering from the Czech Technical University in Prague.
135 The head of the department is Dr. Zdeněk Hanzálek, Director Industrial Informatics Group,
136 Department of Control Engineering, Faculty of Electrical Engineering, Czech Technical University
139 Professor Assistant Ing. Michal Sojka Ph.D., Department of Control Engineering, Faculty of
140 Electrical Engineering, Czech Technical University in Prague, will held as supervisor of the
143 \hypertarget{background}{}
144 \subsection{Background}
146 Back in the beginning of 2012 a leading automotive company requested the Czech Technical University
147 to develop a Engine Control Unit (ECU) for automotive applications. Real-Time Systems group at the
148 Department of Control Engineering from the Faculty of Electrical Engineering developed a hardware
149 and Software platform to the needs of this industry. The hardware uses Texas Instruments
150 TMS570LS3137 CPU and is built with automotive standards and interfaces in mind. It uses a real-time
151 operating system and was directly programmed in C.
153 As will later be described, the automotive company needs to program such board in a different
156 \hypertarget{problem_description}{}
157 \section{Problem description}
159 This section describes the problem faced with this project and the solution aimed.
161 \hypertarget{problem_statement}{}
162 \subsection{Problem statement}
164 The board is programmed using hand written C code. This approach faces the following problems about
168 \item It is hard to produce, sometimes very low-level.
169 \item It is hard to debug. Yes, 1 bit took us 4 hours.
170 \item It requires good knowledge of the underlying hardware.
171 \item Most of the time is non-portable or hard to port between platforms.
172 \item It is hard to audit and certify.
175 In consequence, the automotive company established policies that stipulate that the Software
176 developed for the engine control unit must be designed in a safe and auditable way. The company has
177 the policy to implement the Software for their system using Model-Based Design:
180 Model-Based Design (MBD) is a mathematical and visual method of addressing
181 problems associated with designing complex control, signal processing and
182 communication systems. It is used in many motion control, industrial equipment,
183 aerospace, and automotive applications. Model-based design is a methodology
184 applied in designing embedded software.
187 In order to meet this requirement an interaction layer between the platform and the Software the
188 company uses, Matlab/Simulink, must be implemented.
190 \hypertarget{solution_statement}{}
191 \subsection{Solution statement}
193 The solution for project problem is to implement and Simulink target that allows models to generate
194 code for the board. Such models needs to interact with board peripherals and in consequence driver
195 blocks need to be implemented too. Finally, driver blocks need to generate code on top of a well
196 tested C support library that include drivers and Operating System for the board.
198 \hypertarget{project_stackeholders}{}
199 \subsection{Project stackeholders}
201 Main project stackeholders are:
204 \item Dr. Zdeněk Hanzálek. Director Industrial Informatics Group, Department of Control Engineering,
205 Faculty of Electrical Engineering, Czech Technical University in Prague. As director of the
206 department, Dr. Hanzálek has no direct responsibility on the project but has direct
207 responsibility on the success oof the main project. \newline{}
208 Main interest of Dr. Hanzálek is the success of the project in order to enable the success of the
209 mother project (board development for automotive applications) and to maintain the high prestige
210 and confidence the industry has over the department and the university.
212 \item Ing. Michal Sojka Ph.D. Professor Assistant, Department of Control Engineering, Faculty of
213 Electrical Engineering, Czech Technical University in Prague. CVUT project supervisor,
214 co-responsible for grade the student. \newline{}
215 Ing. Sojka main interest in the project is the success and implementation of the solution.
217 \item Prof. Jeff Schmidt Peralta. Computer Engineering Professor, Faculty of Computer Engineering,
218 Costa Rica Institute of Technology. ITCR project supervisor, co-responsible for grade the
220 Prof. Schmidt main interest is the success of the project in order to enable student to opt-out
221 for Bachelor degree and to maintain and develop the high prestige the university currently held.
224 \hypertarget{summary_of_needs_and_expectations}{}
225 \subsection{Summary of needs and expectations}
227 Project needs are summarized as:
230 \item To have a fully automatic and tested system for Simulink models code generation, build and code
231 download to the hardware board.
232 \item To have a fully tested C support library for those models to link to.
233 \item To have a set of Simulink driver blocks that allows models to interact with the hardware
237 Expected benefits of this project are:
240 \item Enabling faster implementation and rapid-prototyping of Software components through the use of
241 model-based programming.
242 \item Enabling better and clearer visualization of Software implementations for the hardware board
244 \item Improve auditability of Software system for automotive applications.
247 \hypertarget{perspective_assumptions_and_product_dependencies}{}
248 \subsection{Perspective, assumptions and product dependencies}
250 The main assumptions for the project are:
253 \item Drivers work and are tested.
254 \item Hardware works and is tested.
257 Main dependencies for the system to develop are:
260 \item A functional board.
261 \item For each deliverable previous deliverable is required to work and be tested in order to implement
262 the new deliverable. This dependency over the previous product makes the project very dificult to
263 develop in parallel. The following arrows show system dependency: \newline{}
264 Demos \noindent$\rightarrow$ Block Library \noindent$\rightarrow$ Target \noindent$\rightarrow$ Support Library.
267 \hypertarget{non_functional_requirements}{}
268 \subsection{Non-functional requirements}
270 Two main requirements are stipulated according automotive safety policies:
273 \item The use of a real-time Operating System is mandatory.
274 \item Application should be real-time and guarantee to respond in one Operating System tick time.
275 \item All memory should be statically allocated, there should never be dynamically allocated memory.
278 \hypertarget{risk_analysis}{}
279 \section{Risk analysis}
281 This section describes the risk that could be encountered during the execution of the project
282 and the containment and evasion strategies considered.
284 \hypertarget{unkown_development_environment_and_tools}{}
285 \subsection{Unkown development environment and tools}
287 This is the most important risk for the project and involves the lack of technical knowledge and
288 the introduction of the student to a completely new environment, API, processes, tools, hardware
289 and code base. The student is has never being exposed to any of the tools in the environment with
290 exception of C embedded development.
293 \item \textbf{Category:} people.
294 \item \textbf{Possible cause}: lack of technical knowledge.
295 \item \textbf{Impact for the project}: 100.
296 \item \textbf{Probability to happen}: 1.0.
297 \item \textbf{Exposition to risk}: 100 * 1.0 = 100\%.
298 \item \textbf{Evasion strategy}:
300 \item This risk cannot be evaded.
302 \item \textbf{Mitigation strategy}:
304 \item Read technical documentation about tools.
305 \item Read existing code base.
306 \item Learn to use new development tools.
307 \item Document every aspect of the use.
308 \item Learn to use, manipulate and understand the hardware.
314 \hypertarget{board_malfunction}{}
315 \subsection{Board malfunction}
318 \item \textbf{Category:} infrastructure.
319 \item \textbf{Possible cause}: hardware error, mishandling or environment.
320 \item \textbf{Impact for the project}: 80.
321 \item \textbf{Probability to happen}: 0.5.
322 \item \textbf{Exposition to risk}: 80 * 0.5 = 40\%.
323 \item \textbf{Evasion strategy}:
325 \item Board should always be handled in a safe manner, using anti-static methods.
327 \item Power supply connections will always be double checked.
328 \item Environment around the board and board connections will be checked twice before powering on the
331 \item \textbf{Mitigation strategy}:
333 \item Ask to supervisor to check the problem.
334 \item Replace development board to another available board. Very expensive choice.
338 \hypertarget{goals_and_system_scope}{}
339 \section{Goals and system scope}
341 This section describes the goals and scope of the project.
343 \hypertarget{objectives}{}
344 \subsection{Objectives}
346 Main objectives of this project are:
349 \item Allow C code generation from Matlab/Simulink models for custom made hardware platform.
350 \item Implement model blocks for some of the peripheral units of the board for use in Simulink
354 \hypertarget{specific_objectives}{}
355 \subsection{Specific objectives}
357 Specific objectives of this project are:
360 \item Implementation of a C support library that defines an API that can be called by Simulink blocks.
361 The support library should include a test suite that allows to test and confirm the correct
362 behavior of the library.
363 \item Implementation of a Simulink Coder Target for the RPP board that uses the CGT compiler.
364 \item Implementation of a Simulink Block Library that includes the main block drivers for the RPP
366 \item Implementation of a set of demos that illustrates the use of the system and confirms the correct
367 behavior of the implementation.
370 \hypertarget{system_scope}{}
371 \subsection{System scope}
373 For the C support library, the test suite of such library and the block library should limit to
374 the following hardware modules:
391 \hypertarget{development_inputs}{}
392 \section{Development inputs}
394 This section describes conceptual inputs for development.
396 \hypertarget{use_case_diagram}{}
397 \subsection{Use case diagram}
399 This project is focused in embedded Software development in a non-object oriented programming
400 language and thus is not driven with a Use Case methodology. In consequence, this section does not
403 \hypertarget{use_cases_specification}{}
404 \subsection{Use cases specification}
406 This project is focused in embedded Software development in a non-object oriented programming
407 language and thus is not driven with a Use Case methodology. In consequence, this section does not
410 \hypertarget{domain_conceptual_model}{}
411 \subsection{Domain conceptual model}
413 \begin{figure}[H]\begin{center}
415 \noindent\includegraphics[width=400px]{media/images/tlc_process.png}
416 \caption{Conceptual code generation process.}\end{center}\end{figure}
420 \hypertarget{glossary}{}
421 \subsection{Glossary}
425 \textit{Analog to Digital Converter.} \newline{}
426 Hardware circuitry that converts a continuous physical quantity (usually voltage) to a
427 digital number that represents the quantity's amplitude.
430 \textit{Analog Input.} \newline{}
431 Mnemonic to refer to or something related to the analog input (ADC) hardware module.
434 \textit{Analog Output.} \newline{}
435 Mnemonic to refer to or something related to the analog output (DAC) hardware module.
438 \textit{Controller Area Network.} \newline{}
439 The CAN Bus is a vehicle bus standard designed to allow microcontrollers and devices to
440 communicate with each other within a vehicle without a host computer.
441 In this project it is also used as mnemonic to refer to or something related to the CAN
445 \textit{Code Generation Tools.} \newline{}
446 Name given to the tool set produced by Texas Instruments used to compile, link, optimize,
447 assemble, archive, among others. In this project is normally used as synonym for
448 ``Texas Instruments ARM compiler and linker."
451 \textit{Digital to Analog Converter.} \newline{}
452 Hardware circuitry that converts a digital (usually binary) code to an analog signal
453 (current, voltage, or electric charge).
456 \textit{Digital Input.} \newline{}
457 Mnemonic to refer to or something related to the digital input hardware module.
460 \textit{Engine Control Unit.} \newline{}
461 A type of electronic control unit that controls a series of actuators on an internal combustion
462 engine to ensure the optimum running.
465 \textit{Ethernet.} \newline{}
466 Mnemonic to refer to or something related to the Ethernet hardware module.
469 \textit{FlexRay.} \newline{}
470 FlexRay is an automotive network communications protocol developed to govern on-board automotive
472 In this project it is also used as mnemonic to refer to or something related to the FlexRay
476 \textit{General Purpose Input/Output.} \newline{}
477 Generic pin on a chip whose behavior (including whether it is an input or output pin) can be
478 controlled (programmed) by the user at run time.
481 \textit{H-Bridge.} \newline{}
482 Mnemonic to refer to or something related to the H-Bridge hardware module. A H-Bridge is
483 an electronic circuit that enables a voltage to be applied across a load in either direction.
486 \textit{High-Power Output.} \newline{}
487 Mnemonic to refer to or something related to the 10A, PWM, with current sensing, high-power
488 output hardware module.
491 \textit{Integrated Development Environment.} \newline{}
492 An IDE is a Software application that provides comprehensive facilities to computer programmers
493 for software development.
496 \textit{Legacy Code Tool.} \newline{}
497 Matlab tool that allows to generate source code for S-Functions given the descriptor of a C
501 \textit{Local Interconnect Network.} \newline{}
502 The LIN is a serial network protocol used for communication between components in vehicles.
503 In this project it is also used as mnemonic to refer to or something related to the LIN
507 \textit{Logic Output.} \newline{}
508 Mnemonic to refer to or something related to the digital output hardware module.
509 It is logic output (100mA), as opposed to power outputs (2A, 10A).
512 \textit{Model-Based Design.} \newline{}
513 Model-Based Design (MBD) is a mathematical and visual method of addressing problems associated
514 with designing complex control, signal processing and communication systems.
517 \textit{Matlab Executable.} \newline{}
518 Type of binary executable that can be called within Matlab. In this document the common term
519 used is `C MEX S-Function", which means Matlab executable written in C that implements a system
523 \textit{(Motor) Power Output.} \newline{}
524 Mnemonic to refer to or something related to the 2A push/pull power output hardware module.
527 \textit{Pulse-width modulation.} \newline{}
528 Technique for getting analog results with digital means. Digital control is used to create a
529 square wave, a signal switched between on and off. This on-off pattern can simulate voltages
530 in between full on and off by changing the portion of the time the signal spends on versus
531 the time that the signal spends off. The duration of ``on time" is called the pulse width or
535 \textit{Rapid Prototyping Platform.} \newline{}
536 Name of the automotive hardware board. Also generic term to define something related
537 to the board, like the RPP Library, RPP Layer, RPP API, etc.
540 \textit{Serial Communication Interface.} \newline{}
541 Serial Interface for communication through hardware's UART using communication standard RS-232.
542 In this project it is also used as mnemonic to refer to or something related to the Serial
543 Communication Interface hardware module.
546 \textit{SD-Card.} \newline{}
547 Mnemonic to refer to or something related to the SD-Card hardware module.
550 \textit{SD-RAM.} \newline{}
551 Mnemonic to refer to or something related to the SD-RAM hardware module for logging.
554 \textit{Target Language Compiler.} \newline{}
555 Technology and language used to generate code in Matlab/Simulink.
558 \textit{Universal Asynchronous Receiver/Transmitter.} \newline{}
559 Hardware circuitry that translates data between parallel and serial forms.
564 \hypertarget{work_schedule}{}
565 \section{Work schedule}
567 \begin{center}\begin{tabular}{|c|c|l|}
568 \hline \textbf{Date} & \textbf{Deliverable} & \textbf{Priority} \\
569 \hline \multicolumn{1}{|l|}{15.4.2013} & \multicolumn{1}{|l|}{C support library and test suite.} & \multicolumn{1}{|c|}{1} \\
570 \hline \multicolumn{1}{|l|}{01.5.2013} & \multicolumn{1}{|l|}{Simulink Coder target for RPP board.} & \multicolumn{1}{|c|}{2} \\
571 \hline \multicolumn{1}{|l|}{01.6.2013} & \multicolumn{1}{|l|}{Simulink Block library. S-Functions and TLC files.} & \multicolumn{1}{|c|}{3} \\
572 \hline \multicolumn{1}{|l|}{07.6.2013} & \multicolumn{1}{|l|}{Simulink Demo library.} & \multicolumn{1}{|c|}{4} \\
573 \hline \multicolumn{1}{|l|}{21.6.2013} & \multicolumn{1}{|l|}{Finish documentation of the developed product.} & \multicolumn{1}{|c|}{5} \\
574 \hline \end{tabular}\end{center}