Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .include "asm_registers.i"
- .section .text
- .global rcc_config
- .global led_config
- .global delay_ms
- .global led_toggle
- .global pseudo_main
- .syntax unified
- .cpu cortex-m3
- .fpu softvfp
- .thumb
- .align
- rcc_config:
- LDR R0, =RCC_BASE
- LDR R1, [R0, #RCC_APB2ENR]
- LDR R2, =(1<<3)
- ORR R1, R1, R2
- STR R1, [R0, #RCC_APB2ENR]
- BX LR
- led_config:
- LDR R0, =GPIOB_BASE
- LDR R1, [R0, #GPIO_CRH]
- LDR R2, =~(3<<16)
- AND R1, R1, R2
- LDR R2, =(3<<16)
- ORR R1, R1, R2
- STR R1, [R0, #GPIO_CRH]
- BX LR
- delay_ms:
- CMP R0, #0
- BEQ end
- SUBS R0, #1
- MOV.W R1, #1000
- loop:
- SUBS R1, #1
- CMP R1, #0
- NOP
- NOP
- NOP
- BNE loop
- B delay_ms
- end:
- BX LR
- led_toggle:
- LDR R0, =GPIOB_BASE
- LDR R1, [R0, #GPIO_ODR]
- EOR R1, #(1<<12)
- STR R1, [R0, #GPIO_ODR]
- BX LR
- pseudo_main:
- BL rcc_config
- BL led_config
- while_loop:
- BL led_toggle
- MOV.W R0, #1000
- BL delay_ms
- B while_loop
- BX LR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement