没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
This programming manual provides information for application and system-level software developers. It gives a full description of the programming model, instruction set, and core peripherals of the Cortex®-M0+ processor used on the STM32L0 Series and STM32G0 Series MCUs
资源推荐
资源详情
资源评论



















October 2018 PM0223 Rev 4 1/110
1
PM0223
Programming manual
STM32L0 Series and STM32G0 Series Cortex
®
-M0+ programming
manual
Introduction
This programming manual provides information for application and system-level software
developers. It gives a full description of the programming model, instruction set, and core
peripherals of the Cortex
®
-M0+ processor used on the STM32L0 Series and STM32G0
Series MCUs.
Cortex
®
-M0+ is a high performance 32-bit processor designed for integration in
microcontrollers. It offers significant benefits to developers, including:
• Outstanding processing performance combined with fast interrupt handling
• Enhanced system debug with extensive breakpoint options
• Efficient processor core, system and memories
• Ultra-low power consumption with integrated sleep modes
• Platform security
www.st.com

Contents PM0223
2/110 PM0223 Rev 4
Contents
1 About this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1 Typographical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3 About the Cortex-M0+ processor and core peripherals . . . . . . . . . . . . . . . 9
1.3.1 System-level interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.2 Integrated configurable debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.3 Cortex-M0+ processor feature summary . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3.4 Cortex-M0+ core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 Cortex-M0+ processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1 Programmers model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.1 Processor modes and privilege levels for software execution . . . . . . . . 12
2.1.2 Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.3 Core registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.4 Exceptions and interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.5 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.6 The Cortex Microcontroller Software Interface Standard . . . . . . . . . . . . 19
2.2 Memory model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.1 Memory regions, types and attributes . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.2 Memory system ordering of memory accesses . . . . . . . . . . . . . . . . . . . 21
2.2.3 Behavior of memory accesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.4 Additional memory access constraints for caches and shared memory 23
2.2.5 Software ordering of memory accesses . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2.6 Memory endianness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.3 Exception model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.1 Exception states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.2 Exception types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.3 Exception handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.4 Vector table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3.5 Exception priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.3.6 Exception entry and return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.4 Fault handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4.1 Lockup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

PM0223 Rev 4 3/110
PM0223 Contents
5
2.5 Power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.5.1 Entering sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.5.2 Wakeup from sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.5.3 The external event input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5.4 Power management programming hints . . . . . . . . . . . . . . . . . . . . . . . . 35
3 Cortex-M0+ instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.1 Instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2 Intrinsic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3 About the instruction descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3.1 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3.2 Restrictions when using PC or SP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3.3 Shift operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3.4 Address alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.3.5 PC-relative expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.3.6 Conditional execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4 Memory access instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.4.1 ADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.4.2 LDR and STR, immediate offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.4.3 LDR and STR, register offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.4.4 LDR, PC-relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.4.5 LDM and STM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.4.6 PUSH and POP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.5 General data processing instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.5.1 ADC, ADD, RSB, SBC, and SUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.5.2 AND, ORR, EOR, and BIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.5.3 ASR, LSL, LSR, and ROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.5.4 CMP and CMN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.5.5 MOV and MVN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.5.6 MULS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.5.7 REV, REV16, and REVSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.5.8 SXT and UXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.5.9 TST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.6 Branch and control instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.6.1 B, BL, BX, and BLX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.7 Miscellaneous instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Contents PM0223
4/110 PM0223 Rev 4
3.7.1 BKPT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.7.2 CPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.7.3 DMB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.7.4 DSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
3.7.5 ISB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.7.6 MRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
3.7.7 MSR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3.7.8 NOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.7.9 SEV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.7.10 SVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3.7.11 WFE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.7.12 WFI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4 Cortex-M0+ core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.1 About the Cortex-M0+ core peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.2 Nested vectored interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.2.1 Accessing the Cortex-M0+ NVIC registers using CMSIS . . . . . . . . . . . 82
4.2.2 Interrupt Set-enable Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.2.3 Interrupt Clear-enable Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.2.4 Interrupt Set-pending Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.2.5 Interrupt Clear-pending Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.2.6 Interrupt Priority Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.2.7 Level-sensitive and pulse interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.2.8 NVIC usage hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.3 System Control Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.1 The CMSIS mapping of the Cortex-M0+ SCB registers . . . . . . . . . . . . 88
4.3.2 CPUID Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.3 Interrupt Control and State Register (ICSR) . . . . . . . . . . . . . . . . . . . . . 89
4.3.4 Vector Table Offset Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.3.5 Application Interrupt and Reset Control Register . . . . . . . . . . . . . . . . . 91
4.3.6 System Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.3.7 Configuration and Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.3.8 System Handler Priority Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.3.9 SCB usage hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.4 SysTick timer (STK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.4.1 SysTick Control and Status Register (STK_CSR) . . . . . . . . . . . . . . . . . 96
4.4.2 SysTick Reload Value Register (STK_RVR) . . . . . . . . . . . . . . . . . . . . . 96

PM0223 Rev 4 5/110
PM0223 Contents
5
4.4.3 SysTick Current Value Register (STK_CVR) . . . . . . . . . . . . . . . . . . . . . 97
4.4.4 SysTick Calibration Value Register (STK_CALIB) . . . . . . . . . . . . . . . . . 97
4.4.5 SysTick usage hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.5 Memory Protection Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.5.1 MPU Type Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.5.2 MPU Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.5.3 MPU Region Number Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.5.4 MPU Region Base Address Register . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.5.5 MPU Region Attribute and Size Register . . . . . . . . . . . . . . . . . . . . . . . 103
4.5.6 MPU access permission attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4.5.7 MPU mismatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.5.8 Updating an MPU region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.5.9 MPU design hints and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.6 I/O Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
剩余109页未读,继续阅读
资源评论



小僧景贤
- 粉丝: 6
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- EV3100电梯专用变频器源代码
- FLAC3D编程:应力边界施加的函数形式与处理案例分析 针对立方体模型的重力与一侧应力边界影响的应力分布研究 特色:灵活调整应力函数,简单快捷的调节方法 专业定制:地应力反演与走滑断层分析中的边界条件
- 多模态属性级情感分析技术解析:电商平台与社交媒体中的应用
- 多智能体移动与编队控制:快速到达指定目标点与编队
- 超螺旋滑模观测器优化PLL,精准测角
- 基于DSP28335的单相全桥逆变器程序:闭环电流控制与SPWM调制技术详解 详解
- 海上5MW永磁风电直驱系统仿真及并网研究——基于1200V风电技术与矢量控制算法,混合储能及滑动平均滤波算法应用
- 基于虚拟同步发电机(VSG)的分布式能源并网仿真及并网逆变器控制——实现有功频率控制、无功电压控制、VSG控制以及电压电流双环PI控制的完美波形模拟(MATLAB 2021b)
- 煤矿瓦斯气驱监控系统的Python实现与应用
- 边坡工程中C30混凝土群桩计算模拟及位移监测分析
- 开关磁阻电机SRM仿真案例教程与Maxwell模型 v4.0
- 基于MATLAB的DTW算法实现特定人孤立词语音识别系统
- 基于S7-1200 PLC的停车场控制系统仿真:电气原理与图形化操作界面实践
- 基于MATLAB的GA优化算法在车间调度中的应用:多工件多工序与机器的优化配置 高级版
- 基于Matlab的IMU四元数姿态解算:多传感器数据融合与数学建模
- 基于Matlab 2018的新能源电机控制器FOC仿真模型及MTPAMTPV弱磁控制实现
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
