1
francliment.com
Metal-InTest-DrivenDevelopment
A Dual-Target TDD Approach
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
2
francliment.com
Me
• Senior R&D Software Developer @ Kongsberg Discovery Spain
• Technical Agile Coach @ francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
3
francliment.com
Me
• Senior R&D Software Developer @ Kongsberg Discovery Spain
• Technical Agile Coach @ francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
4
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
We are hiring!
5
francliment.com
Why this talk?
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
6
francliment.com
Unembedding Embedded
Systems with TDD:
Benefits of Going Beyond The
Make-It-Work Phase
A‘practical’ companion talk
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
7
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Getting Feedback from the
Metal/Hardware
(an easy example)
8
francliment.com
HowcouldweassurethecodedoesreallyturnOn&OffanLED?
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
9
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Measure
voltage at
GPIO output
Measuring the
current loop
Use Logic
analyzer
(assuring logic
levels & timing)
Use some kind of
photodetector
HowcouldweassurethecodedoesreallyturnOn&OffanLED?
10
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Source: https://www.eetindia.co.in/engineers-in-the-covid-19-era/
Hardware
Bottleneck
11
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Main Goal:
- Make possible to create and evolve any embedded code aspect MUCH faster and
safer, iteratively and incrementally.
‘Metal-In’ DevelopmentApproach
12
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
How:
Main Goal:
- Continuously looking for ways to get feedback faster.
- Make possible to create and evolve any embedded code aspect MUCH faster and
safer, iteratively and incrementally.
‘Metal-In’ DevelopmentApproach
13
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
How:
Main Goal:
- Continuously looking for ways to get feedback faster.
- Treating as much embedded code as possible as a ‘independent’ subsystem.
- Make possible to create and evolve any embedded code aspect MUCH faster and
safer, iteratively and incrementally.
‘Metal-In’ DevelopmentApproach
14
francliment.com
Howcouldweassurethe code doesreallyturnOn&OffanLED?
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Measure
voltage at
GPIO output
Measuring the
current loop
Use Logic
analyzer
(assuring logic
levels &
timing)
Use a camera or
another kind of
photodetector
Embeddedcodeactionablearea
15
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
How:
Main Goal:
- Make possible to create and evolve any embedded code aspect faster and safer,
iteratively and incrementally.
- Continuously looking for ways to get feedback faster.
- Treating as much embedded code as possible as a ‘independent’ subsystem.
- Whenever possible, promote using cheap SIL (aka software test-doubles) instead of any
kind of HIL.
‘Metal-In’ DevelopmentApproach
16
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Nothing happens ‘outside’
if it doesn’t change an SFR bit
‘Metal-In’ DevelopmentApproach
17
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
‘Metal-In’ DevelopmentApproach
How:
Main Goal:
Business outcome:
- Increased embedded software development lead time.
- Sustainable development pace.
- Make possible to create and evolve any embedded code aspect faster and safer,
iteratively and incrementally.
- Continuously looking for ways to get feedback faster.
- Treating as much embedded code as possible as a ‘independent’ subsystem.
- Whenever possible, promote using cheap SIL (aka software test-doubles) instead of any
kind of HIL.
18
francliment.com
1. Make It Work
3. Make It Fast (enough)
2. Make It Right (enough)
https://www.eetindia.co.in/engineers-in-the-covid-19-era/
https://www.ee,tindia.co.in/engineers-in-the-covid-19-era/
― Kent Beck, Test-Driven Development By Example, 2003
― Butler W. Lampson, ’Hints for Computer System Design’, 1983
― Stephen C. Johnson & Brian W. Kernighan, ’The C Language and Models for Systems Programming’, 1983
Focused in understanding how to solve the problem, not about
engineering the code right
Fulfill system timing requirements
Evolutive Design&Development
Engineer and craft the code right to make it easy to understand,
maintain and evolve
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
19
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Test code only
KISS : Keep it Simple, Stupid
1
DRY : Don’t Repeat Yourself
1
2
Production code only
1
Simple Design,
SOLID,
Design Patterns…
2
DAMP : Descriptive And
Maintainable Procedures
Evolutive Design&Development: TDDImplementation
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
20
francliment.com
Embedded TDD cycle
Embedded software as complete subsystem
(End-to-end == from metal-to metal)
Metal-In Test-Driven Development: ADual-Target TDDapproach
HOST
TARGET
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Source: ‘Test-Driven Development for Embedded C’ book, James W. Grenning
Integration ‘datasheet
interpretation’ tests
21
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
The Embedded (“Morse-ish”) Hello world
22
francliment.com
Practical Example (KATA): 4-LevelBattery Monitor
• (Current) Microcontroller: Microchip PIC18F47K40 (8-bit bare metal).
• (Current) Hardware variant: 4 Status LEDs connected to PORTA’s high nibble.
• Kata context:
▪ First internal MCU usage (no PAL implementation available yet).
▪ ‘BatteryStatusPercentageProvider’ module is under development by another
team.
• Kata objective:
▪ Develop a highly decoupled and portable ‘BatteryMonitor’ module following
Metal-In Test-Driven Development.
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
23
francliment.com
Dual-Target Development Environment
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Vendoragnostictools (Current)Vendordependanttools
• Lightweighted unit testing &
buildsystemforC.
• Automatedtest-double
creation.
• UsedonHOSTset-up
• Relatedtools:Gcov
• UsedonTARGETset-up
• Relatedtools: XC8&MicrochipDebugger
(MDB)
+
• (Current)Hardwarevariant
• State-of-the-art
automated refactoring
features.
24
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
Datasheet:
Awritten on(silicon)stone contract
25
francliment.com
PIC18F47K40: Commanding GPIOs
Example: Command A7 GPIO state
▪ Write to PORTA bit 7 (or LATA bit 7)
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
26
francliment.com
PIC18F47K40: Commanding GPIOs
Example: Command A7 GPIO state
▪ Write to PORTA bit 7 (or LATA bit 7)
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
27
francliment.com
PIC18F47K40: Commanding GPIOs
Example: Read A7 GPIO state
▪ Read from PORTA bit 7
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
28
francliment.com
PIC18F47K40: Commanding GPIOs
Example: Read A7 GPIO state
▪ Read from PORTA bit 7
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
29
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
1
30
francliment.com
PIC18F47K40: GPIOResetConfiguration
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
31
francliment.com
1) TRISA bit 7 to LOW (means output driver enabled)
Configuring A7 GPIO as OUTPUT:
PIC18F47K40: GPIOConfiguration
PORTA7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
32
francliment.com
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
1) TRISA bit 7 to LOW (means output driver enabled)
Configuring A7 GPIO as OUTPUT:
PIC18F47K40: GPIOConfiguration
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
33
francliment.com
1) TRISA bit 7 to LOW (means output driver enabled)
Configuring A7 GPIO as OUTPUT:
PIC18F47K40: GPIOConfiguration
2) ANSELA bit 7 to LOW (input buffers enabled)
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
34
francliment.com
1) TRISA bit 7 to LOW (means output driver enabled)
Configuring A7 GPIO as OUTPUT:
PIC18F47K40: GPIOConfiguration
2) ANSELA bit 7 to LOW (input buffers enabled)
A7
TRISA7
ANSELA7
Read LATA7
Read PORTA7
Write LATA7
Write PORTA7
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
35
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
2
36
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Test code only
KISS : Keep it Simple, Stupid
1
DRY : Don’t Repeat Yourself
1
2
Production code only
1
Simple Design,
SOLID,
Design Patterns…
2
DAMP : Descriptive And
Maintainable Procedures
ReachingtheRED:AssuringtheHardware/Metal worksonpurpose
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
37
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
3
38
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Test code only
KISS : Keep it Simple, Stupid
1
DRY : Don’t Repeat Yourself
1
2
Production code only
1
Simple Design,
SOLID,
Design Patterns…
2
DAMP : Descriptive And
Maintainable Procedures
Made-It-Work: ‘Datasheet ContratInterpretation’ acceptance testpassed
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
39
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Test code only
KISS : Keep it Simple, Stupid
1
DRY : Don’t Repeat Yourself
1
2
Production code only
1
Simple Design,
SOLID,
Design Patterns…
2
DAMP : Descriptive And
Maintainable Procedures
Make-It-Right: Timetoengineerthecoderight
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
40
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
4
41
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Nextself-checking specification: acomplete micro-cycle inaction
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
42
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
5
43
francliment.com
Only when running on TARGET
TARGET run: Round1
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
44
francliment.com
Only when running on TARGET
TARGET run: Round1
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
MCU
FW
45
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
6
46
francliment.com
Red
Green
Refactor
Make It Work
Make It Right
Test code only
KISS : Keep it Simple, Stupid
1
DRY : Don’t Repeat Yourself
1
2
Production code only
1
Simple Design,
SOLID,
Design Patterns…
2
DAMP : Descriptive And
Maintainable Procedures
Make-It-Right: Timetoengineerthecoderight
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
47
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
7
48
francliment.com
Only when running on TARGET
TARGET run:Round2.Collaborator
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
MCU
FW
49
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
8
50
francliment.com
Only when
running on
HOST
HOSTrun:‘Tied’totherunningMCU
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
MCU
FW
51
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
9
52
francliment.com
Only when
running on
HOST
HOSTrun:‘Tied’totherunningMCU
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
MCU
FW
53
francliment.com
Currentproduction code:
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
54
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
First make the change easy,
thenmake theeasy change.
55
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
10
56
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
Firstmake thechange easy,
then make the easy change.
57
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
11
58
francliment.com
HOSTrun:Production codedecoupled fromtherunningMCU
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
59
francliment.com
TARGET run:Production codedecoupled fromtherunningMCU
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
MCU
FW
60
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
INCOMPLETENESS
61
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
BatteryMonitor_Init(unit8_t StatusLED1_GPIOId,
unit8_t StatusLED2 _GPIOId,
unit8_t StatusLED3 _GPIOId,
unit8_t StatusLED4 _GPIOId);
62
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
PAL_GPIOpartially implemented
63
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
PAL_GPIOpartially implemented
Test-Driving it through
test_PAL_GPIO
64
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Neo:
Morpheus:
What are you trying to tell me? That I can dodge bullets?
No, Neo. I'm trying to tell you that when you're ready, you won't have to.
65
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
GRACIAS
66
francliment.com
NDC TechTown 2024 Metal-In TDD: A Dual-Target Approach
Neo:
Morpheus:
Q&A

More Related Content

PDF
Unembedding embedded systems with TDD: Benefits of going beyond the make it w...
PDF
Embo++2022 Unembedding Embedded Systems with TDD Benefits of going beyond the...
PDF
Driving cycle tracking device big data storing and management
PDF
Tdd and a new paradigm for hardware verification
PDF
A Computer Based Artificial Neural Network Controller with Interactive Audito...
PDF
The Art of Applied Engineering - An Overview
PDF
SMART AND INTELLIGENCE HI-TECH ARMY SECURITY SYSTEM
PDF
IRJET- IoT based Industrial Level Sensor Data Acquisition & Monitoring
Unembedding embedded systems with TDD: Benefits of going beyond the make it w...
Embo++2022 Unembedding Embedded Systems with TDD Benefits of going beyond the...
Driving cycle tracking device big data storing and management
Tdd and a new paradigm for hardware verification
A Computer Based Artificial Neural Network Controller with Interactive Audito...
The Art of Applied Engineering - An Overview
SMART AND INTELLIGENCE HI-TECH ARMY SECURITY SYSTEM
IRJET- IoT based Industrial Level Sensor Data Acquisition & Monitoring

Similar to Metal-In Test-Driven Development_A Dual-Target TDD Approach (NDC TechTown 2024).pdf (20)

PPTX
ERS Case Study: HCLT develops a slat flap control unit [sfcu] for an Aerospac...
PDF
Development of Software for Estimation of Structural Dynamic Characteristics ...
PPT
Varsha patil AISSMS IOIT Pune mca te pu book
PDF
Digital Design for Computer Data Acquisition 1st Edition Charles D. Spencer
PDF
Q1 2009 Earning Report of National Instruments Corp
PPT
Hardware combinational
DOCX
Resume-Zhuyu
PDF
Imagenext Company Overview 2010 Mar
PDF
Safecast @ 29c3
PPTX
Embedded system and development
PPTX
Kairos aarohan
PDF
Introduction to embedded computing and arm processors
PDF
Embeded microcontroler
DOCX
REPORT IBM (1)
PPTX
Aplit-Soft
ODP
Smartblitzmerker
PDF
Nanometer Testing: Challenges and Solutions
PDF
Abraham q3 2008
PDF
Presentation of NMDG nv: Your Solution Provider for Nonlinear Component Chara...
PDF
The Role Of Software And Hardware As A Common Part Of The...
ERS Case Study: HCLT develops a slat flap control unit [sfcu] for an Aerospac...
Development of Software for Estimation of Structural Dynamic Characteristics ...
Varsha patil AISSMS IOIT Pune mca te pu book
Digital Design for Computer Data Acquisition 1st Edition Charles D. Spencer
Q1 2009 Earning Report of National Instruments Corp
Hardware combinational
Resume-Zhuyu
Imagenext Company Overview 2010 Mar
Safecast @ 29c3
Embedded system and development
Kairos aarohan
Introduction to embedded computing and arm processors
Embeded microcontroler
REPORT IBM (1)
Aplit-Soft
Smartblitzmerker
Nanometer Testing: Challenges and Solutions
Abraham q3 2008
Presentation of NMDG nv: Your Solution Provider for Nonlinear Component Chara...
The Role Of Software And Hardware As A Common Part Of The...
Ad

Recently uploaded (20)

PPTX
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
PPTX
Feature types and data preprocessing steps
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
wireless networks, mobile computing.pptx
PPTX
ai_satellite_crop_management_20250815030350.pptx
PPTX
Building constraction Conveyance of water.pptx
PDF
Applications of Equal_Area_Criterion.pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Soil Improvement Techniques Note - Rabbi
PPTX
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPTX
Software Engineering and software moduleing
PPTX
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
PPTX
Petroleum Refining & Petrochemicals.pptx
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
Feature types and data preprocessing steps
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Computer System Architecture 3rd Edition-M Morris Mano.pdf
August 2025 - Top 10 Read Articles in Network Security & Its Applications
wireless networks, mobile computing.pptx
ai_satellite_crop_management_20250815030350.pptx
Building constraction Conveyance of water.pptx
Applications of Equal_Area_Criterion.pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Soil Improvement Techniques Note - Rabbi
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Software Engineering and software moduleing
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
Petroleum Refining & Petrochemicals.pptx
Module 8- Technological and Communication Skills.pptx
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
distributed database system" (DDBS) is often used to refer to both the distri...
Exploratory_Data_Analysis_Fundamentals.pdf
Ad

Metal-In Test-Driven Development_A Dual-Target TDD Approach (NDC TechTown 2024).pdf