{"id":434,"date":"2023-06-28T12:36:31","date_gmt":"2023-06-28T12:36:31","guid":{"rendered":"http:\/\/localhost\/embeddedwala\/?p=434"},"modified":"2023-07-27T04:12:45","modified_gmt":"2023-07-27T04:12:45","slug":"boot-sequence-of-arm-based-mcu","status":"publish","type":"post","link":"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/","title":{"rendered":"Boot Sequence Of ARM Based MCU"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"434\" class=\"elementor elementor-434\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-top-section elementor-element elementor-element-f2f3aa0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f2f3aa0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-85762c5\" data-id=\"85762c5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-inner-section elementor-element elementor-element-a23de4c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a23de4c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-ba5d572\" data-id=\"ba5d572\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3d2ab1d elementor-widget elementor-widget-text-editor\" data-id=\"3d2ab1d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2 id=\"Introduction\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span><strong>Introduction<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p><strong>Boot Sequence<\/strong>\u00a0is a process that brings life into a\u00a0<strong>Microcontroller unit (MCU)<\/strong>, It also plays a vital role in bringing the software and hardware up and running.<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_51_1 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor: pointer\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\" role=\"button\"><label for=\"item-69e1cb1c62409\" ><span class=\"\"><span style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #337ab7;color:#337ab7\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #337ab7;color:#337ab7\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input aria-label=\"Toggle\" aria-label=\"item-69e1cb1c62409\"  type=\"checkbox\" id=\"item-69e1cb1c62409\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/#Introduction\" title=\"Introduction\">Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/#1-POR\" title=\"1. POR\">1. POR<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/#2-Memory-Aliasing-Remapping-and-Architecture\" title=\"2. Memory Aliasing (Remapping) and Architecture\">2. Memory Aliasing (Remapping) and Architecture<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/#3-Firmware-Booting\" title=\"3. Firmware Booting\">3. Firmware Booting<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/boot-sequence-of-arm-based-mcu\/#4-Reset-Handler\" title=\"4. Reset Handler\">4. Reset Handler<\/a><\/li><\/ul><\/nav><\/div>\n<p>The boot process can have different firmware stages and hardware configurations depending on the hardware and firmware architecture. As the hardware configurations are limited, we can define a standard template to get the depth of the boot process.<\/p><p><strong>\u2022 The boot sequence can be divided into four parts:<\/strong><\/p><ol><li><ol><li>Power on Reset\u00a0<strong>(Hardware Process)<\/strong><\/li><li>Memory Aliasing (Remapping) and Architecture\u00a0<strong>(Hardware Process)<\/strong><\/li><li>Firmware Booting\u00a0<strong>(Hardware and Firmware Process)<\/strong><\/li><li>Reset_Handler() execution, for bringing up firmware\u00a0<strong>(Firmware Process)<\/strong><\/li><\/ol><\/li><\/ol><h2 id=\"POR\"><span class=\"ez-toc-section\" id=\"1-POR\"><\/span><strong>1. POR<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p>The Boot Process begins with the\u00a0<strong>Power On Reset (POR)<\/strong>. When an MCU is first powered up, it has to run predefined checks in the hardware to bring the MCU up, only when all the voltage and clock conditions are proper for operation. Until then this hardware circuitry holds the processor in the reset. This process is called the Power On Reset (POR).<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-437 size-full\" src=\"https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/CPU-blog-image.jpg\" alt=\"\" width=\"750\" height=\"750\" \/><\/p><h2 id=\"MemoryAliasing\"><span class=\"ez-toc-section\" id=\"2-Memory-Aliasing-Remapping-and-Architecture\"><\/span><strong>2. Memory Aliasing (Remapping) and Architecture<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p>After the POR Stage MCU comes out of the reset state. The processor starts pointing from the\u00a0<strong>0x0000_0000<\/strong>\u00a0address. This zero address can also be remapped to any other address in the address space with the help of\u00a0<strong>Remapper<\/strong>\u00a0hardware. With the remapping hardware, The processor still looks for\u00a0<strong>0x0000_0000<\/strong>\u00a0but now the Remapper hardware window changes the address to a new remap address. This results in booting\/execution from different address spaces or different applications. This is also called\u00a0<strong>Memory Aliasing<\/strong>.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-439 size-full\" src=\"https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Memory-Aliasing-blog-image.gif\" alt=\"\" width=\"1440\" height=\"810\" \/><\/p><p>Target application or the firmware needs the address-specific settings in the linker file configuration e.g.\u00a0<strong>FLASH<\/strong>\u00a0start address. Flash address configuration of the linker binds the functions (of an application) binary with the linker file configured address. Each function in a C Language has an address and when the function is called\/executed the Program Count jumps to that specific address to execute the function. So it is required for compiled application code\u00a0<strong>(.obj)<\/strong>\u00a0to be linked with a specific target address, or memory aliased (Remapped) address.<br \/>This boot setting for\u00a0<strong>Remapper<\/strong>\u00a0hardware is typically configured from the Boot Mode selection pin of the MCU. Processor internal circuitry reads this boot mode pin configuration to set the Remapper address as per the selected configuration. Only after this stage processor starts fetching instructions and data from the correct targeted memory address.<\/p><h2 id=\"FirmwareBooting\"><span class=\"ez-toc-section\" id=\"3-Firmware-Booting\"><\/span><strong>3. Firmware Booting<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p>After the\u00a0<strong>Memory Alias<\/strong>\u00a0stage, where the processor takes the boot mode selection pin configuration and is ready to fetch the instruction from the target address, firmware booting starts.<\/p><p>Firmware boot starts with the fetch of a WORD (32 Bit Memory Addr) to the\u00a0<strong>Program counter (PC)<\/strong>. The program counter (PC) is loaded with the address 0x0000_0000 value. As PC points to the next address for the execution, the\u00a0<strong>0x0000_0000<\/strong>\u00a0address is loaded to the\u00a0<strong>Main Stack Pointer (MSP)<\/strong>. This is done in the hardware circuitry. PC after\u00a0<strong>0x0000_0000<\/strong>\u00a0points to the next instruction which is\u00a0<strong>0x0000_0004<\/strong>. The memory map of the ARM based MCU has\u00a0<strong>0x0000_0000<\/strong>\u00a0as the address to the top of the stack and\u00a0<strong>0x0000_0004<\/strong>\u00a0as the Reset Handler. This initial memory map, is part of the Memory segment that is called\u00a0<strong>Vector Table<\/strong>.<br \/>Also in the ARM based MCU, the Initial top of the stack is loaded before the first function (Reset Handler) of the application, allowing the\u00a0<strong>Reset Handler<\/strong>\u00a0to be written completely in C. As C code needs stack to run.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-438 size-full\" src=\"https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/code-memory.gif\" alt=\"\" width=\"1440\" height=\"810\" \/><\/p><h2 id=\"ResetHandler\"><span class=\"ez-toc-section\" id=\"4-Reset-Handler\"><\/span><strong>4. Reset Handler<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><p>Reset Handler in ARM based MCU is considered as an entry point of the firmware. This value of the reset handler in the vector table is basically a pointer to the actual function.<\/p><ul><li><strong>\u00a0Reset Handler Does Below Things :<\/strong><ul><li>\u00a0Initializes the stacks and\u00a0<strong>CPU<\/strong>\u00a0Registers<\/li><li>\u00a0Copies the Memory Data segments from the FLASH to the RAM and fills the\u00a0<strong>BSS<\/strong>\u00a0Segment variables with 0&#8217;s<\/li><li>\u00a0Initializes the Peripherals with the default states<\/li><li>\u00a0Initializes the\u00a0<strong>MMU<\/strong>\u00a0(If Available)<\/li><li>\u00a0Jump to the main function<\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Introduction Boot Sequence\u00a0is a process that brings life into a\u00a0Microcontroller unit (MCU), It also plays&#8230;<\/p>\n","protected":false},"author":1,"featured_media":435,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[110,109,111],"class_list":["post-434","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-digital-communication","tag-arm-cortex-m","tag-bootsequence","tag-processor"],"acf":[],"views":537,"featured_image_urls":{"full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"thumbnail":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",150,101,false],"medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",300,202,false],"medium_large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"1536x1536":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"2048x2048":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"tp-image-grid":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"covernews-slider-full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"covernews-slider-center":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"covernews-featured":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",520,350,false],"covernews-medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",505,340,false],"covernews-medium-square":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",371,250,false],"_nx_notification_thumb":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/Boot-Sequence-Of-ARM-Based-MCU-banner.png",100,67,false]},"author_info":{"display_name":"embeddedwala","author_link":"https:\/\/embeddedwala.com\/beta\/author\/embeddedwala\/"},"category_info":"<a href=\"https:\/\/embeddedwala.com\/beta\/category\/blogs\/digital-communication\/\" rel=\"category tag\">Digital Communication<\/a>","tag_info":"Digital Communication","comment_count":"0","_links":{"self":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":8,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":8857,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/434\/revisions\/8857"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media\/435"}],"wp:attachment":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}