Enviar búsqueda
Cargar
Device-specific Clang Tooling for Embedded Systems
•
1 recomendación
•
5,088 vistas
E
emBO_Conference
Seguir
by Jackie Kay
Leer menos
Leer más
Tecnología
Denunciar
Compartir
Denunciar
Compartir
1 de 20
Descargar ahora
Descargar para leer sin conexión
Recomendados
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf Tools
emBO_Conference
Performance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux Kernel
lcplcp1
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Valeriy Kravchuk
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
SUSE Labs Taipei
BPF Internals (eBPF)
BPF Internals (eBPF)
Brendan Gregg
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
Brendan Gregg
LSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
Brendan Gregg
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
Andrea Righi
Recomendados
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf Tools
emBO_Conference
Performance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux Kernel
lcplcp1
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Valeriy Kravchuk
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
SUSE Labs Taipei
BPF Internals (eBPF)
BPF Internals (eBPF)
Brendan Gregg
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
Brendan Gregg
LSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
Brendan Gregg
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
Andrea Righi
YOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
Brendan Gregg
Performance Profiling in Rust
Performance Profiling in Rust
InfluxData
eBPF Perf Tools 2019
eBPF Perf Tools 2019
Brendan Gregg
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
Brendan Gregg
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
Brendan Gregg
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
Brendan Gregg
FreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame Graphs
Brendan Gregg
Profiling & Testing with Spark
Profiling & Testing with Spark
Roger Rafanell Mas
Tuning parallelcodeonsolaris005
Tuning parallelcodeonsolaris005
dflexer
re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflix
Brendan Gregg
Kernel development
Kernel development
Nuno Martins
USENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame Graphs
Brendan Gregg
LPC2019 BPF Tracing Tools
LPC2019 BPF Tracing Tools
Brendan Gregg
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Brendan Gregg
Netflix: From Clouds to Roots
Netflix: From Clouds to Roots
Brendan Gregg
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
Naoto MATSUMOTO
Modern Linux Tracing Landscape
Modern Linux Tracing Landscape
Sasha Goldshtein
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
Ontico
Open Source Systems Performance
Open Source Systems Performance
Brendan Gregg
QCon 2015 Broken Performance Tools
QCon 2015 Broken Performance Tools
Brendan Gregg
Hta w22
Hta w22
SelectedPresentations
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Andrew Case
Más contenido relacionado
La actualidad más candente
YOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
Brendan Gregg
Performance Profiling in Rust
Performance Profiling in Rust
InfluxData
eBPF Perf Tools 2019
eBPF Perf Tools 2019
Brendan Gregg
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
Brendan Gregg
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
Brendan Gregg
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
Brendan Gregg
FreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame Graphs
Brendan Gregg
Profiling & Testing with Spark
Profiling & Testing with Spark
Roger Rafanell Mas
Tuning parallelcodeonsolaris005
Tuning parallelcodeonsolaris005
dflexer
re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflix
Brendan Gregg
Kernel development
Kernel development
Nuno Martins
USENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame Graphs
Brendan Gregg
LPC2019 BPF Tracing Tools
LPC2019 BPF Tracing Tools
Brendan Gregg
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Brendan Gregg
Netflix: From Clouds to Roots
Netflix: From Clouds to Roots
Brendan Gregg
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
Naoto MATSUMOTO
Modern Linux Tracing Landscape
Modern Linux Tracing Landscape
Sasha Goldshtein
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
Ontico
Open Source Systems Performance
Open Source Systems Performance
Brendan Gregg
QCon 2015 Broken Performance Tools
QCon 2015 Broken Performance Tools
Brendan Gregg
La actualidad más candente
(20)
YOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
Performance Profiling in Rust
Performance Profiling in Rust
eBPF Perf Tools 2019
eBPF Perf Tools 2019
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
FreeBSD 2014 Flame Graphs
FreeBSD 2014 Flame Graphs
Profiling & Testing with Spark
Profiling & Testing with Spark
Tuning parallelcodeonsolaris005
Tuning parallelcodeonsolaris005
re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflix
Kernel development
Kernel development
USENIX ATC 2017: Visualizing Performance with Flame Graphs
USENIX ATC 2017: Visualizing Performance with Flame Graphs
LPC2019 BPF Tracing Tools
LPC2019 BPF Tracing Tools
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Netflix: From Clouds to Roots
Netflix: From Clouds to Roots
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
Modern Linux Tracing Landscape
Modern Linux Tracing Landscape
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
Open Source Systems Performance
Open Source Systems Performance
QCon 2015 Broken Performance Tools
QCon 2015 Broken Performance Tools
Similar a Device-specific Clang Tooling for Embedded Systems
Hta w22
Hta w22
SelectedPresentations
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Andrew Case
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
Andrey Karpov
0x01 - Breaking into Linux VMs for Fun and Profit.pdf
0x01 - Breaking into Linux VMs for Fun and Profit.pdf
scribdsituation719
Shadow pad technical_description_pdf
Shadow pad technical_description_pdf
Andrey Apuhtin
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Deependra Ariyadewa
Cache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From Ruby
Molly Struve
Trap Handling in Linux
Trap Handling in Linux
YongraeJo
Checking the Source SDK Project
Checking the Source SDK Project
Andrey Karpov
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
Shellcoding in linux
Shellcoding in linux
Ajin Abraham
0x01 - Breaking into Linux VMs for Fun and Profit
0x01 - Breaking into Linux VMs for Fun and Profit
Russell Sanford
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
Hands-on Lab: Comparing Redis with Relational
Hands-on Lab: Comparing Redis with Relational
Amazon Web Services
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerun
idsecconf
Swift Install Workshop - OpenStack Conference Spring 2012
Swift Install Workshop - OpenStack Conference Spring 2012
Joe Arnold
Lab Manual Combaring Redis with Relational
Lab Manual Combaring Redis with Relational
Amazon Web Services
Hands-on Lab: Amazon ElastiCache
Hands-on Lab: Amazon ElastiCache
Amazon Web Services
Getting Started with ElastiCache for Redis
Getting Started with ElastiCache for Redis
Amazon Web Services
DevOps Enabling Your Team
DevOps Enabling Your Team
GR8Conf
Similar a Device-specific Clang Tooling for Embedded Systems
(20)
Hta w22
Hta w22
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
200 Open Source Projects Later: Source Code Static Analysis Experience
200 Open Source Projects Later: Source Code Static Analysis Experience
0x01 - Breaking into Linux VMs for Fun and Profit.pdf
0x01 - Breaking into Linux VMs for Fun and Profit.pdf
Shadow pad technical_description_pdf
Shadow pad technical_description_pdf
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Cache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From Ruby
Trap Handling in Linux
Trap Handling in Linux
Checking the Source SDK Project
Checking the Source SDK Project
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Shellcoding in linux
Shellcoding in linux
0x01 - Breaking into Linux VMs for Fun and Profit
0x01 - Breaking into Linux VMs for Fun and Profit
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Hands-on Lab: Comparing Redis with Relational
Hands-on Lab: Comparing Redis with Relational
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerun
Swift Install Workshop - OpenStack Conference Spring 2012
Swift Install Workshop - OpenStack Conference Spring 2012
Lab Manual Combaring Redis with Relational
Lab Manual Combaring Redis with Relational
Hands-on Lab: Amazon ElastiCache
Hands-on Lab: Amazon ElastiCache
Getting Started with ElastiCache for Redis
Getting Started with ElastiCache for Redis
DevOps Enabling Your Team
DevOps Enabling Your Team
Último
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Alan Dix
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
gurkirankumar98700
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
ThousandEyes
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
BookNet Canada
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
shyamraj55
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Pooja Nehwal
Último
(20)
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Slack Application Development 101 Slides
Slack Application Development 101 Slides
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Device-specific Clang Tooling for Embedded Systems
1.
Devicespecific Clang Tooling for Embedded Systems Jackie Kay jackieokay.com emBO++, 18/2/17
2.
Goal: Feed device memory maps to the compiler.
3.
How? 1. Parse CMSIS SVD file to get device memory map. 2. Write Clang AST matchers to locate raw memory accesses and fixits to refactor accesses for typesafety and readability. 3. Run matchers over code.
4.
Step One
5.
To parse CMSIS SVD files, use the same Python backend that generates Kvasir header files. namespace clock_hfclkrun { using Addr = bit::Address<0x40000408, 0xfffffffe, 0x00000000, unsigned>; enum class StatusVal : unsigned { nottriggered=0x00000000, triggered=0x00000001, }; constexpr Register::FieldLocation<Addr, bit::maskFromRange(0, 0), bit::ReadWriteAccess, StatusVal> status{}; /* ... */
6.
Generate YAML that associates registers, fields, and values. address: 0x40000408 name: clock_hfclkrun fields: mask: 0x1 name: status values: name: nottriggered value: 0x0 name: triggered value: 0x1
7.
Step Two
8.
We want to find this: *(volatile uint32_t*)0x40000408 = 0x1; And turn it into this: apply(write(clock_hfclkrun::statusValC::triggered));
9.
Writing a clangtidy check offers a powerful framework for: Registering AST Matchers Configuration and command line options Prettyprinting diagnostics Refactoring with fixits
10.
Writing an AST Matcher auto volatileDereferenceMatcher = allOf( unaryOperator(hasOperatorName("*"), hasUnaryOperand(ignoringParenImpCasts( explicitCastExpr( hasDestinationType(isAnyPointer()), hasSourceExpression(expr().bind("address"))) )) ), expr(hasType(isVolatileQualified())) ); Finds this: *(volatile uint32_t*)0x40000408
11.
Load YAML representation into a map Check if matched expressions can be evaluated at compile time as register values in our memory map Try to decompose the assigned literal into known values if applicable
12.
Fixit hints diag(MatchedLocation>getLocStart(), "Found write to register via volatile cast") << FixItHint::CreateReplacement( ReplacementRange, replacement); Result: test.c:5:3: warning: Found write to register via volatile cast [embeddedtypesaferegisterwrite] *(volatile std::uint32_t*)0x40000408 = 0x1; ^ apply(write(clock_hfclkrun::statusValC::triggered))
13.
Step Three
14.
How to compile code for the Cortex M0 with Clang from the command line on Linux? clang target armv6munknownnoneeabi cccgccname armnoneeabigcc mcpu=cortexm0 mfloatabi=soft mthumb fshortenums specs=nosys.specs I/usr/include/newlib/c++/4.9.3 I/usr/include/newlib/c++/4.9.3/armnoneeabi/armv6m blinky.c
15.
Clang tooling requires " compile_commands.json ", which is generated by CMake ( DCMAKE_EXPORT_COMPILE_COMMANDS ) If using make , use Bear May need to tweak Bear's output to include Clangspecific flags for crosscompiling
16.
Give YAML file to .clangtidy: CheckOptions: key: embeddedtypesaferegisterwrite.DescriptionFile value: nrf51.yaml To run the tool: clangtidy checks=embeddedtypesaferegisterwrite p compile_commands.json blinky.c
17.
In reality, the naive AST matcher often isn't enough. __STATIC_INLINE void nrf_clock_task_trigger( nrf_clock_task_t task) { *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + task)) = NRF_CLOCK_TASK_TRIGGER; } Base peripheral offset is a literal (defined by a macro) but task cannot be evaluated at compile time. Could try to analyze at call site.
18.
Step Four
19.
The more we can check statically/at compile time, the better. Register access checks are just the beginning. The tools are already here, though one must design them with awareness of existing patterns. Maybe we don't need to give up on legacy code if we can write great refactoring tools.
20.
Resources github.com/jacquelinekay/embo2017presentation Implementation of linting tool on Github Writing a clangtidy check CMSIS SVD Specification Crosscompilation using Clang nrf5 SDK from Nordic Semiconductor Kvasir Hardware Description File Generator
Descargar ahora