# Exploring printf on Cortex-M | Interrupt

**URL:** <https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725>\
**Category:** Blog\
**Created:** [September 20, 2023, 11:29pm UTC](https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725 "2023-09-20T23:29:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/discobot/32/1_2.png) [@discobot](https://community.memfault.com/u/discobot)\
**Post date:** [September 20, 2023, 11:29pm UTC](https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725/1 "2023-09-20T23:29:46Z")

</div>

The C `printf` function is a staple of embedded development. It’s a simple way to get logs or debug statements off the system and into a terminal on the host. This article explores the various ways to get `printf` on Cortex-M microcontrollers.

* * *
This is a companion discussion topic for the original entry at [https://interrupt.memfault.com/blog/printf-on-embedded](https://interrupt.memfault.com/blog/printf-on-embedded)

---

<div class="post-metadata">

**Author:** ![Viatorus](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@Viatorus](https://community.memfault.com/u/Viatorus)\
**Post date:** [September 21, 2023, 6:32pm UTC](https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725/2 "2023-09-21T18:32:05Z")

</div>

If you are using C++ and in search for a type-safe, extensible alternative to printf which doesn’t take up to much flash memory, take a look at the library [emio](https://github.com/Viatorus/emio/) which provides a python/fmt like format/print/scan functionality.

---

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/discobot/32/1_2.png) [@discobot](https://community.memfault.com/u/discobot)\
**Post date:** [September 21, 2023, 6:32pm UTC](https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725/3 "2023-09-21T18:32:06Z")

</div>

Listed on September 21, 2023, 6:32pm UTC



---

<div class="post-metadata">

**Author:** ![Ione](https://avatars.discourse-cdn.com/v4/letter/i/eada6e/32.png) [@Ione](https://community.memfault.com/u/Ione)\
**Post date:** [December 4, 2023, 9:45pm UTC](https://community.memfault.com/t/exploring-printf-on-cortex-m-interrupt/725/4 "2023-12-04T21:45:18Z")

</div>

While executing prinf() in semi-hosting mode with DAP-Debugger (buffered mode) program execution halts for approximately 40 ms when ‘\n’ symbol is sent. ISR code is not processed.  
In Disassembly window \_\_iar\_sh\_stdout executes CDPLT instruction - a call to co-processor 0.  
What is the mechanism of tranfering debug data to IDE? Does DAP Debugger halts cpu while sending debug data?
