Today, I learned the course of undefined instruction exception of jz2440 development board. After following teacher Wei Dongshan to write code, compile and burn, the program teacher could not run normally. After careful investigation, it was found that the byte was not aligned to 4 bytes. The start.S file in the previous program started as follows:
_start:
/* Disable watchdog */
ldr r0, =0x53000000
ldr r1, =0
str r1, [r0]
The instructions are aligned to 4 bytes from the beginning, so there is no problem running the program. But when the undefined instruction exception handling statement is added after the _start label, the code is as follows:
_start:
b reset
b do_and
do_and:
ldr sp, =0x34000000
stmdb sp!, {r0-r12, lr}
mrs r0, cpsr
ldr r1, =and_string
bl printException
ldmia sp!, {r0-r12, pc}^
and_string:
.string "underdefined instruction exception"
.align 4
reset:
/* Disable watchdog */
ldr r0, =0x53000000
ldr r1, =0
str r1, [r0]
If you do not add the .align 4 statement before the reset label, the address of the compiled reset segment code will be 0x300000043, which is not 4-byte aligned, so the program cannot jump and execute normally after startup.
Previous article:Exception handling in Arm64
Next article:Analysis of ARM's exception handling process (exception vector/working mode)
Recommended ReadingLatest update time:2024-11-23 08:34
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Some information on Hall sensor applications
- 【Chuanglong TL570x-EVM】Review 02 - LCD driver circuit analysis
- Measuring the reluctance problem
- Electromagnetic compatibility design of flyback power factor correction circuit
- Analog circuit behavior model and simulation based on Verilog-A_.pdf
- DCDC point circuit
- Sublibrary: X-NUCLEO IKS01A3 Motion and Environmental Sensor Development Platform
- EEWORLD University Hall----Principles of Operating Systems Huazhong University of Science and Technology (Su Shuguang)
- Accurate to each component, in-depth understanding of the power circuit
- [Suzhou/Shanghai Zhangjiang] Wifi6 chip start-up company