<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Articles tagged embedded at Royyan Dzakiy</title>
  <link rel="alternate" type="text/html"
        href="https://royyandzakiy.com/tags/embedded/"/>
  <link rel="self" type="application/atom+xml"
        href="https://royyandzakiy.com/tags/embedded/feed/"/>
  <updated>2026-10-16T09:06:07Z</updated>
  <id>urn:uuid:0c51bbbc-1357-8b92-86de-f8af327d5b28</id>

  <author>
    <name>Royyan Dzakiy</name>
    <uri>https://royyandzakiy.com</uri>
  </author>

  <entry>
    <title>Zephyr App Event Manager (app_event_manager)</title>
    <link rel="alternate" type="text/html" href="https://royyandzakiy.com/blog/2026-04/app-event-manager-nrf-connect/"/>
    <id>urn:uuid:b19bb33c-a44d-5a0a-b6a5-5cd6c8cdf4e8</id>
    <updated>2026-04-06T00:00:00Z</updated>
    <category term="zephyr"/><category term="embedded"/>
    <content type="html">
      <![CDATA[<p>Another design of event-driven architecture is the <strong>AEM (app_event_manager)</strong> in Zephyr. This subsystem/framework enforces its users to structure their code in modules. Each module connected to the event-driven backend will need to explicitly subscribe/listen to another module to get notified of any events happening.</p>

<p>To me, this architecture style really helps when I need to isolate a particular module to debug or test easily. I could simply remove it from the CMakeLists.txt, and logically, the tight coupling design will not affect other modules.</p>

<p><a href="https://docs.nordicsemi.com/bundle/ncs-3.0.2/page/nrf/libraries/others/app_event_manager.html">https://docs.nordicsemi.com/bundle/ncs-3.0.2/page/nrf/libraries/others/app_event_manager.html</a></p>

<p>Here’s a small snippet of how it looks in practice:</p>

<pre class="highlight"><code><span class="c">/* --- Event Definition --- */</span>
APP_EVENT_TYPE_DEFINE(sensor_data_event,
		  <span class="k">NULL</span>,
		  <span class="k">NULL</span>,
		  APP_EVENT_FLAGS_CREATE(
			APP_EVENT_TYPE_FLAG_INIT_LOG_ENABLE
		  ));

<span class="c">/* --- Module A: Publisher --- */</span>
<span class="k">static</span> <span class="t">void</span> <span class="f">publish_sensor_data</span>(<span class="t">int32_t</span> value) {
	<span class="k">struct</span> <span class="t">sensor_data_event</span> *evt = new_sensor_data_event();
	evt-&gt;value = value;
	APP_EVENT_SUBMIT(evt);
}

<span class="c">/* --- Module B: Subscriber --- */</span>
<span class="k">static</span> <span class="t">bool</span> <span class="f">app_event_handler</span>(<span class="k">const</span> app_event_header *aeh) {
	<span class="k">if</span> (is_sensor_data_event(aeh)) {
		<span class="k">struct</span> <span class="t">sensor_data_event</span> *evt = cast_sensor_data_event(aeh);
		LOG_INF(<span class="s">"Received sensor data: %d"</span>, evt-&gt;value);
		<span class="k">return</span> <span class="k">true</span>;
	}
	<span class="k">return</span> <span class="k">false</span>;
}

APP_EVENT_LISTENER_DEFINE(sensor_event_listener, app_event_handler);
APP_EVENT_SUBSCRIBE(sensor_event_listener, <span class="t">sensor_data_event</span>);
</code></pre>

<p>With this approach, if I want to test Module B in isolation, I can simply remove Module A from the build, and the app still runs, it simply stops sending events. Really nice for unit testing and incremental development.</p>
]]>
    </content>
  </entry>
  <entry>
    <title>RTOS Sharing Session</title>
    <link rel="alternate" type="text/html" href="https://royyandzakiy.com/blog/2025-11/rtos-sharing-session/"/>
    <id>urn:uuid:053cdd42-a799-56ff-a3aa-37294e2122c5</id>
    <updated>2025-11-11T00:00:00Z</updated>
    <category term="embedded"/>
    <content type="html">
      <![CDATA[<p>Had a blast sharing with the Synapsis team! The topic was about Embedded RTOSes, we mainly talked about FreeRTOS and did hands-on using ESP32.</p>

<p>One thing that I don’t find talked about enough are RTOS &amp; design patterns. How state machines are the bread and butter in many RTOS systems, also problems that may arise in different biz contexts, for instance in a multiple sensor and multi stage data processing device, we can leverage the pipeline pattern.</p>

<p>Had fun preparing the talk, and hopefully it sparked some ideas!</p>

<p>Somethings that I think I would do better on next RTOS sessions:</p>
<ul>
  <li>I’d rather have a handson session, rather than a talkish one, especially when majority are beginners. This way they can bring back the experience of running the code on their pcs, and me checking on them</li>
  <li>For complex topics and abstract software ones like architecture, it’s best to have it during qna or in a consulting manner when someone in the mid senior level actually bringing it up</li>
  <li>I should reduce the amount of examples being run through. And I should groom them better, to not have too many example cases being presented. Or even better, just rewrite the code live (rather than running a premade code) to help give a gist to the students, including how to read the texh docs to get the API correct</li>
</ul>

<p><img src="/assets/images/1763211045758.jpg" alt="" />
<img src="/assets/images/1763211046191.jpg" alt="" />
<img src="/assets/images/1763211046241.jpg" alt="" /></p>
]]>
    </content>
  </entry>
  <entry>
    <title>ESP-IDF Build System</title>
    <link rel="alternate" type="text/html" href="https://royyandzakiy.com/blog/2025-10/esp-idf-build-system/"/>
    <id>urn:uuid:91052b91-94ab-556a-94da-598ea065d64c</id>
    <updated>2025-10-16T00:00:00Z</updated>
    <category term="embedded"/>
    <content type="html">
      <![CDATA[<p>Lately I’ve been going back and forth with zephyr and esp-idf. Something that often times trips me when exploring new frameworks is in understanding their build systems. What goes where, what gets called by what, how to structure things as intended, how can I elevate more with what they have given and make a beautiful (lol) automated and robust build process. I love to fanboy on them gud foldering structures, module seperations, and different build-system task goodness.</p>

<p>This talk by Ivan Grokhotkov really helps to be a primer on most things on what to expect on the esp-idf build system.</p>

<p>Man, really love these espressif talks, super practical and recent. Really grateful for their effort in these</p>

<p><a href="youtube.com/watch?v=7utLBxSOXlQ&amp;feature=youtu.be">DevCon24 - Keynote 2nd Day - Mastering ESP-IDF Build System</a></p>

<div class="video-container">
  <iframe src="https://www.youtube.com/embed/7utLBxSOXlQ" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="">
  </iframe>
</div>

<p>Here’s for further reading on espressifs concept of “components”:</p>

<p><a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html">https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html</a></p>
]]>
    </content>
  </entry>
  <entry>
    <title>ESP-IDF Test Frameworks</title>
    <link rel="alternate" type="text/html" href="https://royyandzakiy.com/blog/2025-10/esp-idf-test-frameworks/"/>
    <id>urn:uuid:a4cab275-ff90-5e75-b9d0-ffcf9d6ad42a</id>
    <updated>2025-10-05T00:00:00Z</updated>
    <category term="embedded"/>
    <content type="html">
      <![CDATA[<p>I’ve lately been keen in learning test systems in the embedded, especially for esp-idf. I’ve been wanting to really understand how far I can take the automated testing and CI processes using built in tools of the espressif ecosystem, or common practices. This talk by Zim Kalinowski really fascinates me, knowing that within espressif, they have been implementing these full blown processes for the longest time. Really excited to ramp up my gear and try implementing these tools myself.</p>

<p>Some of the things he will talk about is as follows:</p>
<ul>
  <li>Test framework Introduction</li>
  <li>Using PyTest with Unity</li>
  <li>Setting Up CI in GitHub</li>
  <li>Using CMock and several already mocked IDF components</li>
  <li>Using QEMU</li>
  <li>Using Self-hosted test runner for on target tests (hardware based)</li>
</ul>

<p><a href="https://www.youtube.com/watch?v=HQcTWjOv8fM">EDC22 Day 2 Talk 9: Leveraging ESP IDF Test Framework in Third-Party Projects</a></p>

<div class="video-container">
  <iframe src="https://www.youtube.com/embed/HQcTWjOv8fM" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="">
  </iframe>
</div>
]]>
    </content>
  </entry>

</feed>
