class done

This commit is contained in:
Trevor Barnes
2019-11-24 23:51:24 -06:00
parent 454bed8831
commit ecd65b11b4
50 changed files with 9495 additions and 2088 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -27,11 +27,11 @@ Idx Name Size VMA LMA File off Algn
ALLOC
11 .ARM.attributes 00000030 00000000 00000000 00020024 2**0
CONTENTS, READONLY
12 .debug_line 00000477 00000000 00000000 00020054 2**0
12 .debug_line 00000475 00000000 00000000 00020054 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_info 00000106 00000000 00000000 000204cb 2**0
13 .debug_info 00000106 00000000 00000000 000204c9 2**0
CONTENTS, READONLY, DEBUGGING
14 .debug_abbrev 0000008a 00000000 00000000 000205d1 2**0
14 .debug_abbrev 0000008a 00000000 00000000 000205cf 2**0
CONTENTS, READONLY, DEBUGGING
15 .debug_aranges 000000e8 00000000 00000000 00020660 2**3
CONTENTS, READONLY, DEBUGGING
@@ -1517,9 +1517,9 @@ main:
bl piezoInit
80007e8: f7ff fd0c bl 8000204 <piezoInit>
080007ec <top>:
080007ec <mainLoop>:
top:
mainLoop:
mov r0, #200
80007ec: f04f 00c8 mov.w r0, #200 ; 0xc8
bl msDelay
@@ -1538,18 +1538,20 @@ top:
08000802 <firstchar>:
# Coded as '2' button
firstchar:
bl KeyGetKey
8000802: f7ff fdda bl 80003ba <KeyGetKey>
add r8, r8, #1
8000806: f108 0801 add.w r8, r8, #1
cmp r0, #2 //2
cmp r0, #char1
800080a: 2802 cmp r0, #2
beq correctchar
800080c: d01b beq.n 8000846 <correctchar>
0800080e <secondchar>:
# Coded as '8' button
secondchar:
ldr r0, =star
800080e: 483d ldr r0, [pc, #244] ; (8000904 <incorrect+0x36>)
@@ -1559,13 +1561,14 @@ secondchar:
8000814: f7ff fdd1 bl 80003ba <KeyGetKey>
add r8, r8, #1
8000818: f108 0801 add.w r8, r8, #1
cmp r0, #10 //'8'
cmp r0, #char2
800081c: 280a cmp r0, #10
beq correctchar
800081e: d012 beq.n 8000846 <correctchar>
08000820 <thirdchar>:
# Coded as '0' button
thirdchar:
ldr r0, =star
8000820: 4838 ldr r0, [pc, #224] ; (8000904 <incorrect+0x36>)
@@ -1575,13 +1578,14 @@ thirdchar:
8000826: f7ff fdc8 bl 80003ba <KeyGetKey>
add r8, r8, #1
800082a: f108 0801 add.w r8, r8, #1
cmp r0, #14 //'0'
cmp r0, #char3
800082e: 280e cmp r0, #14
beq correctchar
8000830: d009 beq.n 8000846 <correctchar>
08000832 <fourthchar>:
# Coded as '1' button
fourthchar:
ldr r0, =star
8000832: 4834 ldr r0, [pc, #208] ; (8000904 <incorrect+0x36>)
@@ -1591,7 +1595,7 @@ fourthchar:
8000838: f7ff fdbf bl 80003ba <KeyGetKey>
add r8, r8, #1
800083c: f108 0801 add.w r8, r8, #1
cmp r0, #1 //'1"
cmp r0, #char4
8000840: 2801 cmp r0, #1
beq correctchar
8000842: d000 beq.n 8000846 <correctchar>
@@ -1634,9 +1638,8 @@ determine:
8000868: e031 b.n 80008ce <incorrect>
0800086a <unlock>:
@ ldr r1, [r0, #BSRR]
@ orr r1, r1, r2
@ str r1, [r0, #BSRR]
unlock:
#Buzz buzzer
mov r0, 1000
@@ -1672,8 +1675,6 @@ scroll_right:
# Read current data
ldr r2, [r1, #GPIO_ODR]
8000892: 694a ldr r2, [r1, #20]
# Clear previous ON bit, default 0
@ bic r2, r4
# Write new data
orr r2, r2, r3
8000894: ea42 0203 orr.w r2, r2, r3
@@ -1725,8 +1726,8 @@ scroll_right:
bl piezoOff
80008c8: f7ff fcd6 bl 8000278 <piezoOff>
b top
80008cc: e78e b.n 80007ec <top>
b mainLoop
80008cc: e78e b.n 80007ec <mainLoop>
080008ce <incorrect>:
@@ -1764,8 +1765,8 @@ incorrect:
bl piezoOff
80008f8: f7ff fcbe bl 8000278 <piezoOff>
b top
80008fc: e776 b.n 80007ec <top>
b mainLoop
80008fc: e776 b.n 80007ec <mainLoop>
80008fe: 0000 .short 0x0000
ldr r0, =msg
8000900: 20000004 .word 0x20000004

View File

@@ -413,14 +413,14 @@ LOAD c:/st/stm32cubeide_1.1.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.exte
0x0000000000000189 0x22 c:/st/stm32cubeide_1.1.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v7e-m/fpv4-sp/hard/crtn.o
OUTPUT(lab6lock.elf elf32-littlearm)
.debug_line 0x0000000000000000 0x477
.debug_line 0x0000000000000000 0x475
.debug_line 0x0000000000000000 0x8e Src/buzzer.o
.debug_line 0x000000000000008e 0x52 Src/delay.o
.debug_line 0x00000000000000e0 0xcf Src/keypad.o
.debug_line 0x00000000000001af 0x13c Src/lcd.o
.debug_line 0x00000000000002eb 0x63 Src/led.o
.debug_line 0x000000000000034e 0xa5 Src/main.o
.debug_line 0x00000000000003f3 0x84 Startup/startup_stm32f446retx.o
.debug_line 0x000000000000034e 0xa3 Src/main.o
.debug_line 0x00000000000003f1 0x84 Startup/startup_stm32f446retx.o
.debug_info 0x0000000000000000 0x106
.debug_info 0x0000000000000000 0x26 Src/buzzer.o

View File

@@ -2,10 +2,10 @@
# Trevor Barnes
# CE2801-031
.syntax unified
.cpu cortex-m4
.thumb
.section .text
.syntax unified
.cpu cortex-m4
.thumb
.section .text
.equ RCC_BASE, 0x40023800
.equ RCC_AHB1ENR, 0x30
@@ -20,7 +20,6 @@
.equ AFRL_OFFSET, 0x20
.equ AFRL_TIM_3_CH_1_EN, 1<<17
.equ CCMR_OFFSET, 0x18
.equ CCMR_OCC1PE, 1<<3
.equ CCMR_OCC1M_PWM, 0b1110000
@@ -41,8 +40,7 @@
.equ mil, 1000000
# Configures the piezo buzzer timer in pwm mode
.global piezoInit
.global piezoInit
piezoInit:
push {r0-r2}
@@ -55,20 +53,20 @@ piezoInit:
orr r1, r1, #TIM3_EN
str r1, [r0, #APB1ENR_OFFSET]
#Set Mode to alternate function
# Set Mode to alternate function
ldr r0, =GPIOB_BASE
ldr r1,[r0, #GPIO_MODER]
bic r1, r1, #1<<8
orr r1, r1, #PB4_ALT_FUNCTION
str r1, [r0, #GPIO_MODER]
#Set Alternate function low register to timer 3.
# Set Alternate function low register to timer 3.
ldr r1, [r0, #AFRL_OFFSET]
bic r1, #16, #4
orr r1, r1, #AFRL_TIM_3_CH_1_EN
str r1, [r0, #AFRL_OFFSET]
#Configure CCMR1 to enable preload and set to pwm
# Configure CCMR1 to enable preload and set to pwm
ldr r0, =TIM3_BASE
ldr r1, [r0, #CCMR_OFFSET]
bfc r1, #4, #3
@@ -77,13 +75,13 @@ piezoInit:
orr r1, r1, r2
str r1, [r0, #CCMR_OFFSET]
#Configure CCER to enable timer 3 as output capture
#C onfigure CCER to enable timer 3 as output capture
ldr r1, [r0, #CCER_OFFSET]
mov r2, #CCER_CC1E
orr r1, r1, r2
str r1, [r0, #CCER_OFFSET]
#Configure control register to enable preload
# Configure control register to enable preload
ldr r1, [r0, #CR1_OFFSET]
mov r2, #CR_ARPE_EN
orr r1, r1, r2
@@ -116,13 +114,11 @@ piezoOff:
pop {r0-r2}
bx lr
# Set's a given frequency to the piezo buzzer
#r0 contains frequency in hz
# r0 contains frequency (hz)
.global piezoSetFrequency
piezoSetFrequency:
push {r0-r3}
ldr r3, =TIM3_BASE
#bring clock rate down to 1mhz or 1,000,000 hz
mov r1, #15
str r1, [r3, #PSC_OFFSET]
ldr r1, =mil

View File

@@ -9,7 +9,13 @@
.equ GPIOB_BASE, 0x40020400
.equ GPIO_ODR, 0x14
.equ BSRR, 0x18
.equ GPIO_BSRR, 0x18
# Code is '2801'
.equ char1, 2 // 2
.equ char2, 10 // 8
.equ char3, 14 // 0
.equ char4, 1 // 1
.global main
@@ -20,7 +26,7 @@ main:
bl ledInit
bl piezoInit
top:
mainLoop:
mov r0, #200
bl msDelay
ldr r0, =msg
@@ -31,34 +37,38 @@ top:
# How many characters are correct
mov r9, #0
# Coded as '2' button
firstchar:
bl KeyGetKey
add r8, r8, #1
cmp r0, #2 //2
cmp r0, #char1
beq correctchar
# Coded as '8' button
secondchar:
ldr r0, =star
bl lcdPrintString
bl KeyGetKey
add r8, r8, #1
cmp r0, #10 //'8'
cmp r0, #char2
beq correctchar
# Coded as '0' button
thirdchar:
ldr r0, =star
bl lcdPrintString
bl KeyGetKey
add r8, r8, #1
cmp r0, #14 //'0'
cmp r0, #char3
beq correctchar
# Coded as '1' button
fourthchar:
ldr r0, =star
bl lcdPrintString
bl KeyGetKey
add r8, r8, #1
cmp r0, #1 //'1"
cmp r0, #char4
beq correctchar
b incorrect
@@ -75,26 +85,18 @@ correctchar:
beq determine
determine:
#Check if the number of correct bits is 4
cmp r9, #4
beq unlock
b incorrect
unlock:
#Turn open LED
@ ldr r0, =GPIOB_BASE
@ mov r2, #0xC060
@ ldr r1, [r0, #BSRR]
@ orr r1, r1, r2
@ str r1, [r0, #BSRR]
#Buzz buzzer
# Correct buzzer sound
mov r0, 1000
bl piezoSetFrequency
bl piezoOn
#Print CORRECT
bl lcdClear
mov r0, #20
bl msDelay
@@ -109,8 +111,6 @@ scroll_right:
lsr r3, r3, #1
# Read current data
ldr r2, [r1, #GPIO_ODR]
# Clear previous ON bit, default 0
@ bic r2, r4
# Write new data
orr r2, r2, r3
# Skip if PB11 "pin"
@@ -127,48 +127,41 @@ scroll_right:
cmp r3, 0x0020
bne scroll_right
#Wait and show message and leds
mov r0, #1000
bl msDelay
#Turn off leds
# Turn off leds
ldr r0, =GPIOB_BASE
mov r2, #0xF7F0
ldr r1, [r0, #BSRR]
ldr r1, [r0, #GPIO_BSRR]
bfi r1, r2, #16, #16
str r1, [r0, #BSRR]
str r1, [r0, #GPIO_BSRR]
#Clear
bl lcdClear
bl piezoOff
b top
b mainLoop
incorrect:
#Buzz buzzer
# Incorrect buzzer sound
mov r0, 300
bl piezoSetFrequency
bl piezoOn
#Print INCORRECT
bl lcdClear
mov r1, #20
bl msDelay
ldr r0, =invalid
bl lcdPrintString
#Wait to show message
mov r0, #1000
bl msDelay
#Clear
bl lcdClear
bl piezoOff
b top
b mainLoop
.section .data