feat: publish FreeRTOS C FC02 card

This commit is contained in:
2026-07-19 16:36:02 +02:00
commit e3420748ee
208 changed files with 57240 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

+18
View File
@@ -0,0 +1,18 @@
@startuml
!include card-uml-style.iuml
scale 620 width
top to bottom direction
class "01 Application C\ntask01_first_task.c" as Application <<layer>>
class "02 FreeRTOS C API\nTaskFunction_t · xTaskCreate" as CAPI <<boundary>>
class "03 Kernel + RV32I port\nscheduler · tick · heap_4\nHazard3 CPU" as Runtime <<runtime>>
Application --> CAPI : requests tasks
CAPI --> Runtime : owns scheduling
note right of CAPI
Public C contract.
Application does not depend
on TCB internals.
end note
@enduml
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="477.3551px" preserveAspectRatio="none" style="width:613px;height:477px;" version="1.1" viewBox="0 0 613 477" width="613.2609px" zoomAndPan="magnify"><defs/><g><!--MD5=[0b4e4b4980470ea387cc45de9bd14b5b]
class Application--><rect fill="#F5F8FA" height="91.7943" id="Application" style="stroke: #607985; stroke-width: 1.6847826086956523;" width="213.4058" x="51.6667" y="9.3899"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="12.3551" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="55.0362" x="130.8514" y="33.2132">«layer»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="171.8478" x="72.4457" y="65.2438">01 Application C</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="192.0652" x="62.337" y="84.8557">task01_first_task.c</text><!--MD5=[f9750b3f2f09b0a9be86a744d1742330]
class CAPI--><rect fill="#F5F8FA" height="91.7943" id="CAPI" style="stroke: #607985; stroke-width: 1.6847826086956523;" width="303.2609" x="6.7391" y="182.0576"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="12.3551" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="78.6232" x="119.058" y="205.8809">«boundary»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="181.9565" x="67.3913" y="237.9116">02 FreeRTOS C API</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="283.0435" x="16.8478" y="257.5235">TaskFunction_t · xTaskCreate</text><!--MD5=[a56a186a64fdd59048237ee22fac1723]
class Runtime--><rect fill="#F5F8FA" height="111.4063" id="Runtime" style="stroke: #607985; stroke-width: 1.6847826086956523;" width="272.9348" x="21.9022" y="354.7141"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="12.3551" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="70.7609" x="122.9891" y="378.5375">«runtime»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="232.5" x="42.1196" y="410.5681">03 Kernel + RV32I port</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="252.7174" x="32.0109" y="430.18">scheduler · tick · heap_4</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="16.8478" lengthAdjust="spacingAndGlyphs" textLength="111.1957" x="102.7717" y="449.7919">Hazard3 CPU</text><path d="M350.4348,192.0652 L350.4348,223.4583 L310.5504,227.9511 L350.4348,232.4438 L350.4348,263.844 A0,0 0 0 0 350.4348,263.844 L599.7826,263.844 A0,0 0 0 0 599.7826,263.844 L599.7826,203.2971 L588.5507,192.0652 L350.4348,192.0652 A0,0 0 0 0 350.4348,192.0652 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 1.1231884057971016;"/><path d="M588.5507,192.0652 L588.5507,203.2971 L599.7826,203.2971 L588.5507,192.0652 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 1.1231884057971016;"/><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="13.4783" lengthAdjust="spacingAndGlyphs" textLength="141.5217" x="363.913" y="216.9311">Public C contract.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="13.4783" lengthAdjust="spacingAndGlyphs" textLength="212.2826" x="363.913" y="232.6207">Application does not depend</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="13.4783" lengthAdjust="spacingAndGlyphs" textLength="133.6594" x="363.913" y="248.3102">on TCB internals.</text><!--MD5=[e3b7ec1ac52dd22be1ed790126c7e198]
link Application to CAPI--><path d="M158.3696,101.6261 C158.3696,124.0562 158.3696,151.271 158.3696,174.5884 " fill="none" id="Application-&gt;CAPI" style="stroke: #607985; stroke-width: 1.4601449275362322;"/><polygon fill="#607985" points="158.3696,179.9909,162.8623,169.8822,158.3696,174.375,153.8768,169.8822,158.3696,179.9909" style="stroke: #607985; stroke-width: 1.4601449275362322;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="15.7246" lengthAdjust="spacingAndGlyphs" textLength="125.7971" x="166.2319" y="147.2333">requests tasks</text><!--MD5=[baa772a5f496014bf0b81eeab2506b5b]
link CAPI to Runtime--><path d="M158.3696,274.0917 C158.3696,296.196 158.3696,323.1862 158.3696,347.2225 " fill="none" id="CAPI-&gt;Runtime" style="stroke: #607985; stroke-width: 1.4601449275362322;"/><polygon fill="#607985" points="158.3696,352.5464,162.8623,342.4377,158.3696,346.9304,153.8768,342.4377,158.3696,352.5464" style="stroke: #607985; stroke-width: 1.4601449275362322;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="15.7246" lengthAdjust="spacingAndGlyphs" textLength="134.7826" x="166.2319" y="319.8898">owns scheduling</text><!--MD5=[8767280e6fafb101c08fb239bf4ae53d]
@startuml
skinparam backgroundColor white
skinparam shadowing false
skinparam monochrome false
skinparam defaultFontName "DejaVu Sans Mono"
skinparam defaultFontSize 14
skinparam defaultFontColor #24343D
skinparam titleFontName "DejaVu Sans Mono"
skinparam titleFontSize 13
skinparam titleFontColor #536B78
skinparam titleFontStyle plain
skinparam ArrowColor #607985
skinparam ArrowFontColor #425B67
skinparam ArrowThickness 1.3
skinparam LineThickness 1.3
skinparam nodesep 36
skinparam ranksep 42
skinparam Padding 6
skinparam classBackgroundColor #F5F8FA
skinparam classBorderColor #607985
skinparam classBorderThickness 1.5
skinparam classFontColor #1F3039
skinparam classFontSize 15
skinparam classAttributeFontColor #2E424D
skinparam classAttributeFontSize 13
skinparam classStereotypeFontColor #526B77
skinparam classStereotypeFontSize 11
skinparam minClassWidth 190
skinparam ClassAttributeIconSize 0
skinparam stateBackgroundColor #F5F8FA
skinparam stateBorderColor #607985
skinparam stateBorderThickness 1.5
skinparam stateFontColor #1F3039
skinparam stateFontSize 14
skinparam stateAttributeFontSize 13
skinparam noteBackgroundColor #F7F5ED
skinparam noteBorderColor #8A887C
skinparam noteFontColor #3E4B50
skinparam noteFontSize 12
skinparam ParticipantBackgroundColor #F5F8FA
skinparam ParticipantBorderColor #607985
skinparam ParticipantBorderThickness 1.5
skinparam ParticipantFontColor #1F3039
skinparam ParticipantFontSize 13
skinparam ActorBorderColor #607985
skinparam ActorFontColor #1F3039
skinparam LifeLineBorderColor #8297A1
skinparam LifeLineBackgroundColor #F9FBFC
skinparam SequenceArrowColor #607985
skinparam SequenceMessageAlign center
skinparam ParticipantPadding 18
skinparam BoxPadding 8
hide circle
hide empty members
scale 620 width
top to bottom direction
class "01 Application C\ntask01_first_task.c" as Application <<layer>>
class "02 FreeRTOS C API\nTaskFunction_t · xTaskCreate" as CAPI <<boundary>>
class "03 Kernel + RV32I port\nscheduler · tick · heap_4\nHazard3 CPU" as Runtime <<runtime>>
Application - -> CAPI : requests tasks
CAPI - -> Runtime : owns scheduling
note right of CAPI
Public C contract.
Application does not depend
on TCB internals.
end note
@enduml
PlantUML version 1.2020.02(Sun Mar 01 11:22:07 CET 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 25.0.4-ea+4-1-Debian
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: null
--></g></svg>

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

+62
View File
@@ -0,0 +1,62 @@
@startuml
!include card-uml-style.iuml
scale 900 width
left to right direction
class "01 WorkerContext" as Worker {
+id : uint32_t
+result : volatile uint32_t
+iterations : volatile uint32_t
+trace_state : WorkerTraceState
+02 handle : TaskHandle_t
+created_handle : uintptr_t
+start_tick / end_tick : TickType_t
+tcb_address : uintptr_t
+stack_low / stack_high : uintptr_t
+entry_sp : uintptr_t
}
class "03 static contexts" as Contexts <<data>> {
g_worker_a : WorkerContext
g_worker_b : WorkerContext
lifetime = whole program
}
class "04 C entry functions" as Entries <<C ABI>> {
sum_task_entry(void*)
supervisor_task_entry(void*)
create_worker(WorkerContext*)
}
class "05 SupervisorContext" as Supervisor {
first : WorkerContext*
second : WorkerContext*
handle : TaskHandle_t
pass : volatile uint32_t
}
class "06 common invariants" as Invariants <<contract>> {
result A = result B = 200010000
iterations A = iterations B = 20000
trace contains A -> B -> A
}
class "heap_4" as Heap <<runtime>> {
TCB A / TCB B
stack A / stack B
supervisor TCB + stack
}
Contexts *-- Worker : contains two
Supervisor o-- Worker : observes
Entries --> Worker : typed context
Entries --> Supervisor : typed context
Worker --> Heap : handle value identifies TCB
Supervisor --> Invariants : verifies
note bottom of Worker
Context is application-owned storage.
&handle is a field address; handle is its value.
Neither is the separate task-stack block.
end note
@enduml
+144
View File
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="338.9189px" preserveAspectRatio="none" style="width:896px;height:338px;" version="1.1" viewBox="0 0 896 338" width="896.2162px" zoomAndPan="magnify"><defs/><g><!--MD5=[7b5bd88a8a025decccf0c9eac4aaabe9]
class Worker--><rect fill="#F5F8FA" height="172.3184" id="Worker" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="164.3243" x="453.2432" y="4.2"/><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="82.7027" x="494.0541" y="17.6721">01 WorkerContext</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="453.7838" x2="617.027" y1="25.5302" y2="25.5302"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="60.5405" x="459.7297" y="37.4583">+id : uint32_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="116.7568" x="459.7297" y="52.1247">+result : volatile uint32_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="134.0541" x="459.7297" y="66.7911">+iterations : volatile uint32_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="134.0541" x="459.7297" y="81.4574">+trace_state : WorkerTraceState</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="108.1081" x="459.7297" y="96.1238">+02 handle : TaskHandle_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="116.7568" x="459.7297" y="110.7902">+created_handle : uintptr_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="151.3514" x="459.7297" y="125.4566">+start_tick / end_tick : TickType_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="103.7838" x="459.7297" y="140.123">+tcb_address : uintptr_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="151.3514" x="459.7297" y="154.7894">+stack_low / stack_high : uintptr_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="90.8108" x="459.7297" y="169.4558">+entry_sp : uintptr_t</text><!--MD5=[e0ad55b29637cf127d65177e32583e01]
class Contexts--><rect fill="#F5F8FA" height="83.0617" id="Contexts" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="125.4054" x="228.1081" y="10.4541"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.9459" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="22.7027" x="279.4595" y="21.9192">«data»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="92.4324" x="244.5946" y="37.3341">03 static contexts</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="228.6486" x2="352.973" y1="45.1922" y2="45.1922"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="112.4324" x="234.5946" y="57.1203">g_worker_a : WorkerContext</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="112.4324" x="234.5946" y="71.7867">g_worker_b : WorkerContext</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="103.7838" x="234.5946" y="86.4531">lifetime = whole program</text><!--MD5=[d356c8aee395c51644a6e46295a3cd9b]
class Entries--><rect fill="#F5F8FA" height="83.0617" id="Entries" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="138.3784" x="3.2432" y="128.2919"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.9459" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="26.4865" x="59.1892" y="139.757">«C ABI»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="102.1622" x="21.3514" y="155.1719">04 C entry functions</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="3.7838" x2="141.0811" y1="163.0301" y2="163.0301"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="90.8108" x="9.7297" y="174.9581">sum_task_entry(void*)</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="121.0811" x="9.7297" y="189.6245">supervisor_task_entry(void*)</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="125.4054" x="9.7297" y="204.2909">create_worker(WorkerContext*)</text><!--MD5=[4f126f465601d391fe0c3c00f8b450b3]
class Supervisor--><rect fill="#F5F8FA" height="84.3201" id="Supervisor" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="116.7568" x="232.4324" y="168.2"/><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="102.1622" x="239.7297" y="181.6721">05 SupervisorContext</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="232.973" x2="348.6486" y1="189.5302" y2="189.5302"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="95.1351" x="238.9189" y="201.4583">first : WorkerContext*</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="99.4595" x="238.9189" y="216.1247">second : WorkerContext*</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="90.8108" x="238.9189" y="230.7911">handle : TaskHandle_t</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="103.7838" x="238.9189" y="245.4574">pass : volatile uint32_t</text><!--MD5=[3c1aae6a6af91a00aebe86d2dd4d752e]
class Invariants--><rect fill="#F5F8FA" height="83.0617" id="Invariants" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="164.3243" x="453.2432" y="249.9135"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.9459" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="37.8378" x="516.4865" y="261.3786">«contract»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="102.1622" x="484.3243" y="276.7935">06 common invariants</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="453.7838" x2="617.027" y1="284.6517" y2="284.6517"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="134.0541" x="459.7297" y="296.5797">result A = result B = 200010000</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="151.3514" x="459.7297" y="311.2461">iterations A = iterations B = 20000</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="112.4324" x="459.7297" y="325.9125">trace contains A -&gt; B -&gt; A</text><!--MD5=[e9f17e4922be6079066fa450c8bff6eb]
class Heap--><rect fill="#F5F8FA" height="83.0617" id="Heap" style="stroke: #607985; stroke-width: 0.8108108108108109;" width="108.1081" x="782.1622" y="48.8324"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.9459" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="34.0541" x="819.1892" y="60.2975">«runtime»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.1081" lengthAdjust="spacingAndGlyphs" textLength="29.1892" x="821.6216" y="75.7124">heap_4</text><line style="stroke: #607985; stroke-width: 0.8108108108108109;" x1="782.7027" x2="889.7297" y1="83.5706" y2="83.5706"/><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="56.2162" x="788.6486" y="95.4987">TCB A / TCB B</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="73.5135" x="788.6486" y="110.165">stack A / stack B</text><text fill="#2E424D" font-family="DejaVu Sans Mono" font-size="7.027" lengthAdjust="spacingAndGlyphs" textLength="95.1351" x="788.6486" y="124.8314">supervisor TCB + stack</text><path d="M435.6757,195.7892 L435.6757,230.3331 A0,0 0 0 0 435.6757,230.3331 L635.1351,230.3331 A0,0 0 0 0 635.1351,230.3331 L635.1351,201.1946 L629.7297,195.7892 L537.5676,195.7892 L535.4054,176.6649 L533.2432,195.7892 L435.6757,195.7892 A0,0 0 0 0 435.6757,195.7892 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.5405405405405406;"/><path d="M629.7297,195.7892 L629.7297,201.1946 L635.1351,201.1946 L629.7297,195.7892 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.5405405405405406;"/><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="6.4865" lengthAdjust="spacingAndGlyphs" textLength="140" x="442.1622" y="207.756">Context is application-owned storage.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="6.4865" lengthAdjust="spacingAndGlyphs" textLength="181.6216" x="442.1622" y="215.3067">&amp;handle is a field address; handle is its value.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="6.4865" lengthAdjust="spacingAndGlyphs" textLength="155.1351" x="442.1622" y="222.8574">Neither is the separate task-stack block.</text><!--MD5=[77eb6e05bec067ba2b628dcc54dd7b08]
reverse link Contexts to Worker--><path d="M361.4919,63.0378 C390.1027,67.5459 423.3838,72.7892 453.0919,77.4757 " fill="none" id="Contexts&lt;-Worker" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#607985" points="354.5568,61.9459,357.4254,64.585,360.9647,62.9521,358.0961,60.313,354.5568,61.9459" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="51.8919" x="368.6486" y="58.9865">contains two</text><!--MD5=[0a09065219b8fc4c2741fad6d91ed526]
reverse link Supervisor to Worker--><path d="M356.7297,188.9838 C378.6324,181.0162 402.9189,171.2919 424.3243,160.6324 C433.8432,155.8919 443.5676,150.5405 453.1135,144.9568 " fill="none" id="Supervisor&lt;-Worker" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#FFFFFF" points="350.173,191.3405,353.9557,192.2809,356.2787,189.1508,352.4959,188.2104,350.173,191.3405" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="34.5946" x="377.2973" y="155.2244">observes</text><!--MD5=[2c6bfd4e3ad4845782e2d985564dafc6]
link Entries to Worker--><path d="M141.8757,157.9676 C223.9351,143.8486 361.0162,120.2703 449.6595,105.0162 " fill="none" id="Entries-&gt;Worker" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#607985" points="452.2486,104.573,447.0889,103.2618,449.5846,105.0286,447.8179,107.5243,452.2486,104.573" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="56.2162" x="262.7027" y="116.7865">typed context</text><!--MD5=[f79e6be81bdb53c12d9f736eae846aaf]
link Entries to Supervisor--><path d="M141.8757,182.6757 C169.773,187.8811 201.7189,193.8378 228.8108,198.8973 " fill="none" id="Entries-&gt;Supervisor" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#607985" points="231.4541,199.3892,227.0752,196.3614,228.7983,198.8874,226.2723,200.6105,231.4541,199.3892" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="56.2162" x="156.7568" y="179.8568">typed context</text><!--MD5=[50e4ee6a0204c339eccdd06d48720435]
link Worker to Heap--><path d="M617.6486,90.3622 C668.5838,90.3622 732.8703,90.3622 778.4,90.3622 " fill="none" id="Worker-&gt;Heap" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#607985" points="781.1027,90.3622,776.2378,88.2,778.4,90.3622,776.2378,92.5243,781.1027,90.3622" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="116.7568" x="650.2703" y="84.9541">handle value identifies TCB</text><!--MD5=[b5aa81ced6422ec50f89e7cce099c4d3]
link Supervisor to Invariants--><path d="M349.3676,229.6811 C379.4216,239.6865 416.6811,252.0919 449.9081,263.1568 " fill="none" id="Supervisor-&gt;Invariants" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><polygon fill="#607985" points="452.3351,263.9622,448.3972,260.3797,449.7696,263.1121,447.0371,264.4845,452.3351,263.9622" style="stroke: #607985; stroke-width: 0.7027027027027027;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.5676" lengthAdjust="spacingAndGlyphs" textLength="34.5946" x="377.2973" y="231.1811">verifies</text><!--MD5=[bd196756b6337a178e85cd39afe76fb8]
@startuml
skinparam backgroundColor white
skinparam shadowing false
skinparam monochrome false
skinparam defaultFontName "DejaVu Sans Mono"
skinparam defaultFontSize 14
skinparam defaultFontColor #24343D
skinparam titleFontName "DejaVu Sans Mono"
skinparam titleFontSize 13
skinparam titleFontColor #536B78
skinparam titleFontStyle plain
skinparam ArrowColor #607985
skinparam ArrowFontColor #425B67
skinparam ArrowThickness 1.3
skinparam LineThickness 1.3
skinparam nodesep 36
skinparam ranksep 42
skinparam Padding 6
skinparam classBackgroundColor #F5F8FA
skinparam classBorderColor #607985
skinparam classBorderThickness 1.5
skinparam classFontColor #1F3039
skinparam classFontSize 15
skinparam classAttributeFontColor #2E424D
skinparam classAttributeFontSize 13
skinparam classStereotypeFontColor #526B77
skinparam classStereotypeFontSize 11
skinparam minClassWidth 190
skinparam ClassAttributeIconSize 0
skinparam stateBackgroundColor #F5F8FA
skinparam stateBorderColor #607985
skinparam stateBorderThickness 1.5
skinparam stateFontColor #1F3039
skinparam stateFontSize 14
skinparam stateAttributeFontSize 13
skinparam noteBackgroundColor #F7F5ED
skinparam noteBorderColor #8A887C
skinparam noteFontColor #3E4B50
skinparam noteFontSize 12
skinparam ParticipantBackgroundColor #F5F8FA
skinparam ParticipantBorderColor #607985
skinparam ParticipantBorderThickness 1.5
skinparam ParticipantFontColor #1F3039
skinparam ParticipantFontSize 13
skinparam ActorBorderColor #607985
skinparam ActorFontColor #1F3039
skinparam LifeLineBorderColor #8297A1
skinparam LifeLineBackgroundColor #F9FBFC
skinparam SequenceArrowColor #607985
skinparam SequenceMessageAlign center
skinparam ParticipantPadding 18
skinparam BoxPadding 8
hide circle
hide empty members
scale 900 width
left to right direction
class "01 WorkerContext" as Worker {
+id : uint32_t
+result : volatile uint32_t
+iterations : volatile uint32_t
+trace_state : WorkerTraceState
+02 handle : TaskHandle_t
+created_handle : uintptr_t
+start_tick / end_tick : TickType_t
+tcb_address : uintptr_t
+stack_low / stack_high : uintptr_t
+entry_sp : uintptr_t
}
class "03 static contexts" as Contexts <<data>> {
g_worker_a : WorkerContext
g_worker_b : WorkerContext
lifetime = whole program
}
class "04 C entry functions" as Entries <<C ABI>> {
sum_task_entry(void*)
supervisor_task_entry(void*)
create_worker(WorkerContext*)
}
class "05 SupervisorContext" as Supervisor {
first : WorkerContext*
second : WorkerContext*
handle : TaskHandle_t
pass : volatile uint32_t
}
class "06 common invariants" as Invariants <<contract>> {
result A = result B = 200010000
iterations A = iterations B = 20000
trace contains A -> B -> A
}
class "heap_4" as Heap <<runtime>> {
TCB A / TCB B
stack A / stack B
supervisor TCB + stack
}
Contexts *- - Worker : contains two
Supervisor o- - Worker : observes
Entries - -> Worker : typed context
Entries - -> Supervisor : typed context
Worker - -> Heap : handle value identifies TCB
Supervisor - -> Invariants : verifies
note bottom of Worker
Context is application-owned storage.
&handle is a field address; handle is its value.
Neither is the separate task-stack block.
end note
@enduml
PlantUML version 1.2020.02(Sun Mar 01 11:22:07 CET 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 25.0.4-ea+4-1-Debian
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: null
--></g></svg>

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+23
View File
@@ -0,0 +1,23 @@
@startuml
!include card-uml-style.iuml
scale 900 width
top to bottom direction
class "01 TaskFunction_t\nvoid (*)(void*)" as Callback <<C ABI>>
class "02 xTaskCreate\nentry + &workerA" as Create <<boundary>>
class "03 callback entry\na0 = pvParameters" as Entry <<runtime>>
class "04 typed pointer\nWorkerContext *worker =\n(WorkerContext *)pvParameters" as Cast <<C>>
class "05 typed calculation\nworker->result = sum" as Work <<application>>
class "06 wrong-cast exhibit\nC cannot verify context type" as Hazard <<compile-time check>>
Callback -right-> Create : accepted signature
Create -right-> Entry : scheduler dispatch
Entry -down-> Cast : same address
Cast -left-> Work : typed fields
Work -left-> Hazard : contrast: unchecked cast
note bottom of Entry
RV32 ILP32 ABI carries the first callback argument in a0.
The explicit C cast documents intent; it performs no type check.
end note
@enduml
+104
View File
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="144.7478px" preserveAspectRatio="none" style="width:896px;height:144px;" version="1.1" viewBox="0 0 896 144" width="896.2611px" zoomAndPan="magnify"><defs/><g><!--MD5=[687e0e93109a4e3b835e34cee365dc7c]
class Callback--><rect fill="#F5F8FA" height="43.6522" id="Callback" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="101.4837" x="227.5371" y="4.3211"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="26.1721" x="265.1929" y="15.6501">«C ABI»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="86.5282" x="235.0148" y="30.882">01 TaskFunction_t</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="72.1068" x="242.2255" y="40.2083">void (*)(void*)</text><!--MD5=[af7d543b6251b12f84b8a2da20750b1a]
class Create--><rect fill="#F5F8FA" height="43.6522" id="Create" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="101.4837" x="432.6409" y="4.3211"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="37.3887" x="464.6884" y="15.6501">«boundary»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="72.1068" x="447.3294" y="30.882">02 xTaskCreate</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="76.9139" x="444.9258" y="40.2083">entry + &amp;workerA</text><!--MD5=[96293e8b231702a792e4ba32419ac2da]
class Entry--><rect fill="#F5F8FA" height="43.6522" id="Entry" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="101.4837" x="637.7448" y="4.3211"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="33.6499" x="671.6617" y="15.6501">«runtime»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="86.5282" x="645.2226" y="30.882">03 callback entry</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="81.7211" x="647.6261" y="40.2083">a0 = pvParameters</text><!--MD5=[b8828fe7ac3f9c4eb842b546e8e5efdc]
class Cast--><rect fill="#F5F8FA" height="52.9785" id="Cast" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="149.0208" x="464.9555" y="86.4267"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="11.2166" x="533.8576" y="97.7557">«C»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="81.7211" x="498.6053" y="112.9877">04 typed pointer</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="110.5638" x="484.184" y="122.314">WorkerContext *worker =</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="139.4065" x="469.7626" y="131.6403">(WorkerContext *)pvParameters</text><!--MD5=[482411d91ae66d861cdea1bfa312d1e2]
class Work--><rect fill="#F5F8FA" height="43.6522" id="Work" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="110.5638" x="276.4095" y="91.0896"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="48.6053" x="307.3887" y="102.4186">«application»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="100.9496" x="281.2166" y="117.6506">05 typed calculation</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="96.1424" x="283.6202" y="126.9769">worker-&gt;result = sum</text><!--MD5=[955ec29e801e64f81c420d0efefda74f]
class Hazard--><rect fill="#F5F8FA" height="43.6522" id="Hazard" style="stroke: #607985; stroke-width: 0.8011869436201781;" width="144.2136" x="3.2047" y="91.0896"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="5.8754" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="74.7774" x="37.9228" y="102.4186">«compile-time check»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="105.7567" x="22.4332" y="117.6506">06 wrong-cast exhibit</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="8.0119" lengthAdjust="spacingAndGlyphs" textLength="134.5994" x="8.0119" y="126.9769">C cannot verify context type</text><path d="M633.2047,99.5822 L633.2047,126.255 A0,0 0 0 0 633.2047,126.255 L890.1187,126.255 A0,0 0 0 0 890.1187,126.255 L890.1187,104.9234 L884.7774,99.5822 L752.7899,99.5822 L706.7644,48.0872 L748.5169,99.5822 L633.2047,99.5822 A0,0 0 0 0 633.2047,99.5822 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.5341246290801187;"/><path d="M884.7774,99.5822 L884.7774,104.9234 L890.1187,104.9234 L884.7774,99.5822 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.5341246290801187;"/><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="6.4095" lengthAdjust="spacingAndGlyphs" textLength="213.1157" x="639.6142" y="111.407">RV32 ILP32 ABI carries the first callback argument in a0.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="6.4095" lengthAdjust="spacingAndGlyphs" textLength="239.2878" x="639.6142" y="118.8681">The explicit C cast documents intent; it performs no type check.</text><!--MD5=[1ff83926f444d43e448833f6dd9e777f]
link Callback to Create--><path d="M329.2398,26.1454 C359.6315,26.1454 398.2006,26.1454 429.1531,26.1454 " fill="none" id="Callback-&gt;Create" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><polygon fill="#607985" points="431.6955,26.1454,426.8884,24.0089,429.0249,26.1454,426.8884,28.2819,431.6955,26.1454" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.4777" lengthAdjust="spacingAndGlyphs" textLength="76.9139" x="342.3739" y="19.1992">accepted signature</text><!--MD5=[5e35778d1735aeaf64c16000162b8682]
link Create to Entry--><path d="M534.3436,26.1454 C564.7353,26.1454 603.3045,26.1454 634.257,26.1454 " fill="none" id="Create-&gt;Entry" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><polygon fill="#607985" points="636.7994,26.1454,631.9923,24.0089,634.1288,26.1454,631.9923,28.2819,636.7994,26.1454" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.4777" lengthAdjust="spacingAndGlyphs" textLength="76.9139" x="547.4777" y="19.1992">scheduler dispatch</text><!--MD5=[2cdb4dcf98f84b2f0f14899bf23cd292]
link Entry to Cast--><path d="M651.0766,48.1941 C631.9709,59.181 608.4961,72.6837 588.0125,84.4665 " fill="none" id="Entry-&gt;Cast" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><polygon fill="#607985" points="585.7104,85.7858,590.943,85.2446,588.0263,84.4558,588.8151,81.5391,585.7104,85.7858" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.4777" lengthAdjust="spacingAndGlyphs" textLength="51.276" x="635.4427" y="69.8662">same address</text><!--MD5=[f4bbda2f015eec5ec20e2f975cf0eb90]
reverse link Work to Cast--><path d="M390.6107,112.9193 C413.6688,112.9193 440.3964,112.9193 464.7792,112.9193 " fill="none" id="Work&lt;-Cast" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><polygon fill="#607985" points="388.0415,112.9193,392.8487,115.0558,390.7122,112.9193,392.8487,110.7828,388.0415,112.9193" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.4777" lengthAdjust="spacingAndGlyphs" textLength="51.276" x="400.3264" y="105.9731">typed fields</text><!--MD5=[31435e59aed6adc8ad2d95d53c329eb2]
reverse link Hazard to Work--><path d="M150.949,112.9193 C191.1151,112.9193 239.6083,112.9193 276.2493,112.9193 " fill="none" id="Hazard&lt;-Work" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><polygon fill="#607985" points="148.3905,112.9193,153.1976,115.0558,151.0611,112.9193,153.1976,110.7828,148.3905,112.9193" style="stroke: #607985; stroke-width: 0.6943620178041543;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="7.4777" lengthAdjust="spacingAndGlyphs" textLength="102.5519" x="160.638" y="105.9731">contrast: unchecked cast</text><!--MD5=[aa23e53a9e1b193daf13397cfcbb102c]
@startuml
skinparam backgroundColor white
skinparam shadowing false
skinparam monochrome false
skinparam defaultFontName "DejaVu Sans Mono"
skinparam defaultFontSize 14
skinparam defaultFontColor #24343D
skinparam titleFontName "DejaVu Sans Mono"
skinparam titleFontSize 13
skinparam titleFontColor #536B78
skinparam titleFontStyle plain
skinparam ArrowColor #607985
skinparam ArrowFontColor #425B67
skinparam ArrowThickness 1.3
skinparam LineThickness 1.3
skinparam nodesep 36
skinparam ranksep 42
skinparam Padding 6
skinparam classBackgroundColor #F5F8FA
skinparam classBorderColor #607985
skinparam classBorderThickness 1.5
skinparam classFontColor #1F3039
skinparam classFontSize 15
skinparam classAttributeFontColor #2E424D
skinparam classAttributeFontSize 13
skinparam classStereotypeFontColor #526B77
skinparam classStereotypeFontSize 11
skinparam minClassWidth 190
skinparam ClassAttributeIconSize 0
skinparam stateBackgroundColor #F5F8FA
skinparam stateBorderColor #607985
skinparam stateBorderThickness 1.5
skinparam stateFontColor #1F3039
skinparam stateFontSize 14
skinparam stateAttributeFontSize 13
skinparam noteBackgroundColor #F7F5ED
skinparam noteBorderColor #8A887C
skinparam noteFontColor #3E4B50
skinparam noteFontSize 12
skinparam ParticipantBackgroundColor #F5F8FA
skinparam ParticipantBorderColor #607985
skinparam ParticipantBorderThickness 1.5
skinparam ParticipantFontColor #1F3039
skinparam ParticipantFontSize 13
skinparam ActorBorderColor #607985
skinparam ActorFontColor #1F3039
skinparam LifeLineBorderColor #8297A1
skinparam LifeLineBackgroundColor #F9FBFC
skinparam SequenceArrowColor #607985
skinparam SequenceMessageAlign center
skinparam ParticipantPadding 18
skinparam BoxPadding 8
hide circle
hide empty members
scale 900 width
top to bottom direction
class "01 TaskFunction_t\nvoid (*)(void*)" as Callback <<C ABI>>
class "02 xTaskCreate\nentry + &workerA" as Create <<boundary>>
class "03 callback entry\na0 = pvParameters" as Entry <<runtime>>
class "04 typed pointer\nWorkerContext *worker =\n(WorkerContext *)pvParameters" as Cast <<C>>
class "05 typed calculation\nworker->result = sum" as Work <<application>>
class "06 wrong-cast exhibit\nC cannot verify context type" as Hazard <<compile-time check>>
Callback -right-> Create : accepted signature
Create -right-> Entry : scheduler dispatch
Entry -down-> Cast : same address
Cast -left-> Work : typed fields
Work -left-> Hazard : contrast: unchecked cast
note bottom of Entry
RV32 ILP32 ABI carries the first callback argument in a0.
The explicit C cast documents intent; it performs no type check.
end note
@enduml
PlantUML version 1.2020.02(Sun Mar 01 11:22:07 CET 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 25.0.4-ea+4-1-Debian
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: null
--></g></svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+30
View File
@@ -0,0 +1,30 @@
@startuml
!include card-uml-style.iuml
scale 900 width
hide footbox
skinparam ParticipantPadding 18
participant "main" as Main
participant "workerA ctx" as A
participant "workerB ctx" as B
participant "sum_task_entry" as Entry
participant "FreeRTOS" as Kernel
participant "supervisor" as Supervisor
Main -> A : <b>01</b> static context prepared
||34||
Main -> A : <b>02</b> create_worker(&workerA)
||34||
Main -> Kernel : <b>03</b> xTaskCreate(entry, &workerA)
activate Kernel
||34||
Kernel --> A : <b>04</b> handle != NULL; READY
deactivate Kernel
||34||
Main -> Kernel : <b>05</b> vTaskStartScheduler()
activate Kernel
note over Main,Supervisor
Continue on part 2/2 with the same participants and the same contexts.
end note
@enduml
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+35
View File
@@ -0,0 +1,35 @@
@startuml
!include card-uml-style.iuml
scale 900 width
hide footbox
skinparam ParticipantPadding 18
participant "main" as Main
participant "workerA ctx" as A
participant "workerB ctx" as B
participant "sum_task_entry" as Entry
participant "FreeRTOS" as Kernel
participant "supervisor" as Supervisor
activate Kernel
Kernel -> Entry : <b>06</b> entry(&workerA)
activate Entry
||30||
Entry -> A : <b>07</b> typed context; RUNNING
||30||
Kernel -> B : <b>08</b> tick: A -> B -> A
||30||
Entry -> A : <b>09</b> result = 200010000
||30||
Entry -> A : <b>10</b> COMPLETED; handle = NULL
||30||
Entry -> Kernel : <b>11</b> vTaskDelete(NULL)
deactivate Entry
||30||
Kernel -> Supervisor : <b>12</b> verify both contexts -> PASS
activate Supervisor
note over A,Supervisor
Static contexts survive self-delete. Idle cleanup of TCB/stack is later.
end note
@enduml
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

+37
View File
@@ -0,0 +1,37 @@
@startuml
!include card-uml-style.iuml
scale 620 width
top to bottom direction
state "01 WorkerContext lifetime\nstatic initialization → program end" as ObjectLifetime
state "PREPARED" as Constructed
state "02 STARTING" as Starting
state "READY" as ReadyWrapper
state "03 RUNNING" as RunningWrapper
state "COMPLETED" as CompletedWrapper
state "Ready" as ReadyKernel
state "04 Running" as RunningKernel
state "05 time sliced\nA ↔ B" as TimeSlice
state "06 Deleted\ncontext remains static" as DeletedKernel
Constructed --> Starting : create_worker()
Starting --> ReadyWrapper : xTaskCreate = pdPASS
ReadyWrapper --> RunningWrapper : callback entry
RunningWrapper --> CompletedWrapper : result published
ReadyKernel --> RunningKernel : scheduler
RunningKernel --> ReadyKernel : preemption
RunningKernel --> TimeSlice : equal priority
TimeSlice --> RunningKernel : resume
RunningKernel --> DeletedKernel : vTaskDelete(NULL)
ObjectLifetime -[hidden]down-> Constructed
CompletedWrapper -[hidden]down-> DeletedKernel
note right of RunningWrapper
trace_state is diagnostic application data.
It is not eTaskState.
end note
@enduml
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+29
View File
@@ -0,0 +1,29 @@
@startuml
!include card-uml-style.iuml
scale 900 width
top to bottom direction
class "01 workerA context\n.data / .bss" as Context <<application storage>>
class "02 &handle / handle\nfield address / opaque value" as Handle <<public API>>
class "03 TCB\nheap_4" as TCB <<kernel internal>>
class "task stack\nheap_4" as Stack <<runtime>>
class "04 callback ABI\na0 = &workerA" as ABI <<CPU>>
class "05 scheduling evidence\nPC · tick · A/B/A trace" as Schedule <<Hazard3>>
class "06 final evidence\nresult + source + E12" as Evidence <<verified>>
Context -right-> Handle : field value
Handle -right-> TCB : identifies
TCB -right-> Stack : points to separate block
ABI -right-> Schedule : PC / tick
Schedule -right-> Evidence : verified E12
Context -[hidden]down-> ABI
ABI --> Context : exact address
ABI --> Stack : SP inside range
Stack --> Schedule : restored execution
note bottom of TCB
Debugger may inspect the TCB address.
Application assertions use public APIs only.
Saved addresses are forensic after self-delete.
end note
@enduml
+115
View File
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="491.1479px" preserveAspectRatio="none" style="width:894px;height:491px;" version="1.1" viewBox="0 0 894 491" width="894.7471px" zoomAndPan="magnify"><defs/><g><!--MD5=[6754354365917abf8f1a56af1b7e344c]
class Context--><rect fill="#F5F8FA" height="71.5505" id="Context" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="166.3424" x="5.2529" y="7.0827"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="128.6965" x="24.0759" y="25.6521">«application storage»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="149.7082" x="13.57" y="50.6189">01 workerA context</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="94.5525" x="41.1479" y="65.9057">.data / .bss</text><!--MD5=[036c1653d048e8122c132b15802304de]
class Handle--><rect fill="#F5F8FA" height="71.5505" id="Handle" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="236.3813" x="292.4125" y="7.0827"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="73.5409" x="373.8327" y="25.6521">«public API»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="157.5875" x="331.8093" y="50.6189">02 &amp;handle / handle</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="220.6226" x="300.2918" y="65.9057">field address / opaque value</text><!--MD5=[55dfe95f9324421dd4dc987285821f78]
class TCB--><rect fill="#F5F8FA" height="71.5505" id="TCB" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="166.3424" x="642.607" y="7.0827"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="104.1829" x="673.6868" y="25.6521">«kernel internal»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="55.1556" x="698.2004" y="50.6189">03 TCB</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="47.2763" x="702.1401" y="65.9057">heap_4</text><!--MD5=[1a47157467d69c83c0a10e9152875283]
class Stack--><rect fill="#F5F8FA" height="71.5505" id="Stack" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="166.3424" x="247.7626" y="276.2597"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="55.1556" x="303.356" y="294.8292">«runtime»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="78.7938" x="291.537" y="319.7959">task stack</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="47.2763" x="307.2957" y="335.0828">heap_4</text><!--MD5=[ca6cab28393b6e810e6fecd613e1e410]
class ABI--><rect fill="#F5F8FA" height="71.5505" id="ABI" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="166.3424" x="57.7821" y="141.6712"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="30.642" x="125.6323" y="160.2407">«CPU»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="126.07" x="77.9183" y="185.2074">04 callback ABI</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="102.4319" x="89.7374" y="200.4942">a0 = &amp;workerA</text><!--MD5=[c680266cf9e454ca06c2d1bb8b683e6b]
class Schedule--><rect fill="#F5F8FA" height="71.5505" id="Schedule" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="196.9844" x="68.7257" y="410.8395"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="55.1556" x="139.6401" y="429.409">«Hazard3»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="181.2257" x="76.6051" y="454.3757">05 scheduling evidence</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="181.2257" x="76.6051" y="469.6625">PC · tick · A/B/A trace</text><!--MD5=[13f56afd7aace6dccdfaaac41cf97a6a]
class Evidence--><rect fill="#F5F8FA" height="71.5505" id="Evidence" style="stroke: #607985; stroke-width: 1.3132295719844358;" width="181.2257" x="393.5311" y="410.8395"/><text fill="#526B77" font-family="DejaVu Sans Mono" font-size="9.6304" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="61.284" x="453.5019" y="429.409">«verified»</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="141.8288" x="413.2296" y="454.3757">06 final evidence</text><text fill="#1F3039" font-family="DejaVu Sans Mono" font-size="13.1323" lengthAdjust="spacingAndGlyphs" textLength="165.4669" x="401.4105" y="469.6625">result + source + E12</text><path d="M567.3152,149.4718 L567.3152,205.4208 A0,0 0 0 0 567.3152,205.4208 L884.2412,205.4208 A0,0 0 0 0 884.2412,205.4208 L884.2412,158.2267 L875.4864,149.4718 L729.2802,149.4718 L725.7782,78.9864 L722.2763,149.4718 L567.3152,149.4718 A0,0 0 0 0 567.3152,149.4718 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.8754863813229572;"/><path d="M875.4864,149.4718 L875.4864,158.2267 L884.2412,158.2267 L875.4864,149.4718 " fill="#F7F5ED" style="stroke: #8A887C; stroke-width: 0.8754863813229572;"/><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="10.5058" lengthAdjust="spacingAndGlyphs" textLength="226.751" x="577.821" y="168.8539">Debugger may inspect the TCB address.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="10.5058" lengthAdjust="spacingAndGlyphs" textLength="269.6498" x="577.821" y="181.0833">Application assertions use public APIs only.</text><text fill="#3E4B50" font-family="DejaVu Sans Mono" font-size="10.5058" lengthAdjust="spacingAndGlyphs" textLength="288.035" x="577.821" y="193.3128">Saved addresses are forensic after self-delete.</text><!--MD5=[f2b95524c1e28a7910e8f2eb818d98c7]
link Context to Handle--><path d="M171.8142,42.8638 C206.7286,42.8638 248.0603,42.8638 286.4241,42.8638 " fill="none" id="Context-&gt;Handle" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="290.7403,42.8638,282.8609,39.3619,286.3628,42.8638,282.8609,46.3658,290.7403,42.8638" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="77.0428" x="193.4825" y="31.4782">field value</text><!--MD5=[6b24788f218641d713329a2ae991a93f]
link Handle to TCB--><path d="M529.0827,42.8638 C564.8813,42.8638 603.5516,42.8638 637.0477,42.8638 " fill="none" id="Handle-&gt;TCB" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="641.0574,42.8638,633.178,39.3619,636.68,42.8638,633.178,46.3658,641.0574,42.8638" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="70.0389" x="550.6809" y="31.4782">identifies</text><!--MD5=[260ca96e0608034bbe20e6455096b2ea]
link TCB to Stack--><path d="M642.4582,62.0632 C543.7733,84.4932 390.2656,121.9027 371.2062,141.6712 C338.0866,176.0078 330.4961,232.3804 329.5418,270.5953 " fill="none" id="TCB-&gt;Stack" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="329.4718,274.7714,333.1083,266.9532,329.5468,270.3946,326.1054,266.8332,329.4718,274.7714" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="168.0934" x="377.3346" y="181.8167">points to separate block</text><!--MD5=[6db3f3df7074aeb50763e28cae90ff59]
link ABI to Schedule--><path d="M144.07,213.3911 C147.1518,247.6751 152.0632,301.3512 156.7121,347.8045 C158.5944,366.6187 160.8093,387.4377 162.7179,405.035 " fill="none" id="ABI-&gt;Schedule" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="163.1819,409.3074,165.8079,401.0944,162.7067,404.9558,158.8453,401.8547,163.1819,409.3074" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="63.035" x="162.8405" y="316.4053">PC / tick</text><!--MD5=[207925ab6ff16cd1f486f6b03ab44a05]
link Schedule to Evidence--><path d="M265.7539,446.6206 C304.5554,446.6206 348.9689,446.6206 387.5691,446.6206 " fill="none" id="Schedule-&gt;Evidence" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="391.894,446.6206,384.0146,443.1187,387.5165,446.6206,384.0146,450.1226,391.894,446.6206" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="84.0467" x="287.5973" y="435.235">verified E12</text><!--MD5=[0692a1c747d599fb65721a3192b7148d]
link Context to ABI--><!--MD5=[0b636485966694c3572d595f72d87511]
link ABI to Context--><path d="M127.0418,141.3911 C120.073,123.7675 111.5982,102.3356 104.3667,84.0554 " fill="none" id="ABI-&gt;Context" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="102.8521,80.2208,102.5041,88.8363,104.4671,84.2895,109.0139,86.2524,102.8521,80.2208" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="91.0506" x="125.5185" y="114.5269">exact address</text><!--MD5=[ba05e5e05147408eaf79428044b1e317]
link ABI to Stack--><path d="M164.4689,213.2685 C176.0428,228.4844 191.0399,245.6002 207.4903,257.8745 C218.2237,265.8765 230.3492,272.9767 242.7023,279.1663 " fill="none" id="ABI-&gt;Stack" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="246.4407,280.9961,240.9253,274.3682,242.5154,279.0585,237.8251,280.6486,246.4407,280.9961" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="105.0584" x="213.6187" y="249.1154">SP inside range</text><!--MD5=[40ef621f4b5ca7ebafeb4f5c63cfc119]
link Stack to Schedule--><path d="M287.4922,348.1547 C265.106,366.321 237.7646,388.4971 214.8093,407.1274 " fill="none" id="Stack-&gt;Schedule" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><polygon fill="#607985" points="211.6051,409.7276,219.9287,407.4769,215.0024,406.9673,215.5121,402.041,211.6051,409.7276" style="stroke: #607985; stroke-width: 1.1381322957198443;"/><text fill="#425B67" font-family="DejaVu Sans Mono" font-size="12.2568" lengthAdjust="spacingAndGlyphs" textLength="126.07" x="269.8687" y="383.6951">restored execution</text><!--MD5=[3e332d5c043ea547ae867251869e07bc]
@startuml
skinparam backgroundColor white
skinparam shadowing false
skinparam monochrome false
skinparam defaultFontName "DejaVu Sans Mono"
skinparam defaultFontSize 14
skinparam defaultFontColor #24343D
skinparam titleFontName "DejaVu Sans Mono"
skinparam titleFontSize 13
skinparam titleFontColor #536B78
skinparam titleFontStyle plain
skinparam ArrowColor #607985
skinparam ArrowFontColor #425B67
skinparam ArrowThickness 1.3
skinparam LineThickness 1.3
skinparam nodesep 36
skinparam ranksep 42
skinparam Padding 6
skinparam classBackgroundColor #F5F8FA
skinparam classBorderColor #607985
skinparam classBorderThickness 1.5
skinparam classFontColor #1F3039
skinparam classFontSize 15
skinparam classAttributeFontColor #2E424D
skinparam classAttributeFontSize 13
skinparam classStereotypeFontColor #526B77
skinparam classStereotypeFontSize 11
skinparam minClassWidth 190
skinparam ClassAttributeIconSize 0
skinparam stateBackgroundColor #F5F8FA
skinparam stateBorderColor #607985
skinparam stateBorderThickness 1.5
skinparam stateFontColor #1F3039
skinparam stateFontSize 14
skinparam stateAttributeFontSize 13
skinparam noteBackgroundColor #F7F5ED
skinparam noteBorderColor #8A887C
skinparam noteFontColor #3E4B50
skinparam noteFontSize 12
skinparam ParticipantBackgroundColor #F5F8FA
skinparam ParticipantBorderColor #607985
skinparam ParticipantBorderThickness 1.5
skinparam ParticipantFontColor #1F3039
skinparam ParticipantFontSize 13
skinparam ActorBorderColor #607985
skinparam ActorFontColor #1F3039
skinparam LifeLineBorderColor #8297A1
skinparam LifeLineBackgroundColor #F9FBFC
skinparam SequenceArrowColor #607985
skinparam SequenceMessageAlign center
skinparam ParticipantPadding 18
skinparam BoxPadding 8
hide circle
hide empty members
scale 900 width
top to bottom direction
class "01 workerA context\n.data / .bss" as Context <<application storage>>
class "02 &handle / handle\nfield address / opaque value" as Handle <<public API>>
class "03 TCB\nheap_4" as TCB <<kernel internal>>
class "task stack\nheap_4" as Stack <<runtime>>
class "04 callback ABI\na0 = &workerA" as ABI <<CPU>>
class "05 scheduling evidence\nPC · tick · A/B/A trace" as Schedule <<Hazard3>>
class "06 final evidence\nresult + source + E12" as Evidence <<verified>>
Context -right-> Handle : field value
Handle -right-> TCB : identifies
TCB -right-> Stack : points to separate block
ABI -right-> Schedule : PC / tick
Schedule -right-> Evidence : verified E12
Context -[hidden]down-> ABI
ABI - -> Context : exact address
ABI - -> Stack : SP inside range
Stack - -> Schedule : restored execution
note bottom of TCB
Debugger may inspect the TCB address.
Application assertions use public APIs only.
Saved addresses are forensic after self-delete.
end note
@enduml
PlantUML version 1.2020.02(Sun Mar 01 11:22:07 CET 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 25.0.4-ea+4-1-Debian
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: null
--></g></svg>

After

Width:  |  Height:  |  Size: 14 KiB

+60
View File
@@ -0,0 +1,60 @@
' Shared print-first style for every diagram in this card.
skinparam backgroundColor white
skinparam shadowing false
skinparam monochrome false
skinparam defaultFontName "DejaVu Sans Mono"
skinparam defaultFontSize 14
skinparam defaultFontColor #24343D
skinparam titleFontName "DejaVu Sans Mono"
skinparam titleFontSize 13
skinparam titleFontColor #536B78
skinparam titleFontStyle plain
skinparam ArrowColor #607985
skinparam ArrowFontColor #425B67
skinparam ArrowThickness 1.3
skinparam LineThickness 1.3
skinparam nodesep 36
skinparam ranksep 42
skinparam Padding 6
skinparam classBackgroundColor #F5F8FA
skinparam classBorderColor #607985
skinparam classBorderThickness 1.5
skinparam classFontColor #1F3039
skinparam classFontSize 15
skinparam classAttributeFontColor #2E424D
skinparam classAttributeFontSize 13
skinparam classStereotypeFontColor #526B77
skinparam classStereotypeFontSize 11
skinparam minClassWidth 190
skinparam ClassAttributeIconSize 0
skinparam stateBackgroundColor #F5F8FA
skinparam stateBorderColor #607985
skinparam stateBorderThickness 1.5
skinparam stateFontColor #1F3039
skinparam stateFontSize 14
skinparam stateAttributeFontSize 13
skinparam noteBackgroundColor #F7F5ED
skinparam noteBorderColor #8A887C
skinparam noteFontColor #3E4B50
skinparam noteFontSize 12
skinparam ParticipantBackgroundColor #F5F8FA
skinparam ParticipantBorderColor #607985
skinparam ParticipantBorderThickness 1.5
skinparam ParticipantFontColor #1F3039
skinparam ParticipantFontSize 13
skinparam ActorBorderColor #607985
skinparam ActorFontColor #1F3039
skinparam LifeLineBorderColor #8297A1
skinparam LifeLineBackgroundColor #F9FBFC
skinparam SequenceArrowColor #607985
skinparam SequenceMessageAlign center
skinparam ParticipantPadding 18
skinparam BoxPadding 8
hide circle
hide empty members
+49
View File
@@ -0,0 +1,49 @@
# FC02 card plan
## Position
```text
C pointers and structures
→ heap_4 mechanics in C
→ FC02 raw FreeRTOS task in C
→ C++ language/OOP prerequisites
→ K02 Task<Derived> wrapper in FreeRTOS C++
```
FC02 and K02 are a controlled pair. They use the same kernel, config,
priorities, stack depths, workload and `E01E12` meanings. The variable under
study is the language-facing representation: raw C callback/context versus a
C++ CRTP wrapper.
## Task01
Two equal-priority CPU-bound workers independently sum `1..20000`. A lower
priority supervisor checks both results, task-stack evidence and an observed
`A,B,A` scheduling subsequence.
Enabled viewpoints:
- A1 Context;
- A2 Structure;
- A3 Dispatch;
- A5 Flow;
- A6 State;
- A7 Runtime.
A4 is unavailable because application topology is already complete in A2/A5.
A8 is unavailable because the relevant C idioms are attached directly to
A2/A3 rather than promoted into a decorative pattern diagram.
## Acceptance
- freestanding C11 build for RV32I/Hazard3;
- `make check-pair`, context contract, host workload and C-only ABI pass;
- simulator returns PASS with two results `200010000`;
- E03 proves `xTaskCreate` argument registers;
- E06 proves `a0 == &g_worker_a` at callback entry;
- E08 proves a real `A,B,A` subsequence;
- context, `&handle`, handle/TCB and separate task-stack range are not
conflated;
- all active UML anchors resolve and every RUN step has an event, strategy and
snapshot;
- navigation alone never mutates the simulator.
+342
View File
@@ -0,0 +1,342 @@
% 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-c}
\newcommand{\CardNumber}{02}
\newcommand{\CardCount}{15}
\newcommand{\CardSlug}{first-task-tcb-stack}
\newcommand{\CardVersion}{v00.01}
\newcommand{\DocumentUUID}{9ad444ee-ff3c-42c3-a108-80ed9ddb914d}
\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]{24mm}\centering%
\qrcode[level=L,height=22mm]{https://zsl-gitea.mpabi.pl/edu-freertos-c/lab-rv32i-freertos-c-first-task}%
\end{minipage}%
\vrule width0.35pt%
\begin{minipage}[c][23mm][c]{\dimexpr\linewidth-48mm-0.7pt\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 Pierwszy task, TCB i stos taska}\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-18T00: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 02/15}\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 9ad444ee-ff3c-42c3-a108-80ed9ddb914d}\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 a2538a1a-3c37-4c14-a6ea-db5aba8fd038}\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-c/lab-rv32i-freertos-c-first-task}{\nolinkurl{https://zsl-gitea.mpabi.pl/edu-freertos-c/lab-rv32i-freertos-c-first-task}}}} \\%
\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{https://dce7fb9d-7b2f-5d49-96a2-3a30d3070b84.mpabi.pl/a2538a1a-3c37-4c14-a6ea-db5aba8fd038}{\nolinkurl{https://dce7fb9d-7b2f-5d49-96a2-3a30d3070b84.mpabi.pl/a2538a1a-3c37-4c14-a6ea-db5aba8fd038}}}} \\%
\end{tabularx}%
\end{minipage}%
\vrule width0.35pt%
\begin{minipage}[c][23mm][c]{24mm}\centering%
\qrcode[level=L,height=22mm]{https://dce7fb9d-7b2f-5d49-96a2-3a30d3070b84.mpabi.pl/a2538a1a-3c37-4c14-a6ea-db5aba8fd038}%
\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~RTOS}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Odtwarza task w Hazard3/GDB.}}\par%
\hspace*{0.54em}\textcolor{blue!70!black}{KW~LOCAL~RTOS}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Łączy checkpoint z UML i stanem CPU.}}\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~C}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Czyta jawny model danych C.}}\par%
\hspace*{0.54em}\textcolor{blue!70!black}{KW~LOCAL~KW~C}\textcolor{black!48}{\pdftooltip[width=\textwidth]{.01}{Rozróżnia adres pola, handle, TCB i stack.}}\par%
\end{minipage}%
}%
\end{minipage}%
}
}
\begin{document}
\sloppy
\vspace{1.0em}
\noindent{\Large\bfseries Cel karty}\par
\vspace{0.35em}
Uczeń tworzy task przez surowe API C FreeRTOS, śledzi \texttt{pvParameters} od \texttt{xTaskCreate} do typowanego \texttt{WorkerContext} i odróżnia kontekst aplikacji od TCB oraz stosu taska. Każdy punkt wykonania odtwarza deterministycznie w Hazard3/GDB.
\vspace{0.8em}
\noindent\textcolor{black!25}{\rule{\textwidth}{0.35pt}}
\vspace{0.7em}
\noindent{\Large\bfseries Zakres karty}\par
\vspace{0.35em}
Dwa workery o równym priorytecie liczą sumę \texttt{1..20000}; niżej priorytetowy supervisor sprawdza wyniki, ticki, podciąg \texttt{A->B->A}, TCB i zakresy stosów. Poza zakresem są C++, kolejki, mutexy, ISR, timery i peryferia.
\vspace{0.55em}
\small\begin{tabularx}{\textwidth}{@{}>{\ttfamily\raggedright\arraybackslash}p{0.85cm}>{\ttfamily\raggedright\arraybackslash}p{1.45cm}X>{\raggedright\arraybackslash}p{2.45cm}>{\raggedright\arraybackslash}p{1.75cm}>{\ttfamily\raggedright\arraybackslash}p{1.50cm}@{}}
\textbf{Lekcja} & \textbf{Task} & \textbf{Najważniejsza idea} & \textbf{Priorytet} & \textbf{Status} & \textbf{Version} \\ \hline
\hline
\multicolumn{1}{|l|}{\textbf{\texttt{FC02}}} & \multicolumn{1}{l|}{\textbf{\texttt{Task01}}} & \multicolumn{1}{l|}{\textbf{Raw C task, typed context, TCB i stack}} & \multicolumn{1}{l|}{\textbf{główny}} & \multicolumn{1}{l|}{\textbf{opracowane}} & \multicolumn{1}{l|}{\textbf{\texttt{v00.01}}} \\ \hline
\end{tabularx}
\normalsize
\vspace{0.8em}
\noindent\textcolor{black!25}{\rule{\textwidth}{0.35pt}}
\clearpage
\ESCSectionBlockStart
\noindent{\small\bfseries A1 — Context \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.92879\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a1-context.png}}
\caption{A1 CONTEXT — od modułu aplikacji C do wykonania na Hazard3. — część 1/1 (r1 c1).}
\label{fig:a1-context}
\end{figure}
\ESCSectionBlockEnd
\clearpage
\begin{landscape}
\ESCSectionBlockStart
\noindent{\small\bfseries A2 — Structure \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.95319\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a2-structure.png}}
\caption{A2 STRUCTURE — konteksty, funkcje wejściowe, inwarianty i domeny pamięci. — część 1/1 (r1 c1).}
\label{fig:a2-structure}
\end{figure}
\ESCSectionBlockEnd
\end{landscape}
\clearpage
\begin{landscape}
\ESCSectionBlockStart
\noindent{\small\bfseries A3 — Dispatch \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.95319\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a3-dispatch.png}}
\caption{A3 DISPATCH — od TaskFunction\_t i xTaskCreate do WorkerContext*. — część 1/1 (r1 c1).}
\label{fig:a3-dispatch}
\end{figure}
\ESCSectionBlockEnd
\end{landscape}
\clearpage
\begin{landscape}
\ESCSectionBlockStart
\noindent{\small\bfseries A5 — Flow \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.9617\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a5-flow-a.png}}
\caption{A5 część 1/2 — context, create, handle i scheduler. — część 1/1 (r1 c1).}
\label{fig:a5-flow-a}
\end{figure}
\clearpage
\noindent{\small\bfseries A5 — Flow \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.9617\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a5-flow-b.png}}
\caption{A5 część 2/2 — callback, time slicing, wynik, delete i PASS. — część 1/1 (r1 c1).}
\label{fig:a5-flow-b}
\end{figure}
\ESCSectionBlockEnd
\end{landscape}
\clearpage
\ESCSectionBlockStart
\noindent{\small\bfseries A6 — State \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.93333\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a6-state.png}}
\caption{A6 STATE — korelacja stanu kontekstu z Ready, Running, time slice i Deleted. — część 1/1 (r1 c1).}
\label{fig:a6-state}
\end{figure}
\ESCSectionBlockEnd
\clearpage
\begin{landscape}
\ESCSectionBlockStart
\noindent{\small\bfseries A7 — Runtime \hfill część 1/1 \textperiodcentered\ r1 c1}\par
\vspace{0.35em}
\begin{figure}[H]
\centering
\includegraphics[width=0.95106\linewidth,trim=0.000bp 0.000bp 0.000bp 0.000bp,clip]{\detokenize{../assets/a7-runtime.png}}
\caption{A7 RUNTIME — context, handle/TCB, osobny stack, ABI i dowód końcowy. — część 1/1 (r1 c1).}
\label{fig:a7-runtime}
\end{figure}
\ESCSectionBlockEnd
\end{landscape}
\clearpage
\ESCSectionBlockStart
\section{Task01 — Raw C task}
\begin{ESCTaskFrame}{TASK01 · Pierwszy task FreeRTOS — callback, context, TCB i stos}
{\scriptsize\ttfamily a2538a1a-3c37-4c14-a6ea-db5aba8fd038}\par
\begin{ESCBlockFrame}{A — model C i granica ABI}
Najpierw czytaj A1--A3 bez uruchamiania programu.
\begin{ESCStepFrame}{read-context · Odczytaj WorkerContext.}
Rozróżnij static context, adres pola handle, wartość handle, TCB i stack.
\end{ESCStepFrame}
\begin{ESCStepFrame}{prove-c-abi · Udowodnij callback ABI.}
Na E03 zbadaj argumenty xTaskCreate, a na E06 rejestr a0 przed prologiem sum_task_entry.
\end{ESCStepFrame}
\end{ESCBlockFrame}
\begin{ESCBlockFrame}{B — sekwencja i scheduler}
Każdy RUN replay zaczyna się od czystej RAM.
\begin{ESCStepFrame}{follow-context · Śledź jeden adres context.}
Porównaj &g_worker_a w main, xTaskCreate i sum_task_entry.
\end{ESCStepFrame}
\begin{ESCStepFrame}{follow-stack · Śledź osobny stos.}
Potwierdź stack_low <= sp <= stack_high i created_handle == tcb_address.
\end{ESCStepFrame}
\begin{ESCStepFrame}{follow-scheduler · Śledź A-B-A.}
Zapisz triplet workerów, ticki i liczbę obserwowanych zmian.
\end{ESCStepFrame}
\end{ESCBlockFrame}
\begin{ESCBlockFrame}{Ćwiczenie · Ćwiczenie — timestampowany ślad taska C}
Wybierz E01, E03, E06, E08, E10 i E12. Dla każdego zapisz timestamp, PC, SP, adres context, wartość handle/TCB i stan. Wyjaśnij, których adresów po E11 nie wolno dereferencjonować.
\par\textbf{Evidence:} Timestampowane snapshoty Hazard3/GDB powiązane z kotwami UML oraz końcowy PASS.
\par\textbf{Acceptance:} Raport zachowuje tożsamość context, rozdziela TCB od stack i nie myli trace\_state z eTaskState.
\end{ESCBlockFrame}
\tcblower\textbf{Task acceptance:} Program wypisuje PASS; oba wyniki wynoszą 200010000; E06 pokazuje a0=\&workerA; trace zawiera A-B-A; context, TCB i stack są rozdzielone.
\end{ESCTaskFrame}
\begin{ESCConclusionFrame}
Surowe API C przekazuje zachowanie i dane oddzielnie: \texttt{TaskFunction_t} wybiera kod, a \texttt{void*} niesie adres jawnego kontekstu. Scheduler, TCB i stos pozostają własnością FreeRTOS.
\end{ESCConclusionFrame}
\ESCSectionBlockEnd
\end{document}
+3
View File
@@ -0,0 +1,3 @@
% Compatibility entry point.
% The canonical TeX is generated from json/card_source.json.
\input{generated/main.tex}
+17
View File
@@ -0,0 +1,17 @@
# FC02 page layout
| Content | Physical layout | Reason |
|---|---|---|
| Goal and scope | portrait | short learning contract and viewpoint index |
| A1 Context | portrait | vertical responsibility stack |
| A2 Structure | landscape | contexts, functions and memory domains |
| A3 Dispatch | landscape | function-call chain from `TaskFunction_t` to typed body |
| A5 Flow 1/2 | landscape | E01E05, first half of one logical sequence |
| A5 Flow 2/2 | landscape | E06E12, same participants and spread group |
| A6 State | portrait | diagnostic and kernel state lanes |
| A7 Runtime | landscape | memory/CPU evidence map |
Each diagram begins on a new physical sheet. A5 is one logical diagram split
at the scheduler boundary; both sheets use the same participant order and are
joined only in the screen spread. Printing keeps two independent A4 landscape
sheets. No diagram uses tiles in this card.
+311
View File
@@ -0,0 +1,311 @@
# FC02 Plan — First Task, TCB and Task Stack
Status: implemented locally and under validation. The repository exists at
`series/freertos/lab-rv32i-freertos-c-first-task`, but it remains outside the
active series manifest until all build, simulator, replay and layout gates
pass.
The paired experiment and common E01E12 vocabulary are defined in
[`freertos-first-task-a1-a8.md`](freertos-first-task-a1-a8.md).
## Goal
The student creates a FreeRTOS task through the raw C API, follows
`pvParameters` into a typed context, separates that context from the TCB and
task stack, observes equal-priority time slicing, and proves deterministic
completion in Hazard3/GDB.
The card is the C baseline for K02. It must not imitate a C++ wrapper in C.
## Scope
Included:
- `TaskFunction_t` and `void *pvParameters`;
- `xTaskCreate`, `TaskHandle_t`, scheduler start and self-delete;
- two equal-priority CPU-bound workers and one lower-priority supervisor;
- static application contexts, dynamic TCB/task-stack allocation in `heap_4`;
- TCB, stack, PC/SP, callback ABI and task-state observations;
- the same sum and scheduling invariants as K02.
Excluded:
- C++ classes, templates, RAII or virtual dispatch;
- queues, mutexes, notifications, timers, ISR APIs and peripherals;
- proof that the idle task has already reclaimed deleted tasks;
- report/PDF/Teams generation and the later book/matura lesson payload.
## Planned program shape
```c
typedef enum
{
TRACE_PREPARED,
TRACE_STARTING,
TRACE_READY,
TRACE_RUNNING,
TRACE_COMPLETED,
TRACE_CREATE_FAILED
} WorkerTraceState;
typedef struct
{
uint32_t id;
volatile uint32_t result;
volatile uint32_t iterations;
volatile WorkerTraceState trace_state;
TaskHandle_t handle;
TickType_t start_tick;
TickType_t end_tick;
} WorkerContext;
```
Planned source responsibilities:
```text
src/tasks/task01_first_task.c
├── two static WorkerContext instances
├── trace/checkpoint state
├── create_worker(WorkerContext*, ...)
├── sum_task_entry(void *pvParameters)
├── supervisor_task_entry(void *pvParameters)
├── task01_debug_checkpoint(event, subject)
└── main()
```
`trace_state` is an application diagnostic. Its name deliberately avoids
pretending that it is `eTaskState`.
## Applicable viewpoint profile
| View | Status | FC02 purpose |
|---|---|---|
| A1 CONTEXT | enabled | raw application → C API/kernel/port → Hazard3 |
| A2 STRUCTURE | enabled | contexts, handles, entry functions and storage domains |
| A3 DISPATCH | enabled | function pointer + erased parameter → typed C body |
| A4 APPLICATION | unavailable | the raw task module already is the concrete application; no generic application layer exists |
| A5 FLOW | enabled | E01E12 creation and execution scenario |
| A6 STATE | enabled | static context/diagnostic state versus kernel state |
| A7 RUNTIME | enabled | context, TCB, stack, registers, PC and ticks |
| A8 PATTERNS | unavailable | a standalone pattern view would be decorative; idioms are labelled in A2/A3 and compared in K02 A8 |
Unavailable A4/A8 tabs remain readable in the viewer and print index with the
reasons above.
## Canonical tree
```text
Series · FreeRTOS C
└── Card FC02 · First Task, TCB and Task Stack
└── Task01 · Raw C task and typed context
├── Block · A1 CONTEXT
│ └── Phase · SYSTEM BOUNDARY
│ ├── Step 01 · application module requests tasks [CODE]
│ ├── Step 02 · FreeRTOS C API owns scheduling [CODE]
│ └── Step 03 · kernel/port execute on Hazard3 [CODE]
├── Block · A2 STRUCTURE
│ └── Phase · C DATA / FUNCTIONS
│ ├── Step 01 · WorkerContext is application state [CODE]
│ ├── Step 02 · TaskHandle_t is an opaque kernel handle [CODE]
│ ├── Step 03 · two static worker contexts [CODE]
│ ├── Step 04 · sum_task_entry has TaskFunction_t shape [CODE]
│ ├── Step 05 · SupervisorContext observes both workers [CODE]
│ └── Step 06 · common sum/scheduling invariants [CODE]
├── Block · A3 DISPATCH · C FUNCTION POINTER
│ └── Phase · CALLBACK / CONTEXT
│ ├── Step 01 · TaskFunction_t erases the context type [CODE]
│ ├── Step 02 · xTaskCreate receives entry and context [RUN E03]
│ ├── Step 03 · pvParameters arrives in RV32 a0 at entry [RUN E06]
│ ├── Step 04 · cast recovers WorkerContext* [RUN E06]
│ ├── Step 05 · entry executes the typed calculation [RUN E07]
│ └── Step 06 · wrong context cast is not rejected by C [CODE]
├── Block · A5 FLOW
│ ├── Phase · CREATE / START
│ │ ├── Step 01 · static contexts prepared [RUN E01]
│ │ ├── Step 02 · first worker create request [RUN E02]
│ │ ├── Step 03 · xTaskCreate(entry, &workerA) [RUN E03]
│ │ ├── Step 04 · handle != null; diagnostic ready [RUN E04]
│ │ └── Step 05 · vTaskStartScheduler() [RUN E05]
│ └── Phase · DISPATCH / FINISH
│ ├── Step 06 · sum_task_entry(&workerA) [RUN E06]
│ ├── Step 07 · diagnostic running; calculation loop [RUN E07]
│ ├── Step 08 · tick/time slice A -> B -> A [RUN E08]
│ ├── Step 09 · result 200010000 published [RUN E09]
│ ├── Step 10 · diagnostic completed; public handle null [RUN E10]
│ ├── Step 11 · vTaskDelete(NULL) [RUN E11]
│ └── Step 12 · supervisor verifies PASS [RUN E12]
├── Block · A6 STATE
│ ├── Phase · CONTEXT / DIAGNOSTIC
│ │ ├── Step 01 · static WorkerContext lifetime [CODE]
│ │ ├── Step 02 · PREPARED -> STARTING -> READY [RUN E01E04]
│ │ └── Step 03 · RUNNING -> COMPLETED [RUN E07E10]
│ └── Phase · KERNEL
│ ├── Step 04 · Ready -> Running through scheduler [RUN E04E07]
│ ├── Step 05 · equal-priority time slicing [RUN E08]
│ └── Step 06 · Deleted does not destroy static context [RUN E10E11]
├── Block · A7 RUNTIME
│ ├── Phase · MEMORY
│ │ ├── Step 01 · context address is not a TCB address [RUN E04/E06]
│ │ ├── Step 02 · TCB and task stack come from heap_4 [RUN E04/E07]
│ │ └── Step 03 · SP lies inside worker stack interval [RUN E06/E07]
│ └── Phase · CPU / SCHEDULER
│ ├── Step 04 · pvParameters in a0 only at callback entry [RUN E06]
│ ├── Step 05 · PC, tick and switch trace [RUN E08]
│ └── Step 06 · result, source and checkpoint identity [RUN E12]
└── Exercise · Timestamped raw-C task trace
```
## Planned checkpoint table
FC02 snapshots are local to the FC02 binary even though their `event_id`
matches K02.
| Event | Planned snapshot | Stop condition | Required verification |
|---|---|---|---|
| E01 | `task01.contexts` | point 1, worker A | trace prepared, handle null, result zero |
| E02 | `task01.create-request` | point 2, worker A, previous point 1 | first launch request only |
| E03 | `task01.create-call` | point 3, worker A | trace starting; callback/context arguments correct |
| E04 | `task01.ready` | point 4, worker A | trace ready; handle non-null |
| E05 | `task01.scheduler` | point 5 | all three tasks created; startup stack active |
| E06 | `task01.entry` | point 6, worker A | `pvParameters == &workerA`; callback-entry `a0` matches |
| E07 | `task01.work` | point 7, worker A | typed context recovered; trace running |
| E08 | `task01.timeslice` | point 8, worker A only | A/B/A trace; >=2 switches and elapsed ticks |
| E09 | `task01.result` | point 9, worker A | result `200010000`, iterations `20000` |
| E10 | `task01.completed` | point 10, worker A | trace completed; public handle null |
| E11 | `task01.delete` | point 11, worker A | published state persists before non-returning delete |
| E12 | `task01.pass` | point 12, supervisor | two results, contexts, handles, stacks and scheduler invariants pass |
The checkpoint sink is `noinline` and `used`, writes volatile point/subject
state, and ends with a compiler memory barrier. E08 is emitted once by worker
A after the trace has proved `A -> B -> A`.
## A3 dispatch evidence
The exact boundary is:
```text
xTaskCreate(sum_task_entry, ..., &workerA, ..., &workerA.handle)
│ │
│ TaskFunction_t │ void* context
▼ ▼
sum_task_entry(void *pvParameters)
│ callback-entry a0 == &workerA
WorkerContext *worker = (WorkerContext *)pvParameters
typed calculation and published result
```
There is one C callback dispatch. The cast does not cause a second dynamic
dispatch. At callback entry, source + disassembly + `a0` prove the ABI. After
ordinary instructions execute, the card stops claiming that `a0` retains
`pvParameters`.
A compile-only negative exhibit demonstrates that C can accept a wrong
`void*`-to-structure cast that the K02 C++ contract rejects. The unsafe fixture
is never linked into or executed by the teaching program.
## Per-view debugging strategies
| View/anchor | Mode | Layout/action | Expected evidence |
|---|---|---|---|
| A1 dependency boundary | CODE | include/link/config excerpts | application calls public API; kernel/port/target boundary |
| A2 context layout | CODE | source excerpt + `ptype`/DWARF or bounded layout output | static context fields and no hidden C++ object model |
| A2 handle/storage | CODE | declaration + memory-region map | handle is opaque; context is static; TCB/stack are dynamic |
| A3 entry/context | RUN | source + entry disassembly + `a0` + context memory | callback ABI and exact worker identity |
| A3 wrong-cast exhibit | CODE | deterministic compile output and source blob | C compiler does not encode the desired context type |
| A5 E01E12 | RUN | per-event minimal source/asm/register/stack/memory set | ordered scenario and non-empty assertions |
| A6 diagnostic state | RUN | context fields beside public `eTaskGetState`/`vTaskGetInfo` result | correlated domains remain explicitly distinct |
| A7 TCB/stack | RUN | context address, public handle, TCB address, heap range, SP interval | context != TCB; SP belongs to the selected task stack |
| A7 scheduling | RUN | PC, tick, trace buffer and current-task observation | computation crosses real ticks and task changes |
Application code uses public task APIs. `pxCurrentTCB` may appear only in a
clearly labelled debugger-internal observation, never in a C assertion or
source dependency.
## State model
```text
static context lifetime: initialized -------------------------- program end
diagnostic trace state: PREPARED -> STARTING -> READY -> RUNNING -> COMPLETED
kernel task state: Ready <-> Running <-> Blocked; Deleted
```
The lanes can be correlated by an event and handle, but they are not equal.
Clearing the public handle before `vTaskDelete(NULL)` is an application
diagnostic choice. It does not prove immediate heap reclamation.
## Page and spread plan
1. goal/scope, paired invariants and viewpoint index;
2. compact A1 plus main A2 C structure/storage map;
3. A3 callback/parameter dispatch;
4. A5 CREATE/START (E01E05);
5. A5 DISPATCH/FINISH (E06E12), joined with sheet 4 in the viewer;
6. A6 diagnostic and kernel state lanes;
7. A7 runtime map plus exercise/rubric.
The A5 split occurs at the scheduler boundary. Both assets share a
`spread_group`, stable anchor numbering and common participant alignment.
## Acceptance contract for future implementation
- freestanding C11 build, same pinned kernel/port/config as K02;
- no `_Z*`, `.init_array`, `_GLOBAL__sub_I`, `_Unwind*`, `__cxa_*` or hosted
C++ runtime symbols; positive C/FreeRTOS/checkpoint symbols must exist;
- two independent results equal `200010000`;
- two workers each execute `20000` loop iterations;
- work crosses at least two ticks and proves at least two task changes with an
`A -> B -> A` subsequence;
- callback-entry `a0`, `pvParameters` and worker A address match;
- static context, TCB and task stack are shown as distinct objects/domains;
- all twelve RUN checkpoints have assertions and replay from clean RAM;
- every CODE step has a deterministic source/artifact query and no snapshot;
- all enabled/disabled views, anchors and full tree keys validate;
- plain cursor movement never runs or resets the simulator.
## Future implementation order
1. Create the FC02 repository from the current card template only after
explicit authorization.
2. Pin the same kernel, port, config and Hazard3 profile as K02.
3. Implement the raw C workload and E01E12 checkpoint sink.
4. Add host/build parity tests and C-only ABI checks.
5. Author A1/A2/A3/A5/A6/A7 PlantUML and text fallbacks.
6. Add viewpoint manifest, anchors, CODE/RUN strategies and assertions.
7. Validate simulator results, replay determinism, navigation and print
geometry.
8. Add FC02 to the active series manifest only after all gates pass.
No PDF or commit is performed by this implementation pass.
## Implementation decisions after Claude review
Accepted:
- E03 stops at `xTaskCreate+0` and checks the actual RV32 argument registers;
- E06 stops at `sum_task_entry+0`, before any checkpoint call can overwrite
callback register `a0`;
- all other replay events stop at `task01_debug_checkpoint_committed`, after
volatile evidence has been published;
- E08 records an actual `A,B,A` subsequence and its ticks; it does not assume
that the complete trace starts with worker A;
- `g_observed_worker_changes` names the measured application trace honestly;
- `created_handle` preserves the historical opaque handle before the public
handle is cleared, while TCB and task-stack addresses become forensic after
self-delete;
- `config/paired-experiment.json` makes kernel/config/workload parity machine
readable and explicitly declares the C-versus-C++ evidence representation as
the lesson variable;
- A3 is landscape because it visualizes an invocation chain; A1/A6 remain
portrait and A2/A5/A7 landscape.
Not copied from K02:
- C++ `start()`, duplicate-start guard, CRTP, `friend`, copy/move rules and
ownership vocabulary;
- `nullptr`, `static_cast`, RTTI/vtable tests and C++ symbol requirements;
- checkpoint stops at a sink before its evidence writes;
- claims that `a0` still carries callback context inside the checkpoint sink;
- a forced A4 or A8 diagram with no independent teaching question.