SlideShare a Scribd company logo
1 of 118
eece237lab2/EECE237Lab2.uvproj
1.1
### uVision Project, (C) Keil Software
EECE237Lab2
0x4
ARM-ADS
LM4F120H5QR
Texas Instruments
IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF)
CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2
"STARTUPLuminaryStartup.s" ("Luminary Startup
Code")
UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -
FN1 -FF0LM4F_256 -FS00 -FL040000)
5995
LM4Fxxxx.H
SFDLuminaryLM4F120H5QR.SFR
0
0
Luminary
Luminary
0
0
0
0
1
.
Lab1
1
0
0
1
1
.
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1
SARMCM3.DLL
-MPU
DCM.DLL
-pCM4
SARMCM3.DLL
-MPU
TCM.DLL
-pCM4
1
0
0
0
16
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
3
BINlmidk-agdi.dll
1
0
0
1
1
4097
1
BINlmidk-agdi.dll
"" ()
0
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
1
0
0
"Cortex-M4"
0
0
0
1
1
0
0
1
0
0
8
0
0
0
3
3
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x20000000
0x8000
1
0x0
0x40000
0
0x0
0x0
1
0x0
0x0
1
0x0
0x0
1
0x0
0x0
1
0x0
0x40000
1
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x20000000
0x8000
0
0x0
0x0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0x00000000
0x20000000
Source Code
main2.s
2
.main2.s
startup.s
2
.startup.s
eece237lab2/main2.s
;****************** main.s ***************
; Program written by: ***Your Name Here***
; Date Created: 1/30/2015
; EECE237 Fall Semester 2016
; Lab number: 2
; The overall objective of this system is a simple user interface
; Hardware connections
; PF0 is switch input (1 means switch is not pressed, 0 means
switch is pressed)
; PF44 is switch input (1 means switch is not pressed, 0 means
switch is pressed)
; PF1, 2, 3 are LED output (0 means door is locked, 1 means
door is unlocked)
; The specific operation of this system is to unlock if both
switches are pressed
; Useful declarations
THUMB
; PortF register declarations
GPIO_PORTF_DATA_R EQU 0x400253FC
GPIO_PORTF_DIR_R EQU 0x40025400
GPIO_PORTF_AFSEL_R EQU 0x40025420
GPIO_PORTF_PUR_R EQU 0x40025510
GPIO_PORTF_DEN_R EQU 0x4002551C
GPIO_PORTF_LOCK_R EQU 0x40025520
GPIO_PORTF_CR_R EQU 0x40025524
GPIO_PORTF_AMSEL_R EQU 0x40025528
GPIO_PORTF_PCTL_R EQU 0x4002552C
GPIO_LOCK_KEY EQU 0x4C4F434B ; Unlocks the
GPIO_CR register
SYSCTL_RCGC2_R EQU 0x400FE108
SYSCTL_RCGC2_GPIOF EQU 0x00000020 ; port F Clock
Gating Control
AREA DATA, ALIGN=2
; Global variables go here, you will not need any in
lab2.
ALIGN ; make sure the end of this section is aligned
AREA |.text|, CODE, READONLY, ALIGN=2
EXPORT Start
Start
; Write initialization code here. This segment is only executed
once at reset
;------------PortF_Init------------
; Initialize GPIO Port F for negative logic switches on PF0 and
; PF4 to match Launchpad wiring. Weak internal pull-up
; resistors are enabled, and the NMI functionality on PF0 is
; disabled. R,G, and B LED's Pins (PF1-PF3) set as outputs.
; Follows Valvano Text program 4.1.
; Input: none
; Output: none
; Modifies: R0, R1, R2
PortF_Init
LDR R1, =SYSCTL_RCGC2_R ; 1) activate clock for
Port F
LDR R0, [R1]
ORR R0, R0, #0x20 ; set bit 5 to turn on clock
STR R0, [R1]
NOP
NOP ; allow time for clock to finish
; 2) unlock the
lock register
; unlock GPIO
Port F Commit Register
; enable commit
for Port F
; 1 means allow
access
; 3) disable
analog functionality
; 0 means analog
is off
; 4) configure as
GPIO
; 0 means
configure Port F as GPIO
; 5) set direction
register
; PF0 and PF7-4
input, PF3-1 output
; 6) regular port
function
; 0 means disable
alternate function
; pull-up resistors
for PF4,PF0
; enable weak
pull-up on PF0 and PF4
; 7) enable Port F
digital port
; 1 means enable
digital I/O
mainloop
; Write your main program here. This segment
loops indefinitely while the microcontroller is on
; You must use the Portf_Input and Portf_Output
functions to access PortF
B mainloop ;infinite main loop
; Useful Functions
; (From Valvano Text Program 4.1)
;------------PortF_Input------
; Read ProtF
; Input: none
; Output: R0 value read from PortF
; Modifies: R1
PortF_Input
LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F
data
LDR R0, [R1] ; read all of PortF
AND R0,R0,#0x11 ; just the input
pins, bits 4,0
BX LR ; return R0 with inputs
;------------PortF_Output------
; Set the output state of PF3-1.
; Input: R0 new state of PF
; Output: none
; Modifies: R1
PortF_Output
LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F
data
STR R0, [R1] ; write to PF3-1
BX LR
ALIGN ; make sure the end of this section is aligned (For
the code/data to follow)
END ; mark end of file
eece237lab2/startup.s
; <<< Use Configuration Wizard in Context Menu >>>
;****************************************************
**************************
;
; startup_rvmdk.S - Startup code for use with Keil's uVision.
;
; Copyright (c) 2012 Texas Instruments Incorporated. All rights
reserved.
; Software License Agreement
;
; Texas Instruments (TI) is supplying this software for use
solely and
; exclusively on TI's microcontroller products. The software is
owned by
; TI and/or its suppliers, and is protected under applicable
copyright
; laws. You may not combine this software with "viral" open-
source
; software in order to form a larger program.
;
; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL
FAULTS.
; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR
STATUTORY, INCLUDING, BUT
; NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
TI SHALL NOT, UNDER ANY
; CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL
; DAMAGES, FOR ANY REASON WHATSOEVER.
;
; This is part of revision 9453 of the EK-LM4F120XL Firmware
Package.
;
;****************************************************
**************************
; Edited to conform with ISR names as described in
; "Embedded Systems: Introduction to ARM Cortex M
Microcontrollers",
; ISBN: 978-1469998749, Jonathan Valvano, copyright (c)
2012
; "Embedded Systems: Real Time Interfacing to ARM Cortex
M Microcontrollers",
; ISBN: 978-1463590154, Jonathan Valvano, copyright (c)
2012
; "Embedded Systems: Real-Time Operating Systems for ARM
Cortex M Microcontrollers",
; ISBN: 978-1466468863, Jonathan Valvano, copyright (c)
2013
;
;****************************************************
**************************
;
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;****************************************************
**************************
Stack EQU 0x00000400
;****************************************************
**************************
;
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;****************************************************
**************************
Heap EQU 0x00000000
;****************************************************
**************************
;
; Allocate space for the stack.
;
;****************************************************
**************************
AREA STACK, NOINIT, READWRITE, ALIGN=3
StackMem
SPACE Stack
__initial_sp
;****************************************************
**************************
;
; Allocate space for the heap.
;
;****************************************************
**************************
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
HeapMem
SPACE Heap
__heap_limit
;****************************************************
**************************
;
; Indicate that the code in this file preserves 8-byte alignment of
the stack.
;
;****************************************************
**************************
PRESERVE8
;****************************************************
**************************
;
; Place code into the reset code section.
;
;****************************************************
**************************
AREA RESET, CODE, READONLY
THUMB
;****************************************************
**************************
;
; The vector table.
;
;****************************************************
**************************
EXPORT __Vectors
__Vectors
DCD StackMem + Stack ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor
Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
DCD GPIOPortA_Handler ; GPIO Port A
DCD GPIOPortB_Handler ; GPIO Port B
DCD GPIOPortC_Handler ; GPIO Port C
DCD GPIOPortD_Handler ; GPIO Port D
DCD GPIOPortE_Handler ; GPIO Port E
DCD UART0_Handler ; UART0 Rx and Tx
DCD UART1_Handler ; UART1 Rx and Tx
DCD SSI0_Handler ; SSI0 Rx and Tx
DCD I2C0_Handler ; I2C0 Master and Slave
DCD PWM0Fault_Handler ; PWM 0 Fault
DCD PWM0Generator0_Handler ; PWM 0 Generator
0
DCD PWM0Generator1_Handler ; PWM 0 Generator
1
DCD PWM0Generator2_Handler ; PWM 0 Generator
2
DCD Quadrature0_Handler ; Quadrature Encoder 0
DCD ADC0Seq0_Handler ; ADC0 Sequence 0
DCD ADC0Seq1_Handler ; ADC0 Sequence 1
DCD ADC0Seq1_Handler ; ADC0 Sequence 2
DCD ADC0Seq1_Handler ; ADC0 Sequence 3
DCD WDT_Handler ; Watchdog
DCD Timer0A_Handler ; Timer 0 subtimer A
DCD Timer0B_Handler ; Timer 0 subtimer B
DCD Timer1A_Handler ; Timer 1 subtimer A
DCD Timer1B_Handler ; Timer 1 subtimer B
DCD Timer2A_Handler ; Timer 2 subtimer A
DCD Timer2B_Handler ; Timer 2 subtimer B
DCD Comp0_Handler ; Analog Comp 0
DCD Comp1_Handler ; Analog Comp 1
DCD Comp2_Handler ; Analog Comp 2
DCD SysCtl_Handler ; System Control
DCD FlashCtl_Handler ; Flash Control
DCD GPIOPortF_Handler ; GPIO Port F
DCD GPIOPortG_Handler ; GPIO Port G
DCD GPIOPortH_Handler ; GPIO Port H
DCD UART2_Handler ; UART2 Rx and Tx
DCD SSI1_Handler ; SSI1 Rx and Tx
DCD Timer3A_Handler ; Timer 3 subtimer A
DCD Timer3B_Handler ; Timer 3 subtimer B
DCD I2C1_Handler ; I2C1 Master and Slave
DCD Quadrature1_Handler ; Quadrature Encoder 1
DCD CAN0_Handler ; CAN0
DCD CAN1_Handler ; CAN1
DCD CAN2_Handler ; CAN2
DCD Ethernet_Handler ; Ethernet
DCD Hibernate_Handler ; Hibernate
DCD USB0_Handler ; USB0
DCD PWM0Generator3_Handler ; PWM 0 Generator
3
DCD uDMA_Handler ; uDMA Software
Transfer
DCD uDMA_Error ; uDMA Error
DCD ADC1Seq0_Handler ; ADC1 Sequence 0
DCD ADC1Seq1_Handler ; ADC1 Sequence 1
DCD ADC1Seq2_Handler ; ADC1 Sequence 2
DCD ADC1Seq3_Handler ; ADC1 Sequence 3
DCD I2S0_Handler ; I2S0
DCD ExtBus_Handler ; External Bus Interface
0
DCD GPIOPortJ_Handler ; GPIO Port J
DCD GPIOPortK_Handler ; GPIO Port K
DCD GPIOPortL_Handler ; GPIO Port L
DCD SSI2_Handler ; SSI2 Rx and Tx
DCD SSI3_Handler ; SSI3 Rx and Tx
DCD UART3_Handler ; UART3 Rx and Tx
DCD UART4_Handler ; UART4 Rx and Tx
DCD UART5_Handler ; UART5 Rx and Tx
DCD UART6_Handler ; UART6 Rx and Tx
DCD UART7_Handler ; UART7 Rx and Tx
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD I2C2_Handler ; I2C2 Master and Slave
DCD I2C3_Handler ; I2C3 Master and Slave
DCD Timer4A_Handler ; Timer 4 subtimer A
DCD Timer4B_Handler ; Timer 4 subtimer B
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD Timer5A_Handler ; Timer 5 subtimer A
DCD Timer5B_Handler ; Timer 5 subtimer B
DCD WideTimer0A_Handler ; Wide Timer 0
subtimer A
DCD WideTimer0B_Handler ; Wide Timer 0
subtimer B
DCD WideTimer1A_Handler ; Wide Timer 1
subtimer A
DCD WideTimer1B_Handler ; Wide Timer 1
subtimer B
DCD WideTimer2A_Handler ; Wide Timer 2
subtimer A
DCD WideTimer2B_Handler ; Wide Timer 2
subtimer B
DCD WideTimer3A_Handler ; Wide Timer 3
subtimer A
DCD WideTimer3B_Handler ; Wide Timer 3
subtimer B
DCD WideTimer4A_Handler ; Wide Timer 4
subtimer A
DCD WideTimer4B_Handler ; Wide Timer 4
subtimer B
DCD WideTimer5A_Handler ; Wide Timer 5
subtimer A
DCD WideTimer5B_Handler ; Wide Timer 5
subtimer B
DCD FPU_Handler ; FPU
DCD PECI0_Handler ; PECI 0
DCD LPC0_Handler ; LPC 0
DCD I2C4_Handler ; I2C4 Master and Slave
DCD I2C5_Handler ; I2C5 Master and Slave
DCD GPIOPortM_Handler ; GPIO Port M
DCD GPIOPortN_Handler ; GPIO Port N
DCD Quadrature2_Handler ; Quadrature Encoder 2
DCD Fan0_Handler ; Fan 0
DCD 0 ; Reserved
DCD GPIOPortP_Handler ; GPIO Port P
(Summary or P0)
DCD GPIOPortP1_Handler ; GPIO Port P1
DCD GPIOPortP2_Handler ; GPIO Port P2
DCD GPIOPortP3_Handler ; GPIO Port P3
DCD GPIOPortP4_Handler ; GPIO Port P4
DCD GPIOPortP5_Handler ; GPIO Port P5
DCD GPIOPortP6_Handler ; GPIO Port P6
DCD GPIOPortP7_Handler ; GPIO Port P7
DCD GPIOPortQ_Handler ; GPIO Port Q
(Summary or Q0)
DCD GPIOPortQ1_Handler ; GPIO Port Q1
DCD GPIOPortQ2_Handler ; GPIO Port Q2
DCD GPIOPortQ3_Handler ; GPIO Port Q3
DCD GPIOPortQ4_Handler ; GPIO Port Q4
DCD GPIOPortQ5_Handler ; GPIO Port Q5
DCD GPIOPortQ6_Handler ; GPIO Port Q6
DCD GPIOPortQ7_Handler ; GPIO Port Q7
DCD GPIOPortR_Handler ; GPIO Port R
DCD GPIOPortS_Handler ; GPIO Port S
DCD PWM1Generator0_Handler ; PWM 1 Generator
0
DCD PWM1Generator1_Handler ; PWM 1 Generator
1
DCD PWM1Generator2_Handler ; PWM 1 Generator
2
DCD PWM1Generator3_Handler ; PWM 1 Generator
3
DCD PWM1Fault_Handler ; PWM 1 Fault
;****************************************************
**************************
;
; This is the code that gets called when the processor first starts
execution
; following a reset event.
;
;****************************************************
**************************
EXPORT Reset_Handler
Reset_Handler
;
; DO NOT Enable the floating-point unit. This must be
done here to handle the
; case where main() uses floating-point and the function
prologue saves
; floating-point registers (which will fault if floating-point
is not
; enabled). Any configuration of the floating-point unit
using
; DriverLib APIs must be done here prior to the floating-
point unit
; being enabled.
;
; Note that this does not use DriverLib since it might not
be included
; in this project.
;
; MOVW R0, #0xED88
; MOVT R0, #0xE000
; LDR R1, [R0]
; ORR R1, #0x00F00000
; STR R1, [R0]
;
; Call the C library enty point that handles startup. This
will copy
; the .data section initializers from flash to SRAM and
zero fill the
; .bss section.
;
IMPORT Start
B Start ;call user assembly language program
;****************************************************
**************************
;
; This is the code that gets called when the processor receives a
NMI. This
; simply enters an infinite loop, preserving the system state for
examination
; by a debugger.
;
;****************************************************
**************************
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
;****************************************************
**************************
;
; This is the code that gets called when the processor receives a
fault
; interrupt. This simply enters an infinite loop, preserving the
system state
; for examination by a debugger.
;
;****************************************************
**************************
HardFault_Handler
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemManage_Handler
PROC
EXPORT MemManage_Handler [WEAK]
B .
ENDP
BusFault_Handler
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
IntDefaultHandler
PROC
EXPORT GPIOPortA_Handler [WEAK]
EXPORT GPIOPortB_Handler [WEAK]
EXPORT GPIOPortC_Handler [WEAK]
EXPORT GPIOPortD_Handler [WEAK]
EXPORT GPIOPortE_Handler [WEAK]
EXPORT UART0_Handler [WEAK]
EXPORT UART1_Handler [WEAK]
EXPORT SSI0_Handler [WEAK]
EXPORT I2C0_Handler [WEAK]
EXPORT PWM0Fault_Handler [WEAK]
EXPORT PWM0Generator0_Handler [WEAK]
EXPORT PWM0Generator1_Handler [WEAK]
EXPORT PWM0Generator2_Handler [WEAK]
EXPORT Quadrature0_Handler [WEAK]
EXPORT ADC0Seq0_Handler [WEAK]
EXPORT ADC0Seq1_Handler [WEAK]
EXPORT ADC0Seq2_Handler [WEAK]
EXPORT ADC0Seq3_Handler [WEAK]
EXPORT WDT_Handler [WEAK]
EXPORT Timer0A_Handler [WEAK]
EXPORT Timer0B_Handler [WEAK]
EXPORT Timer1A_Handler [WEAK]
EXPORT Timer1B_Handler [WEAK]
EXPORT Timer2A_Handler [WEAK]
EXPORT Timer2B_Handler [WEAK]
EXPORT Comp0_Handler [WEAK]
EXPORT Comp1_Handler [WEAK]
EXPORT Comp2_Handler [WEAK]
EXPORT SysCtl_Handler [WEAK]
EXPORT FlashCtl_Handler [WEAK]
EXPORT GPIOPortF_Handler [WEAK]
EXPORT GPIOPortG_Handler [WEAK]
EXPORT GPIOPortH_Handler [WEAK]
EXPORT UART2_Handler [WEAK]
EXPORT SSI1_Handler [WEAK]
EXPORT Timer3A_Handler [WEAK]
EXPORT Timer3B_Handler [WEAK]
EXPORT I2C1_Handler [WEAK]
EXPORT Quadrature1_Handler [WEAK]
EXPORT CAN0_Handler [WEAK]
EXPORT CAN1_Handler [WEAK]
EXPORT CAN2_Handler [WEAK]
EXPORT Ethernet_Handler [WEAK]
EXPORT Hibernate_Handler [WEAK]
EXPORT USB0_Handler [WEAK]
EXPORT PWM0Generator3_Handler [WEAK]
EXPORT uDMA_Handler [WEAK]
EXPORT uDMA_Error [WEAK]
EXPORT ADC1Seq0_Handler [WEAK]
EXPORT ADC1Seq1_Handler [WEAK]
EXPORT ADC1Seq2_Handler [WEAK]
EXPORT ADC1Seq3_Handler [WEAK]
EXPORT I2S0_Handler [WEAK]
EXPORT ExtBus_Handler [WEAK]
EXPORT GPIOPortJ_Handler [WEAK]
EXPORT GPIOPortK_Handler [WEAK]
EXPORT GPIOPortL_Handler [WEAK]
EXPORT SSI2_Handler [WEAK]
EXPORT SSI3_Handler [WEAK]
EXPORT UART3_Handler [WEAK]
EXPORT UART4_Handler [WEAK]
EXPORT UART5_Handler [WEAK]
EXPORT UART6_Handler [WEAK]
EXPORT UART7_Handler [WEAK]
EXPORT I2C2_Handler [WEAK]
EXPORT I2C3_Handler [WEAK]
EXPORT Timer4A_Handler [WEAK]
EXPORT Timer4B_Handler [WEAK]
EXPORT Timer5A_Handler [WEAK]
EXPORT Timer5B_Handler [WEAK]
EXPORT WideTimer0A_Handler [WEAK]
EXPORT WideTimer0B_Handler [WEAK]
EXPORT WideTimer1A_Handler [WEAK]
EXPORT WideTimer1B_Handler [WEAK]
EXPORT WideTimer2A_Handler [WEAK]
EXPORT WideTimer2B_Handler [WEAK]
EXPORT WideTimer3A_Handler [WEAK]
EXPORT WideTimer3B_Handler [WEAK]
EXPORT WideTimer4A_Handler [WEAK]
EXPORT WideTimer4B_Handler [WEAK]
EXPORT WideTimer5A_Handler [WEAK]
EXPORT WideTimer5B_Handler [WEAK]
EXPORT FPU_Handler [WEAK]
EXPORT PECI0_Handler [WEAK]
EXPORT LPC0_Handler [WEAK]
EXPORT I2C4_Handler [WEAK]
EXPORT I2C5_Handler [WEAK]
EXPORT GPIOPortM_Handler [WEAK]
EXPORT GPIOPortN_Handler [WEAK]
EXPORT Quadrature2_Handler [WEAK]
EXPORT Fan0_Handler [WEAK]
EXPORT GPIOPortP_Handler [WEAK]
EXPORT GPIOPortP1_Handler [WEAK]
EXPORT GPIOPortP2_Handler [WEAK]
EXPORT GPIOPortP3_Handler [WEAK]
EXPORT GPIOPortP4_Handler [WEAK]
EXPORT GPIOPortP5_Handler [WEAK]
EXPORT GPIOPortP6_Handler [WEAK]
EXPORT GPIOPortP7_Handler [WEAK]
EXPORT GPIOPortQ_Handler [WEAK]
EXPORT GPIOPortQ1_Handler [WEAK]
EXPORT GPIOPortQ2_Handler [WEAK]
EXPORT GPIOPortQ3_Handler [WEAK]
EXPORT GPIOPortQ4_Handler [WEAK]
EXPORT GPIOPortQ5_Handler [WEAK]
EXPORT GPIOPortQ6_Handler [WEAK]
EXPORT GPIOPortQ7_Handler [WEAK]
EXPORT GPIOPortR_Handler [WEAK]
EXPORT GPIOPortS_Handler [WEAK]
EXPORT PWM1Generator0_Handler [WEAK]
EXPORT PWM1Generator1_Handler [WEAK]
EXPORT PWM1Generator2_Handler [WEAK]
EXPORT PWM1Generator3_Handler [WEAK]
EXPORT PWM1Fault_Handler [WEAK]
GPIOPortA_Handler
GPIOPortB_Handler
GPIOPortC_Handler
GPIOPortD_Handler
GPIOPortE_Handler
UART0_Handler
UART1_Handler
SSI0_Handler
I2C0_Handler
PWM0Fault_Handler
PWM0Generator0_Handler
PWM0Generator1_Handler
PWM0Generator2_Handler
Quadrature0_Handler
ADC0Seq0_Handler
ADC0Seq1_Handler
ADC0Seq2_Handler
ADC0Seq3_Handler
WDT_Handler
Timer0A_Handler
Timer0B_Handler
Timer1A_Handler
Timer1B_Handler
Timer2A_Handler
Timer2B_Handler
Comp0_Handler
Comp1_Handler
Comp2_Handler
SysCtl_Handler
FlashCtl_Handler
GPIOPortF_Handler
GPIOPortG_Handler
GPIOPortH_Handler
UART2_Handler
SSI1_Handler
Timer3A_Handler
Timer3B_Handler
I2C1_Handler
Quadrature1_Handler
CAN0_Handler
CAN1_Handler
CAN2_Handler
Ethernet_Handler
Hibernate_Handler
USB0_Handler
PWM0Generator3_Handler
uDMA_Handler
uDMA_Error
ADC1Seq0_Handler
ADC1Seq1_Handler
ADC1Seq2_Handler
ADC1Seq3_Handler
I2S0_Handler
ExtBus_Handler
GPIOPortJ_Handler
GPIOPortK_Handler
GPIOPortL_Handler
SSI2_Handler
SSI3_Handler
UART3_Handler
UART4_Handler
UART5_Handler
UART6_Handler
UART7_Handler
I2C2_Handler
I2C3_Handler
Timer4A_Handler
Timer4B_Handler
Timer5A_Handler
Timer5B_Handler
WideTimer0A_Handler
WideTimer0B_Handler
WideTimer1A_Handler
WideTimer1B_Handler
WideTimer2A_Handler
WideTimer2B_Handler
WideTimer3A_Handler
WideTimer3B_Handler
WideTimer4A_Handler
WideTimer4B_Handler
WideTimer5A_Handler
WideTimer5B_Handler
FPU_Handler
PECI0_Handler
LPC0_Handler
I2C4_Handler
I2C5_Handler
GPIOPortM_Handler
GPIOPortN_Handler
Quadrature2_Handler
Fan0_Handler
GPIOPortP_Handler
GPIOPortP1_Handler
GPIOPortP2_Handler
GPIOPortP3_Handler
GPIOPortP4_Handler
GPIOPortP5_Handler
GPIOPortP6_Handler
GPIOPortP7_Handler
GPIOPortQ_Handler
GPIOPortQ1_Handler
GPIOPortQ2_Handler
GPIOPortQ3_Handler
GPIOPortQ4_Handler
GPIOPortQ5_Handler
GPIOPortQ6_Handler
GPIOPortQ7_Handler
GPIOPortR_Handler
GPIOPortS_Handler
PWM1Generator0_Handler
PWM1Generator1_Handler
PWM1Generator2_Handler
PWM1Generator3_Handler
PWM1Fault_Handler
B .
ENDP
;****************************************************
**************************
;
; Make sure the end of this section is aligned.
;
;****************************************************
**************************
ALIGN
;****************************************************
**************************
;
; Some code in the normal code section for initializing the heap
and stack.
;
;****************************************************
**************************
AREA |.text|, CODE, READONLY
;****************************************************
**************************
;
; Useful functions.
;
;****************************************************
**************************
EXPORT DisableInterrupts
EXPORT EnableInterrupts
EXPORT StartCritical
EXPORT EndCritical
EXPORT WaitForInterrupt
;*********** DisableInterrupts ***************
; disable interrupts
; inputs: none
; outputs: none
DisableInterrupts
CPSID I
BX LR
;*********** EnableInterrupts ***************
; disable interrupts
; inputs: none
; outputs: none
EnableInterrupts
CPSIE I
BX LR
;*********** StartCritical ************************
; make a copy of previous I bit, disable interrupts
; inputs: none
; outputs: previous I bit
StartCritical
MRS R0, PRIMASK ; save old status
CPSID I ; mask all (except faults)
BX LR
;*********** EndCritical ************************
; using the copy of previous I bit, restore I bit to previous value
; inputs: previous I bit
; outputs: none
EndCritical
MSR PRIMASK, R0
BX LR
;*********** WaitForInterrupt ************************
; go to low power mode while waiting for the next interrupt
; inputs: none
; outputs: none
WaitForInterrupt
WFI
BX LR
;****************************************************
**************************
;
; Make sure the end of this section is aligned.
;
;****************************************************
**************************
ALIGN
;****************************************************
**************************
;
; Tell the assembler that we're done.
;
;****************************************************
**************************
END
eece237lab2/EECE237Lab2.uvproj
1.1
### uVision Project, (C) Keil Software
EECE237Lab2
0x4
ARM-ADS
LM4F120H5QR
Texas Instruments
IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF)
CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2
"STARTUPLuminaryStartup.s" ("Luminary Startup
Code")
UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -
FN1 -FF0LM4F_256 -FS00 -FL040000)
5995
LM4Fxxxx.H
SFDLuminaryLM4F120H5QR.SFR
0
0
Luminary
Luminary
0
0
0
0
1
.
Lab1
1
0
0
1
1
.
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1
SARMCM3.DLL
-MPU
DCM.DLL
-pCM4
SARMCM3.DLL
-MPU
TCM.DLL
-pCM4
1
0
0
0
16
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
3
BINlmidk-agdi.dll
1
0
0
1
1
4097
1
BINlmidk-agdi.dll
"" ()
0
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
1
0
0
"Cortex-M4"
0
0
0
1
1
0
0
1
0
0
8
0
0
0
3
3
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x20000000
0x8000
1
0x0
0x40000
0
0x0
0x0
1
0x0
0x0
1
0x0
0x0
1
0x0
0x0
1
0x0
0x40000
1
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x0
0x0
0
0x20000000
0x8000
0
0x0
0x0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0x00000000
0x20000000
Source Code
main2.s
2
.main2.s
startup.s
2
.startup.s
eece237lab2/main2.s
;****************** main.s ***************
; Program written by: ***Your Name Here***
; Date Created: 1/30/2015
; EECE237 Fall Semester 2016
; Lab number: 2
; The overall objective of this system is a simple user interface
; Hardware connections
; PF0 is switch input (1 means switch is not pressed, 0 means
switch is pressed)
; PF44 is switch input (1 means switch is not pressed, 0 means
switch is pressed)
; PF1, 2, 3 are LED output (0 means door is locked, 1 means
door is unlocked)
; The specific operation of this system is to unlock if both
switches are pressed
; Useful declarations
THUMB
; PortF register declarations
GPIO_PORTF_DATA_R EQU 0x400253FC
GPIO_PORTF_DIR_R EQU 0x40025400
GPIO_PORTF_AFSEL_R EQU 0x40025420
GPIO_PORTF_PUR_R EQU 0x40025510
GPIO_PORTF_DEN_R EQU 0x4002551C
GPIO_PORTF_LOCK_R EQU 0x40025520
GPIO_PORTF_CR_R EQU 0x40025524
GPIO_PORTF_AMSEL_R EQU 0x40025528
GPIO_PORTF_PCTL_R EQU 0x4002552C
GPIO_LOCK_KEY EQU 0x4C4F434B ; Unlocks the
GPIO_CR register
SYSCTL_RCGC2_R EQU 0x400FE108
SYSCTL_RCGC2_GPIOF EQU 0x00000020 ; port F Clock
Gating Control
AREA DATA, ALIGN=2
; Global variables go here, you will not need any in
lab2.
ALIGN ; make sure the end of this section is aligned
AREA |.text|, CODE, READONLY, ALIGN=2
EXPORT Start
Start
; Write initialization code here. This segment is only executed
once at reset
;------------PortF_Init------------
; Initialize GPIO Port F for negative logic switches on PF0 and
; PF4 to match Launchpad wiring. Weak internal pull-up
; resistors are enabled, and the NMI functionality on PF0 is
; disabled. R,G, and B LED's Pins (PF1-PF3) set as outputs.
; Follows Valvano Text program 4.1.
; Input: none
; Output: none
; Modifies: R0, R1, R2
PortF_Init
LDR R1, =SYSCTL_RCGC2_R ; 1) activate clock for
Port F
LDR R0, [R1]
ORR R0, R0, #0x20 ; set bit 5 to turn on clock
STR R0, [R1]
NOP
NOP ; allow time for clock to finish
; 2) unlock the
lock register
; unlock GPIO
Port F Commit Register
; enable commit
for Port F
; 1 means allow
access
; 3) disable
analog functionality
; 0 means analog
is off
; 4) configure as
GPIO
; 0 means
configure Port F as GPIO
; 5) set direction
register
; PF0 and PF7-4
input, PF3-1 output
; 6) regular port
function
; 0 means disable
alternate function
; pull-up resistors
for PF4,PF0
; enable weak
pull-up on PF0 and PF4
; 7) enable Port F
digital port
; 1 means enable
digital I/O
mainloop
; Write your main program here. This segment
loops indefinitely while the microcontroller is on
; You must use the Portf_Input and Portf_Output
functions to access PortF
B mainloop ;infinite main loop
; Useful Functions
; (From Valvano Text Program 4.1)
;------------PortF_Input------
; Read ProtF
; Input: none
; Output: R0 value read from PortF
; Modifies: R1
PortF_Input
LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F
data
LDR R0, [R1] ; read all of PortF
AND R0,R0,#0x11 ; just the input
pins, bits 4,0
BX LR ; return R0 with inputs
;------------PortF_Output------
; Set the output state of PF3-1.
; Input: R0 new state of PF
; Output: none
; Modifies: R1
PortF_Output
LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F
data
STR R0, [R1] ; write to PF3-1
BX LR
ALIGN ; make sure the end of this section is aligned (For
the code/data to follow)
END ; mark end of file
eece237lab2/startup.s
; <<< Use Configuration Wizard in Context Menu >>>
;****************************************************
**************************
;
; startup_rvmdk.S - Startup code for use with Keil's uVision.
;
; Copyright (c) 2012 Texas Instruments Incorporated. All rights
reserved.
; Software License Agreement
;
; Texas Instruments (TI) is supplying this software for use
solely and
; exclusively on TI's microcontroller products. The software is
owned by
; TI and/or its suppliers, and is protected under applicable
copyright
; laws. You may not combine this software with "viral" open-
source
; software in order to form a larger program.
;
; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL
FAULTS.
; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR
STATUTORY, INCLUDING, BUT
; NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
TI SHALL NOT, UNDER ANY
; CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL
; DAMAGES, FOR ANY REASON WHATSOEVER.
;
; This is part of revision 9453 of the EK-LM4F120XL Firmware
Package.
;
;****************************************************
**************************
; Edited to conform with ISR names as described in
; "Embedded Systems: Introduction to ARM Cortex M
Microcontrollers",
; ISBN: 978-1469998749, Jonathan Valvano, copyright (c)
2012
; "Embedded Systems: Real Time Interfacing to ARM Cortex
M Microcontrollers",
; ISBN: 978-1463590154, Jonathan Valvano, copyright (c)
2012
; "Embedded Systems: Real-Time Operating Systems for ARM
Cortex M Microcontrollers",
; ISBN: 978-1466468863, Jonathan Valvano, copyright (c)
2013
;
;****************************************************
**************************
;
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;****************************************************
**************************
Stack EQU 0x00000400
;****************************************************
**************************
;
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;****************************************************
**************************
Heap EQU 0x00000000
;****************************************************
**************************
;
; Allocate space for the stack.
;
;****************************************************
**************************
AREA STACK, NOINIT, READWRITE, ALIGN=3
StackMem
SPACE Stack
__initial_sp
;****************************************************
**************************
;
; Allocate space for the heap.
;
;****************************************************
**************************
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
HeapMem
SPACE Heap
__heap_limit
;****************************************************
**************************
;
; Indicate that the code in this file preserves 8-byte alignment of
the stack.
;
;****************************************************
**************************
PRESERVE8
;****************************************************
**************************
;
; Place code into the reset code section.
;
;****************************************************
**************************
AREA RESET, CODE, READONLY
THUMB
;****************************************************
**************************
;
; The vector table.
;
;****************************************************
**************************
EXPORT __Vectors
__Vectors
DCD StackMem + Stack ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor
Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
DCD GPIOPortA_Handler ; GPIO Port A
DCD GPIOPortB_Handler ; GPIO Port B
DCD GPIOPortC_Handler ; GPIO Port C
DCD GPIOPortD_Handler ; GPIO Port D
DCD GPIOPortE_Handler ; GPIO Port E
DCD UART0_Handler ; UART0 Rx and Tx
DCD UART1_Handler ; UART1 Rx and Tx
DCD SSI0_Handler ; SSI0 Rx and Tx
DCD I2C0_Handler ; I2C0 Master and Slave
DCD PWM0Fault_Handler ; PWM 0 Fault
DCD PWM0Generator0_Handler ; PWM 0 Generator
0
DCD PWM0Generator1_Handler ; PWM 0 Generator
1
DCD PWM0Generator2_Handler ; PWM 0 Generator
2
DCD Quadrature0_Handler ; Quadrature Encoder 0
DCD ADC0Seq0_Handler ; ADC0 Sequence 0
DCD ADC0Seq1_Handler ; ADC0 Sequence 1
DCD ADC0Seq1_Handler ; ADC0 Sequence 2
DCD ADC0Seq1_Handler ; ADC0 Sequence 3
DCD WDT_Handler ; Watchdog
DCD Timer0A_Handler ; Timer 0 subtimer A
DCD Timer0B_Handler ; Timer 0 subtimer B
DCD Timer1A_Handler ; Timer 1 subtimer A
DCD Timer1B_Handler ; Timer 1 subtimer B
DCD Timer2A_Handler ; Timer 2 subtimer A
DCD Timer2B_Handler ; Timer 2 subtimer B
DCD Comp0_Handler ; Analog Comp 0
DCD Comp1_Handler ; Analog Comp 1
DCD Comp2_Handler ; Analog Comp 2
DCD SysCtl_Handler ; System Control
DCD FlashCtl_Handler ; Flash Control
DCD GPIOPortF_Handler ; GPIO Port F
DCD GPIOPortG_Handler ; GPIO Port G
DCD GPIOPortH_Handler ; GPIO Port H
DCD UART2_Handler ; UART2 Rx and Tx
DCD SSI1_Handler ; SSI1 Rx and Tx
DCD Timer3A_Handler ; Timer 3 subtimer A
DCD Timer3B_Handler ; Timer 3 subtimer B
DCD I2C1_Handler ; I2C1 Master and Slave
DCD Quadrature1_Handler ; Quadrature Encoder 1
DCD CAN0_Handler ; CAN0
DCD CAN1_Handler ; CAN1
DCD CAN2_Handler ; CAN2
DCD Ethernet_Handler ; Ethernet
DCD Hibernate_Handler ; Hibernate
DCD USB0_Handler ; USB0
DCD PWM0Generator3_Handler ; PWM 0 Generator
3
DCD uDMA_Handler ; uDMA Software
Transfer
DCD uDMA_Error ; uDMA Error
DCD ADC1Seq0_Handler ; ADC1 Sequence 0
DCD ADC1Seq1_Handler ; ADC1 Sequence 1
DCD ADC1Seq2_Handler ; ADC1 Sequence 2
DCD ADC1Seq3_Handler ; ADC1 Sequence 3
DCD I2S0_Handler ; I2S0
DCD ExtBus_Handler ; External Bus Interface
0
DCD GPIOPortJ_Handler ; GPIO Port J
DCD GPIOPortK_Handler ; GPIO Port K
DCD GPIOPortL_Handler ; GPIO Port L
DCD SSI2_Handler ; SSI2 Rx and Tx
DCD SSI3_Handler ; SSI3 Rx and Tx
DCD UART3_Handler ; UART3 Rx and Tx
DCD UART4_Handler ; UART4 Rx and Tx
DCD UART5_Handler ; UART5 Rx and Tx
DCD UART6_Handler ; UART6 Rx and Tx
DCD UART7_Handler ; UART7 Rx and Tx
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD I2C2_Handler ; I2C2 Master and Slave
DCD I2C3_Handler ; I2C3 Master and Slave
DCD Timer4A_Handler ; Timer 4 subtimer A
DCD Timer4B_Handler ; Timer 4 subtimer B
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD Timer5A_Handler ; Timer 5 subtimer A
DCD Timer5B_Handler ; Timer 5 subtimer B
DCD WideTimer0A_Handler ; Wide Timer 0
subtimer A
DCD WideTimer0B_Handler ; Wide Timer 0
subtimer B
DCD WideTimer1A_Handler ; Wide Timer 1
subtimer A
DCD WideTimer1B_Handler ; Wide Timer 1
subtimer B
DCD WideTimer2A_Handler ; Wide Timer 2
subtimer A
DCD WideTimer2B_Handler ; Wide Timer 2
subtimer B
DCD WideTimer3A_Handler ; Wide Timer 3
subtimer A
DCD WideTimer3B_Handler ; Wide Timer 3
subtimer B
DCD WideTimer4A_Handler ; Wide Timer 4
subtimer A
DCD WideTimer4B_Handler ; Wide Timer 4
subtimer B
DCD WideTimer5A_Handler ; Wide Timer 5
subtimer A
DCD WideTimer5B_Handler ; Wide Timer 5
subtimer B
DCD FPU_Handler ; FPU
DCD PECI0_Handler ; PECI 0
DCD LPC0_Handler ; LPC 0
DCD I2C4_Handler ; I2C4 Master and Slave
DCD I2C5_Handler ; I2C5 Master and Slave
DCD GPIOPortM_Handler ; GPIO Port M
DCD GPIOPortN_Handler ; GPIO Port N
DCD Quadrature2_Handler ; Quadrature Encoder 2
DCD Fan0_Handler ; Fan 0
DCD 0 ; Reserved
DCD GPIOPortP_Handler ; GPIO Port P
(Summary or P0)
DCD GPIOPortP1_Handler ; GPIO Port P1
DCD GPIOPortP2_Handler ; GPIO Port P2
DCD GPIOPortP3_Handler ; GPIO Port P3
DCD GPIOPortP4_Handler ; GPIO Port P4
DCD GPIOPortP5_Handler ; GPIO Port P5
DCD GPIOPortP6_Handler ; GPIO Port P6
DCD GPIOPortP7_Handler ; GPIO Port P7
DCD GPIOPortQ_Handler ; GPIO Port Q
(Summary or Q0)
DCD GPIOPortQ1_Handler ; GPIO Port Q1
DCD GPIOPortQ2_Handler ; GPIO Port Q2
DCD GPIOPortQ3_Handler ; GPIO Port Q3
DCD GPIOPortQ4_Handler ; GPIO Port Q4
DCD GPIOPortQ5_Handler ; GPIO Port Q5
DCD GPIOPortQ6_Handler ; GPIO Port Q6
DCD GPIOPortQ7_Handler ; GPIO Port Q7
DCD GPIOPortR_Handler ; GPIO Port R
DCD GPIOPortS_Handler ; GPIO Port S
DCD PWM1Generator0_Handler ; PWM 1 Generator
0
DCD PWM1Generator1_Handler ; PWM 1 Generator
1
DCD PWM1Generator2_Handler ; PWM 1 Generator
2
DCD PWM1Generator3_Handler ; PWM 1 Generator
3
DCD PWM1Fault_Handler ; PWM 1 Fault
;****************************************************
**************************
;
; This is the code that gets called when the processor first starts
execution
; following a reset event.
;
;****************************************************
**************************
EXPORT Reset_Handler
Reset_Handler
;
; DO NOT Enable the floating-point unit. This must be
done here to handle the
; case where main() uses floating-point and the function
prologue saves
; floating-point registers (which will fault if floating-point
is not
; enabled). Any configuration of the floating-point unit
using
; DriverLib APIs must be done here prior to the floating-
point unit
; being enabled.
;
; Note that this does not use DriverLib since it might not
be included
; in this project.
;
; MOVW R0, #0xED88
; MOVT R0, #0xE000
; LDR R1, [R0]
; ORR R1, #0x00F00000
; STR R1, [R0]
;
; Call the C library enty point that handles startup. This
will copy
; the .data section initializers from flash to SRAM and
zero fill the
; .bss section.
;
IMPORT Start
B Start ;call user assembly language program
;****************************************************
**************************
;
; This is the code that gets called when the processor receives a
NMI. This
; simply enters an infinite loop, preserving the system state for
examination
; by a debugger.
;
;****************************************************
**************************
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
;****************************************************
**************************
;
; This is the code that gets called when the processor receives a
fault
; interrupt. This simply enters an infinite loop, preserving the
system state
; for examination by a debugger.
;
;****************************************************
**************************
HardFault_Handler
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemManage_Handler
PROC
EXPORT MemManage_Handler [WEAK]
B .
ENDP
BusFault_Handler
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
IntDefaultHandler
PROC
EXPORT GPIOPortA_Handler [WEAK]
EXPORT GPIOPortB_Handler [WEAK]
EXPORT GPIOPortC_Handler [WEAK]
EXPORT GPIOPortD_Handler [WEAK]
EXPORT GPIOPortE_Handler [WEAK]
EXPORT UART0_Handler [WEAK]
EXPORT UART1_Handler [WEAK]
EXPORT SSI0_Handler [WEAK]
EXPORT I2C0_Handler [WEAK]
EXPORT PWM0Fault_Handler [WEAK]
EXPORT PWM0Generator0_Handler [WEAK]
EXPORT PWM0Generator1_Handler [WEAK]
EXPORT PWM0Generator2_Handler [WEAK]
EXPORT Quadrature0_Handler [WEAK]
EXPORT ADC0Seq0_Handler [WEAK]
EXPORT ADC0Seq1_Handler [WEAK]
EXPORT ADC0Seq2_Handler [WEAK]
EXPORT ADC0Seq3_Handler [WEAK]
EXPORT WDT_Handler [WEAK]
EXPORT Timer0A_Handler [WEAK]
EXPORT Timer0B_Handler [WEAK]
EXPORT Timer1A_Handler [WEAK]
EXPORT Timer1B_Handler [WEAK]
EXPORT Timer2A_Handler [WEAK]
EXPORT Timer2B_Handler [WEAK]
EXPORT Comp0_Handler [WEAK]
EXPORT Comp1_Handler [WEAK]
EXPORT Comp2_Handler [WEAK]
EXPORT SysCtl_Handler [WEAK]
EXPORT FlashCtl_Handler [WEAK]
EXPORT GPIOPortF_Handler [WEAK]
EXPORT GPIOPortG_Handler [WEAK]
EXPORT GPIOPortH_Handler [WEAK]
EXPORT UART2_Handler [WEAK]
EXPORT SSI1_Handler [WEAK]
EXPORT Timer3A_Handler [WEAK]
EXPORT Timer3B_Handler [WEAK]
EXPORT I2C1_Handler [WEAK]
EXPORT Quadrature1_Handler [WEAK]
EXPORT CAN0_Handler [WEAK]
EXPORT CAN1_Handler [WEAK]
EXPORT CAN2_Handler [WEAK]
EXPORT Ethernet_Handler [WEAK]
EXPORT Hibernate_Handler [WEAK]
EXPORT USB0_Handler [WEAK]
EXPORT PWM0Generator3_Handler [WEAK]
EXPORT uDMA_Handler [WEAK]
EXPORT uDMA_Error [WEAK]
EXPORT ADC1Seq0_Handler [WEAK]
EXPORT ADC1Seq1_Handler [WEAK]
EXPORT ADC1Seq2_Handler [WEAK]
EXPORT ADC1Seq3_Handler [WEAK]
EXPORT I2S0_Handler [WEAK]
EXPORT ExtBus_Handler [WEAK]
EXPORT GPIOPortJ_Handler [WEAK]
EXPORT GPIOPortK_Handler [WEAK]
EXPORT GPIOPortL_Handler [WEAK]
EXPORT SSI2_Handler [WEAK]
EXPORT SSI3_Handler [WEAK]
EXPORT UART3_Handler [WEAK]
EXPORT UART4_Handler [WEAK]
EXPORT UART5_Handler [WEAK]
EXPORT UART6_Handler [WEAK]
EXPORT UART7_Handler [WEAK]
EXPORT I2C2_Handler [WEAK]
EXPORT I2C3_Handler [WEAK]
EXPORT Timer4A_Handler [WEAK]
EXPORT Timer4B_Handler [WEAK]
EXPORT Timer5A_Handler [WEAK]
EXPORT Timer5B_Handler [WEAK]
EXPORT WideTimer0A_Handler [WEAK]
EXPORT WideTimer0B_Handler [WEAK]
EXPORT WideTimer1A_Handler [WEAK]
EXPORT WideTimer1B_Handler [WEAK]
EXPORT WideTimer2A_Handler [WEAK]
EXPORT WideTimer2B_Handler [WEAK]
EXPORT WideTimer3A_Handler [WEAK]
EXPORT WideTimer3B_Handler [WEAK]
EXPORT WideTimer4A_Handler [WEAK]
EXPORT WideTimer4B_Handler [WEAK]
EXPORT WideTimer5A_Handler [WEAK]
EXPORT WideTimer5B_Handler [WEAK]
EXPORT FPU_Handler [WEAK]
EXPORT PECI0_Handler [WEAK]
EXPORT LPC0_Handler [WEAK]
EXPORT I2C4_Handler [WEAK]
EXPORT I2C5_Handler [WEAK]
EXPORT GPIOPortM_Handler [WEAK]
EXPORT GPIOPortN_Handler [WEAK]
EXPORT Quadrature2_Handler [WEAK]
EXPORT Fan0_Handler [WEAK]
EXPORT GPIOPortP_Handler [WEAK]
EXPORT GPIOPortP1_Handler [WEAK]
EXPORT GPIOPortP2_Handler [WEAK]
EXPORT GPIOPortP3_Handler [WEAK]
EXPORT GPIOPortP4_Handler [WEAK]
EXPORT GPIOPortP5_Handler [WEAK]
EXPORT GPIOPortP6_Handler [WEAK]
EXPORT GPIOPortP7_Handler [WEAK]
EXPORT GPIOPortQ_Handler [WEAK]
EXPORT GPIOPortQ1_Handler [WEAK]
EXPORT GPIOPortQ2_Handler [WEAK]
EXPORT GPIOPortQ3_Handler [WEAK]
EXPORT GPIOPortQ4_Handler [WEAK]
EXPORT GPIOPortQ5_Handler [WEAK]
EXPORT GPIOPortQ6_Handler [WEAK]
EXPORT GPIOPortQ7_Handler [WEAK]
EXPORT GPIOPortR_Handler [WEAK]
EXPORT GPIOPortS_Handler [WEAK]
EXPORT PWM1Generator0_Handler [WEAK]
EXPORT PWM1Generator1_Handler [WEAK]
EXPORT PWM1Generator2_Handler [WEAK]
EXPORT PWM1Generator3_Handler [WEAK]
EXPORT PWM1Fault_Handler [WEAK]
GPIOPortA_Handler
GPIOPortB_Handler
GPIOPortC_Handler
GPIOPortD_Handler
GPIOPortE_Handler
UART0_Handler
UART1_Handler
SSI0_Handler
I2C0_Handler
PWM0Fault_Handler
PWM0Generator0_Handler
PWM0Generator1_Handler
PWM0Generator2_Handler
Quadrature0_Handler
ADC0Seq0_Handler
ADC0Seq1_Handler
ADC0Seq2_Handler
ADC0Seq3_Handler
WDT_Handler
Timer0A_Handler
Timer0B_Handler
Timer1A_Handler
Timer1B_Handler
Timer2A_Handler
Timer2B_Handler
Comp0_Handler
Comp1_Handler
Comp2_Handler
SysCtl_Handler
FlashCtl_Handler
GPIOPortF_Handler
GPIOPortG_Handler
GPIOPortH_Handler
UART2_Handler
SSI1_Handler
Timer3A_Handler
Timer3B_Handler
I2C1_Handler
Quadrature1_Handler
CAN0_Handler
CAN1_Handler
CAN2_Handler
Ethernet_Handler
Hibernate_Handler
USB0_Handler
PWM0Generator3_Handler
uDMA_Handler
uDMA_Error
ADC1Seq0_Handler
ADC1Seq1_Handler
ADC1Seq2_Handler
ADC1Seq3_Handler
I2S0_Handler
ExtBus_Handler
GPIOPortJ_Handler
GPIOPortK_Handler
GPIOPortL_Handler
SSI2_Handler
SSI3_Handler
UART3_Handler
UART4_Handler
UART5_Handler
UART6_Handler
UART7_Handler
I2C2_Handler
I2C3_Handler
Timer4A_Handler
Timer4B_Handler
Timer5A_Handler
Timer5B_Handler
WideTimer0A_Handler
WideTimer0B_Handler
WideTimer1A_Handler
WideTimer1B_Handler
WideTimer2A_Handler
WideTimer2B_Handler
WideTimer3A_Handler
WideTimer3B_Handler
WideTimer4A_Handler
WideTimer4B_Handler
WideTimer5A_Handler
WideTimer5B_Handler
FPU_Handler
PECI0_Handler
LPC0_Handler
I2C4_Handler
I2C5_Handler
GPIOPortM_Handler
GPIOPortN_Handler
Quadrature2_Handler
Fan0_Handler
GPIOPortP_Handler
GPIOPortP1_Handler
GPIOPortP2_Handler
GPIOPortP3_Handler
GPIOPortP4_Handler
GPIOPortP5_Handler
GPIOPortP6_Handler
GPIOPortP7_Handler
GPIOPortQ_Handler
GPIOPortQ1_Handler
GPIOPortQ2_Handler
GPIOPortQ3_Handler
GPIOPortQ4_Handler
GPIOPortQ5_Handler
GPIOPortQ6_Handler
GPIOPortQ7_Handler
GPIOPortR_Handler
GPIOPortS_Handler
PWM1Generator0_Handler
PWM1Generator1_Handler
PWM1Generator2_Handler
PWM1Generator3_Handler
PWM1Fault_Handler
B .
ENDP
;****************************************************
**************************
;
; Make sure the end of this section is aligned.
;
;****************************************************
**************************
ALIGN
;****************************************************
**************************
;
; Some code in the normal code section for initializing the heap
and stack.
;
;****************************************************
**************************
AREA |.text|, CODE, READONLY
;****************************************************
**************************
;
; Useful functions.
;
;****************************************************
**************************
EXPORT DisableInterrupts
EXPORT EnableInterrupts
EXPORT StartCritical
EXPORT EndCritical
EXPORT WaitForInterrupt
;*********** DisableInterrupts ***************
; disable interrupts
; inputs: none
; outputs: none
DisableInterrupts
CPSID I
BX LR
;*********** EnableInterrupts ***************
; disable interrupts
; inputs: none
; outputs: none
EnableInterrupts
CPSIE I
BX LR
;*********** StartCritical ************************
; make a copy of previous I bit, disable interrupts
; inputs: none
; outputs: previous I bit
StartCritical
MRS R0, PRIMASK ; save old status
CPSID I ; mask all (except faults)
BX LR
;*********** EndCritical ************************
; using the copy of previous I bit, restore I bit to previous value
; inputs: previous I bit
; outputs: none
EndCritical
MSR PRIMASK, R0
BX LR
;*********** WaitForInterrupt ************************
; go to low power mode while waiting for the next interrupt
; inputs: none
; outputs: none
WaitForInterrupt
WFI
BX LR
;****************************************************
**************************
;
; Make sure the end of this section is aligned.
;
;****************************************************
**************************
ALIGN
;****************************************************
**************************
;
; Tell the assembler that we're done.
;
;****************************************************
**************************
END
Lab 02 EECE 237, Fall 2016 Semester
Objectives:
1. To gain experience with the ARM Assembly and the TI TIVA
C Launchpad
Development Board.
2. To gain experience of the Keil ARM development
environment and debugging
features.
3. To gain experience with the ARM I/O port con_guration and
interfacing GPIO
pins to buttons and LEDs.
Reference:
1. Textbook x4:1:1 and x4:2:1.
Introduction: In this experiment you will write assembly code to
control to implement
a rudimentary user interface of your launchpad. There are two
push buttons and three
LEDs that are mounted on your TM4C123 board as shown in
Figure 1.
Figure 1: Switch and LED interface on the Launchpad
In this lab, we will poll the switches and drive the LEDs in
interesting ways. The
challenge is con_guring the GPIO pins appropriately, reading
values from PF0 and
PF4 (your push buttons) and driving the appropriate output pins
in response (namely,
PF1, PF2, and PF3 for the red, blue, and green LEDs
respectively). Note from the
schematic in Figure 1 that the LEDs are positive logic and the
switches are negative
logic. Also, the switches will need pull-up resistors. This will
be provided by enabling
internal pull-ups in the TM4C123 through GPIO PORTF PUR R.
Experiment:
1. Download the project in eece237lab2.zip from the course
website as a starting
point. The _rst step is to initialize the TM4C123 GIPIO Port F
as appropriate
to the LEDs and push buttons that are mounted on the TIVA C
Development
board. As described in the course text in section 4.2.1 there are
several registers
that need to be set to speci_c values for PF0-PF4 to be
con_gured correctly. Do
this _rst.
2. Implement the following LED output behaviors based on the
button inputs.
_ If both buttons are simultaneously pressed we would like to
illuminate the
green LED, indicating the user has been granted access.
_ If only SW1 is pressed, light the Blue LED.
_ If only SW2 is pressed, light the Red LED.
_ If no buttons are pressed, no LEDs will be illuminated.
Your code should poll the switches and illuminate the LEDs as
described above.
You must use the Portf Input and Portf Output functions to
access
PortF. These two functions are provided in main2.s in
eece237lab2.zip.
What to turn in:
1. Write a document describing how you design your code using
owcharts. The
writeup is due on Oct. 10 at the beginning of the class. Print
your writeup on
paper to turn in.
2. The code is due on Oct. 9 at 11:00 pm. Submit your code in
Blackboard Learn. Compress yourcode in a .zip" _le and then
upload it to Blackboard Learn. Please include all the code that
makes your launchpad runnable.

More Related Content

Similar to eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx

# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docxmayank272369
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)Niraj Bharambe
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2srknec
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingMichelle Holley
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Dobrica Pavlinušić
 
Compact logix1769l32 l35-
Compact logix1769l32 l35-Compact logix1769l32 l35-
Compact logix1769l32 l35-Steven Qi
 
Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesCorrado Santoro
 
Datasheet PIC16f887
Datasheet PIC16f887Datasheet PIC16f887
Datasheet PIC16f887whendygarcia
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copymkazree
 
1763 in001 -en-p
1763 in001 -en-p1763 in001 -en-p
1763 in001 -en-ppmx
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller Gaurav Verma
 
Practical file
Practical filePractical file
Practical filerajeevkr35
 
plc_training_manual.pdf
plc_training_manual.pdfplc_training_manual.pdf
plc_training_manual.pdfMarioHaguila
 
RoboticCarKit_MANUAL
RoboticCarKit_MANUALRoboticCarKit_MANUAL
RoboticCarKit_MANUALElijah Barner
 

Similar to eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx (20)

# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx# peripheral registers  .equ PWR_BASE0x40007000    .equ PWR_CR0x00  .docx
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
P89v51rd2
P89v51rd2P89v51rd2
P89v51rd2
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
Compact logix1769l32 l35-
Compact logix1769l32 l35-Compact logix1769l32 l35-
Compact logix1769l32 l35-
 
Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR Libraries
 
Datasheet PIC16f887
Datasheet PIC16f887Datasheet PIC16f887
Datasheet PIC16f887
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
Pic16f87x1a
Pic16f87x1aPic16f87x1a
Pic16f87x1a
 
Catálogo Paradox G2K
Catálogo Paradox G2KCatálogo Paradox G2K
Catálogo Paradox G2K
 
1763 in001 -en-p
1763 in001 -en-p1763 in001 -en-p
1763 in001 -en-p
 
Módulo adc 18f4550
Módulo adc   18f4550Módulo adc   18f4550
Módulo adc 18f4550
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Practical file
Practical filePractical file
Practical file
 
plc_training_manual.pdf
plc_training_manual.pdfplc_training_manual.pdf
plc_training_manual.pdf
 
RoboticCarKit_MANUAL
RoboticCarKit_MANUALRoboticCarKit_MANUAL
RoboticCarKit_MANUAL
 
Automation-PLC
Automation-PLCAutomation-PLC
Automation-PLC
 
Introduction to PIC.pptx
Introduction to PIC.pptxIntroduction to PIC.pptx
Introduction to PIC.pptx
 

More from SALU18

AFRICAResearch Paper AssignmentInstructionsOverview.docx
AFRICAResearch Paper AssignmentInstructionsOverview.docxAFRICAResearch Paper AssignmentInstructionsOverview.docx
AFRICAResearch Paper AssignmentInstructionsOverview.docxSALU18
 
Adversarial ProceedingsCritically discuss with your classmates t.docx
Adversarial ProceedingsCritically discuss with your classmates t.docxAdversarial ProceedingsCritically discuss with your classmates t.docx
Adversarial ProceedingsCritically discuss with your classmates t.docxSALU18
 
Advances In Management .docx
Advances In Management                                        .docxAdvances In Management                                        .docx
Advances In Management .docxSALU18
 
African-American Literature An introduction to major African-Americ.docx
African-American Literature An introduction to major African-Americ.docxAfrican-American Literature An introduction to major African-Americ.docx
African-American Literature An introduction to major African-Americ.docxSALU18
 
African American Women and Healthcare I want to explain how heal.docx
African American Women and Healthcare I want to explain how heal.docxAfrican American Women and Healthcare I want to explain how heal.docx
African American Women and Healthcare I want to explain how heal.docxSALU18
 
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docx
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docxAdvocacy & Legislation in Early Childhood EducationAdvocacy & Le.docx
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docxSALU18
 
Advertising is one of the most common forms of visual persuasion we .docx
Advertising is one of the most common forms of visual persuasion we .docxAdvertising is one of the most common forms of visual persuasion we .docx
Advertising is one of the most common forms of visual persuasion we .docxSALU18
 
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docx
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docxAdult Health 1 Study GuideSensory Unit Chapters 63 & 64.docx
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docxSALU18
 
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docx
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docxAdvertising Campaign Management Part 3Jennifer Sundstrom-F.docx
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docxSALU18
 
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxAdopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxSALU18
 
ADM2302 M, N, P and Q Assignment # 4 Winter 2020 Page 1 .docx
ADM2302 M, N, P and Q  Assignment # 4 Winter 2020  Page 1 .docxADM2302 M, N, P and Q  Assignment # 4 Winter 2020  Page 1 .docx
ADM2302 M, N, P and Q Assignment # 4 Winter 2020 Page 1 .docxSALU18
 
Adlerian-Based Positive Group Counseling Interventions w ith.docx
Adlerian-Based Positive Group Counseling Interventions w ith.docxAdlerian-Based Positive Group Counseling Interventions w ith.docx
Adlerian-Based Positive Group Counseling Interventions w ith.docxSALU18
 
After completing the assessment, my Signature Theme Report produ.docx
After completing the assessment, my Signature Theme Report produ.docxAfter completing the assessment, my Signature Theme Report produ.docx
After completing the assessment, my Signature Theme Report produ.docxSALU18
 
After careful reading of the case material, consider and fully answe.docx
After careful reading of the case material, consider and fully answe.docxAfter careful reading of the case material, consider and fully answe.docx
After careful reading of the case material, consider and fully answe.docxSALU18
 
AffluentBe unique toConformDebatableDominantEn.docx
AffluentBe unique toConformDebatableDominantEn.docxAffluentBe unique toConformDebatableDominantEn.docx
AffluentBe unique toConformDebatableDominantEn.docxSALU18
 
Advocacy Advoc.docx
Advocacy Advoc.docxAdvocacy Advoc.docx
Advocacy Advoc.docxSALU18
 
Advanced persistent threats (APTs) have been thrust into the spotlig.docx
Advanced persistent threats (APTs) have been thrust into the spotlig.docxAdvanced persistent threats (APTs) have been thrust into the spotlig.docx
Advanced persistent threats (APTs) have been thrust into the spotlig.docxSALU18
 
Advanced persistent threatRecommendations for remediation .docx
Advanced persistent threatRecommendations for remediation .docxAdvanced persistent threatRecommendations for remediation .docx
Advanced persistent threatRecommendations for remediation .docxSALU18
 
Adultism refers to the oppression of young people by adults. The pop.docx
Adultism refers to the oppression of young people by adults. The pop.docxAdultism refers to the oppression of young people by adults. The pop.docx
Adultism refers to the oppression of young people by adults. The pop.docxSALU18
 
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docx
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docxADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docx
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docxSALU18
 

More from SALU18 (20)

AFRICAResearch Paper AssignmentInstructionsOverview.docx
AFRICAResearch Paper AssignmentInstructionsOverview.docxAFRICAResearch Paper AssignmentInstructionsOverview.docx
AFRICAResearch Paper AssignmentInstructionsOverview.docx
 
Adversarial ProceedingsCritically discuss with your classmates t.docx
Adversarial ProceedingsCritically discuss with your classmates t.docxAdversarial ProceedingsCritically discuss with your classmates t.docx
Adversarial ProceedingsCritically discuss with your classmates t.docx
 
Advances In Management .docx
Advances In Management                                        .docxAdvances In Management                                        .docx
Advances In Management .docx
 
African-American Literature An introduction to major African-Americ.docx
African-American Literature An introduction to major African-Americ.docxAfrican-American Literature An introduction to major African-Americ.docx
African-American Literature An introduction to major African-Americ.docx
 
African American Women and Healthcare I want to explain how heal.docx
African American Women and Healthcare I want to explain how heal.docxAfrican American Women and Healthcare I want to explain how heal.docx
African American Women and Healthcare I want to explain how heal.docx
 
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docx
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docxAdvocacy & Legislation in Early Childhood EducationAdvocacy & Le.docx
Advocacy & Legislation in Early Childhood EducationAdvocacy & Le.docx
 
Advertising is one of the most common forms of visual persuasion we .docx
Advertising is one of the most common forms of visual persuasion we .docxAdvertising is one of the most common forms of visual persuasion we .docx
Advertising is one of the most common forms of visual persuasion we .docx
 
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docx
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docxAdult Health 1 Study GuideSensory Unit Chapters 63 & 64.docx
Adult Health 1 Study GuideSensory Unit Chapters 63 & 64.docx
 
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docx
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docxAdvertising Campaign Management Part 3Jennifer Sundstrom-F.docx
Advertising Campaign Management Part 3Jennifer Sundstrom-F.docx
 
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxAdopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
 
ADM2302 M, N, P and Q Assignment # 4 Winter 2020 Page 1 .docx
ADM2302 M, N, P and Q  Assignment # 4 Winter 2020  Page 1 .docxADM2302 M, N, P and Q  Assignment # 4 Winter 2020  Page 1 .docx
ADM2302 M, N, P and Q Assignment # 4 Winter 2020 Page 1 .docx
 
Adlerian-Based Positive Group Counseling Interventions w ith.docx
Adlerian-Based Positive Group Counseling Interventions w ith.docxAdlerian-Based Positive Group Counseling Interventions w ith.docx
Adlerian-Based Positive Group Counseling Interventions w ith.docx
 
After completing the assessment, my Signature Theme Report produ.docx
After completing the assessment, my Signature Theme Report produ.docxAfter completing the assessment, my Signature Theme Report produ.docx
After completing the assessment, my Signature Theme Report produ.docx
 
After careful reading of the case material, consider and fully answe.docx
After careful reading of the case material, consider and fully answe.docxAfter careful reading of the case material, consider and fully answe.docx
After careful reading of the case material, consider and fully answe.docx
 
AffluentBe unique toConformDebatableDominantEn.docx
AffluentBe unique toConformDebatableDominantEn.docxAffluentBe unique toConformDebatableDominantEn.docx
AffluentBe unique toConformDebatableDominantEn.docx
 
Advocacy Advoc.docx
Advocacy Advoc.docxAdvocacy Advoc.docx
Advocacy Advoc.docx
 
Advanced persistent threats (APTs) have been thrust into the spotlig.docx
Advanced persistent threats (APTs) have been thrust into the spotlig.docxAdvanced persistent threats (APTs) have been thrust into the spotlig.docx
Advanced persistent threats (APTs) have been thrust into the spotlig.docx
 
Advanced persistent threatRecommendations for remediation .docx
Advanced persistent threatRecommendations for remediation .docxAdvanced persistent threatRecommendations for remediation .docx
Advanced persistent threatRecommendations for remediation .docx
 
Adultism refers to the oppression of young people by adults. The pop.docx
Adultism refers to the oppression of young people by adults. The pop.docxAdultism refers to the oppression of young people by adults. The pop.docx
Adultism refers to the oppression of young people by adults. The pop.docx
 
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docx
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docxADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docx
ADVANCE v.09212015 •APPLICANT DIVERSITY STATEMENT .docx
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx

  • 1. eece237lab2/EECE237Lab2.uvproj 1.1 ### uVision Project, (C) Keil Software EECE237Lab2 0x4 ARM-ADS LM4F120H5QR Texas Instruments IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2 "STARTUPLuminaryStartup.s" ("Luminary Startup Code") UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 - FN1 -FF0LM4F_256 -FS00 -FL040000) 5995 LM4Fxxxx.H
  • 13. eece237lab2/main2.s ;****************** main.s *************** ; Program written by: ***Your Name Here*** ; Date Created: 1/30/2015 ; EECE237 Fall Semester 2016 ; Lab number: 2 ; The overall objective of this system is a simple user interface ; Hardware connections ; PF0 is switch input (1 means switch is not pressed, 0 means switch is pressed) ; PF44 is switch input (1 means switch is not pressed, 0 means switch is pressed) ; PF1, 2, 3 are LED output (0 means door is locked, 1 means door is unlocked) ; The specific operation of this system is to unlock if both switches are pressed ; Useful declarations THUMB
  • 14. ; PortF register declarations GPIO_PORTF_DATA_R EQU 0x400253FC GPIO_PORTF_DIR_R EQU 0x40025400 GPIO_PORTF_AFSEL_R EQU 0x40025420 GPIO_PORTF_PUR_R EQU 0x40025510 GPIO_PORTF_DEN_R EQU 0x4002551C GPIO_PORTF_LOCK_R EQU 0x40025520 GPIO_PORTF_CR_R EQU 0x40025524 GPIO_PORTF_AMSEL_R EQU 0x40025528 GPIO_PORTF_PCTL_R EQU 0x4002552C GPIO_LOCK_KEY EQU 0x4C4F434B ; Unlocks the GPIO_CR register SYSCTL_RCGC2_R EQU 0x400FE108 SYSCTL_RCGC2_GPIOF EQU 0x00000020 ; port F Clock Gating Control AREA DATA, ALIGN=2 ; Global variables go here, you will not need any in lab2.
  • 15. ALIGN ; make sure the end of this section is aligned AREA |.text|, CODE, READONLY, ALIGN=2 EXPORT Start Start ; Write initialization code here. This segment is only executed once at reset ;------------PortF_Init------------ ; Initialize GPIO Port F for negative logic switches on PF0 and ; PF4 to match Launchpad wiring. Weak internal pull-up ; resistors are enabled, and the NMI functionality on PF0 is ; disabled. R,G, and B LED's Pins (PF1-PF3) set as outputs. ; Follows Valvano Text program 4.1. ; Input: none ; Output: none ; Modifies: R0, R1, R2 PortF_Init
  • 16. LDR R1, =SYSCTL_RCGC2_R ; 1) activate clock for Port F LDR R0, [R1] ORR R0, R0, #0x20 ; set bit 5 to turn on clock STR R0, [R1] NOP NOP ; allow time for clock to finish ; 2) unlock the lock register ; unlock GPIO Port F Commit Register ; enable commit for Port F ; 1 means allow access ; 3) disable analog functionality ; 0 means analog is off ; 4) configure as GPIO ; 0 means configure Port F as GPIO
  • 17. ; 5) set direction register ; PF0 and PF7-4 input, PF3-1 output ; 6) regular port function ; 0 means disable alternate function ; pull-up resistors for PF4,PF0 ; enable weak pull-up on PF0 and PF4 ; 7) enable Port F digital port ; 1 means enable digital I/O mainloop ; Write your main program here. This segment loops indefinitely while the microcontroller is on
  • 18. ; You must use the Portf_Input and Portf_Output functions to access PortF B mainloop ;infinite main loop ; Useful Functions ; (From Valvano Text Program 4.1) ;------------PortF_Input------ ; Read ProtF ; Input: none ; Output: R0 value read from PortF ; Modifies: R1 PortF_Input LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F data LDR R0, [R1] ; read all of PortF AND R0,R0,#0x11 ; just the input pins, bits 4,0 BX LR ; return R0 with inputs
  • 19. ;------------PortF_Output------ ; Set the output state of PF3-1. ; Input: R0 new state of PF ; Output: none ; Modifies: R1 PortF_Output LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F data STR R0, [R1] ; write to PF3-1 BX LR ALIGN ; make sure the end of this section is aligned (For the code/data to follow) END ; mark end of file eece237lab2/startup.s ; <<< Use Configuration Wizard in Context Menu >>> ;**************************************************** **************************
  • 20. ; ; startup_rvmdk.S - Startup code for use with Keil's uVision. ; ; Copyright (c) 2012 Texas Instruments Incorporated. All rights reserved. ; Software License Agreement ; ; Texas Instruments (TI) is supplying this software for use solely and ; exclusively on TI's microcontroller products. The software is owned by ; TI and/or its suppliers, and is protected under applicable copyright ; laws. You may not combine this software with "viral" open- source ; software in order to form a larger program. ; ; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. ; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  • 21. ; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY ; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL ; DAMAGES, FOR ANY REASON WHATSOEVER. ; ; This is part of revision 9453 of the EK-LM4F120XL Firmware Package. ; ;**************************************************** ************************** ; Edited to conform with ISR names as described in ; "Embedded Systems: Introduction to ARM Cortex M Microcontrollers", ; ISBN: 978-1469998749, Jonathan Valvano, copyright (c) 2012 ; "Embedded Systems: Real Time Interfacing to ARM Cortex M Microcontrollers", ; ISBN: 978-1463590154, Jonathan Valvano, copyright (c) 2012 ; "Embedded Systems: Real-Time Operating Systems for ARM
  • 22. Cortex M Microcontrollers", ; ISBN: 978-1466468863, Jonathan Valvano, copyright (c) 2013 ; ;**************************************************** ************************** ; ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;**************************************************** ************************** Stack EQU 0x00000400 ;**************************************************** ************************** ; ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;**************************************************** ************************** Heap EQU 0x00000000
  • 23. ;**************************************************** ************************** ; ; Allocate space for the stack. ; ;**************************************************** ************************** AREA STACK, NOINIT, READWRITE, ALIGN=3 StackMem SPACE Stack __initial_sp ;**************************************************** ************************** ; ; Allocate space for the heap. ; ;**************************************************** **************************
  • 24. AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base HeapMem SPACE Heap __heap_limit ;**************************************************** ************************** ; ; Indicate that the code in this file preserves 8-byte alignment of the stack. ; ;**************************************************** ************************** PRESERVE8 ;**************************************************** ************************** ; ; Place code into the reset code section.
  • 25. ; ;**************************************************** ************************** AREA RESET, CODE, READONLY THUMB ;**************************************************** ************************** ; ; The vector table. ; ;**************************************************** ************************** EXPORT __Vectors __Vectors DCD StackMem + Stack ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler
  • 26. DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler DCD GPIOPortA_Handler ; GPIO Port A DCD GPIOPortB_Handler ; GPIO Port B DCD GPIOPortC_Handler ; GPIO Port C DCD GPIOPortD_Handler ; GPIO Port D DCD GPIOPortE_Handler ; GPIO Port E DCD UART0_Handler ; UART0 Rx and Tx
  • 27. DCD UART1_Handler ; UART1 Rx and Tx DCD SSI0_Handler ; SSI0 Rx and Tx DCD I2C0_Handler ; I2C0 Master and Slave DCD PWM0Fault_Handler ; PWM 0 Fault DCD PWM0Generator0_Handler ; PWM 0 Generator 0 DCD PWM0Generator1_Handler ; PWM 0 Generator 1 DCD PWM0Generator2_Handler ; PWM 0 Generator 2 DCD Quadrature0_Handler ; Quadrature Encoder 0 DCD ADC0Seq0_Handler ; ADC0 Sequence 0 DCD ADC0Seq1_Handler ; ADC0 Sequence 1 DCD ADC0Seq1_Handler ; ADC0 Sequence 2 DCD ADC0Seq1_Handler ; ADC0 Sequence 3 DCD WDT_Handler ; Watchdog DCD Timer0A_Handler ; Timer 0 subtimer A DCD Timer0B_Handler ; Timer 0 subtimer B DCD Timer1A_Handler ; Timer 1 subtimer A
  • 28. DCD Timer1B_Handler ; Timer 1 subtimer B DCD Timer2A_Handler ; Timer 2 subtimer A DCD Timer2B_Handler ; Timer 2 subtimer B DCD Comp0_Handler ; Analog Comp 0 DCD Comp1_Handler ; Analog Comp 1 DCD Comp2_Handler ; Analog Comp 2 DCD SysCtl_Handler ; System Control DCD FlashCtl_Handler ; Flash Control DCD GPIOPortF_Handler ; GPIO Port F DCD GPIOPortG_Handler ; GPIO Port G DCD GPIOPortH_Handler ; GPIO Port H DCD UART2_Handler ; UART2 Rx and Tx DCD SSI1_Handler ; SSI1 Rx and Tx DCD Timer3A_Handler ; Timer 3 subtimer A DCD Timer3B_Handler ; Timer 3 subtimer B DCD I2C1_Handler ; I2C1 Master and Slave DCD Quadrature1_Handler ; Quadrature Encoder 1 DCD CAN0_Handler ; CAN0
  • 29. DCD CAN1_Handler ; CAN1 DCD CAN2_Handler ; CAN2 DCD Ethernet_Handler ; Ethernet DCD Hibernate_Handler ; Hibernate DCD USB0_Handler ; USB0 DCD PWM0Generator3_Handler ; PWM 0 Generator 3 DCD uDMA_Handler ; uDMA Software Transfer DCD uDMA_Error ; uDMA Error DCD ADC1Seq0_Handler ; ADC1 Sequence 0 DCD ADC1Seq1_Handler ; ADC1 Sequence 1 DCD ADC1Seq2_Handler ; ADC1 Sequence 2 DCD ADC1Seq3_Handler ; ADC1 Sequence 3 DCD I2S0_Handler ; I2S0 DCD ExtBus_Handler ; External Bus Interface 0 DCD GPIOPortJ_Handler ; GPIO Port J DCD GPIOPortK_Handler ; GPIO Port K DCD GPIOPortL_Handler ; GPIO Port L
  • 30. DCD SSI2_Handler ; SSI2 Rx and Tx DCD SSI3_Handler ; SSI3 Rx and Tx DCD UART3_Handler ; UART3 Rx and Tx DCD UART4_Handler ; UART4 Rx and Tx DCD UART5_Handler ; UART5 Rx and Tx DCD UART6_Handler ; UART6 Rx and Tx DCD UART7_Handler ; UART7 Rx and Tx DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD I2C2_Handler ; I2C2 Master and Slave DCD I2C3_Handler ; I2C3 Master and Slave DCD Timer4A_Handler ; Timer 4 subtimer A DCD Timer4B_Handler ; Timer 4 subtimer B DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved
  • 31. DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD Timer5A_Handler ; Timer 5 subtimer A
  • 32. DCD Timer5B_Handler ; Timer 5 subtimer B DCD WideTimer0A_Handler ; Wide Timer 0 subtimer A DCD WideTimer0B_Handler ; Wide Timer 0 subtimer B DCD WideTimer1A_Handler ; Wide Timer 1 subtimer A DCD WideTimer1B_Handler ; Wide Timer 1 subtimer B DCD WideTimer2A_Handler ; Wide Timer 2 subtimer A DCD WideTimer2B_Handler ; Wide Timer 2 subtimer B DCD WideTimer3A_Handler ; Wide Timer 3 subtimer A DCD WideTimer3B_Handler ; Wide Timer 3 subtimer B DCD WideTimer4A_Handler ; Wide Timer 4 subtimer A DCD WideTimer4B_Handler ; Wide Timer 4 subtimer B DCD WideTimer5A_Handler ; Wide Timer 5 subtimer A
  • 33. DCD WideTimer5B_Handler ; Wide Timer 5 subtimer B DCD FPU_Handler ; FPU DCD PECI0_Handler ; PECI 0 DCD LPC0_Handler ; LPC 0 DCD I2C4_Handler ; I2C4 Master and Slave DCD I2C5_Handler ; I2C5 Master and Slave DCD GPIOPortM_Handler ; GPIO Port M DCD GPIOPortN_Handler ; GPIO Port N DCD Quadrature2_Handler ; Quadrature Encoder 2 DCD Fan0_Handler ; Fan 0 DCD 0 ; Reserved DCD GPIOPortP_Handler ; GPIO Port P (Summary or P0) DCD GPIOPortP1_Handler ; GPIO Port P1 DCD GPIOPortP2_Handler ; GPIO Port P2 DCD GPIOPortP3_Handler ; GPIO Port P3 DCD GPIOPortP4_Handler ; GPIO Port P4 DCD GPIOPortP5_Handler ; GPIO Port P5
  • 34. DCD GPIOPortP6_Handler ; GPIO Port P6 DCD GPIOPortP7_Handler ; GPIO Port P7 DCD GPIOPortQ_Handler ; GPIO Port Q (Summary or Q0) DCD GPIOPortQ1_Handler ; GPIO Port Q1 DCD GPIOPortQ2_Handler ; GPIO Port Q2 DCD GPIOPortQ3_Handler ; GPIO Port Q3 DCD GPIOPortQ4_Handler ; GPIO Port Q4 DCD GPIOPortQ5_Handler ; GPIO Port Q5 DCD GPIOPortQ6_Handler ; GPIO Port Q6 DCD GPIOPortQ7_Handler ; GPIO Port Q7 DCD GPIOPortR_Handler ; GPIO Port R DCD GPIOPortS_Handler ; GPIO Port S DCD PWM1Generator0_Handler ; PWM 1 Generator 0 DCD PWM1Generator1_Handler ; PWM 1 Generator 1 DCD PWM1Generator2_Handler ; PWM 1 Generator 2 DCD PWM1Generator3_Handler ; PWM 1 Generator 3
  • 35. DCD PWM1Fault_Handler ; PWM 1 Fault ;**************************************************** ************************** ; ; This is the code that gets called when the processor first starts execution ; following a reset event. ; ;**************************************************** ************************** EXPORT Reset_Handler Reset_Handler ; ; DO NOT Enable the floating-point unit. This must be done here to handle the ; case where main() uses floating-point and the function prologue saves ; floating-point registers (which will fault if floating-point is not ; enabled). Any configuration of the floating-point unit
  • 36. using ; DriverLib APIs must be done here prior to the floating- point unit ; being enabled. ; ; Note that this does not use DriverLib since it might not be included ; in this project. ; ; MOVW R0, #0xED88 ; MOVT R0, #0xE000 ; LDR R1, [R0] ; ORR R1, #0x00F00000 ; STR R1, [R0] ; ; Call the C library enty point that handles startup. This will copy ; the .data section initializers from flash to SRAM and zero fill the
  • 37. ; .bss section. ; IMPORT Start B Start ;call user assembly language program ;**************************************************** ************************** ; ; This is the code that gets called when the processor receives a NMI. This ; simply enters an infinite loop, preserving the system state for examination ; by a debugger. ; ;**************************************************** ************************** NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP
  • 38. ;**************************************************** ************************** ; ; This is the code that gets called when the processor receives a fault ; interrupt. This simply enters an infinite loop, preserving the system state ; for examination by a debugger. ; ;**************************************************** ************************** HardFault_Handler PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler PROC
  • 39. EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler
  • 40. PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP IntDefaultHandler PROC EXPORT GPIOPortA_Handler [WEAK] EXPORT GPIOPortB_Handler [WEAK] EXPORT GPIOPortC_Handler [WEAK]
  • 41. EXPORT GPIOPortD_Handler [WEAK] EXPORT GPIOPortE_Handler [WEAK] EXPORT UART0_Handler [WEAK] EXPORT UART1_Handler [WEAK] EXPORT SSI0_Handler [WEAK] EXPORT I2C0_Handler [WEAK] EXPORT PWM0Fault_Handler [WEAK] EXPORT PWM0Generator0_Handler [WEAK] EXPORT PWM0Generator1_Handler [WEAK] EXPORT PWM0Generator2_Handler [WEAK] EXPORT Quadrature0_Handler [WEAK] EXPORT ADC0Seq0_Handler [WEAK] EXPORT ADC0Seq1_Handler [WEAK] EXPORT ADC0Seq2_Handler [WEAK] EXPORT ADC0Seq3_Handler [WEAK] EXPORT WDT_Handler [WEAK] EXPORT Timer0A_Handler [WEAK] EXPORT Timer0B_Handler [WEAK]
  • 42. EXPORT Timer1A_Handler [WEAK] EXPORT Timer1B_Handler [WEAK] EXPORT Timer2A_Handler [WEAK] EXPORT Timer2B_Handler [WEAK] EXPORT Comp0_Handler [WEAK] EXPORT Comp1_Handler [WEAK] EXPORT Comp2_Handler [WEAK] EXPORT SysCtl_Handler [WEAK] EXPORT FlashCtl_Handler [WEAK] EXPORT GPIOPortF_Handler [WEAK] EXPORT GPIOPortG_Handler [WEAK] EXPORT GPIOPortH_Handler [WEAK] EXPORT UART2_Handler [WEAK] EXPORT SSI1_Handler [WEAK] EXPORT Timer3A_Handler [WEAK] EXPORT Timer3B_Handler [WEAK] EXPORT I2C1_Handler [WEAK] EXPORT Quadrature1_Handler [WEAK]
  • 43. EXPORT CAN0_Handler [WEAK] EXPORT CAN1_Handler [WEAK] EXPORT CAN2_Handler [WEAK] EXPORT Ethernet_Handler [WEAK] EXPORT Hibernate_Handler [WEAK] EXPORT USB0_Handler [WEAK] EXPORT PWM0Generator3_Handler [WEAK] EXPORT uDMA_Handler [WEAK] EXPORT uDMA_Error [WEAK] EXPORT ADC1Seq0_Handler [WEAK] EXPORT ADC1Seq1_Handler [WEAK] EXPORT ADC1Seq2_Handler [WEAK] EXPORT ADC1Seq3_Handler [WEAK] EXPORT I2S0_Handler [WEAK] EXPORT ExtBus_Handler [WEAK] EXPORT GPIOPortJ_Handler [WEAK] EXPORT GPIOPortK_Handler [WEAK] EXPORT GPIOPortL_Handler [WEAK]
  • 44. EXPORT SSI2_Handler [WEAK] EXPORT SSI3_Handler [WEAK] EXPORT UART3_Handler [WEAK] EXPORT UART4_Handler [WEAK] EXPORT UART5_Handler [WEAK] EXPORT UART6_Handler [WEAK] EXPORT UART7_Handler [WEAK] EXPORT I2C2_Handler [WEAK] EXPORT I2C3_Handler [WEAK] EXPORT Timer4A_Handler [WEAK] EXPORT Timer4B_Handler [WEAK] EXPORT Timer5A_Handler [WEAK] EXPORT Timer5B_Handler [WEAK] EXPORT WideTimer0A_Handler [WEAK] EXPORT WideTimer0B_Handler [WEAK] EXPORT WideTimer1A_Handler [WEAK] EXPORT WideTimer1B_Handler [WEAK] EXPORT WideTimer2A_Handler [WEAK]
  • 45. EXPORT WideTimer2B_Handler [WEAK] EXPORT WideTimer3A_Handler [WEAK] EXPORT WideTimer3B_Handler [WEAK] EXPORT WideTimer4A_Handler [WEAK] EXPORT WideTimer4B_Handler [WEAK] EXPORT WideTimer5A_Handler [WEAK] EXPORT WideTimer5B_Handler [WEAK] EXPORT FPU_Handler [WEAK] EXPORT PECI0_Handler [WEAK] EXPORT LPC0_Handler [WEAK] EXPORT I2C4_Handler [WEAK] EXPORT I2C5_Handler [WEAK] EXPORT GPIOPortM_Handler [WEAK] EXPORT GPIOPortN_Handler [WEAK] EXPORT Quadrature2_Handler [WEAK] EXPORT Fan0_Handler [WEAK] EXPORT GPIOPortP_Handler [WEAK] EXPORT GPIOPortP1_Handler [WEAK]
  • 46. EXPORT GPIOPortP2_Handler [WEAK] EXPORT GPIOPortP3_Handler [WEAK] EXPORT GPIOPortP4_Handler [WEAK] EXPORT GPIOPortP5_Handler [WEAK] EXPORT GPIOPortP6_Handler [WEAK] EXPORT GPIOPortP7_Handler [WEAK] EXPORT GPIOPortQ_Handler [WEAK] EXPORT GPIOPortQ1_Handler [WEAK] EXPORT GPIOPortQ2_Handler [WEAK] EXPORT GPIOPortQ3_Handler [WEAK] EXPORT GPIOPortQ4_Handler [WEAK] EXPORT GPIOPortQ5_Handler [WEAK] EXPORT GPIOPortQ6_Handler [WEAK] EXPORT GPIOPortQ7_Handler [WEAK] EXPORT GPIOPortR_Handler [WEAK] EXPORT GPIOPortS_Handler [WEAK] EXPORT PWM1Generator0_Handler [WEAK] EXPORT PWM1Generator1_Handler [WEAK]
  • 47. EXPORT PWM1Generator2_Handler [WEAK] EXPORT PWM1Generator3_Handler [WEAK] EXPORT PWM1Fault_Handler [WEAK] GPIOPortA_Handler GPIOPortB_Handler GPIOPortC_Handler GPIOPortD_Handler GPIOPortE_Handler UART0_Handler UART1_Handler SSI0_Handler I2C0_Handler PWM0Fault_Handler PWM0Generator0_Handler PWM0Generator1_Handler PWM0Generator2_Handler Quadrature0_Handler
  • 54. ; ;**************************************************** ************************** ALIGN ;**************************************************** ************************** ; ; Some code in the normal code section for initializing the heap and stack. ; ;**************************************************** ************************** AREA |.text|, CODE, READONLY ;**************************************************** ************************** ; ; Useful functions. ;
  • 55. ;**************************************************** ************************** EXPORT DisableInterrupts EXPORT EnableInterrupts EXPORT StartCritical EXPORT EndCritical EXPORT WaitForInterrupt ;*********** DisableInterrupts *************** ; disable interrupts ; inputs: none ; outputs: none DisableInterrupts CPSID I BX LR ;*********** EnableInterrupts *************** ; disable interrupts ; inputs: none
  • 56. ; outputs: none EnableInterrupts CPSIE I BX LR ;*********** StartCritical ************************ ; make a copy of previous I bit, disable interrupts ; inputs: none ; outputs: previous I bit StartCritical MRS R0, PRIMASK ; save old status CPSID I ; mask all (except faults) BX LR ;*********** EndCritical ************************ ; using the copy of previous I bit, restore I bit to previous value ; inputs: previous I bit ; outputs: none
  • 57. EndCritical MSR PRIMASK, R0 BX LR ;*********** WaitForInterrupt ************************ ; go to low power mode while waiting for the next interrupt ; inputs: none ; outputs: none WaitForInterrupt WFI BX LR ;**************************************************** ************************** ; ; Make sure the end of this section is aligned.
  • 58. ; ;**************************************************** ************************** ALIGN ;**************************************************** ************************** ; ; Tell the assembler that we're done. ; ;**************************************************** ************************** END eece237lab2/EECE237Lab2.uvproj 1.1 ### uVision Project, (C) Keil Software EECE237Lab2
  • 59. 0x4 ARM-ADS LM4F120H5QR Texas Instruments IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2 "STARTUPLuminaryStartup.s" ("Luminary Startup Code") UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 - FN1 -FF0LM4F_256 -FS00 -FL040000) 5995 LM4Fxxxx.H SFDLuminaryLM4F120H5QR.SFR 0 0 Luminary Luminary 0 0 0
  • 70. Source Code main2.s 2 .main2.s startup.s 2 .startup.s eece237lab2/main2.s ;****************** main.s *************** ; Program written by: ***Your Name Here*** ; Date Created: 1/30/2015 ; EECE237 Fall Semester 2016 ; Lab number: 2 ; The overall objective of this system is a simple user interface
  • 71. ; Hardware connections ; PF0 is switch input (1 means switch is not pressed, 0 means switch is pressed) ; PF44 is switch input (1 means switch is not pressed, 0 means switch is pressed) ; PF1, 2, 3 are LED output (0 means door is locked, 1 means door is unlocked) ; The specific operation of this system is to unlock if both switches are pressed ; Useful declarations THUMB ; PortF register declarations GPIO_PORTF_DATA_R EQU 0x400253FC GPIO_PORTF_DIR_R EQU 0x40025400 GPIO_PORTF_AFSEL_R EQU 0x40025420 GPIO_PORTF_PUR_R EQU 0x40025510 GPIO_PORTF_DEN_R EQU 0x4002551C GPIO_PORTF_LOCK_R EQU 0x40025520
  • 72. GPIO_PORTF_CR_R EQU 0x40025524 GPIO_PORTF_AMSEL_R EQU 0x40025528 GPIO_PORTF_PCTL_R EQU 0x4002552C GPIO_LOCK_KEY EQU 0x4C4F434B ; Unlocks the GPIO_CR register SYSCTL_RCGC2_R EQU 0x400FE108 SYSCTL_RCGC2_GPIOF EQU 0x00000020 ; port F Clock Gating Control AREA DATA, ALIGN=2 ; Global variables go here, you will not need any in lab2. ALIGN ; make sure the end of this section is aligned AREA |.text|, CODE, READONLY, ALIGN=2 EXPORT Start Start ; Write initialization code here. This segment is only executed once at reset
  • 73. ;------------PortF_Init------------ ; Initialize GPIO Port F for negative logic switches on PF0 and ; PF4 to match Launchpad wiring. Weak internal pull-up ; resistors are enabled, and the NMI functionality on PF0 is ; disabled. R,G, and B LED's Pins (PF1-PF3) set as outputs. ; Follows Valvano Text program 4.1. ; Input: none ; Output: none ; Modifies: R0, R1, R2 PortF_Init LDR R1, =SYSCTL_RCGC2_R ; 1) activate clock for Port F LDR R0, [R1] ORR R0, R0, #0x20 ; set bit 5 to turn on clock STR R0, [R1] NOP NOP ; allow time for clock to finish ; 2) unlock the
  • 74. lock register ; unlock GPIO Port F Commit Register ; enable commit for Port F ; 1 means allow access ; 3) disable analog functionality ; 0 means analog is off ; 4) configure as GPIO ; 0 means configure Port F as GPIO ; 5) set direction register ; PF0 and PF7-4 input, PF3-1 output ; 6) regular port function ; 0 means disable alternate function ; pull-up resistors
  • 75. for PF4,PF0 ; enable weak pull-up on PF0 and PF4 ; 7) enable Port F digital port ; 1 means enable digital I/O mainloop ; Write your main program here. This segment loops indefinitely while the microcontroller is on ; You must use the Portf_Input and Portf_Output functions to access PortF B mainloop ;infinite main loop ; Useful Functions ; (From Valvano Text Program 4.1) ;------------PortF_Input------
  • 76. ; Read ProtF ; Input: none ; Output: R0 value read from PortF ; Modifies: R1 PortF_Input LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F data LDR R0, [R1] ; read all of PortF AND R0,R0,#0x11 ; just the input pins, bits 4,0 BX LR ; return R0 with inputs ;------------PortF_Output------ ; Set the output state of PF3-1. ; Input: R0 new state of PF ; Output: none ; Modifies: R1 PortF_Output LDR R1, =GPIO_PORTF_DATA_R ; pointer to Port F
  • 77. data STR R0, [R1] ; write to PF3-1 BX LR ALIGN ; make sure the end of this section is aligned (For the code/data to follow) END ; mark end of file eece237lab2/startup.s ; <<< Use Configuration Wizard in Context Menu >>> ;**************************************************** ************************** ; ; startup_rvmdk.S - Startup code for use with Keil's uVision. ; ; Copyright (c) 2012 Texas Instruments Incorporated. All rights reserved. ; Software License Agreement ;
  • 78. ; Texas Instruments (TI) is supplying this software for use solely and ; exclusively on TI's microcontroller products. The software is owned by ; TI and/or its suppliers, and is protected under applicable copyright ; laws. You may not combine this software with "viral" open- source ; software in order to form a larger program. ; ; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. ; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT ; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY ; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL ; DAMAGES, FOR ANY REASON WHATSOEVER. ; ; This is part of revision 9453 of the EK-LM4F120XL Firmware
  • 79. Package. ; ;**************************************************** ************************** ; Edited to conform with ISR names as described in ; "Embedded Systems: Introduction to ARM Cortex M Microcontrollers", ; ISBN: 978-1469998749, Jonathan Valvano, copyright (c) 2012 ; "Embedded Systems: Real Time Interfacing to ARM Cortex M Microcontrollers", ; ISBN: 978-1463590154, Jonathan Valvano, copyright (c) 2012 ; "Embedded Systems: Real-Time Operating Systems for ARM Cortex M Microcontrollers", ; ISBN: 978-1466468863, Jonathan Valvano, copyright (c) 2013 ; ;**************************************************** ************************** ; ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  • 80. ; ;**************************************************** ************************** Stack EQU 0x00000400 ;**************************************************** ************************** ; ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;**************************************************** ************************** Heap EQU 0x00000000 ;**************************************************** ************************** ; ; Allocate space for the stack. ; ;**************************************************** **************************
  • 81. AREA STACK, NOINIT, READWRITE, ALIGN=3 StackMem SPACE Stack __initial_sp ;**************************************************** ************************** ; ; Allocate space for the heap. ; ;**************************************************** ************************** AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base HeapMem SPACE Heap __heap_limit ;****************************************************
  • 82. ************************** ; ; Indicate that the code in this file preserves 8-byte alignment of the stack. ; ;**************************************************** ************************** PRESERVE8 ;**************************************************** ************************** ; ; Place code into the reset code section. ; ;**************************************************** ************************** AREA RESET, CODE, READONLY THUMB ;**************************************************** **************************
  • 83. ; ; The vector table. ; ;**************************************************** ************************** EXPORT __Vectors __Vectors DCD StackMem + Stack ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved
  • 84. DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler DCD GPIOPortA_Handler ; GPIO Port A DCD GPIOPortB_Handler ; GPIO Port B DCD GPIOPortC_Handler ; GPIO Port C DCD GPIOPortD_Handler ; GPIO Port D DCD GPIOPortE_Handler ; GPIO Port E DCD UART0_Handler ; UART0 Rx and Tx DCD UART1_Handler ; UART1 Rx and Tx DCD SSI0_Handler ; SSI0 Rx and Tx DCD I2C0_Handler ; I2C0 Master and Slave DCD PWM0Fault_Handler ; PWM 0 Fault DCD PWM0Generator0_Handler ; PWM 0 Generator 0 DCD PWM0Generator1_Handler ; PWM 0 Generator 1
  • 85. DCD PWM0Generator2_Handler ; PWM 0 Generator 2 DCD Quadrature0_Handler ; Quadrature Encoder 0 DCD ADC0Seq0_Handler ; ADC0 Sequence 0 DCD ADC0Seq1_Handler ; ADC0 Sequence 1 DCD ADC0Seq1_Handler ; ADC0 Sequence 2 DCD ADC0Seq1_Handler ; ADC0 Sequence 3 DCD WDT_Handler ; Watchdog DCD Timer0A_Handler ; Timer 0 subtimer A DCD Timer0B_Handler ; Timer 0 subtimer B DCD Timer1A_Handler ; Timer 1 subtimer A DCD Timer1B_Handler ; Timer 1 subtimer B DCD Timer2A_Handler ; Timer 2 subtimer A DCD Timer2B_Handler ; Timer 2 subtimer B DCD Comp0_Handler ; Analog Comp 0 DCD Comp1_Handler ; Analog Comp 1 DCD Comp2_Handler ; Analog Comp 2 DCD SysCtl_Handler ; System Control
  • 86. DCD FlashCtl_Handler ; Flash Control DCD GPIOPortF_Handler ; GPIO Port F DCD GPIOPortG_Handler ; GPIO Port G DCD GPIOPortH_Handler ; GPIO Port H DCD UART2_Handler ; UART2 Rx and Tx DCD SSI1_Handler ; SSI1 Rx and Tx DCD Timer3A_Handler ; Timer 3 subtimer A DCD Timer3B_Handler ; Timer 3 subtimer B DCD I2C1_Handler ; I2C1 Master and Slave DCD Quadrature1_Handler ; Quadrature Encoder 1 DCD CAN0_Handler ; CAN0 DCD CAN1_Handler ; CAN1 DCD CAN2_Handler ; CAN2 DCD Ethernet_Handler ; Ethernet DCD Hibernate_Handler ; Hibernate DCD USB0_Handler ; USB0 DCD PWM0Generator3_Handler ; PWM 0 Generator 3 DCD uDMA_Handler ; uDMA Software
  • 87. Transfer DCD uDMA_Error ; uDMA Error DCD ADC1Seq0_Handler ; ADC1 Sequence 0 DCD ADC1Seq1_Handler ; ADC1 Sequence 1 DCD ADC1Seq2_Handler ; ADC1 Sequence 2 DCD ADC1Seq3_Handler ; ADC1 Sequence 3 DCD I2S0_Handler ; I2S0 DCD ExtBus_Handler ; External Bus Interface 0 DCD GPIOPortJ_Handler ; GPIO Port J DCD GPIOPortK_Handler ; GPIO Port K DCD GPIOPortL_Handler ; GPIO Port L DCD SSI2_Handler ; SSI2 Rx and Tx DCD SSI3_Handler ; SSI3 Rx and Tx DCD UART3_Handler ; UART3 Rx and Tx DCD UART4_Handler ; UART4 Rx and Tx DCD UART5_Handler ; UART5 Rx and Tx DCD UART6_Handler ; UART6 Rx and Tx DCD UART7_Handler ; UART7 Rx and Tx
  • 88. DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD I2C2_Handler ; I2C2 Master and Slave DCD I2C3_Handler ; I2C3 Master and Slave DCD Timer4A_Handler ; Timer 4 subtimer A DCD Timer4B_Handler ; Timer 4 subtimer B DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved
  • 89. DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD Timer5A_Handler ; Timer 5 subtimer A DCD Timer5B_Handler ; Timer 5 subtimer B DCD WideTimer0A_Handler ; Wide Timer 0 subtimer A DCD WideTimer0B_Handler ; Wide Timer 0 subtimer B DCD WideTimer1A_Handler ; Wide Timer 1 subtimer A DCD WideTimer1B_Handler ; Wide Timer 1 subtimer B
  • 90. DCD WideTimer2A_Handler ; Wide Timer 2 subtimer A DCD WideTimer2B_Handler ; Wide Timer 2 subtimer B DCD WideTimer3A_Handler ; Wide Timer 3 subtimer A DCD WideTimer3B_Handler ; Wide Timer 3 subtimer B DCD WideTimer4A_Handler ; Wide Timer 4 subtimer A DCD WideTimer4B_Handler ; Wide Timer 4 subtimer B DCD WideTimer5A_Handler ; Wide Timer 5 subtimer A DCD WideTimer5B_Handler ; Wide Timer 5 subtimer B DCD FPU_Handler ; FPU DCD PECI0_Handler ; PECI 0 DCD LPC0_Handler ; LPC 0 DCD I2C4_Handler ; I2C4 Master and Slave DCD I2C5_Handler ; I2C5 Master and Slave DCD GPIOPortM_Handler ; GPIO Port M
  • 91. DCD GPIOPortN_Handler ; GPIO Port N DCD Quadrature2_Handler ; Quadrature Encoder 2 DCD Fan0_Handler ; Fan 0 DCD 0 ; Reserved DCD GPIOPortP_Handler ; GPIO Port P (Summary or P0) DCD GPIOPortP1_Handler ; GPIO Port P1 DCD GPIOPortP2_Handler ; GPIO Port P2 DCD GPIOPortP3_Handler ; GPIO Port P3 DCD GPIOPortP4_Handler ; GPIO Port P4 DCD GPIOPortP5_Handler ; GPIO Port P5 DCD GPIOPortP6_Handler ; GPIO Port P6 DCD GPIOPortP7_Handler ; GPIO Port P7 DCD GPIOPortQ_Handler ; GPIO Port Q (Summary or Q0) DCD GPIOPortQ1_Handler ; GPIO Port Q1 DCD GPIOPortQ2_Handler ; GPIO Port Q2 DCD GPIOPortQ3_Handler ; GPIO Port Q3 DCD GPIOPortQ4_Handler ; GPIO Port Q4
  • 92. DCD GPIOPortQ5_Handler ; GPIO Port Q5 DCD GPIOPortQ6_Handler ; GPIO Port Q6 DCD GPIOPortQ7_Handler ; GPIO Port Q7 DCD GPIOPortR_Handler ; GPIO Port R DCD GPIOPortS_Handler ; GPIO Port S DCD PWM1Generator0_Handler ; PWM 1 Generator 0 DCD PWM1Generator1_Handler ; PWM 1 Generator 1 DCD PWM1Generator2_Handler ; PWM 1 Generator 2 DCD PWM1Generator3_Handler ; PWM 1 Generator 3 DCD PWM1Fault_Handler ; PWM 1 Fault ;**************************************************** ************************** ; ; This is the code that gets called when the processor first starts execution ; following a reset event.
  • 93. ; ;**************************************************** ************************** EXPORT Reset_Handler Reset_Handler ; ; DO NOT Enable the floating-point unit. This must be done here to handle the ; case where main() uses floating-point and the function prologue saves ; floating-point registers (which will fault if floating-point is not ; enabled). Any configuration of the floating-point unit using ; DriverLib APIs must be done here prior to the floating- point unit ; being enabled. ; ; Note that this does not use DriverLib since it might not be included ; in this project.
  • 94. ; ; MOVW R0, #0xED88 ; MOVT R0, #0xE000 ; LDR R1, [R0] ; ORR R1, #0x00F00000 ; STR R1, [R0] ; ; Call the C library enty point that handles startup. This will copy ; the .data section initializers from flash to SRAM and zero fill the ; .bss section. ; IMPORT Start B Start ;call user assembly language program ;**************************************************** ************************** ;
  • 95. ; This is the code that gets called when the processor receives a NMI. This ; simply enters an infinite loop, preserving the system state for examination ; by a debugger. ; ;**************************************************** ************************** NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP ;**************************************************** ************************** ; ; This is the code that gets called when the processor receives a fault ; interrupt. This simply enters an infinite loop, preserving the system state ; for examination by a debugger.
  • 96. ; ;**************************************************** ************************** HardFault_Handler PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler PROC EXPORT BusFault_Handler [WEAK] B .
  • 97. ENDP UsageFault_Handler PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B .
  • 98. ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP IntDefaultHandler PROC EXPORT GPIOPortA_Handler [WEAK] EXPORT GPIOPortB_Handler [WEAK] EXPORT GPIOPortC_Handler [WEAK] EXPORT GPIOPortD_Handler [WEAK] EXPORT GPIOPortE_Handler [WEAK] EXPORT UART0_Handler [WEAK] EXPORT UART1_Handler [WEAK] EXPORT SSI0_Handler [WEAK] EXPORT I2C0_Handler [WEAK] EXPORT PWM0Fault_Handler [WEAK]
  • 99. EXPORT PWM0Generator0_Handler [WEAK] EXPORT PWM0Generator1_Handler [WEAK] EXPORT PWM0Generator2_Handler [WEAK] EXPORT Quadrature0_Handler [WEAK] EXPORT ADC0Seq0_Handler [WEAK] EXPORT ADC0Seq1_Handler [WEAK] EXPORT ADC0Seq2_Handler [WEAK] EXPORT ADC0Seq3_Handler [WEAK] EXPORT WDT_Handler [WEAK] EXPORT Timer0A_Handler [WEAK] EXPORT Timer0B_Handler [WEAK] EXPORT Timer1A_Handler [WEAK] EXPORT Timer1B_Handler [WEAK] EXPORT Timer2A_Handler [WEAK] EXPORT Timer2B_Handler [WEAK] EXPORT Comp0_Handler [WEAK] EXPORT Comp1_Handler [WEAK] EXPORT Comp2_Handler [WEAK]
  • 100. EXPORT SysCtl_Handler [WEAK] EXPORT FlashCtl_Handler [WEAK] EXPORT GPIOPortF_Handler [WEAK] EXPORT GPIOPortG_Handler [WEAK] EXPORT GPIOPortH_Handler [WEAK] EXPORT UART2_Handler [WEAK] EXPORT SSI1_Handler [WEAK] EXPORT Timer3A_Handler [WEAK] EXPORT Timer3B_Handler [WEAK] EXPORT I2C1_Handler [WEAK] EXPORT Quadrature1_Handler [WEAK] EXPORT CAN0_Handler [WEAK] EXPORT CAN1_Handler [WEAK] EXPORT CAN2_Handler [WEAK] EXPORT Ethernet_Handler [WEAK] EXPORT Hibernate_Handler [WEAK] EXPORT USB0_Handler [WEAK] EXPORT PWM0Generator3_Handler [WEAK]
  • 101. EXPORT uDMA_Handler [WEAK] EXPORT uDMA_Error [WEAK] EXPORT ADC1Seq0_Handler [WEAK] EXPORT ADC1Seq1_Handler [WEAK] EXPORT ADC1Seq2_Handler [WEAK] EXPORT ADC1Seq3_Handler [WEAK] EXPORT I2S0_Handler [WEAK] EXPORT ExtBus_Handler [WEAK] EXPORT GPIOPortJ_Handler [WEAK] EXPORT GPIOPortK_Handler [WEAK] EXPORT GPIOPortL_Handler [WEAK] EXPORT SSI2_Handler [WEAK] EXPORT SSI3_Handler [WEAK] EXPORT UART3_Handler [WEAK] EXPORT UART4_Handler [WEAK] EXPORT UART5_Handler [WEAK] EXPORT UART6_Handler [WEAK] EXPORT UART7_Handler [WEAK]
  • 102. EXPORT I2C2_Handler [WEAK] EXPORT I2C3_Handler [WEAK] EXPORT Timer4A_Handler [WEAK] EXPORT Timer4B_Handler [WEAK] EXPORT Timer5A_Handler [WEAK] EXPORT Timer5B_Handler [WEAK] EXPORT WideTimer0A_Handler [WEAK] EXPORT WideTimer0B_Handler [WEAK] EXPORT WideTimer1A_Handler [WEAK] EXPORT WideTimer1B_Handler [WEAK] EXPORT WideTimer2A_Handler [WEAK] EXPORT WideTimer2B_Handler [WEAK] EXPORT WideTimer3A_Handler [WEAK] EXPORT WideTimer3B_Handler [WEAK] EXPORT WideTimer4A_Handler [WEAK] EXPORT WideTimer4B_Handler [WEAK] EXPORT WideTimer5A_Handler [WEAK] EXPORT WideTimer5B_Handler [WEAK]
  • 103. EXPORT FPU_Handler [WEAK] EXPORT PECI0_Handler [WEAK] EXPORT LPC0_Handler [WEAK] EXPORT I2C4_Handler [WEAK] EXPORT I2C5_Handler [WEAK] EXPORT GPIOPortM_Handler [WEAK] EXPORT GPIOPortN_Handler [WEAK] EXPORT Quadrature2_Handler [WEAK] EXPORT Fan0_Handler [WEAK] EXPORT GPIOPortP_Handler [WEAK] EXPORT GPIOPortP1_Handler [WEAK] EXPORT GPIOPortP2_Handler [WEAK] EXPORT GPIOPortP3_Handler [WEAK] EXPORT GPIOPortP4_Handler [WEAK] EXPORT GPIOPortP5_Handler [WEAK] EXPORT GPIOPortP6_Handler [WEAK] EXPORT GPIOPortP7_Handler [WEAK] EXPORT GPIOPortQ_Handler [WEAK]
  • 104. EXPORT GPIOPortQ1_Handler [WEAK] EXPORT GPIOPortQ2_Handler [WEAK] EXPORT GPIOPortQ3_Handler [WEAK] EXPORT GPIOPortQ4_Handler [WEAK] EXPORT GPIOPortQ5_Handler [WEAK] EXPORT GPIOPortQ6_Handler [WEAK] EXPORT GPIOPortQ7_Handler [WEAK] EXPORT GPIOPortR_Handler [WEAK] EXPORT GPIOPortS_Handler [WEAK] EXPORT PWM1Generator0_Handler [WEAK] EXPORT PWM1Generator1_Handler [WEAK] EXPORT PWM1Generator2_Handler [WEAK] EXPORT PWM1Generator3_Handler [WEAK] EXPORT PWM1Fault_Handler [WEAK] GPIOPortA_Handler GPIOPortB_Handler GPIOPortC_Handler
  • 111. PWM1Generator2_Handler PWM1Generator3_Handler PWM1Fault_Handler B . ENDP ;**************************************************** ************************** ; ; Make sure the end of this section is aligned. ; ;**************************************************** ************************** ALIGN ;**************************************************** ************************** ;
  • 112. ; Some code in the normal code section for initializing the heap and stack. ; ;**************************************************** ************************** AREA |.text|, CODE, READONLY ;**************************************************** ************************** ; ; Useful functions. ; ;**************************************************** ************************** EXPORT DisableInterrupts EXPORT EnableInterrupts EXPORT StartCritical EXPORT EndCritical EXPORT WaitForInterrupt
  • 113. ;*********** DisableInterrupts *************** ; disable interrupts ; inputs: none ; outputs: none DisableInterrupts CPSID I BX LR ;*********** EnableInterrupts *************** ; disable interrupts ; inputs: none ; outputs: none EnableInterrupts CPSIE I BX LR ;*********** StartCritical ************************ ; make a copy of previous I bit, disable interrupts
  • 114. ; inputs: none ; outputs: previous I bit StartCritical MRS R0, PRIMASK ; save old status CPSID I ; mask all (except faults) BX LR ;*********** EndCritical ************************ ; using the copy of previous I bit, restore I bit to previous value ; inputs: previous I bit ; outputs: none EndCritical MSR PRIMASK, R0 BX LR ;*********** WaitForInterrupt ************************ ; go to low power mode while waiting for the next interrupt ; inputs: none
  • 115. ; outputs: none WaitForInterrupt WFI BX LR ;**************************************************** ************************** ; ; Make sure the end of this section is aligned. ; ;**************************************************** ************************** ALIGN ;**************************************************** ************************** ;
  • 116. ; Tell the assembler that we're done. ; ;**************************************************** ************************** END Lab 02 EECE 237, Fall 2016 Semester Objectives: 1. To gain experience with the ARM Assembly and the TI TIVA C Launchpad Development Board. 2. To gain experience of the Keil ARM development environment and debugging features. 3. To gain experience with the ARM I/O port con_guration and interfacing GPIO pins to buttons and LEDs. Reference: 1. Textbook x4:1:1 and x4:2:1. Introduction: In this experiment you will write assembly code to control to implement a rudimentary user interface of your launchpad. There are two push buttons and three LEDs that are mounted on your TM4C123 board as shown in Figure 1. Figure 1: Switch and LED interface on the Launchpad In this lab, we will poll the switches and drive the LEDs in interesting ways. The challenge is con_guring the GPIO pins appropriately, reading values from PF0 and
  • 117. PF4 (your push buttons) and driving the appropriate output pins in response (namely, PF1, PF2, and PF3 for the red, blue, and green LEDs respectively). Note from the schematic in Figure 1 that the LEDs are positive logic and the switches are negative logic. Also, the switches will need pull-up resistors. This will be provided by enabling internal pull-ups in the TM4C123 through GPIO PORTF PUR R. Experiment: 1. Download the project in eece237lab2.zip from the course website as a starting point. The _rst step is to initialize the TM4C123 GIPIO Port F as appropriate to the LEDs and push buttons that are mounted on the TIVA C Development board. As described in the course text in section 4.2.1 there are several registers that need to be set to speci_c values for PF0-PF4 to be con_gured correctly. Do this _rst. 2. Implement the following LED output behaviors based on the button inputs. _ If both buttons are simultaneously pressed we would like to illuminate the green LED, indicating the user has been granted access. _ If only SW1 is pressed, light the Blue LED. _ If only SW2 is pressed, light the Red LED. _ If no buttons are pressed, no LEDs will be illuminated. Your code should poll the switches and illuminate the LEDs as described above. You must use the Portf Input and Portf Output functions to access PortF. These two functions are provided in main2.s in eece237lab2.zip. What to turn in:
  • 118. 1. Write a document describing how you design your code using owcharts. The writeup is due on Oct. 10 at the beginning of the class. Print your writeup on paper to turn in. 2. The code is due on Oct. 9 at 11:00 pm. Submit your code in Blackboard Learn. Compress yourcode in a .zip" _le and then upload it to Blackboard Learn. Please include all the code that makes your launchpad runnable.