"Cortex-M0 Authoritative Guide" Architecture --- Program Image and Boot Process

Publisher:不见南师久Latest update time:2016-12-19 Source: eefocusKeywords:Cortex-M0 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Let's take a look at the program image first.

  

  Typically, the program image of the Cortex-M0 processor starts at address 0x00000000.

  The program image starts with a vector table, which contains the actual addresses (vectors) of the exceptions. The address of each interrupt vector is equal to "exception number*4". For example, the exception type of external IRQ0 is 16, so its vector address is 16*4=0x40. The lowest bit of these vectors is set to 1 to indicate the use of thumb instructions. The size of the vector table is determined by the number of interrupts actually used.

  The vector table contains the initial value of the MSP, which is stored in the first four bytes of the vector table.

  When reset, the processor first reads the first two words (8 bytes) of the vector table. The first word is the initial value of MSP, and the second word is the reset vector, which indicates the starting address of program execution.

  For example, if the startup code is located at address 0x000000C0, this address needs to be written at the reset vector, and the lowest bit of the address is set to 1 to indicate that it is currently thumb code. Therefore, the value at address 0x00000004 is 0x000000C1. After obtaining the reset vector value, the processor starts executing program code from this address.

  The reset process will also initialize the MSP. Assuming that the memory is located at 0x20000000~0x20007FFF, 0x20008000 can be written at address 0x00000000, thus placing the main stack pointer at the top of the memory.

  If you want to use the PSP, you must first initialize it through software code before configuring the CONTROL register to switch the stack pointer, because the reset process only initializes the MSP, not the PSP.

 


Keywords:Cortex-M0 Reference address:"Cortex-M0 Authoritative Guide" Architecture --- Program Image and Boot Process

Previous article:"Cortex-M0 Definitive Guide" - Getting Started with Cortex-M0 Programming
Next article:"Cortex-M0 Authoritative Guide" Architecture --- Nested Interrupt Controller (NVIC)

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号