<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gian Michele Pasinelli</title>
    <description>The latest articles on DEV Community by Gian Michele Pasinelli (@mik1981).</description>
    <link>https://dev.to/mik1981</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3950585%2F3b4c0765-4b35-4404-bac0-960303e1f3ec.png</url>
      <title>DEV Community: Gian Michele Pasinelli</title>
      <link>https://dev.to/mik1981</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mik1981"/>
    <language>en</language>
    <item>
      <title>Firmware Calculations Are Invisible — So I Built CalcDocs for VS Code</title>
      <dc:creator>Gian Michele Pasinelli</dc:creator>
      <pubDate>Wed, 27 May 2026 11:33:41 +0000</pubDate>
      <link>https://dev.to/mik1981/firmware-calculations-are-invisible-so-i-built-calcdocs-for-vs-code-48g</link>
      <guid>https://dev.to/mik1981/firmware-calculations-are-invisible-so-i-built-calcdocs-for-vs-code-48g</guid>
      <description>&lt;p&gt;Every embedded project eventually accumulates “hidden math”.&lt;/p&gt;

&lt;p&gt;Not complex algorithms.&lt;/p&gt;

&lt;p&gt;Just hundreds of tiny engineering calculations scattered across:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;macros&lt;/li&gt;
&lt;li&gt;scaling constants&lt;/li&gt;
&lt;li&gt;ADC conversions&lt;/li&gt;
&lt;li&gt;timer formulas&lt;/li&gt;
&lt;li&gt;configuration headers&lt;/li&gt;
&lt;li&gt;lookup tables&lt;/li&gt;
&lt;li&gt;spreadsheets&lt;/li&gt;
&lt;li&gt;comments&lt;/li&gt;
&lt;li&gt;old documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And over time, nobody remembers where the numbers actually come from.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem Isn't Complexity. It's Visibility.
&lt;/h2&gt;

&lt;p&gt;A firmware project may contain code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#define PWM_FREQ      20000
#define TIMER_CLK     170000000
#define PWM_PERIOD    (TIMER_CLK / PWM_FREQ)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The calculation is technically simple.&lt;/p&gt;

&lt;p&gt;But understanding it still requires mental parsing, context switching, and manual evaluation.&lt;/p&gt;

&lt;p&gt;Now multiply that by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multiple abstraction layers&lt;/li&gt;
&lt;li&gt;chained macros
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8i3rwd4w91kd5cts5f4x.gif" alt="Macro chain revelation code" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;unit conversions&lt;/li&gt;
&lt;li&gt;integer scaling&lt;/li&gt;
&lt;li&gt;safety margins&lt;/li&gt;
&lt;li&gt;hardware-specific constants&lt;/li&gt;
&lt;li&gt;formulas real-time resolver&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyy4wp5a24qw73a36t0g.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyy4wp5a24qw73a36t0g.gif" alt="Macro chain revelation formulas" width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Eventually the firmware becomes full of numeric logic that engineers can no longer see directly.&lt;/p&gt;

&lt;p&gt;That was the frustration behind CalcDocs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F63jvjbgtdgxco1h3aipd.png" alt="Firmware constant revelation" width="800" height="208"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What Is CalcDocs?
&lt;/h2&gt;

&lt;p&gt;CalcDocs is a VS Code extension that turns engineering calculations into live, inspectable objects directly inside the editor.&lt;/p&gt;

&lt;p&gt;Instead of treating formulas as passive text, it evaluates and visualizes them in context.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#define PWM_PERIOD    (TIMER_CLK / PWM_FREQ)   // 8500
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No spreadsheet.&lt;/p&gt;

&lt;p&gt;No calculator.&lt;/p&gt;

&lt;p&gt;No mentally simulating the preprocessor.&lt;/p&gt;

&lt;p&gt;Just immediate feedback where the calculation actually lives.&lt;/p&gt;




&lt;h2&gt;
  
  
  What It Can Do
&lt;/h2&gt;

&lt;p&gt;CalcDocs currently supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inline formula evaluation&lt;/li&gt;
&lt;li&gt;C/C++ macro expansion&lt;/li&gt;
&lt;li&gt;live computed values&lt;/li&gt;
&lt;li&gt;engineering formulas in YAML&lt;/li&gt;
&lt;li&gt;dimensional/unit validation&lt;/li&gt;
&lt;li&gt;symbol dependency resolution&lt;/li&gt;
&lt;li&gt;inline calculations inside comments&lt;/li&gt;
&lt;li&gt;interactive formula visualization&lt;/li&gt;
&lt;li&gt;hybrid static analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to replace firmware code.&lt;/p&gt;

&lt;p&gt;The goal is to make engineering intent visible again.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters in Embedded Systems
&lt;/h2&gt;

&lt;p&gt;Embedded software often sits in a strange middle ground between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;software engineering&lt;/li&gt;
&lt;li&gt;electronics&lt;/li&gt;
&lt;li&gt;physics&lt;/li&gt;
&lt;li&gt;control systems&lt;/li&gt;
&lt;li&gt;industrial constraints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A single incorrect scaling factor can silently propagate across an entire system.&lt;/p&gt;

&lt;p&gt;And the worst bugs are often not algorithmic bugs.&lt;/p&gt;

&lt;p&gt;They're interpretation bugs.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;wrong unit assumptions&lt;/li&gt;
&lt;li&gt;invalid conversion factors&lt;/li&gt;
&lt;li&gt;outdated spreadsheet formulas&lt;/li&gt;
&lt;li&gt;mismatched documentation&lt;/li&gt;
&lt;li&gt;stale calibration constants&lt;/li&gt;
&lt;li&gt;copy-pasted numeric logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of these issues are fundamentally visibility problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Spreadsheet Problem
&lt;/h2&gt;

&lt;p&gt;In many companies, engineering knowledge slowly migrates outside the firmware repository.&lt;/p&gt;

&lt;p&gt;The code contains one version.&lt;/p&gt;

&lt;p&gt;Excel contains another.&lt;/p&gt;

&lt;p&gt;Documentation contains a third.&lt;/p&gt;

&lt;p&gt;Eventually nobody fully trusts any of them.&lt;/p&gt;

&lt;p&gt;CalcDocs started as an attempt to reduce that fragmentation.&lt;/p&gt;

&lt;p&gt;The idea is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;keep formulas close to the code, but make them understandable like documentation.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Interactive Formula Exploration
&lt;/h2&gt;

&lt;p&gt;One of the most interesting additions was the interactive formula viewer.&lt;/p&gt;

&lt;p&gt;Instead of only displaying final values, formulas can now be explored dynamically inside VS Code.&lt;/p&gt;

&lt;p&gt;This becomes extremely useful during:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;debugging&lt;/li&gt;
&lt;li&gt;calibration&lt;/li&gt;
&lt;li&gt;signal analysis&lt;/li&gt;
&lt;li&gt;parameter tuning&lt;/li&gt;
&lt;li&gt;validation activities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Especially when formulas intentionally remain symbolic during development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4p3sylxx0lkbppuhpfz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4p3sylxx0lkbppuhpfz.gif" alt="Interactive formula viwer" width="720" height="388"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Under the Hood
&lt;/h2&gt;

&lt;p&gt;CalcDocs combines several layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;expression parsing&lt;/li&gt;
&lt;li&gt;AST evaluation&lt;/li&gt;
&lt;li&gt;macro expansion&lt;/li&gt;
&lt;li&gt;lightweight static analysis&lt;/li&gt;
&lt;li&gt;symbol tracking&lt;/li&gt;
&lt;li&gt;unit-aware computation&lt;/li&gt;
&lt;li&gt;VS Code integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difficult part isn't evaluating formulas.&lt;/p&gt;

&lt;p&gt;The difficult part is matching how real firmware projects are structured.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I’m Exploring This Area
&lt;/h2&gt;

&lt;p&gt;I work mostly on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;embedded firmware&lt;/li&gt;
&lt;li&gt;Cortex-M systems&lt;/li&gt;
&lt;li&gt;industrial/IoT devices&lt;/li&gt;
&lt;li&gt;RTOS-based applications&lt;/li&gt;
&lt;li&gt;developer tooling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over time I realized many embedded workflows still depend heavily on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tribal knowledge&lt;/li&gt;
&lt;li&gt;disconnected spreadsheets&lt;/li&gt;
&lt;li&gt;manual verification&lt;/li&gt;
&lt;li&gt;implicit assumptions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think tooling around engineering visibility is still massively underexplored.&lt;/p&gt;




&lt;h2&gt;
  
  
  Future Directions
&lt;/h2&gt;

&lt;p&gt;Some areas I’m currently exploring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stronger dimensional analysis&lt;/li&gt;
&lt;li&gt;cross-file dependency graphs&lt;/li&gt;
&lt;li&gt;richer interactive webviews&lt;/li&gt;
&lt;li&gt;symbolic computation&lt;/li&gt;
&lt;li&gt;tighter integration with documentation&lt;/li&gt;
&lt;li&gt;formula traceability&lt;/li&gt;
&lt;li&gt;engineering validation workflows&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;Most firmware calculations are not difficult.&lt;/p&gt;

&lt;p&gt;They're just hidden.&lt;/p&gt;

&lt;p&gt;CalcDocs is an attempt to make embedded engineering knowledge visible directly where it matters most: inside the code.&lt;/p&gt;

&lt;p&gt;If you work on embedded systems, I’d genuinely be interested in how your team handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;formulas&lt;/li&gt;
&lt;li&gt;scaling factors&lt;/li&gt;
&lt;li&gt;engineering constants&lt;/li&gt;
&lt;li&gt;unit conversions&lt;/li&gt;
&lt;li&gt;spreadsheet dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;because every company seems to reinvent this differently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=convergo-dev.calcdocs-vscode-extension" rel="noopener noreferrer"&gt;CalcDocs VS Code extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mik1981/Calcdocs-VSCode-Extension" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>productivity</category>
      <category>c</category>
      <category>firmware</category>
    </item>
  </channel>
</rss>
