diff --git a/20210601/fak-r-1.c b/20210607/fak-r-1.c similarity index 100% rename from 20210601/fak-r-1.c rename to 20210607/fak-r-1.c diff --git a/20210607/fak-r-1.s b/20210607/fak-r-1.s new file mode 100644 index 0000000000000000000000000000000000000000..ed7a328f3442c0a18fa3bdf026663777743e950a --- /dev/null +++ b/20210607/fak-r-1.s @@ -0,0 +1,52 @@ + .file "fak-r-1.c" + .text + .globl fak + .type fak, @function +fak: +.LFB11: + .cfi_startproc + movl $1, %eax + cmpl $1, %edi + jg .L8 + ret +.L8: + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + movl %edi, %ebx + leal -1(%rdi), %edi + call fak + imull %ebx, %eax + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE11: + .size fak, .-fak + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "%d! = %d\n" + .text + .globl main + .type main, @function +main: +.LFB12: + .cfi_startproc + subq $8, %rsp + .cfi_def_cfa_offset 16 + movl $6, %edi + call fak + movl %eax, %edx + movl $6, %esi + leaq .LC0(%rip), %rdi + movl $0, %eax + call printf@PLT + movl $0, %eax + addq $8, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE12: + .size main, .-main + .ident "GCC: (Debian 8.3.0-6) 8.3.0" + .section .note.GNU-stack,"",@progbits diff --git a/20210607/fak-r-2.c b/20210607/fak-r-2.c new file mode 100644 index 0000000000000000000000000000000000000000..38533dc976292ddbbef898afc94bd6d69d697e27 --- /dev/null +++ b/20210607/fak-r-2.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int fak (int n) +{ + return n * fak (n - 1); +} + +int main (void) +{ + printf ("%d! = %d\n", 6, fak (6)); + return 0; +} diff --git a/20210607/fak-r-3.c b/20210607/fak-r-3.c new file mode 100644 index 0000000000000000000000000000000000000000..1b6b3b85e19eda191d6795513e7d30c52563fa63 --- /dev/null +++ b/20210607/fak-r-3.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int fak (int n) +{ + if (n <= 1) + return 1; + else + return n * fak (n); +} + +int main (void) +{ + printf ("%d! = %d\n", 6, fak (6)); + return 0; +} diff --git a/20210607/logo-hochschule-bochum-cvh-text-v2.pdf b/20210607/logo-hochschule-bochum-cvh-text-v2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3725a72c764b4d9ab200553474e4262161f7a5b5 Binary files /dev/null and b/20210607/logo-hochschule-bochum-cvh-text-v2.pdf differ diff --git a/20210607/logo-hochschule-bochum.pdf b/20210607/logo-hochschule-bochum.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8cad73dbb48a2b550bf29355b5a6ec895ce091f8 Binary files /dev/null and b/20210607/logo-hochschule-bochum.pdf differ diff --git a/20210607/pgslides.sty b/20210607/pgslides.sty new file mode 100644 index 0000000000000000000000000000000000000000..9a019ce99f03d27a17942facc56fe2145f46b6a6 --- /dev/null +++ b/20210607/pgslides.sty @@ -0,0 +1,233 @@ +% pgslides.sty - LaTeX Settings for Lecture Slides +% Copyright (C) 2012, 2013 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +\usepackage{amsfonts} +\usepackage[british,german]{babel} % Yes, really "german" and not "ngerman". +\usepackage[utf8]{luainputenc} % Without this, umlauts are broken. Weird. +\usepackage{microtype} +\usepackage[T1]{fontenc} +\usepackage{times} +\usepackage{helvet} +\renewcommand*\familydefault{\sfdefault} +\usepackage{graphicx} +\usepackage{pstricks} + +\hypersetup{colorlinks,allcolors=blue} + +%% @@@ Not necessary for slides. Why??? +%% Repair kerning: Automatically insert "\kern{-0.15em}" between "//" % (in URLs). +%\directlua{ +% local glyph = node.id ("glyph") +% local function my_kerning (head) +% for t in node.traverse (head) do +% if t.id == glyph and t.char == 47 then +% if t.next +% and t.next.next +% and t.next.next.id == glyph +% and t.next.next.char == 47 then +% local k = node.new ("kern") +% k.kern = tex.sp ("-0.15em") +% k.next = t.next +% k.prev = t +% t.next.prev = k +% t.next = k +% end +% end +% end +% node.kerning (head) +% end +% luatexbase.add_to_callback ("kerning", my_kerning, "URL kerning") +%} + +\usetheme{default} +\usefonttheme{structurebold} +\setbeamertemplate{navigation symbols}{} +\setbeamersize{text margin left = 0.3cm, text margin right = 0.2cm} +\setbeamertemplate{itemize item}{$\bullet$} +\setbeamertemplate{itemize subitem}{--} +\setbeamerfont{itemize/enumerate subbody}{size=\normalsize} +\setbeamerfont{itemize/enumerate subsubbody}{size=\normalsize} +\setbeamercolor{footline}{fg=gray} + +\newcommand{\sep}{~$\cdot$~} + +\newif\ifminimalistic +\minimalistictrue + +\institute[Hochschule Bochum\sep CVH]{% + \makebox(0,0.005)[tl]{\includegraphics[scale=0.72]{logo-hochschule-bochum-cvh-text-v2.pdf}}\hfill + \makebox(0,0)[tr]{\includegraphics[scale=0.5]{logo-hochschule-bochum.pdf}}% +} + +\setbeamertemplate{headline}{% + \leavevmode + \hbox to \textwidth{% + \ifminimalistic + \strut\hfill + \else + \rule{0pt}{5.7pt}% + \hspace*{8.55pt}\insertinstitute\hspace*{5.7pt}% + \raisebox{-30pt}{\rule{0pt}{1pt}}% + \fi + }% + \vskip0pt% +} + +\iffalse + \setbeamertemplate{footline}{} +\else + \setbeamertemplate{footline}{% + \leavevmode + \hbox to \textwidth{% + \usebeamercolor{footline}% + \usebeamerfont{footline}% + \ifminimalistic + \strut\hfill + \else + \,\insertshorttitle\sep + \insertshortauthor\sep + \insertshortinstitute\sep + \insertshortdate\hfill + \fi + \insertframenumber/\inserttotalframenumber + %Folie\,\insertframenumber\sep Seite\,\insertpagenumber\, + }% + \vskip0pt% + } +\fi + +\newcommand{\maketitleframe}{% + \ifminimalistic + \begin{frame}[t,plain] + \insertinstitute + \par\vfill + \begin{center} + {\LARGE\color{structure}\inserttitle\par}\bigskip\bigskip + {\large \insertauthor\par}\bigskip\medskip + \insertdate + \end{center} + \end{frame} + \else + \begin{frame} + \vfill + \begin{center} + {\LARGE\color{structure}\inserttitle\par}\bigskip\bigskip + {\large \insertauthor\par}\bigskip\medskip + \insertdate + \end{center} + \vfill + \end{frame} + \fi +} + +\definecolor{medgreen}{rgb}{0.0,0.5,0.0} +\definecolor{darkgreen}{rgb}{0.0,0.3,0.0} +\definecolor{lightred}{rgb}{1.0,0.7,0.7} +\definecolor{medred}{rgb}{0.5,0.0,0.0} +\definecolor{bored}{rgb}{0.89,0.0,0.098} +\definecolor{lightgray}{rgb}{0.85,0.85,0.85} +\definecolor{orange}{rgb}{1.0,0.5,0.0} +\definecolor{darkgray}{rgb}{0.4,0.4,0.4} + +\newenvironment{experts}{\color{darkgray}}{} + +\usepackage{listings} +\lstset{basicstyle=\color{structure}, + language=C, + captionpos=b, + gobble=4, + columns=fullflexible, + aboveskip=0pt, + belowskip=0pt, + moredelim=**[is][\color{structure}]{¡}{¿}, + moredelim=**[is][\only<2->{\color{structure}}]{²}{¿}, + moredelim=**[is][\only<3->{\color{structure}}]{³}{¿}, + moredelim=**[is][\only<4->{\color{structure}}]{°}{¿}, + moredelim=**[is][\only<5->{\color{structure}}]{¤}{¿}, + moredelim=**[is][\only<6->{\color{structure}}]{¢}{¿}, + moredelim=**[is][\only<7->{\color{structure}}]{æ}{¿}, + moredelim=**[is][\only<8->{\color{structure}}]{ø}{¿}} +\lstdefinestyle{terminal}{basicstyle=\ttfamily\color{darkgreen}, + language={}, + columns=fixed, + moredelim=**[is][\color{red}]{¡}{¿}, + moredelim=**[is][\color{blendedblue}]{°}{¿}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}} +\lstdefinestyle{cmd}{basicstyle=\ttfamily\color{red}, + language={}, + gobble=2, + columns=fixed, + moredelim=**[is][\color{darkgreen}]{¡}{¿}, + moredelim=**[is][\color{structure}]{°}{¿}, + moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}} +\lstdefinestyle{shy}{basicstyle=\color{lightgray}} + +\setcounter{topnumber}{3} +\renewcommand\topfraction{0.7} +\setcounter{bottomnumber}{3} +\renewcommand\bottomfraction{0.7} +\setcounter{totalnumber}{5} +\renewcommand\textfraction{0.1} +\renewcommand\floatpagefraction{0.9} + +\setlength{\unitlength}{1cm} + +\newcommand{\protectfile}[1]{#1} +\urlstyle{sf} +\newcommand{\file}[1]{{\color{structure}\protectfile{#1}}} +\newcommand{\textarrow}{{\boldmath $\longrightarrow$}} +\newcommand{\arrowitem}{\item[\textarrow]} +\newcommand{\newterm}[1]{\emph{\color{darkgreen}#1}} +\newcommand{\BIGskip}{\vspace{1cm}} +\newcommand{\shy}{\color{lightgray}} +\newcommand{\hot}{\color{red}} +\newcommand{\shyhot}{\color{lightred}} + +\newcommand{\sectionnonumber}[1]{\section{#1}\addtocounter{section}{-1}} + +\def\showsectionnonumber{\hbox{\Large\color{structure}\bf + \vtop{\secname}\par}\bigskip} + +\newcommand{\nosectionnonumber}[1]{\gdef\nosectionnonumbername{#1}} + +\def\shownosectionnonumber{\hbox{\Large\color{structure}\bf + \vtop{\nosectionnonumbername}\par}\bigskip} + +\def\showsection{\hbox{\Large\color{structure}\bf + \vtop{\hbox{\arabic{section}}}\kern1em% + \vtop{\secname}\par}\bigskip} + +\newcommand{\subsectionnonumber}[1]{\subsection{#1}\addtocounter{subsection}{-1}} + +\def\showsubsectionnonumber{{\large\color{structure}\bf\subsecname\par}\bigskip} + +\def\showsubsection{\hbox{\large\color{structure}\bf + \vtop{\hbox{\arabic{section}.\arabic{subsection}}}\kern1em% + \vtop{\subsecname}\par}\bigskip} + +\newcommand{\subsubsectionnonumber}[1]{\subsubsection{#1}\addtocounter{subsubsection}{-1}} + +\def\showsubsubsectionnonumber{{\normalsize\color{structure}\bf\subsubsecname\par}\bigskip} + +\def\showsubsubsection{\hbox{\normalsize\color{structure}\bf + \vtop{\hbox{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}}\kern1em% + \vtop{\subsubsecname}\par}\bigskip} diff --git a/20210607/rtech-20210607.pdf b/20210607/rtech-20210607.pdf new file mode 100644 index 0000000000000000000000000000000000000000..162b173b22725925eb98338afac97f9f1d15ad3f Binary files /dev/null and b/20210607/rtech-20210607.pdf differ diff --git a/20210607/rtech-20210607.tex b/20210607/rtech-20210607.tex new file mode 100644 index 0000000000000000000000000000000000000000..56b7d392521787771c2058bd060480f726683766 --- /dev/null +++ b/20210607/rtech-20210607.tex @@ -0,0 +1,534 @@ +% rtech-20210607.pdf - Lecture Slides on Computer Technology +% Copyright (C) 2012, 2013, 2014, 2021 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +% README: Architekturmerkmale von Prozessoren + +\documentclass[10pt,t]{beamer} + +\usepackage{pgslides} +\usepackage{rotating} + +\lstdefinestyle{asm}{basicstyle=\color{structure}, + language={}, + gobble=4} + +\title{Rechnertechnik} +\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski} +\date{7.\ Juni 2021} + +\begin{document} + +\maketitleframe + +\sectionnonumber{\inserttitle} + +\begin{frame} + + \showsectionnonumber + + \begin{itemize} + \item[\textbf{1}] \textbf{Einführung} + \item[\textbf{2}] \textbf{Vom Schaltkreis zum Computer} + \item[\textbf{3}] \textbf{Architekturmerkmale von Prozessoren} + \item[\textbf{4}] \textbf{Der CPU-Stack} + \begin{itemize} + \color{medgreen} + \item[4.1] Implementation + \item[4.2] Unterprogramme + \item[4.3] Register sichern + \end{itemize} + \color{gray} +% \item[\textbf{5}] \textbf{Hardwarenahe Programmierung} +% \item[\textbf{6}] \textbf{Anwender-Software} +% \item[\textbf{7}] \textbf{Bus-Systeme} +% \item[\textbf{8}] \textbf{Pipelining} + \item[\textbf{\dots\hspace{-0.75em}}] +% \item[\textbf{9}] \textbf{Ausblick} + \end{itemize} + +\end{frame} + +\setcounter{section}{3} +\section{Der CPU-Stack\label{CPU-Stack}} +\subsection{Implementation} + +\begin{frame} + + \showsection + \showsubsection + + Speicher, in dem Werte "`gestapelt"' werden: \newterm{Stack} + + \begin{itemize} + \item + Speicherbereich (ein array) reservieren + \item + Variable (typischerweise: Prozessorregister) als + \newterm{Stack Pointer\/} reservieren \textarrow\ \lstinline{SP} + \item + Assembler-Befehl \lstinline[style=asm]{push foo}: \quad + \lstinline{*SP++ = foo;} + \item + Assembler-Befehl \lstinline[style=asm]{pop bar}: \quad + \lstinline{bar = *--SP;} + \end{itemize} + +% \pause + \medskip + Speziell: Unterprogramme + +\end{frame} + +\subsection{Unterprogramme} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \begin{minipage}[t]{4.5cm} + Parameter: + \begin{itemize} + \item + Prozessorregister + \item + CPU-Stack + \end{itemize} + + \smallskip + + Rückgabewert: + \begin{itemize} + \item + Prozessorregister + \end{itemize} + \end{minipage}% + \begin{minipage}[t]{5cm} + Aufruf: + \begin{itemize} + \item + \lstinline[style=asm]{push IP}\\ + \lstinline[style=asm]{jmp foo} + {\color{red}\boldmath $\longleftarrow$ mov \#foo IP}\\ + \textarrow\ \lstinline[style=asm]{call foo} + \end{itemize} + Rücksprung: + \begin{itemize} + \item + \lstinline[style=asm]{pop IP}\\ + \textarrow\ \lstinline[style=asm]{ret} + \end{itemize} + \end{minipage} + +\end{frame} + +\subsection{Register sichern} + +\begin{frame} + + \showsection + \showsubsection + + Ein Unterprogramm verändert Registerinhalte. + \begin{itemize} + \item + im Hauptprogramm nötigenfalls vor Aufruf sichern + \item + im Unterprogramm vor Benutzung sichern + \item + Kombinationen (manche Register so, manche so) + \end{itemize} + +\end{frame} + +\section{Anwender-Software} +\subsection{Relokation und Linken} + +\begin{frame}[fragile] + + \showsection + \vspace*{-\smallskipamount} + \showsubsection + + Software im Speicher + + \begin{center} + \setlength{\unitlength}{0.8cm} + \begin{picture}(15,3)(2,-1.25) + \footnotesize + + \put(2,1.0){\line(1,0){15}} + \multiput(2,1)(0.1,0){151}{\line(0,1){0.1}} + \put(2,1.1){\line(1,0){15}} + \put(3.5,1.2){$\overbrace{\rule{10\unitlength}{0pt}}$} + \only<4->{% + \put(3.5,-0.05){\vector(0,1){1}} + \put(2.5,-0.05){\line(1,0){1}} + \put(2.4,-0.05){\makebox(0,0)[r]{\lstinline|CS|}}} + + \put(4.95,0.7){\line(0,1){0.25}} + \put(4.95,0.7){\line(1,0){0.5}} + \put(5.45,0.7){\vector(0,1){0.25}} + \put(6.65,0.7){\line(0,1){0.25}} + \put(6.65,0.7){\line(1,0){0.8}} + \put(7.45,0.7){\vector(0,1){0.25}} + \put(9.55,0.6){\line(0,1){0.35}} + \put(9.55,0.6){\line(-1,0){3.2}} + \put(6.35,0.6){\vector(0,1){0.35}} + \put(7.25,0.4){\makebox(0,0)[t]{Sprünge innerhalb des Programms}} + + \put(8.50,1.55){\makebox(0,0)[b]{Programm}} + \end{picture} + \pause + \begin{picture}(15,3)(0,-1.25) + \footnotesize + + \put(0,1.0){\line(1,0){15}} + \multiput(0,1)(0.1,0){151}{\line(0,1){0.1}} + \put(0,1.1){\line(1,0){15}} + \put(3.5,1.2){$\overbrace{\rule{10\unitlength}{0pt}}$} + \only<4->{% + \put(3.5,-0.05){\vector(0,1){1}} + \put(2.5,-0.05){\line(1,0){1}} + \put(2.4,-0.05){\makebox(0,0)[r]{\lstinline|CS|}}} + + \put(4.95,0.7){\line(0,1){0.25}} + \put(4.95,0.7){\line(1,0){0.5}} + \put(5.45,0.7){\vector(0,1){0.25}} + \put(6.65,0.7){\line(0,1){0.25}} + \put(6.65,0.7){\line(1,0){0.8}} + \put(7.45,0.7){\vector(0,1){0.25}} + \put(9.55,0.6){\line(0,1){0.35}} + \put(9.55,0.6){\line(-1,0){3.2}} + \put(6.35,0.6){\vector(0,1){0.35}} + \put(7.25,0.4){\makebox(0,0)[t]{Sprünge innerhalb des Programms}} + + \put(8.50,1.55){\makebox(0,0)[b]{Programm}} + \end{picture} + \end{center} + \pause + \vspace*{-0.8cm} + Sprünge anpassen: Relokation + + \pause + \smallskip + + Hardware-Unterstützung (z.\,B.\ Intel): Speichersegmentierung + + \lstinline{CS} = Code-Segment: Segment-Register oder Selektor + +\end{frame} + +\begin{frame}[fragile] + + \showsubsection + \vspace*{-0.8cm} + + \begin{center} + \setlength{\unitlength}{0.8cm} + \begin{picture}(15,4.2)(2,-1.25) + \footnotesize + + \put(2,1.0){\line(1,0){15}} + \multiput(2,1)(0.1,0){151}{\line(0,1){0.1}} + \put(2,1.1){\line(1,0){15}} + \put(3.5,1.2){$\overbrace{\rule{8.0\unitlength}{0pt}}$} + \put(7.50,1.55){\makebox(0,0)[b]{Programm}} + \put(12.2,2.2){$\overbrace{\rule{3.0\unitlength}{0pt}}$} + \put(13.7,2.55){\makebox(0,0)[b]{Bibliothek}} + + \put(8.45,0.95){\line(0,-1){1}} + \put(8.45,-0.05){\line(1,0){5.5}} + \put(13.95,-0.05){\vector(0,1){1}} + \put(13.95,1.25){\begin{rotate}{45}\normalsize\lstinline{scanf}\end{rotate}} + \put(10.15,0.95){\line(0,-1){0.8}} + \put(10.15,0.15){\line(1,0){2.5}} + \put(12.65,0.15){\vector(0,1){0.8}} + \put(12.65,1.25){\begin{rotate}{45}\normalsize\lstinline{printf}\end{rotate}} + \put(11.20,-0.25){\makebox(0,0)[t]{Sprünge aus dem Programm heraus}} + \end{picture} + \pause + \begin{picture}(15,4.2)(2,-1.25) + \footnotesize + + \put(2,1.0){\line(1,0){15}} + \multiput(2,1)(0.1,0){151}{\line(0,1){0.1}} + \put(2,1.1){\line(1,0){15}} + \put(3.5,1.2){$\overbrace{\rule{8.0\unitlength}{0pt}}$} + \put(7.50,1.55){\makebox(0,0)[b]{Programm}} + \put(13.2,2.2){$\overbrace{\rule{3.0\unitlength}{0pt}}$} + \put(14.7,2.55){\makebox(0,0)[b]{Bibliothek}} + + \put(8.45,0.95){\line(0,-1){1}} + \put(8.45,-0.05){\line(1,0){6.5}} + \put(14.95,-0.05){\vector(0,1){1}} + \put(14.95,1.25){\begin{rotate}{45}\normalsize\lstinline{scanf}\end{rotate}} + \put(10.15,0.95){\line(0,-1){0.8}} + \put(10.15,0.15){\line(1,0){3.5}} + \put(13.65,0.15){\vector(0,1){0.8}} + \put(13.65,1.25){\begin{rotate}{45}\normalsize\lstinline{printf}\end{rotate}} + \put(12.20,-0.25){\makebox(0,0)[t]{Sprünge aus dem Programm heraus}} + \end{picture} + \end{center} + \pause + \vspace*{-0.8cm} + Sprünge anpassen: Linken + + \pause + \smallskip + + Beim Erzeugen der Datei: statisches Linken\\ + Beim Laden: dynamisches Linken + +\end{frame} + +\subsection{Dateiformate} + +\begin{frame} + + \visible<3->{\showsubsection} + + Man kann Maschinenprogramme nicht "`einfach so"' in den Speicher laden. + + \pause + \bigskip + + Sprünge anpassen + \begin{itemize} + \item + Relokation: Relokationstabelle + \item + Linken: Symboltabelle + \end{itemize} + +\end{frame} + +\begin{frame} + + \showsubsection + + \vspace*{-0.5cm} + + \begin{center} + \setlength{\unitlength}{0.8cm} + \begin{picture}(15,6)(0,-1.25) + \footnotesize + + \put(0,1.0){\line(1,0){15}} + \multiput(0,1)(0.1,0){151}{\line(0,1){0.1}} + \put(0,1.1){\line(1,0){15}} + \put(0,0.8){\makebox(0,0)[tl]{Ausführbare Binärdatei}} + \put(0.5,1.2){$\overbrace{\rule{1.0\unitlength}{0pt}}$} + \put(2.0,1.2){$\overbrace{\rule{1.0\unitlength}{0pt}}$} + \put(3.5,1.2){$\overbrace{\rule{11.5\unitlength}{0pt}}$} + + \put(0,4.0){\line(1,0){5}} + \multiput(0,3.5)(0.5,0){11}{\line(0,1){0.5}} + \put(0,3.5){\line(1,0){5}} + \put(0,4.2){\makebox(0,0)[bl]{Relokationstabelle}} + \put(1.0,3.4){\line(0,-1){1.9}} + \put(3.75,3.4){\vector(1,-2){1.2}} + \put(4.25,3.4){\vector(1,-1){2.4}} + \put(4.75,3.4){\vector(2,-1){4.8}} + + \put(4.95,0.7){\line(0,1){0.25}} + \put(4.95,0.7){\line(1,0){0.5}} + \put(5.45,0.7){\vector(0,1){0.25}} + \put(6.65,0.7){\line(0,1){0.25}} + \put(6.65,0.7){\line(1,0){0.8}} + \put(7.45,0.7){\vector(0,1){0.25}} + \put(9.55,0.6){\line(0,1){0.35}} + \put(9.55,0.6){\line(-1,0){3.2}} + \put(6.35,0.6){\vector(0,1){0.35}} + \put(7.25,0.4){\makebox(0,0)[t]{Sprünge innerhalb des Programms}} + + \put(6,4.0){\line(1,0){5}} + \multiput(6,3.5)(0.5,0){11}{\line(0,1){0.5}} + \put(6,3.5){\line(1,0){5}} + \put(6,4.2){\makebox(0,0)[bl]{Symboltabelle}} + \put(6.4,3.4){\line(-2,-1){3.8}} + \put(10.25,3.4){\vector(1,-2){1.2}} + \put(10.75,3.4){\vector(1,-1){2.4}} + + \put(9.25,1.55){\line(0,1){1}} + \put(8.50,2.60){\makebox(0,0)[b]{Maschinenprogramm}} + + \put(11.45,0.95){\vector(0,-1){1}} + \put(11.45,-0.10){\makebox(0,0)[t]{\lstinline{scanf}}} + \put(13.15,0.95){\vector(0,-1){1}} + \put(13.15,-0.10){\makebox(0,0)[t]{\lstinline{printf}}} + \put(12.30,-0.50){\makebox(0,0)[t]{Sprünge aus dem Programm heraus}} + + \end{picture} + \end{center} + + \vspace*{-1.2cm} + + \begin{onlyenv}<2> + + Ausführbare Binärdatei: + + \smallskip + + Relokationstabelle,\\ + Symboltabelle für dynamischen Linker + + \smallskip + + Formate: a.out, COFF, ELF, \dots\\ + Dateiendungen: (keine), .elf, .com, .exe, .scr + + \end{onlyenv} + + \begin{onlyenv}<3> + + Objektdatei: + + \smallskip + + Relokationstabelle,\\ + Symboltabellen für statischen und dynamischen Linker + + \smallskip + + Formate: a.out, COFF, ELF, \dots\\ + Dateiendungen: .o, .obj + + \end{onlyenv} + + \begin{onlyenv}<4-> + + \strut\\ + Bibliothek: + + \smallskip + + Zusammenfassung mehrerer Objekt-Dateien + + \smallskip + + Statische Bibliotheken: .a, .lib\\ + Dynamische Bibliotheken: .so, .dll + + \end{onlyenv} + +\end{frame} + +\subsection{Die Toolchain} + +\begin{frame}[fragile] + + \showsubsection + + \vspace*{-0.8cm} + \begin{center} + \addtolength{\leftskip}{4cm} + \small + \newcommand{\vtextarrow}[1]{% + \begin{picture}(0,0.8) + \put(0,0.8){\vector(0,-1){0.8}} + \put(0.125,0.4){\makebox(0,0)[l]{#1}} + \end{picture}} + + \framebox{\shortstack{\strut menschliche Gedanken}} + + \vtextarrow{Texteditor} + + \framebox{\shortstack{\strut C-Quelltext}} % (z.\,B.\ hello.c)}} + + \vtextarrow{Compiler} + + \framebox{\shortstack{\strut Assembler-Quelltext}} % (z.\,B.\ hello.s, hello.asm)}} + + \vtextarrow{Assembler} + + \framebox{\shortstack{\strut Objekt- und Bibliothek-Dateien}} % (z.\,B.\ hello.o, hello.obj)}} + + \vtextarrow{Linker} + + \framebox{\shortstack{\strut ausführbare Binärdatei}} % (z.\,B.\ hello, hello.exe)}} + + \vtextarrow{Loader} + + \framebox{\shortstack{\strut Programm im Speicher bereit zur Ausführung}} + \end{center} + + \pause + \vspace*{-7cm} + Automatischer Aufruf: + \begin{itemize} + \item + Entwicklungsumgebungen\\ + (z.\,B.\ Eclipse, Code::Blocks, \dots) + \medskip + \item + \file{gcc} = Compiler\\ + \hspace*{3em}+ Assembler\\ + \hspace*{3em}+ Linker\\ + \hspace*{3em}+ \dots + \medskip + \item + \file{make} kann \emph{alles} aufrufen + \end{itemize} + +\end{frame} + +\subsection{Besonderheiten von Mikro-Controllern} + +\begin{frame} + + \showsubsection + + Kein Betriebssystem\pause\\ + \textarrow\ kein Relocator, kein dynamischer Linker\pause\\ + \textarrow\ Wir müssen dem Mikro-Controller alles "`mundgerecht"' servieren. + + \pause + \smallskip + + \begin{itemize} + \item + fertiges ROM: Hersteller + \item + Flash-Speicher und In-System Programmer (ISP) + \item + Flash-Speicher und Boot-Loader + \end{itemize} + + \smallskip + + In jedem Fall: statisch linken, Relokation vorher + \begin{picture}(0,0) + \color{red} + \put(0.1,0.1){\line(1,0){1.2}} + \put(1.3,0.1){\vector(0,1){2.2}} + \end{picture}\\ + \textarrow\ ELF-Datei in HEX-Datei umwandeln + + \smallskip + + Format: Intel-Hex-Format\\ + Dateiendung: .hex + +\end{frame} + +\end{document} diff --git a/20210607/toolchain-1.txt b/20210607/toolchain-1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58a90da6e909e9076085c9604074bf49a539e6f8 --- /dev/null +++ b/20210607/toolchain-1.txt @@ -0,0 +1,20 @@ +cassini/home/peter/bo/2021ss/rtech/20210607> ls -lrt fak-r-1* +-rw-r--r-- 1 peter peter 173 Jun 1 11:55 fak-r-1.c +cassini/home/peter/bo/2021ss/rtech/20210607> gcc -Wall -O fak-r-1.c -S +cassini/home/peter/bo/2021ss/rtech/20210607> ls -lrt fak-r-1* +-rw-r--r-- 1 peter peter 173 Jun 1 11:55 fak-r-1.c +-rw-r--r-- 1 peter peter 810 Jun 7 18:32 fak-r-1.s +cassini/home/peter/bo/2021ss/rtech/20210607> gcc fak-r-1.s -c +cassini/home/peter/bo/2021ss/rtech/20210607> ls -lrt fak-r-1* +-rw-r--r-- 1 peter peter 173 Jun 1 11:55 fak-r-1.c +-rw-r--r-- 1 peter peter 810 Jun 7 18:32 fak-r-1.s +-rw-r--r-- 1 peter peter 1736 Jun 7 18:33 fak-r-1.o +cassini/home/peter/bo/2021ss/rtech/20210607> gcc fak-r-1.o -o fak-r-1 +cassini/home/peter/bo/2021ss/rtech/20210607> ls -lrt fak-r-1* +-rw-r--r-- 1 peter peter 173 Jun 1 11:55 fak-r-1.c +-rw-r--r-- 1 peter peter 810 Jun 7 18:32 fak-r-1.s +-rw-r--r-- 1 peter peter 1736 Jun 7 18:33 fak-r-1.o +-rwxr-xr-x 1 peter peter 16640 Jun 7 18:34 fak-r-1 +cassini/home/peter/bo/2021ss/rtech/20210607> ./fak-r-1 +6! = 720 +cassini/home/peter/bo/2021ss/rtech/20210607> diff --git a/projekte.txt b/projekte.txt index 4f2f5b628e77435cbfca6fbb6f114d9c537a1f5a..77cbc43692d6712acfb457bf261e50038a9c4151 100644 --- a/projekte.txt +++ b/projekte.txt @@ -44,7 +44,7 @@ Rechnertechnik-Projekte: o Arduino als VU-Meter o Soft-serielle Schnittstelle per TCP/IP übertragen o Core War - - Minecraft + o Minecraft-Taschenrechner Allgemeine Projektideen: @@ -86,3 +86,9 @@ Allgemeine Projektideen: Doku dazu: https://howto.rc3.world/workadventure.en.html * 3d-Scan aus einem Film heraus ;) BBB: Standard-Umfrage: Ja/Nein/Enthaltung + o NumPad für Hexadezimalzahlen + - taktile Tastaturen oder andere Eingabegeräte für mobile Computer (Smartphones) + - Automatische Transkription in BBB und/oder PULT + (zum Vergleich https://github.com/jitsi/jigasi/pull/294) + - GNU Pascal (Compiler) + - adele (Verschlüsselungsroboter)