cortex_m7 generic user guide handbook

2.1 programmers model 

2.1.1 processor mode and privilege levels for sw exec

as we all kown, cm7 has 2 modes: thread and handler.

reset -> thread --exception-->handler--finished-->thread

privileged can use all instruction and access all sources,but unprivileged not

handler alwawsy privileged and thread use CONTOL register to control level

2.2 stacks

thread use MSP or PSP by use CONTORL register, handler use MSP

2.1.3 core registers

R0-R12:general_purpose register

SP(R13):msp or psp 

LR(R14):link register,stores return information for subroutines,function calls,and exceptions

PC(R15):program counter ,contains the current program address

PSR:Program Status Register

2.1.4 Exceptions and interrupts

nvic and exception 

2.1.5 data types

instuction memory and private peripheral bus always little-endian

2.1.6 CMSIS

2.2 memory model

for STM32H7 code from 0x08000000 and for RT1052 code from 0x60000000

(external ram)address 

2.3 exception model

2.3.1 exception states

2.3.2 exception types

reset:-3

NMI:-2

HardFault:-1

memmanage :

busfault:

usagefault:

SVCall:

Pendsv:

Systick:

interrupt:

入栈:发生打断时,将会产生压栈动作如上,此时PC保存着程序返回的位置,

用于退出打断子程序后返回正常处理的app或者说线程函数位置,而LR中写入的是所谓的

“EXC_RETURN”value,从中我们可以看出打断子程序进入前的操作模式(线程或中断)

以及使用的栈帧(MSP还是PSP)。

2.4 faults handling

subset of exceptions:

bus error: instruction fetch or vector table load. data access

internally-detected error such as undfined instrcution

attempt to exec instruction from XN

MPU detect fault

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值