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.
Previous article:"Cortex-M0 Definitive Guide" - Getting Started with Cortex-M0 Programming
Next article:"Cortex-M0 Authoritative Guide" Architecture --- Nested Interrupt Controller (NVIC)
- Popular Resources
- Popular amplifiers
- Detailed explanation of big data technology system: principles, architecture and practice (Dong Xicheng)
- Multi-port and shared memory architecture for high-performance ADAS SoCs
- Machine Learning: Architecture in the Age of Artificial Intelligence
- Research and design of electric vehicle drive motor ECU control software based on AUTOSAR
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Thank you + thank you EEWORLD community
- Medical electronics popular data download collection
- GaN Power Devices
- PIN diodes for RF circuits explained in detail
- During the fight against the epidemic, we will teach you how to have instruments in your mind without having any in your hands.
- Migrating between TMS320F28004x and TMS320F28002x
- 5G high-frequency board material selection and multi-layer board design requirements
- EETALK: What changes has the epidemic brought about in technology?
- "Playing with the board" + Yu Zhennan's STM32 development board experiment 4
- MSP430F169 MCU DAC12