Sei sulla pagina 1di 56

Cortex-M4

Dariusz Chaberski
STM32 Cortex-M4 implementation
2
Processor core registers
3
APSR, IPSR, EPSR and PSR bit assignments
ICI - Interruptible-continuable instructions (LDM, STM, PUSH, POP, VLDM, VSTM, VPUSH, VPOP)
IT - If-Then block
4
Load and Store Multiple instructions
5
Condition Flags - Example
6
Memory map
7
Bit-band mapping
8
Exception model
9
Vector table
10
Cortex-M4 stack frame layout
11
Condition code suxes
12
Condition code suxes - continued
13
Instruction width selection
14
Basic structure of a ve-volt tolerant I/O port bit
15
Port bit conguration table
GP = general-purpose, PP = push-pull, PU = pull-up, PD = pull-down, OD = open-drain, AF =
alternate function
16
Port bit conguration table
17
DMA block diagram
18
Channel selection
19
EXTI block diagram
20
Single ADC block diagram
21
Single ADC block diagram
22
Timing diagram
23
Data alignment of 12-bit data
24
Left alignment of 6-bit data
25
Multi ADC block diagram
26
Multi ADC block diagram
27
DAC channel block diagram
28
Noise generation
29
DAC conversion (SW trigger enabled) with triangle wave
generation
30
Digital camera interface
31
DCMI signal waveforms
32
Advanced-control timers (TIM1&TIM8)
33
Addressing Mode 1 - Data-processing operands
l <opcode>{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
#<immediate>
immed_8 == 0x3F, rotate_imm == 0xE
immed_8 == 0xFC, rotate_imm == 0xF
<Rm>
<Rm>, LSL #<shift_imm>
34
Addressing Mode 1 - Data-processing operands
l <opcode>{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
<Rm>, LSL <Rs>
<Rm>, LSR #<shift_imm>
<Rm>, LSR <Rs>
<Rm>, ASR #<shift_imm>
<Rm>, ASR <Rs>
<Rm>, ROR #<shift_imm>
<Rm>, ROR <Rs>
<Rm>, RRX
35
Addressing Mode 2 - Load and Store Word or Unsigned Byte
l LDR|STR{<cond>}{B}{T} <Rd>, <addressing_mode>
[<Rn>, #+/-<oset_12>]
[<Rn>, +/-<Rm>]
[<Rn>, +/-<Rm>, <shift> #<shift_imm>]
[<Rn>, +/-<Rm>, LSL #<shift_imm>]
[<Rn>, +/-<Rm>, LSR #<shift_imm>]
[<Rn>, +/-<Rm>, ASR #<shift_imm>]
[<Rn>, +/-<Rm>, ROR #<shift_imm>]
[<Rn>, +/-<Rm>, RRX]
36
Addressing Mode 2 - Load and Store Word or Unsigned Byte
l LDR|STR{<cond>}{B}{T} <Rd>, <addressing_mode>
[<Rn>, #+/-<oset_12>]!
[<Rn>, +/-<Rm>]!
[<Rn>, +/-<Rm>, <shift> #<shift_imm>]!
[<Rn>], #+/-<oset_12>
[<Rn>], +/-<Rm>
[<Rn>], +/-<Rm>, <shift> #<shift_imm>
37
Addressing Mode 3 - Miscellaneous Loads and Stores
l LDR|STR{<cond>}H|SH|SB|D <Rd>, <addressing_mode>
[<Rn>, #+/-<oset_8>]
[<Rn>, +/-<Rm>]
[<Rn>, #+/-<oset_8>]!
[<Rn>, +/-<Rm>]!
[<Rn>], #+/-<oset_8>
[<Rn>], +/-<Rm>
38
Addressing Mode 4 - Load and Store Multiple
l LDM|STM{<cond>}<addressing_mode> <Rn>{!}, <registers>{^}
IA (Increment After)
IB (Increment Before)
DA (Decrement After)
DB (Decrement Before)
39
Addressing Mode 5 - Load and Store Coprocessor
l <opcode>{<cond>}{L} <coproc>,<CRd>,<addressing_mode>
[<Rn>,#+/-<oset_8>*4]
[<Rn>,#+/-<oset_8>*4]!
[<Rn>],#+/-<oset_8>*4
[<Rn>],<option>
40
ARM Instructions
ADC{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
ADDS R4,R0,R2
ADCS R5,R1,R3
41
ARM Instructions
AND{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
42
ARM Instructions
B{L}{<cond>} <target_address>
43
ARM Instructions
BIC{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
44
ARM Instructions
BLX <target_addr>
45
ARM Instructions
BLX{<cond>} <Rm>
46
ARM Instructions
CDP{<cond>} <coproc>, <opcode_1>, <CRd>, <CRn>, <CRm>, <opcode_2>
CDP2 <coproc>, <opcode_1>, <CRd>, <CRn>, <CRm>, <opcode_2>
47
ARM Instructions
CLZ{<cond>} <Rd>, <Rm>
48
ARM Instructions
LDC{<cond>}{L} <coproc>, <CRd>, <addressing_mode>
LDC2{L} <coproc>, <CRd>, <addressing_mode>
49
ARM Instructions
MLA{<cond>}{S} <Rd>, <Rm>, <Rs>, <Rn>
50
ARM Instructions
QADD{<cond>} <Rd>, <Rm>, <Rn>
51
Thumb Instructions
ADC <Rd>, <Rm>
52
Thumb Instructions
Rd = Rn + immed_3
Rd = Rd + immed_8
Rd = Rn + Rm
53
Thumb Instructions
Rd = Rd + Rm
Rd = (PC AND 0xFFFFFFFC) + (immed_8 * 4)
54
Thumb Instructions
Rd = SP + (immed_8 < < 2)
SP = SP + (immed_7 < < 2)
55
Thumb Instructions
56

Potrebbero piacerti anche