\hypertarget{installation_procedure}{}
\subsection{Installation procedure}
-\textbf{1) Download and install CCS for Linux:}
+\begin{enumerate}
+\item Download and install CCS for Linux:
Details on how to setup CCS are available in section
\htmladdnormallink{TI Code Composer Studio}{\#ti\_code\_composer\_studio}.
-\textbf{2) Install RPP Target:}
+\item Install RPP Target:
Open Matlab and type on command window:
-\lstset{language=}
+\lstset{language=Matlab}
\begin{lstlisting}
cd <repo>/rpp/rpp/
-rpp_setup()
+rpp_setup
\end{lstlisting}
This will launch the RPP setup script. This script will ask the user to provide the path to the CCS
directory, infer and save some relevant CCS paths, add paths to Matlab path and build S-Function
blocks for user's architecture (using Matlab's mex command line tool).
-\textbf{3) Create a new model or load a demo:}
+\item Create a new model or load a demo:
Demos are located on \texttt{$<$repo$>$/rpp/demo} or you can start a new model and configure target to RPP.
For new models see \htmladdnormallink{Target Reference}{\#target\_reference} section below.
+\end{enumerate}
+
+
+\subsection{Usage}
+\label{sec:usage}
+
+\begin{enumerate}
+\item Open or create a model you want to generate code from.
+\item Make sure that the model is configured (Simulation $\rightarrow$
+ Model Configuration Parameters) as described in Section \ref{sec:target-reference}.
+\item From Matlab command window change the current directory to where
+ you want your generated code to appear, e.g.:
+\begin{lstlisting}[language=Matlab]
+cd /tmp/my-code
+\end{lstlisting}
+ The code will be generated in a subdirectory of that directory. The
+ name of the subdirectory will be \texttt{<model>\_rpp}, where
+ \texttt{model} is the name of the Simulink model.
+\item Generate the code by choosing ``Code $\rightarrow$ C/C++ Code
+ $\rightarrow$ Build Model''.
+\item If \emph{Download compiled binary to RPP} was selected in
+ \emph{RPP Options} pane (see Section \ref{sec:rpp-target-options}),
+ the compiled binary will be downloaded to the to the board. After
+ the download is finished you should reset the board to run the
+ downloaded code.
+
+ Note: You should quit the Code Composer Studio before downloading the
+ generated code to the RPP board. Otherwise the download fails.
+\end{enumerate}
\newpage
\hypertarget{target_reference}{}
\subsection{Target Reference}
+\label{sec:target-reference}
This section describes the options required or available for running a Simulink model with the RPP
Target.
\noindent\includegraphics[width=400px]{media/images/simulink_solver.png}
\newpage
\end{compactitem}
-\item Diagnostics - Sample Time:
+\item Diagnostics -- Sample Time:
\begin{compactitem}
\item Disable warning source block specifies -1 sampling time. It's ok for the source blocks to run
once per tick. \newline{}
\hypertarget{rpp_target_options}{}
\subsubsection{RPP Target options}
+\label{sec:rpp-target-options}
The RPP Target include the following configuration options, all of them configurable per model
under \texttt{Code Generation} \noindent$\rightarrow$ \texttt{RPP Options}:
\item \textbf{Download compiled binary to RPP}: if set, this option will download the generated binary to
the board after the model is successfully built. Note that this option is unaware of the option
\textit{Generate code only} in the \textit{Code Generation} options panel, so it will try to upload even if
- only source code has being generated, failing graciously or uploading an old binary laying around
+ only source code has been generated, failing graciously or uploading an old binary laying around
in the build directory. This option calls the \texttt{rpp\_download.m} script, which is in turn a
wrapper on the \texttt{loadti.sh} script. More information on the \texttt{loadti.sh} script can be found
in:
\end{verbatim}
The \texttt{loadti.sh} script will close after the download of the generated program and in
- consequence the execution of the loaded program will stop (because it work as the CCS debug
+ consequence the execution of the loaded program will stop (because it works as the CCS debug
server). In order to test the loaded model a manual reset of the board is always required after a
successful download.
definitions like the following:
\newpage
-\lstset{language=}
-\begin{lstlisting}
+\begin{lstlisting}[language=Matlab]
%% GPIO Write
% Populate legacy_code structure with information
GPIOWrite = legacy_code('initialize');
Also a script called \texttt{compile\_blocks.m} is included that allows all \texttt{sfunctions\_*.c} to be fed
to the \texttt{mex} compiler so all S-Functions are compiled at once. To use this script, in Matlab do:
-\lstset{language=}
+\lstset{language=Matlab}
\begin{lstlisting}
cd <repo>/rpp/blocks/
compile_blocks()