feat: add lab-rv32i-freertos-event-group card
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# K13 — EventGroup and coordinated state
|
||||
|
||||
## Position
|
||||
|
||||
- Series: FreeRTOS C++
|
||||
- Lesson: L12, card K13
|
||||
- Duration: 30 minutes
|
||||
- Typed bits: UART=0x1, GPIO=0x2, APP=0x4
|
||||
- Static control block; no heap delta
|
||||
|
||||
## Outcome
|
||||
|
||||
The student designs a typed readiness mask, distinguishes any/all and
|
||||
keep/clear-on-exit, explains timeout snapshots, and rejects the interpretation
|
||||
of an event bit as a counter or payload.
|
||||
|
||||
## Lesson plan
|
||||
|
||||
| Time | Mode | Evidence |
|
||||
| --- | --- | --- |
|
||||
| 0–5 | typed masks | enum bits combine to all=0x7 |
|
||||
| 5–10 | publishers | coordinator Blocked; workers set 1,2,4 |
|
||||
| 10–15 | wait all | snapshot/current=0x7, satisfied |
|
||||
| 15–20 | clear one | clear GPIO returns 0x7, current=0x5 |
|
||||
| 20–25 | timeout | all unsatisfied for 3 ticks, snapshot=0x5 |
|
||||
| 25–30 | any + clear | snapshot=0x5, final=0; discuss races/counters |
|
||||
|
||||
## Acceptance
|
||||
|
||||
- type is an enum and masks remain typed at the wrapper boundary;
|
||||
- event-group handle equals caller static control and heap delta is zero;
|
||||
- coordinator is eBlocked before the first worker publishes;
|
||||
- repeated UART set is idempotent at mask 1;
|
||||
- all/keep gives 7 and explicit GPIO clear gives 5;
|
||||
- second all wait times out after at least 3 ticks with snapshot 5;
|
||||
- any/clear-on-exit succeeds with snapshot 5 and final mask 0;
|
||||
- target exits with PASS.
|
||||
|
||||
## Main traps
|
||||
|
||||
1. A bit is state, not an event count.
|
||||
2. A bit mask is not a payload record.
|
||||
3. Clear-on-exit affects all selected bits and can race with other waiters.
|
||||
4. Timeout return is a snapshot; test satisfaction explicitly.
|
||||
5. EventGroup FromISR set is deferred through the timer service task.
|
||||
@@ -0,0 +1,344 @@
|
||||
% Generated from json/card_source.json by tools/render_card.py.
|
||||
% Do not edit manually; update the JSON and regenerate.
|
||||
|
||||
\documentclass[12pt,a4paper]{article}
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[polish]{babel}
|
||||
\usepackage{csquotes}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{xcolor}
|
||||
\usepackage[a4paper,left=2.15cm,right=2.15cm,top=0.5cm,bottom=0.5cm,headheight=24mm,headsep=3mm,includehead]{geometry}
|
||||
\usepackage{eso-pic}
|
||||
\usepackage{marginnote}
|
||||
\usepackage{array}
|
||||
\usepackage{tabularx}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{pdflscape}
|
||||
\usepackage{float}
|
||||
\usepackage{silence}
|
||||
\WarningFilter{soulutf8}{This package is obsolete}
|
||||
\usepackage{pdfcomment}
|
||||
\usepackage{enumitem}
|
||||
\usepackage{needspace}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{lastpage}
|
||||
\usepackage{microtype}
|
||||
\usepackage[most]{tcolorbox}
|
||||
\usepackage{qrcode}
|
||||
\IfFileExists{references.bib}{%
|
||||
\usepackage[backend=biber,style=numeric,sorting=none]{biblatex}%
|
||||
\addbibresource{references.bib}%
|
||||
}{}
|
||||
|
||||
\hypersetup{hidelinks}
|
||||
|
||||
\IfFileExists{build-meta.tex}{%
|
||||
\input{build-meta.tex}%
|
||||
}{%
|
||||
\newcommand{\BuildCommit}{lokalna}%
|
||||
}
|
||||
|
||||
\newcommand{\DocumentAuthor}{M. Pabiszczak}
|
||||
\newcommand{\DocumentYear}{2026}
|
||||
\newcommand{\CardSeries}{freertos-cpp}
|
||||
\newcommand{\CardNumber}{13}
|
||||
\newcommand{\CardCount}{16}
|
||||
\newcommand{\CardSlug}{event-group}
|
||||
\newcommand{\CardVersion}{v00.01}
|
||||
\newcommand{\DocumentUUID}{5fbcd7c6-3a73-4cd2-b76c-bdb016d1daaa}
|
||||
|
||||
\newcommand{\EmptyCheck}{\(\square\)}
|
||||
\newcommand{\EscAnswerLines}[1][3]{\par\noindent\dotfill\par\noindent\dotfill\par\noindent\dotfill}
|
||||
\newcommand{\EscWriteRow}[1][2.8em]{\rule{0pt}{#1}}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{0.45em}
|
||||
\setlength{\headheight}{24mm}
|
||||
\setlength{\headsep}{3mm}
|
||||
\setlength{\footskip}{8mm}
|
||||
\setlength{\marginparwidth}{1.5cm}
|
||||
\setlength{\marginparsep}{0.25cm}
|
||||
\renewcommand{\arraystretch}{1.22}
|
||||
% Margin separator lines disabled for layout trial.
|
||||
|
||||
\newcommand{\ESCPageResourceHeader}{%
|
||||
\begingroup%
|
||||
\setlength{\parskip}{0pt}%
|
||||
\setlength{\fboxsep}{0pt}%
|
||||
\setlength{\fboxrule}{0.35pt}%
|
||||
\setlength{\arrayrulewidth}{0.35pt}%
|
||||
\noindent\fbox{%
|
||||
\begin{minipage}[c][23.5mm][c]{\dimexpr\textwidth-2\fboxrule\relax}%
|
||||
\begin{minipage}[c][23mm][c]{\dimexpr\linewidth-24mm-0.35pt\relax}%
|
||||
\setlength{\tabcolsep}{0pt}%
|
||||
\renewcommand{\arraystretch}{0}%
|
||||
\begin{tabularx}{\linewidth}{@{}p{\dimexpr0.50000000\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.15126050\linewidth-\arrayrulewidth\relax}|X@{}}%
|
||||
\parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries TITLE}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{7.7}{7.9}\selectfont\ttfamily\bfseries EventGroup and Coordinated State}\hspace{0.45mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries VER.}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{6.6}{6.8}\selectfont\ttfamily\bfseries v00.01}\hspace{0.45mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries DATETIME}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{6.4}{6.6}\selectfont\ttfamily\bfseries 2026-07-19T00:00:00+02:00}\hspace{0.45mm}}\par} \\%
|
||||
\end{tabularx}%
|
||||
\par\nointerlineskip%
|
||||
\hrule height0.35pt%
|
||||
\nointerlineskip%
|
||||
\begin{tabularx}{\linewidth}{@{}p{\dimexpr0.50000000\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.25210084\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.14285714\linewidth-\arrayrulewidth\relax}|X@{}}%
|
||||
\parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries PROJECT}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{7.7}{7.9}\selectfont\ttfamily\bfseries Freestanding C++ nad FreeRTOS}\hspace{0.45mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries SERIES}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{6.4}{6.6}\selectfont\ttfamily\bfseries FreeRTOS C++}\hspace{0.45mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries CARD}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{6.4}{6.6}\selectfont\ttfamily\bfseries 13/16}\hspace{0.45mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{3.2}{3.4}\selectfont\ttfamily\bfseries SHEET}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{6.4}{6.6}\selectfont\ttfamily\bfseries \thepage/\pageref{LastPage}}\hspace{0.45mm}}\par} \\%
|
||||
\end{tabularx}%
|
||||
\par\nointerlineskip%
|
||||
\hrule height0.35pt%
|
||||
\nointerlineskip%
|
||||
\begin{tabularx}{\linewidth}{@{}p{\dimexpr0.05882353\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.05042017\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.14705882\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.09243697\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.07563025\linewidth-\arrayrulewidth\relax}|p{\dimexpr0.07563025\linewidth-\arrayrulewidth\relax}|X@{}}%
|
||||
\parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries SUBJ.}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries Inf.}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries PROG.}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries —}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries CORE}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries —}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries SCOPE}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries —}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries LEVEL}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries —}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hspace{0.15mm}{\fontsize{2.85}{3}\selectfont\ttfamily\bfseries POS.}\par\nointerlineskip\vspace{0.12mm}\noindent\makebox[\linewidth][r]{{\fontsize{4.45}{4.65}\selectfont\ttfamily\bfseries —}\hspace{0.15mm}}\par} & \parbox[c][5.19414mm][c]{\linewidth}{\hbox to\linewidth{\hspace{0.35mm}{\fontsize{3.4}{3.75}\selectfont\ttfamily\bfseries GITEA UUID}\hfill{\fontsize{3.4}{3.75}\selectfont\ttfamily 5fbcd7c6-3a73-4cd2-b76c-bdb016d1daaa}\hspace{0.35mm}}\par\nointerlineskip\hbox to\linewidth{\hspace{0.35mm}{\fontsize{3.4}{3.75}\selectfont\ttfamily\bfseries CARD UUID} {\fontsize{3.4}{3.75}\selectfont\ttfamily 5fbcd7c6-3a73-4cd2-b76c-bdb016d1daaa}\hfill{\fontsize{3.4}{3.75}\selectfont\ttfamily\bfseries AUTHOR M. Pabiszczak}\hspace{0.35mm}}} \\%
|
||||
\end{tabularx}%
|
||||
\par\nointerlineskip%
|
||||
\hrule height0.35pt%
|
||||
\nointerlineskip%
|
||||
\begin{tabularx}{\linewidth}{@{}X@{}}%
|
||||
\parbox[c][3.46276mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{4.5}{4.85}\selectfont\ttfamily\bfseries GITEA} {\fontsize{4.5}{4.85}\selectfont\ttfamily\href{https://zsl-gitea.mpabi.pl/edu-freertos-cpp/lab-rv32i-freertos-event-group}{\nolinkurl{https://zsl-gitea.mpabi.pl/edu-freertos-cpp/lab-rv32i-freertos-event-group}}}} \\%
|
||||
\end{tabularx}%
|
||||
\par\nointerlineskip%
|
||||
\hrule height0.35pt%
|
||||
\nointerlineskip%
|
||||
\begin{tabularx}{\linewidth}{@{}X@{}}%
|
||||
\parbox[c][3.46276mm][c]{\linewidth}{\hspace{0.45mm}{\fontsize{4.5}{4.85}\selectfont\ttfamily\bfseries HTML} {\fontsize{4.5}{4.85}\selectfont\ttfamily\href{}{\nolinkurl{}}}} \\%
|
||||
\end{tabularx}%
|
||||
\end{minipage}%
|
||||
\vrule width0.35pt%
|
||||
\begin{minipage}[c][23mm][c]{24mm}\centering%
|
||||
{\tiny QR wyłączony}%
|
||||
\end{minipage}%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\fancyhead[C]{\ESCPageResourceHeader}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\renewcommand{\footrulewidth}{0pt}
|
||||
|
||||
\newcommand{\ESCMarginTag}[4]{%
|
||||
\hspace*{#1}\textcolor{#2}{#3~#4}%
|
||||
}
|
||||
\newcommand{\ESCSectionBlockStart}{%
|
||||
\Needspace{8\baselineskip}%
|
||||
\par\vspace{0.35em}%
|
||||
\noindent\textcolor{black!28}{\rule{\textwidth}{0.35pt}}%
|
||||
\par\vspace{0.15em}%
|
||||
}
|
||||
\newcommand{\ESCSectionBlockEnd}{%
|
||||
\par\vspace{0.25em}%
|
||||
\noindent\textcolor{black!18}{\rule{\textwidth}{0.25pt}}%
|
||||
\par\vspace{0.45em}%
|
||||
}
|
||||
\newcommand{\ESCTinyStepSeparator}{%
|
||||
\par\vspace{0.10em}%
|
||||
\noindent{\color{black!18}\leaders\hbox{\rule{0.60em}{0.22pt}\hspace{0.38em}}\hfill\kern0pt}%
|
||||
\par\vspace{0.10em}%
|
||||
}
|
||||
\newtcolorbox{ESCTaskFrame}[1]{enhanced,breakable,arc=0pt,boxrule=0.35pt,colback=white,colframe=black,boxsep=0pt,left=1.4mm,right=1.4mm,top=0.8mm,bottom=0.8mm,colbacktitle=black!7,coltitle=black,title={\ttfamily\bfseries TASK\quad #1}}
|
||||
\newtcolorbox{ESCBlockFrame}[1]{enhanced,breakable,arc=0pt,boxrule=0.35pt,colback=white,colframe=black!55,boxsep=0pt,left=1.0mm,right=1.0mm,top=0.6mm,bottom=0.6mm,colbacktitle=black!4,coltitle=black,title={\ttfamily\bfseries BLOCK\quad #1}}
|
||||
\newtcolorbox{ESCStepFrame}[1]{enhanced,breakable,arc=0pt,boxrule=0.35pt,colback=white,colframe=black!28,boxsep=0pt,left=0.8mm,right=0.8mm,top=0.45mm,bottom=0.45mm,colbacktitle=black!2,coltitle=black,title={\ttfamily STEP\quad #1}}
|
||||
\newtcolorbox{ESCConclusionFrame}{enhanced,breakable,arc=0pt,boxrule=0.45pt,colback=blue!2,colframe=blue!45!black,boxsep=0pt,left=1.2mm,right=1.2mm,top=0.7mm,bottom=0.7mm,colbacktitle=blue!7,coltitle=black,title={\ttfamily\bfseries WNIOSEK}}
|
||||
|
||||
\newcommand{\ESCLearningTreeWidget}{%
|
||||
\reversemarginpar
|
||||
\marginnote[%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\begin{minipage}[t]{\marginparwidth}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{TECH}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\hspace*{0.28em}\textcolor{orange!85!black}{EK~LOCAL~DBG.EVENT}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Mierzy transitions, task blocking, snapshots i timeout ticks.}}\par%
|
||||
\hspace*{0.54em}\textcolor{blue!70!black}{KW~LOCAL~DBG.EVENT}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Pokazuje 0x7, 0x5, timeout false, final 0x0 i PASS.}}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
]{}
|
||||
\normalmarginpar
|
||||
|
||||
\marginnote{%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\hspace*{0.06cm}%
|
||||
\begin{minipage}[t]{\dimexpr\marginparwidth-0.06cm\relax}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{OG}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\hspace*{0.28em}\textcolor{green!50!black}{EN~LOCAL~EN~RTOS.EVENT}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Analizuje stan bitowy, utratę informacji i granice EventGroup.}}\par%
|
||||
\hspace*{0.54em}\textcolor{blue!70!black}{KW~LOCAL~KW~RTOS.EVENT}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Nie używa bitów jako licznika ani payloadu i uzasadnia race clear-on-exit.}}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
\sloppy
|
||||
|
||||
\vspace{1.0em}
|
||||
\noindent{\Large\bfseries Cel karty}\par
|
||||
\vspace{0.35em}
|
||||
Uczeń modeluje skoordynowany stan trzema typowanymi bitami, wybiera predykat any/all oraz mierzy snapshot, clear-on-exit i timeout.
|
||||
|
||||
\vspace{0.8em}
|
||||
\noindent\textcolor{black!25}{\rule{\textwidth}{0.35pt}}
|
||||
\vspace{0.7em}
|
||||
\noindent{\Large\bfseries Zakres karty}\par
|
||||
\vspace{0.35em}
|
||||
EventGroup przechowuje bity stanu, nie licznik zdarzeń ani payload. Wynik wait jest snapshotem i wymaga sprawdzenia wybranego predykatu.
|
||||
|
||||
\vspace{0.8em}
|
||||
\noindent\textcolor{black!25}{\rule{\textwidth}{0.35pt}}
|
||||
|
||||
\clearpage
|
||||
|
||||
\ESCSectionBlockStart
|
||||
\section{Typed masks i wait all}
|
||||
\reversemarginpar
|
||||
\marginnote[%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\begin{minipage}[t]{\marginparwidth}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{TECH}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
]{}[-3.1em]
|
||||
\normalmarginpar
|
||||
|
||||
\marginnote{%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\hspace*{0.06cm}%
|
||||
\begin{minipage}[t]{\dimexpr\marginparwidth-0.06cm\relax}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{OG}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
}[-3.1em]
|
||||
|
||||
|
||||
\begingroup
|
||||
\scriptsize\ttfamily\color{black!60}\sloppy
|
||||
\noindent drzewka: \pdftooltip[width=\textwidth]{D1}{K13.WE01.TECH.LOCAL.DBG.EVENT.01 | WE 01: EventGroup i koordynacja. Implementacja i pomiar\textCR EventGroup jako współdzielonego bitowego stanu. | EK LOCAL DBG.EVENT.01: Mierzy transitions,\textCR task blocking, snapshots i timeout ticks. | KW LOCAL DBG.EVENT.01: Pokazuje 0x7, 0x5,\textCR timeout false, final 0x0 i PASS.}\par
|
||||
\vspace{0.10em}%
|
||||
\noindent K1: Potwierdź Blocked oraz set 1, 2 i 4.\quad D1\par
|
||||
\ESCTinyStepSeparator
|
||||
\noindent K2: Zapisz all snapshot i current 0x7.\quad D1\par
|
||||
\par\vspace{0.18em}%
|
||||
\endgroup
|
||||
|
||||
Zbuduj maskę UART/GPIO/APP, zablokuj coordinator, opublikuj trzy stany i zachowaj maskę po wait all.
|
||||
\ESCSectionBlockEnd
|
||||
|
||||
\ESCSectionBlockStart
|
||||
\section{Clear, timeout i wait any}
|
||||
\reversemarginpar
|
||||
\marginnote[%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\begin{minipage}[t]{\marginparwidth}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{TECH}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
]{}[-3.1em]
|
||||
\normalmarginpar
|
||||
|
||||
\marginnote{%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\hspace*{0.06cm}%
|
||||
\begin{minipage}[t]{\dimexpr\marginparwidth-0.06cm\relax}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{OG}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
}[-3.1em]
|
||||
|
||||
|
||||
\begingroup
|
||||
\scriptsize\ttfamily\color{black!60}\sloppy
|
||||
\noindent drzewka: \pdftooltip[width=\textwidth]{D1}{K13.WE01.TECH.LOCAL.DBG.EVENT.01 | WE 01: EventGroup i koordynacja. Implementacja i pomiar\textCR EventGroup jako współdzielonego bitowego stanu. | EK LOCAL DBG.EVENT.01: Mierzy transitions,\textCR task blocking, snapshots i timeout ticks. | KW LOCAL DBG.EVENT.01: Pokazuje 0x7, 0x5,\textCR timeout false, final 0x0 i PASS.}\par
|
||||
\vspace{0.10em}%
|
||||
\noindent K1: Pokaż transition 0x7 do 0x5.\quad D1\par
|
||||
\ESCTinyStepSeparator
|
||||
\noindent K2: Zmierz timeout 3 i final mask 0x0.\quad D1\par
|
||||
\par\vspace{0.18em}%
|
||||
\endgroup
|
||||
|
||||
Usuń GPIO, zmierz timeout all z częściową maską, a następnie skonsumuj UART i APP przez any/clear-on-exit.
|
||||
\ESCSectionBlockEnd
|
||||
|
||||
\ESCSectionBlockStart
|
||||
\section{Stan, licznik i race}
|
||||
\reversemarginpar
|
||||
\marginnote[%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\begin{minipage}[t]{\marginparwidth}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{TECH}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
]{}[-3.1em]
|
||||
\normalmarginpar
|
||||
|
||||
\marginnote{%
|
||||
\begin{minipage}{\marginparwidth}%
|
||||
\raggedright
|
||||
{\fontsize{3.55}{3.95}\selectfont\ttfamily
|
||||
\hspace*{0.06cm}%
|
||||
\begin{minipage}[t]{\dimexpr\marginparwidth-0.06cm\relax}%
|
||||
\raggedright
|
||||
{\bfseries\textcolor{black!65}{OG}\par}%
|
||||
\vspace{0.08em}%
|
||||
\hspace*{0.00em}\textcolor{red}{WE~01}\textcolor{black!48}{}\par%
|
||||
\end{minipage}%
|
||||
}%
|
||||
\end{minipage}%
|
||||
}[-3.1em]
|
||||
|
||||
|
||||
\begingroup
|
||||
\scriptsize\ttfamily\color{black!60}\sloppy
|
||||
\noindent drzewka: \pdftooltip[width=\textwidth]{D1}{K13.WE01.OG.LOCAL.RTOS.EVENT.01 | WE 01: EventGroup i koordynacja. Implementacja i pomiar\textCR EventGroup jako współdzielonego bitowego stanu. | EN LOCAL RTOS.EVENT.01: Analizuje stan\textCR bitowy, utratę informacji i granice EventGroup. | KW LOCAL RTOS.EVENT.01: Nie używa bitów\textCR jako licznika ani payloadu i uzasadnia race clear-on-exit.}\par
|
||||
\vspace{0.10em}%
|
||||
\noindent K1: Dobierz queue/counter dla wielokrotnych zdarzeń.\quad D1\par
|
||||
\ESCTinyStepSeparator
|
||||
\noindent K2: Przeanalizuj dwóch waiterów z clear-on-exit.\quad D1\par
|
||||
\par\vspace{0.18em}%
|
||||
\endgroup
|
||||
|
||||
Wyjaśnij, dlaczego repeated set pozostaje 0x1, dlaczego result!=0 nie dowodzi wait all i jak clear-on-exit wpływa na drugiego waitera.
|
||||
\ESCSectionBlockEnd
|
||||
|
||||
\end{document}
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
\documentclass[10pt]{article}
|
||||
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage[polish]{babel}
|
||||
\usepackage[a4paper,margin=1.55cm]{geometry}
|
||||
\usepackage{array,tabularx,booktabs,amsmath,amssymb,xcolor,listings,hyperref,fancyhdr,lastpage,enumitem}
|
||||
\definecolor{accent}{HTML}{16324A}\definecolor{accentlight}{HTML}{EEF3F7}\definecolor{rulegray}{HTML}{D7DEE5}
|
||||
\hypersetup{colorlinks=true,linkcolor=accent,urlcolor=blue}
|
||||
\IfFileExists{build-meta.tex}{\input{build-meta.tex}}{\newcommand{\BuildCommit}{local}}
|
||||
\newcommand{\PublisherDomain}{mpabi}
|
||||
\newcommand{\CardArea}{inf}
|
||||
\newcommand{\CardSeries}{freertos-cpp}
|
||||
\newcommand{\CardNumber}{13}
|
||||
\newcommand{\CardCount}{16}
|
||||
\newcommand{\CardSlug}{event-group}
|
||||
\newcommand{\CardVersion}{v00.01}
|
||||
\newcommand{\DocumentUUID}{5fbcd7c6-3a73-4cd2-b76c-bdb016d1daaa}
|
||||
\newcommand{\blank}[1]{\rule{#1}{.2pt}}
|
||||
\lstset{language=C++,basicstyle=\ttfamily\scriptsize,columns=fullflexible,keepspaces=true,frame=single,breaklines=true,showstringspaces=false,numbers=none,backgroundcolor=\color{accentlight},rulecolor=\color{rulegray}}
|
||||
\pagestyle{fancy}\fancyhf{}
|
||||
\lhead{\textbf{K13 · FreeRTOS C++ · EventGroup}}\rhead{\small L12 · typed coordinated state}
|
||||
\lfoot{\scriptsize commit \BuildCommit}\cfoot{\scriptsize \thepage/\pageref{LastPage}}\rfoot{\scriptsize V11.3.0 / \CardVersion}
|
||||
\setlength{\headheight}{14pt}\setlength{\footskip}{19pt}
|
||||
\setlist[itemize]{nosep,leftmargin=1.45em}\setlist[enumerate]{nosep,leftmargin=1.65em}
|
||||
\begin{document}\sloppy
|
||||
\begin{center}
|
||||
{\LARGE\bfseries Typed \texttt{EventBits} i koordynacja stanu}\par
|
||||
\vspace{.25em}{\large wait any/all, keep/clear-on-exit i timeout snapshot}\par
|
||||
\end{center}
|
||||
\noindent\begin{tabularx}{\textwidth}{@{}p{1.65cm}Xp{1.75cm}X@{}}
|
||||
\toprule
|
||||
Karta & K13 / \CardCount & Czas & 30 minut \\
|
||||
Platforma & Hazard3 / RV32I & Bity & UART/GPIO/APP \\
|
||||
Maska all & \texttt{0x7} & Storage & static, heap delta 0 \\
|
||||
Wersja & \CardVersion & UUID karty & \texttt{5fbcd7c6-...} \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\section*{Typowana maska}
|
||||
\begin{lstlisting}
|
||||
enum class ReadyBit : EventBits_t {
|
||||
uart = 1u << 0, gpio = 1u << 1, app = 1u << 2
|
||||
};
|
||||
auto all = Mask{ReadyBit::uart} | Mask{ReadyBit::gpio} |
|
||||
Mask{ReadyBit::app};
|
||||
\end{lstlisting}
|
||||
|
||||
\noindent\fcolorbox{accent}{accentlight}{\begin{minipage}{.94\textwidth}
|
||||
\textbf{Kontrakt K13.} Bit opisuje stan true/false. Ponowne set nie zwiększa
|
||||
licznika. Wynik wait jest snapshotem; trzeba oddzielnie sprawdzić, czy spełnia
|
||||
politykę any/all. Clear-on-exit jest jawną decyzją współdzieloną z waiterami.
|
||||
\end{minipage}}
|
||||
|
||||
\section*{Plan 30 minut}
|
||||
\noindent\begin{tabularx}{\textwidth}{@{}p{1.35cm}p{3.1cm}X@{}}
|
||||
\toprule Czas & Tryb & Dowód \\
|
||||
\midrule
|
||||
0--5 & masks & enum 1,2,4; all=7 \\
|
||||
5--10 & publish & coordinator Blocked; trzy taski set \\
|
||||
10--15 & all/keep & snapshot i current = 7 \\
|
||||
15--20 & clear & tylko GPIO: 7--5 \\
|
||||
20--25 & timeout & all false po 3 tickach, snapshot 5 \\
|
||||
25--30 & any/clear & UART|APP true; snapshot 5, final 0 \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\section*{Predykcja}
|
||||
\texttt{UART|GPIO|APP} = \blank{2cm}. Czy dwukrotne set UART da maskę 2?
|
||||
\blank{2cm}. Dlaczego? \blank{7cm}
|
||||
|
||||
\newpage
|
||||
\section{Trzech publisherów, jeden wait all}
|
||||
|
||||
\begin{center}
|
||||
\texttt{coordinator wait ALL(0x7), keep -- Blocked}\\
|
||||
$\downarrow$ \texttt{UART set 0x1}\\
|
||||
$\downarrow$ \texttt{GPIO set 0x2}\\
|
||||
$\downarrow$ \texttt{APP set 0x4 -- mask 0x7 -- coordinator Ready}
|
||||
\end{center}
|
||||
|
||||
\noindent\begin{tabularx}{\textwidth}{@{}p{4.5cm}p{3.3cm}X@{}}
|
||||
\toprule Pomiar & Predykcja & Odczyt \\
|
||||
\midrule
|
||||
coordinator przy first set & Blocked & \blank{2.5cm} \\
|
||||
UART first set result & \texttt{0x1} & \blank{2.5cm} \\
|
||||
UART repeated set & \texttt{0x1} & \blank{2.5cm} \\
|
||||
wait all snapshot & \texttt{0x7} & \blank{2.5cm} \\
|
||||
all satisfied & true & \blank{2.5cm} \\
|
||||
current po keep & \texttt{0x7} & \blank{2.5cm} \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\section*{Dlaczego repeated set nie liczy zdarzeń?}
|
||||
Set wykonuje logiczne OR. Jeśli UART musi policzyć pięć ramek, EventGroup nie
|
||||
przechowa tej liczby. Potrzebny jest counter, queue albo notification count.
|
||||
|
||||
Podaj przykład poprawnego stanu bitowego i błędnego licznika bitowego:\\[.5em]
|
||||
\blank{16cm}\\[1em]\blank{16cm}
|
||||
|
||||
\section{Jawne clear jednego bitu}
|
||||
\begin{lstlisting}
|
||||
auto before = group.clear(Mask{ReadyBit::gpio}); // returns 0x7
|
||||
auto after = group.bits(); // now 0x5
|
||||
\end{lstlisting}
|
||||
|
||||
Clear return: \blank{2.5cm}. Maska po clear: \blank{2.5cm}. Które subsystemy
|
||||
pozostają ready? \blank{5cm}.
|
||||
|
||||
\newpage
|
||||
\section{Timeout jest snapshotem, nie osobnym błędem}
|
||||
|
||||
Po usunięciu GPIO maska \texttt{0x5} nie spełnia ALL(\texttt{0x7}).
|
||||
|
||||
\noindent\begin{tabularx}{\textwidth}{@{}p{5cm}p{3.3cm}X@{}}
|
||||
\toprule Pomiar & Predykcja & Odczyt \\
|
||||
\midrule
|
||||
timeout & 3 ticki & \blank{2.5cm} \\
|
||||
returned snapshot & \texttt{0x5} & \blank{2.5cm} \\
|
||||
ALL satisfied & false & \blank{2.5cm} \\
|
||||
current po keep & \texttt{0x5} & \blank{2.5cm} \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
Nie testuj timeoutu przez \texttt{result==0}: częściowa maska może być niezerowa.
|
||||
Poprawny test porównuje \texttt{result \& wanted} według any/all.
|
||||
|
||||
\section{Any i clear-on-exit}
|
||||
\begin{lstlisting}
|
||||
auto wanted = Mask{ReadyBit::uart} | Mask{ReadyBit::app};
|
||||
auto result = group.wait(wanted, WaitMode::any,
|
||||
ClearMode::clear_on_exit, 0);
|
||||
\end{lstlisting}
|
||||
|
||||
\noindent\begin{tabularx}{\textwidth}{@{}p{5cm}p{3.3cm}X@{}}
|
||||
\toprule Pomiar & Predykcja & Odczyt \\
|
||||
\midrule
|
||||
snapshot before clear & \texttt{0x5} & \blank{2.5cm} \\
|
||||
ANY satisfied & true & \blank{2.5cm} \\
|
||||
bits cleared & UART i APP & \blank{2.5cm} \\
|
||||
final current mask & \texttt{0x0} & \blank{2.5cm} \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\section*{Race do omówienia}
|
||||
Dwóch waiterów czeka na ten sam bit z clear-on-exit. Który zobaczy stan i czy
|
||||
drugi ma gwarancję sukcesu?\\[.5em]\blank{16cm}\\[1em]\blank{16cm}
|
||||
|
||||
\section*{ISR boundary}
|
||||
\texttt{xEventGroupSetBitsFromISR} nie edytuje grupy bezpośrednio: odkłada
|
||||
operację do timer service task. To wymaga działającego daemon taska i jawnej
|
||||
analizy opóźnienia; K13 mierzy wyłącznie task-context API.
|
||||
|
||||
\newpage
|
||||
\section{Hazard3/GDB i zaliczenie}
|
||||
\begin{lstlisting}[language=bash]
|
||||
make check
|
||||
riscv64-unknown-elf-gdb build/task01_event_group/prog.elf
|
||||
b event_group_debug_checkpoint
|
||||
\end{lstlisting}
|
||||
\begin{lstlisting}
|
||||
p g_coordinator_state_seen
|
||||
p g_worker_set_result
|
||||
p/x g_uart_repeat_mask
|
||||
p/x g_all_snapshot
|
||||
p/x g_mask_after_gpio_clear
|
||||
p/x g_timeout_snapshot
|
||||
p g_timeout_satisfied
|
||||
p g_timeout_ticks
|
||||
p/x g_any_snapshot
|
||||
p/x g_final_mask
|
||||
p g_event_group_pass
|
||||
\end{lstlisting}
|
||||
|
||||
\section*{Zaliczenie}
|
||||
\begin{itemize}
|
||||
\item $\square$ buduję typed maskę UART/GPIO/APP = 0x7;
|
||||
\item $\square$ pokazuję Blocked, wait all/keep i snapshot 0x7;
|
||||
\item $\square$ repeated UART set zostaje 0x1, więc nie jest counterem;
|
||||
\item $\square$ clear GPIO zmienia 0x7 na 0x5;
|
||||
\item $\square$ timeout 3 zwraca snapshot 0x5 i unsatisfied;
|
||||
\item $\square$ any/clear zwraca 0x5 i pozostawia final 0x0.
|
||||
\end{itemize}
|
||||
|
||||
\section*{Wyjście}
|
||||
Dlaczego \texttt{result!=0} nie dowodzi spełnienia wait all?\\[.5em]
|
||||
\blank{16cm}\\[1em]
|
||||
Kiedy clear-on-exit może zgubić informację drugiemu waiterowi?\\[.5em]
|
||||
\blank{16cm}
|
||||
|
||||
\vfill
|
||||
\noindent\textbf{Następna karta K14:} software timer, daemon task, one-shot,
|
||||
auto-reload, callback context oraz bezpieczna granica lifetime.
|
||||
\end{document}
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user