{"id":9920,"date":"2022-06-20T09:45:22","date_gmt":"2022-06-20T09:45:22","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=9920"},"modified":"2023-08-04T09:36:00","modified_gmt":"2023-08-04T04:06:00","slug":"microcontroller-embedded-c-programming-lecture-48-embedded-hello-world","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 48 | Embedded &#8211; &#8216;Hello World&#8217;"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\" style=\"padding: 0px 15px;\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 35px; border-width: 0px; line-height: 50px;\"><span style=\"color: #000080;\"><strong>Embedded &#8211; &#8216;Hello World&#8217;<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this lecture, let&#8217;s write a &#8216;Hello World&#8217; program for our embedded board based on the ARM Cortex M4 processor.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now we&#8217;ll start a new STM32 project. To create a new STM32 project, go to file, go to new, and click on STM32 project, as shown in Figure 1.&nbsp;<\/span><\/p>\n<figure id=\"attachment_9923\" aria-describedby=\"caption-attachment-9923\" style=\"width: 703px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-9923 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-1-3-1024x587.png\" alt=\"Figure 1. Creating a new STM32 Project\" width=\"703\" height=\"403\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-1024x587.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-300x172.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-768x440.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-600x344.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-120x69.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-500x287.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-200x115.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-400x229.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-800x459.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3-1200x688.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-3.png 1411w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><figcaption id=\"caption-attachment-9923\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Creating a new STM32 Project<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\"><span style=\"color: #000000;\">After that, select the STM32F4DISCOVERY option, and click on Next, as shown in Figure 2.<\/span>&nbsp;<\/span><\/p>\n<figure id=\"attachment_9924\" aria-describedby=\"caption-attachment-9924\" style=\"width: 701px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9924 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-2-3-1024x555.png\" alt=\"Figure 2. Target selection\" width=\"701\" height=\"380\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-1024x555.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-300x163.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-768x416.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-600x325.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-1536x832.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-500x271.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-200x108.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-400x217.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-800x434.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3-1200x650.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-2-3.png 1873w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><figcaption id=\"caption-attachment-9924\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Target selection<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now you have to give a name for your project. Let me give a 001HelloWorld. After that, the targeted language is &#8216;C,&#8217; the Targeted Binary type is Executable here, and the targeted project type is select Empty, and after click Finish, as shown in Figure 3.<\/span><\/p>\n<figure id=\"attachment_9925\" aria-describedby=\"caption-attachment-9925\" style=\"width: 703px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9925 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-3-2-1024x792.png\" alt=\"Figure 3. Project setup\" width=\"703\" height=\"544\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-1024x792.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-300x232.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-768x594.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-600x464.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-120x93.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-500x387.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-200x155.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-400x309.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2-800x618.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-2.png 1093w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><figcaption id=\"caption-attachment-9925\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Project setup<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">We just created an empty 001HelloWorld project, so it has added a couple of folders here\u2014the <\/span><b>Inc<\/b><span style=\"font-weight: 400;\"> folder or include folder, where we keep all our header files of our project. And the source(Src) folder so where we keep all our source codes that is <\/span><b>.c <\/b><span style=\"font-weight: 400;\">files. And here, we can see that the IDE has already added three files: main.c, syscalls.c, sysmem.c.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, the important thing here is the startup code for the microcontroller. So, before working with any microcontroller, it doesn&#8217;t matter whether it is from ST, or whether it is from TI, or prescale, or whatever it is. So, you should have a startup code for that microcontroller in your project. That is very very important, and so for this article, we are not going to explore the startup code because that would be too early to explore. But, in later sections, I have a plan to introduce writing startup files from scratch.<\/span><\/p>\n<figure id=\"attachment_9926\" aria-describedby=\"caption-attachment-9926\" style=\"width: 701px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9926 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-4-2-1024x545.png\" alt=\"Figure 4. 001 HelloWorld Project\" width=\"701\" height=\"373\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-1024x545.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-300x160.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-768x409.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-600x319.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-1536x817.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-120x64.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-500x266.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-400x213.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-800x426.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2-1200x639.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-2.png 1915w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><figcaption id=\"caption-attachment-9926\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. 001 HelloWorld Project<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, we&#8217;ll see that later when we understand more about the microcontroller and the Embedded &#8216;C&#8217; concept.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The main thing here that you should observe is that it has added the main source file where we will write our code for the microcontroller.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now, let&#8217;s write a program to print the &#8220;Hello World&#8221; message. For that, let&#8217;s use the standard library function <\/span><b>printf<\/b><span style=\"font-weight: 400;\">. Let me write <\/span><b>printf(&#8220;Hello World\\n&#8221;);<\/b><span style=\"font-weight: 400;\"> And since it is a standard library function, I write<\/span><b> #include&lt;stdio.h&gt;&nbsp;<\/b><\/span><\/p>\n<pre class=\"\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\"><span style=\"color: #008000;\">\/**<\/span>\r\n<span style=\"color: #008000;\">******************************************************************************<\/span>\r\n<span style=\"color: #008000;\">* @file main.c<\/span>\r\n<span style=\"color: #008000;\">* @author Auto-generated by STM32CubeIDE<\/span>\r\n<span style=\"color: #008000;\">* @version V1.0<\/span>\r\n<span style=\"color: #008000;\">* @brief Default main function.<\/span>\r\n<span style=\"color: #008000;\">******************************************************************************<\/span>\r\n<span style=\"color: #008000;\">*\/<\/span>\r\n\r\n<span style=\"color: #993366;\">#include<\/span><span style=\"color: #3366ff;\">&lt;stdio.h&gt;<\/span>\r\n<span style=\"color: #993366;\">int<\/span> main(<span style=\"color: #993366;\">void<\/span>)\r\n{\r\n<span style=\"color: #800080;\">printf<\/span>(\"<span style=\"color: #3366ff;\">Hello World\\n<\/span>\");\r\n\r\n<span style=\"color: #800080;\">for(;;);<\/span>\r\n}<\/pre>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now you may wonder how this printf would work because we don&#8217;t have any display or standard output device which is connected to our embedded board. So, we don&#8217;t have any monitor, or we don&#8217;t have an LCD, which is connected to our embedded board.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">How are we going to see the message output without a display device connected to our board?&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For that, there is one solution, and that solution comes from the ARM Cortex Processor itself. Let&#8217;s explore that.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; line-height: 32px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #003366;\"><strong>Using printf outputs on ARM Cortex M3\/M4\/M7 based MCUs<\/strong><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">This discussion is only applicable to MCUs based on ARM Cortex M3\/M4\/M7 or higher processors.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">printf works over the SWO pin(Serial Wire Output) of the SWD interface.&nbsp;<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Let&#8217;s explore more on this. First of all, this is your board(Figure 5). <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<figure id=\"attachment_9928\" aria-describedby=\"caption-attachment-9928\" style=\"width: 701px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9928 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-6-2-1024x399.png\" alt=\"Embedded\" width=\"701\" height=\"273\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-1024x399.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-300x117.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-768x299.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-600x234.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-1536x599.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-120x47.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-500x195.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-200x78.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-400x156.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-800x312.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2-1200x468.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png 1845w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><figcaption id=\"caption-attachment-9928\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. STM32F4 DISC Board<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You have a board, which is the STM32F4 Discovery board or Nucleo board. And your board has a microcontroller. The microcontroller is STM32F407VG. This is a microcontroller which is produced by ST microelectronics. That microcontroller has a processor inside, which is ARM Cortex M4 Processor.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now our board also has one more circuitry, which is at the front end of the board and that we call ST link V2 or V1 DEBUG circuitry. That is an ST link onboard debug circuitry. So, by using that debug circuitry, your PC communicates with the board. Through that debug circuitry, you actually write your program to the internal flash of the microcontroller, you read various memory locations of the microcontroller, you make processor run, you make processor stop, so all those debug related activities you do by taking help of this to debug circuitry, which is present on the board. Debug circuitry will talk to your PC over a USB connection.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There is a pin called SWO pin, which is coming from the ARM Cortex M4 processor and it is connected to the debug circuitry. So, the printf works over this SWO pin. Let&#8217;s explore further.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For that, I&#8217;m going to zoom the ARM Cortex M4 processor. Let&#8217;s consider only the ARM Cortex M4 processor(Figure 6).<\/span><\/p>\n<figure id=\"attachment_9929\" aria-describedby=\"caption-attachment-9929\" style=\"width: 703px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9929 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-7-2-1024x531.png\" alt=\"Embedded\" width=\"703\" height=\"365\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-1024x531.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-300x156.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-768x398.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-600x311.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-1536x796.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-500x259.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-200x104.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-400x207.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-800x415.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2-1200x622.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-2.png 1769w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><figcaption id=\"caption-attachment-9929\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. ARM Cortex M4 Processor<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Inside the ARM Cortex M4 processor, there is a unit or a peripheral called the <\/span><b>ITM unit<\/b><span style=\"font-weight: 400;\">.&nbsp; ITM stands for Instrumentation Trace Macrocell Unit. So, this is inside the processor. The ITM is an optional application-driven trace source that supports printf style debugging to trace operating system and application events, and generates diagnostic system information.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This unit is only available in ARM Cortex M3 or above processors. So, it is not available in the ARM Cortex M0 processor. And to debug the processor, debug means if you want to read the memory location, if you want to read the processor-related register, if you want to make the processor halt, or if you want it to run. So, if you want to do all these activities, then we do that using the debug interface. The debug interface that we are using here is SWD. SWD stands for Serial Wire Debug, which is a two-wire protocol for accessing the ARM debug interface. SWD works over the SWD connector, and that SWD connector has three pins. Two pins are used for debugging, and one pin is used for tracing. Trace means to get the trace related information from the processor.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 35px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #003366;\"><b>SWD<\/b><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Serial Wire Debug(SWD)is a two-wire protocol for accessing the ARM debug interface.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">It is part of the ARM Debug Interface Specification v5 and is an alternative to JTAG.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The physical layer of SWD consists of only two lines.&nbsp;<\/span>\n<ul class=\"\" style=\"border-width: 0px;\">\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">SWDIO: a bidirectional data line, which carries debug related data.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400; color: #000000;\">SWCLK: a clock driven by the host.<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">By using SWD interface should be able to program MCUs internal flash, you can access memory regions, add breakpoints, stop or run the CPU.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The other good thing about SWD is you can use the serial wire viewer for your printf statements for debugging.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">As I said, SWD comes with only two pins used for debugging, but there is one optional pin that we call SWO, which we can use for printf functionality.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 35px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #003366;\"><b>SWD and JTAG<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There is also another debug interface which is called JTAG. JTAG and SWD&#8217;s difference is that JTAG needs more pins than SWD.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">JTAG was the traditional mechanism for debug connections for ARM7 or ARM9 family, but with the Cortex-M family, ARM introduced the Serial Wire Debug interface. SWD is designed to reduce the pin count required for debug from the 4 used by JTAG(excluding GND) down to 2. In addition, SWD interface provides one more pin called SWO which is used for Single Wire Viewing(SWV), which is a low cost tracing technology.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s move forward. If I zoom this ITM unit further, you see a FIFO, or you can call it a buffer or a register. It&#8217;s a hardware buffer that is there inside the ITM unit.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now all you need to do is write the printf data into this FIFO. So, that FIFO is connected to the SWO pin, which is coming out of the processor, and it is coming all the way to your debug circuitry, which is present on the board.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The moment your printf writes into this FIFO, that messages will come over the SWO pin, and you then capture it. So, there is a provision to capture this SWO pin in the IDE.<\/span><\/p>\n<figure id=\"attachment_9930\" aria-describedby=\"caption-attachment-9930\" style=\"width: 702px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9930 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-8-2-1024x629.png\" alt=\"Embedded\" width=\"702\" height=\"431\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-1024x629.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-300x184.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-768x472.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-600x369.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-1536x944.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-120x74.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-500x307.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-200x123.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-400x246.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-800x492.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2-1200x738.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-2.png 1562w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><figcaption id=\"caption-attachment-9930\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. ITM unit<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Remember that not all IDE support this feature of capturing SWO pin. But fortunately, STM32Cube IDE and true studio, so those IDEs actually support these functionalities. SWO pin is connected to the ST link circuitry of the board and can be captured using our debug software.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is the idea behind how printf works in the ARM Cortex MX processor. So, there is an ITM unit, and it has a FIFO, and your printf somehow should write into that FIFO, and that FIFO is connected to the SWO pin, and through that you get that message back to the IDE.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now in our application, you have to do some settings or add some code to make your printf writes into that ITMs FIFO. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For that, you have to add a small code snippet. In the syscalls.c, the implementation of printf like feature using ARM Cortex M3\/M4\/M7 ITM functionality. This function will not work for ARM M0\/M0+. If you are using Cortex M0, then you can use the semihosting feature of openOCD. <\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And this is a code that we added and which actually writes into that FIFO.<\/span><\/p>\n<pre class=\"\" style=\"font-size: 12px;\"><span style=\"color: #008000;\">\/* Includes *\/<\/span>\r\n<span style=\"color: #993366;\">#include<\/span> &lt;sys\/stat.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;stdlib.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;errno.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;stdio.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;signal.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;time.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;sys\/time.h&gt;\r\n<span style=\"color: #993366;\">#include<\/span> &lt;sys\/times.h&gt;\r\n\r\n\r\n<span style=\"color: #008000;\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n<span style=\"color: #008000;\">\/\/ Implementation of printf like feature using ARM Cortex M3\/M4\/M7 ITM functionality<\/span>\r\n<span style=\"color: #008000;\">\/\/ This function will not work for ARM Cortex M0\/M0+<\/span>\r\n<span style=\"color: #008000;\">\/\/ If you are using Cortex M0, then you can use semihosting feature of openOCD<\/span>\r\n<span style=\"color: #008000;\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n\r\n\r\n<span style=\"color: #008000;\">\/\/Debug Exception and Monitor Control Register base address<\/span>\r\n<span style=\"color: #800000;\">#define<\/span> DEMCR *((volatile uint32_t*) 0xE000EDFCU )\r\n\r\n<span style=\"color: #339966;\">\/* ITM register addresses *\/<\/span>\r\n<span style=\"color: #800000;\">#define<\/span> ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 )\r\n<span style=\"color: #800000;\">#define<\/span> ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 )\r\n\r\nvoid ITM_SendChar(uint8_t ch)\r\n{\r\n\r\n<span style=\"color: #339966;\">\/\/Enable TRCENA<\/span>\r\nDEMCR |= ( 1 &lt;&lt; 24);\r\n\r\n<span style=\"color: #339966;\">\/\/enable stimulus port 0<\/span>\r\nITM_TRACE_EN |= ( 1 &lt;&lt; 0);\r\n\r\n<span style=\"color: #339966;\">\/\/ read FIFO status in bit [0]:<\/span>\r\nwhile(!(ITM_STIMULUS_PORT0 &amp; 1));\r\n\r\n<span style=\"color: #339966;\">\/\/Write to ITM stimulus port0<\/span>\r\nITM_STIMULUS_PORT0 = ch;\r\n}\r\n\r\n<span style=\"color: #339966;\">\/* Variables *\/<\/span>\r\n<span style=\"color: #339966;\">\/\/#undef errno<\/span>\r\nextern int errno;\r\nextern int __io_putchar(int ch) __attribute__((weak));\r\nextern int __io_getchar(void) __attribute__((weak));\r\n\r\nregister char * stack_ptr asm(\"sp\");\r\n\r\nchar *__env[1] = { 0 };\r\nchar **environ = __env;\r\n\r\n\r\n<span style=\"color: #339966;\">\/* Functions *\/<\/span>\r\nvoid initialise_monitor_handles()\r\n{\r\n}\r\n\r\nint _getpid(void)\r\n{\r\nreturn 1;\r\n}\r\n\r\nint _kill(int pid, int sig)\r\n{\r\nerrno = EINVAL;\r\nreturn -1;\r\n}\r\n\r\nvoid _exit (int status)\r\n{\r\n_kill(status, -1);\r\nwhile (1) {} \/* Make sure we hang here *\/\r\n}\r\n\r\n__attribute__((weak)) int _read(int file, char *ptr, int len)\r\n{\r\nint DataIdx;\r\n\r\nfor (DataIdx = 0; DataIdx &lt; len; DataIdx++)\r\n{\r\n*ptr++ = __io_getchar();\r\n}\r\n\r\nreturn len;\r\n}\r\n\r\n__attribute__((weak)) int _write(int file, char *ptr, int len)\r\n{\r\nint DataIdx;\r\n\r\nfor (DataIdx = 0; DataIdx &lt; len; DataIdx++)\r\n{\r\n<span style=\"color: #339966;\">\/\/__io_putchar(*ptr++);<\/span>\r\nITM_SendChar(*ptr++);\r\n}\r\nreturn len;\r\n}\r\n\r\nint _close(int file)\r\n{\r\nreturn -1;\r\n}\r\n\r\n\r\nint _fstat(int file, struct stat *st)\r\n{\r\nst-&gt;st_mode = S_IFCHR;\r\nreturn 0;\r\n}\r\n\r\nint _isatty(int file)\r\n{\r\nreturn 1;\r\n}\r\n\r\nint _lseek(int file, int ptr, int dir)\r\n{\r\nreturn 0;\r\n}\r\n\r\nint _open(char *path, int flags, ...)\r\n{\r\n\/* Pretend like we always fail *\/\r\nreturn -1;\r\n}\r\n\r\nint _wait(int *status)\r\n{\r\nerrno = ECHILD;\r\nreturn -1;\r\n}\r\n\r\nint _unlink(char *name)\r\n{\r\nerrno = ENOENT;\r\nreturn -1;\r\n}\r\n\r\nint _times(struct tms *buf)\r\n{\r\nreturn -1;\r\n}\r\n\r\nint _stat(char *file, struct stat *st)\r\n{\r\nst-&gt;st_mode = S_IFCHR;\r\nreturn 0;\r\n}\r\n\r\nint _link(char *old, char *new)\r\n{\r\nerrno = EMLINK;\r\nreturn -1;\r\n}\r\n\r\nint _fork(void)\r\n{\r\nerrno = EAGAIN;\r\nreturn -1;\r\n}\r\n\r\nint _execve(char *name, char **argv, char **env)\r\n{\r\nerrno = ENOMEM;\r\nreturn -1;\r\n}\r\n\r\n<\/pre>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">So, in the syscalls.c you should identify a function called write. In the write function, you have to comment out this line <\/span><b>_io_putchar(*ptr++)<\/b><span style=\"font-weight: 400;\">, so instead of that, call this function <\/span><b>ITM_SendChar<\/b><span style=\"font-weight: 400;\"> and give the argument<\/span><b> *ptr++, <\/b><span style=\"font-weight: 400;\">as shown below.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, instead of calling this, you are just calling our ITM message sending function. That&#8217;s all you have to do.<\/span><\/p>\n<pre class=\"\" style=\"font-size: 12px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #993366;\">__attribute__<\/span>((weak)) <span style=\"color: #993366;\">int<\/span> _write(<span style=\"color: #993366;\">int<\/span> file, <span style=\"color: #993366;\">char<\/span> *ptr, <span style=\"color: #993366;\">int<\/span> len) \r\n\r\n{ \r\n\r\n<span style=\"color: #993366;\">int<\/span> DataIdx; \r\n\r\n<span style=\"color: #993366;\">for<\/span> (DataIdx = 0; DataIdx &lt; len; DataIdx++) \r\n\r\n{ \r\n\r\n<strong><span style=\"color: #339966;\">\/\/__io_putchar(*ptr++);<\/span> <\/strong>\r\n\r\n<strong>ITM_SendChar(*ptr++);<\/strong> \r\n\r\n} \r\nreturn len;\r\n}<\/pre>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, you are ready to test this application.<\/span><\/p>\n<figure id=\"attachment_9935\" aria-describedby=\"caption-attachment-9935\" style=\"width: 704px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9935 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-11-1-1024x529.png\" alt=\"Embedded\" width=\"704\" height=\"364\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-1024x529.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-300x155.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-768x396.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-600x310.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-1536x793.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-500x258.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-200x103.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-400x206.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-800x413.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1-1200x619.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-11-1.png 1757w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><figcaption id=\"caption-attachment-9935\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Printf implementation in std. library<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">So, what&#8217;s happening here is, when you call a printf function which is a standard library function. So, the printf function is implemented in the &#8216;C&#8217; standard library. The printf implementation then calls a lower-level function called write. That write is actually implemented in syscalls.c. And in that write, we call our API <\/span><b>ITM_SendChar<\/b><span style=\"font-weight: 400;\"> to populate the ITMs FIFO. And that&#8217;s how we actually divert the printf to the ITM unit, and then we get the trace through the SWO pin.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Suppose you have an LCD, you can call LCD_SendChar here. If you have UART, then you can call UART_SendChar here. After that, to test this application, you have first to compile it, So that is what we call cross-compilation.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 25px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span><span style=\"color: #0000ff;\">&nbsp;<\/span><\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Embedded &#8211; &#8216;Hello World&#8217; &nbsp; &nbsp; In this lecture, let&#8217;s write a &#8216;Hello World&#8217; program for our embedded board based on the ARM Cortex M4 processor. Now we&#8217;ll start a new STM32 project. To create a new STM32 project, go to file, go to new, and click on STM32 project, as shown in Figure [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9928,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[16],"class_list":["post-9920","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-microcontroller-embedded-c-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Embedded - &#039;Hello World&#039; Program | Fastbit EBA<\/title>\n<meta name=\"description\" content=\"Embedded - &#039;Hello World&#039; program in C. Write a &#039;Hello World&#039; program for our embedded board based on the ARM Cortex M4 processor. SWD\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Embedded - &#039;Hello World&#039; Program | Fastbit EBA\" \/>\n<meta property=\"og:description\" content=\"Embedded - &#039;Hello World&#039; program in C. Write a &#039;Hello World&#039; program for our embedded board based on the ARM Cortex M4 processor. SWD\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-20T09:45:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-04T04:06:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1845\" \/>\n\t<meta property=\"og:image:height\" content=\"719\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 48 | Embedded &#8211; &#8216;Hello World&#8217;\",\"datePublished\":\"2022-06-20T09:45:22+00:00\",\"dateModified\":\"2023-08-04T04:06:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/\"},\"wordCount\":1818,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-6-2.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/\",\"name\":\"Embedded - 'Hello World' Program | Fastbit EBA\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-6-2.png\",\"datePublished\":\"2022-06-20T09:45:22+00:00\",\"dateModified\":\"2023-08-04T04:06:00+00:00\",\"description\":\"Embedded - 'Hello World' program in C. Write a 'Hello World' program for our embedded board based on the ARM Cortex M4 processor. SWD\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-6-2.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-6-2.png\",\"width\":1845,\"height\":719,\"caption\":\"Figure 6. STM32F4 DISC Board\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 48 | Embedded &#8211; &#8216;Hello World&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Embedded - 'Hello World' Program | Fastbit EBA","description":"Embedded - 'Hello World' program in C. Write a 'Hello World' program for our embedded board based on the ARM Cortex M4 processor. SWD","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/","og_locale":"en_US","og_type":"article","og_title":"Embedded - 'Hello World' Program | Fastbit EBA","og_description":"Embedded - 'Hello World' program in C. Write a 'Hello World' program for our embedded board based on the ARM Cortex M4 processor. SWD","og_url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-06-20T09:45:22+00:00","article_modified_time":"2023-08-04T04:06:00+00:00","og_image":[{"width":1845,"height":719,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 48 | Embedded &#8211; &#8216;Hello World&#8217;","datePublished":"2022-06-20T09:45:22+00:00","dateModified":"2023-08-04T04:06:00+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/"},"wordCount":1818,"commentCount":9,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/","url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/","name":"Embedded - 'Hello World' Program | Fastbit EBA","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png","datePublished":"2022-06-20T09:45:22+00:00","dateModified":"2023-08-04T04:06:00+00:00","description":"Embedded - 'Hello World' program in C. Write a 'Hello World' program for our embedded board based on the ARM Cortex M4 processor. SWD","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-2.png","width":1845,"height":719,"caption":"Figure 6. STM32F4 DISC Board"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-48-embedded-hello-world\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 48 | Embedded &#8211; &#8216;Hello World&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=9920"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9920\/revisions"}],"predecessor-version":[{"id":10802,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9920\/revisions\/10802"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/9928"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=9920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=9920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=9920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}