http://www.zembedded.com/cortex-m3-registers-in-depth/

Thanks for the overwhelm response you show in our first tutorial on Cortex_M3 series controllers.

This is going to be the second tutorial, where we are going to discuss about the registers available

on Cortex-M3 series of microcontrollers.

If you are yet to go through the first tutorial then please click here to read it first.

I will repeat, for a deep knowledge to these registers please read the datasheet

or user manual provided by NXP or other manufacturer.

At the end of the tutorial I am providing the links for user manual for cortex-M3 controllers by NXP.

 A brief about Registers:

It has a register bank R0 to R15, where R0-R7 are called as low registers and R8-R15 are high registers.

R-13 is stack pointer (SP). This SP(stack pointer) is banked, with only one copy of the R-13 visible at a time.

Out of these 16 registers, R0 to R12 are 32-bit general purpose registers for data operations.

A few of Thumb instructions can only access a sub set of this general purpose registers (low registers R0-R-7). Let’s dig into it.

R0 through R7:

These R0 to R7 registers are also called as low registers.

These registers can access by both 16-bit Thumb instructions and 32-bit Thumb-2 instructions.

R8 through R12:

These registers are also called as High registers.

They are accessible by all Thumb-2instructions but not by all 16-bit Thumb instructions.

Stack Pointer R13:

This R13 is stack pointer (SP).

In Cortex-M3 there are two separate stack pointers.

This twostack pointers are allowed to set up two separate stack memories.

If you use the R13 name, in that case you can access only current SP.

The other one is inaccessible unless you use special instructions to move to special register

from general-purpose register (MSR) and move special register to general-purpose register (MRS).

Main Stack Pointer (MSP):

This is default stack pointer and this is used by OS kernel and exception handlers.

Process Stack Pointer (PSP):

Used by use application mode only.

This is used by the base-level application code (when not running an exception handler).

Link Register: R14 is Link Register.

When we call subroutine, the return address is stored in the link register.

Inside an assembly program, you can write it as either R14 or LR.

LR is used to store the return program counter (PC) when a subroutine or function is called.

Program Counter: R15 is program counter.

This stores the current program address.

You can access PC in assembler code by either R15 or PC.

Because of thepipelined natureof the Cortex-M3 processor, when you read this register,

you will find that thevalue is different than thelocation of the executing instruction.

Special Registers:

  • Program Status Registers (PSRs)
  • Interrupt Mask Registers(PRIMASK, FAULTMASK and BASEPRI)
  • Control Register(CONTROL)

 

Special Registers and their functions:

xPSR:

This register is to provide the arithmetic and logic processing flags (zero flag and carry flag),

execution status and current executing interrupt number.

PRIMANSK:

This can disable all the interrupts except nonmaskable interrupt (NMI) and hard fault.

FAULTMASK:

This register function is to disable all the interrupts except non maskable interrupt.

BASEPRI:

This register function is disabling all interrupts of specific priority level or lower priority level.

CONTROL:

It defines the privileged status and stack pointer selection.

CORTEX -M3 : Registers in depth的更多相关文章

  1. Implementation of Serial Wire JTAG flash programming in ARM Cortex M3 Processors

    Implementation of Serial Wire JTAG flash programming in ARM Cortex M3 Processors The goal of the pro ...

  2. ARM Cortex M3系列GPIO口介绍(工作方式探讨)

    一.Cortex M3的GPIO口特性    在介绍GPIO口功能前,有必要先说明一下M3的结构框图,这样能够更好理解总线结构和GPIO所处的位置. Cortex M3结构框图     从图中可以看出 ...

  3. ARM Cortex M3(V7-M架构)硬件启动程序 一

    Cortex-m3启动代码分析笔记 启动代码文件名是STM32F10X.S,它的作用先总结下,然后再分析. 启动代码作用一般是: 1)堆和栈的初始化: 2)中断向量表定义: 3)地址重映射及中断向量表 ...

  4. ARM 架构、ARM7、ARM9、STM32、Cortex M3 M4 、51、AVR 之间有什么区别和联系?(转载自知乎)

    ARM架构:  由英国ARM公司设计的一系列32位的RISC微处理器架构总称,现有ARMv1~ARMv8种类. ARM7:       一类采用ARMv3或ARMv4架构的,使用冯诺依曼结构的内核. ...

  5. STM32学习之路入门篇之指令集及cortex——m3的存储系统

    STM32学习之路入门篇之指令集及cortex——m3的存储系统 一.汇编语言基础 一).汇编语言:基本语法 1.汇编指令最典型的书写模式: 标号 操作码        操作数1, 操作数2,... ...

  6. 【ARM-Linux开发】ARM7 ARM9 ARM Cortex M3 M4 有什么区别

    ARM7 ARM9 ARM Cortex M3 M4 区别 arm7 arm9 可以类比386和奔腾, 不同代,arm9相比arm7指令集和性能都有所增强,arm7和arm9都有带mmu和无mmu的版 ...

  7. 【freertos】002-posix模拟器设计与cortex m3异常处理

    目录 前言 posix 标准接口层设计 模拟器的系统心跳 模拟器的task底层实质 模拟器的任务切换原理 cortex M3/M4异常处理 双堆栈指针 双操作模式 栈帧 EXC_RETURN 前言 如 ...

  8. ARM Cortex M3(V7-M架构)硬件启动程序 二

    解析 STM32 的启动过程 解析STM32的启动过程 当前的嵌入式应用程序开发过程里,并且C语言成为了绝大部分场合的最佳选择.如此一来main函数似乎成为了理所当然的起点——因为C程序往往从main ...

  9. stm32和cortex M3学习内核简单总结

    1.stm32综述 2.寄存器组 3.操作模式和特权级别 4.存储器映射 5.中断和异常 6.其他 Stm32综述 这可以说是我第一款认真学习的单片机了,学完这个就要开启我通往arm9的大门了,接下来 ...

随机推荐

  1. 自己的一个LESS工具函数库

    自己大概在一年前开始使用LESS编写样式,现在感觉不用LESS都不会写样式了.现在写静态页面完全离不开LESS与Zen Coding,我可以不用什么IDE,但这两个工具却必须要,当然也强烈推荐看到这篇 ...

  2. 锁之“重量级锁”Synchronized

    一.Synchronized的基本使用 Synchronized是Java中解决并发问题的一种最常用的方法,也是最简单的一种方法.Synchronized的作用主要有三个:(1)确保线程互斥的访问同步 ...

  3. Java 与无符号那些事儿

    最近在使用 Java 作为 WebSocket 客户端连接 Node.js 的 WebSocket 服务器的时候,由于使用的客户端库比较老,所以遇到了字节符号的问题,上网查了一下,看到这篇文章写的很有 ...

  4. mysql 用户名密码登陆不上

    问题1:刚安装完mysql,设置了用户名密码root,登陆OK的,后来再连怎么也连不上了 操作步骤: 输入:mysql -uroot -proot 提示:ERROR 1045 (28000): Acc ...

  5. Http中Cookie和Session介绍

    先介绍下B/S系统的工作的完整过程.首先客户端的浏览器发出请求,服务端的webserver接受到请求后,调用相关请求的页面进行处理,处理完后将结果发送给客户端的浏览器进行显示.只能是浏览器向webse ...

  6. OTG_FS_ID功能及引申

    1. 概要   OTG设备使用插头中的ID引脚来区分A/B Device,ID接地被称作为A-Device,充当USB Host,A-Device始终为总线   提供电力,ID悬空被称作为B-Devi ...

  7. ASP.NET 使用application和session对象写的简单聊天室程序

    ASP.Net中有两个重要的对象,一个是application对象,一个是session对象. Application:记录应用程序参数的对象,该对象用于共享应用程序级信息. Session:记录浏览 ...

  8. 九度 Online Judge 之《剑指 Offer》一书相关题目解答

    前段时间准备华为机试,正好之前看了一遍<剑指 Offer>,就在九度 Online Judge 上刷了书中的题目,使用的语言为 C++:只有3题没做,其他的都做了. 正如 Linus To ...

  9. jQuery对select标签的常用操作

    1.获取当前选中项的value. $("#selector").val(); 2.获取当前选中项的text. $("#selector").find(" ...

  10. html --- canvas --- javascript --- 绘图方法

    Canvas元素是HTML5的一部分,允许脚本语言动态渲染位图像. 如有疑问请访问链接:http://javascript.ruanyifeng.com/htmlapi/canvas.html < ...