Question: I need help with my assembly code This segment below is giving me errror of expecting opcode or Macro ( both EQU and SET don't

I need help with my assembly code
This segment below is giving me errror of expecting opcode or Macro (both EQU and SET don't work)
; Subroutine to configure individual GPIO ports A and B
Configure_GPIO_Ports PROC
; Define base addresses for GPIO Ports A and B
GPIOA_BASE EQU 0x40020000
GPIOB_BASE EQU 0x40020400
; Define offsets for GPIO registers
MODER_OFFSET EQU 0x00
OTYPER_OFFSET EQU 0x04
OSPEEDR_OFFSET EQU 0x08
PUPDR_OFFSET EQU 0x0C
; Define values for GPIO registers
GPIOA_MODER_VALUE EQU 0xA8000000 ; Corresponding to the configuration required for GPIO Port A
GPIOB_MODER_VALUE EQU 0x00000280 ; Corresponding to the configuration required for GPIO Port B
GPIOA_OTYPER_VALUE EQU 0x00000000 ; No open-drain output for GPIO Port A
GPIOB_OTYPER_VALUE EQU 0x00000000 ; No open-drain output for GPIO Port B
GPIOA_OSPEEDR_VALUE EQU 0x0C000000 ; High speed for GPIO Port A
GPIOB_OSPEEDR_VALUE EQU 0x000000C0 ; High speed for GPIO Port B
GPIOA_PUPDR_VALUE EQU 0x64000000 ; Pull-down for GPIO Port A
GPIOB_PUPDR_VALUE EQU 0x00000100 ; Pull-down for GPIO Port B
My full; Vector Table - mapped to address 0 at reset.
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD 0x20010000 ; Initial Stack pointer value (place it at the start of RAM).
DCD Reset_Handler ; Reset_Handler location
; Code Section
AREA |.text|, CODE, READONLY
EXPORT Reset_Handler
Reset_Handler PROC
; Initialize stack pointer to the top of the stack.
LDR SP,=stack_top
; Configure RCC module to enable GPIOA and GPIOB subsystems
BL Configure_GPIO
; Configure individual GPIO ports
BL Configure_GPIO_Ports
; Main loop
Main BL Read_GPIO_Inputs
BL Decode_Inputs
BL LED4_Operation
BL LED3_Operation
BL Delay50ms
B Main
ENDP
; Subroutine to configure RCC module to enable GPIOA and GPIOB subsystems
Configure_GPIO PROC
; Read-modify-write to RCC_AHB1RSTR register
LDR R0,=0x40023810 ; RCC_AHB1RSTR register address
LDR R1,[R0] ; Read the current value
ORR R1, R1, #0x03 ; Set corresponding bits for GPIOA and GPIOB
STR R1,[R0] ; Write back the modified value
; Read-modify-write to RCC_AHB1ENR register
LDR R0,=0x40023830 ; RCC_AHB1ENR register address
LDR R1,[R0] ; Read the current value
ORR R1, R1, #0x03 ; Set corresponding bits for GPIOA and GPIOB
STR R1,[R0] ; Write back the modified value
; Implement delay to ensure GPIO reset is successful
NOP
NOP
BX LR ; Return from subroutine
ENDP
; Subroutine to configure individual GPIO ports A and B
Configure_GPIO_Ports PROC
; Define base addresses for GPIO Ports A and B
GPIOA_BASE EQU 0x40020000
GPIOB_BASE EQU 0x40020400
; Define offsets for GPIO registers
MODER_OFFSET EQU 0x00
OTYPER_OFFSET EQU 0x04
OSPEEDR_OFFSET EQU 0x08
PUPDR_OFFSET EQU 0x0C
; Define values for GPIO registers
GPIOA_MODER_VALUE EQU 0xA8000000 ; Corresponding to the configuration required for GPIO Port A
GPIOB_MODER_VALUE EQU 0x00000280 ; Corresponding to the configuration required for GPIO Port B
GPIOA_OTYPER_VALUE EQU 0x00000000 ; No open-drain output for GPIO Port A
GPIOB_OTYPER_VALUE EQU 0x00000000 ; No open-drain output for GPIO Port B
GPIOA_OSPEEDR_VALUE EQU 0x0C000000 ; High speed for GPIO Port A
GPIOB_OSPEEDR_VALUE EQU 0x000000C0 ; High speed for GPIO Port B
GPIOA_PUPDR_VALUE EQU 0x64000000 ; Pull-down for GPIO Port A
GPIOB_PUPDR_VALUE EQU 0x00000100 ; Pull-down for GPIO Port B
; Configure GPIO Port A
LDR R0,=GPIOA_BASE
; Configure MODER register
LDR R1,=GPIOA_MODER_VALUE
STR R1,[R0, #MODER_OFFSET]
; Configure OTYPER register
LDR R1,=GPIOA_OTYPER_VALUE
STR R1,[R0, #OTYPER_OFFSET]
; Configure OSPEEDR register
LDR R1,=GPIOA_OSPEEDR_VALUE
STR R1,[R0, #OSPEEDR_OFFSET]
; Configure PUPDR register
LDR R1,=GPIOA_PUPDR_VALUE
STR R1,[R0, #PUPDR_OFFSET]
; Configure GPIO Port B
LDR R0,=GPIOB_BASE
; Configure MODER register
LDR R1,=GPIOB_MODER_VALUE
STR R1,[R0, #MODER_OFFSET]
; Configure OTYPER register
LDR R1,=GPIOB_OTYPER_VALUE
STR R1,[R0, #OTYPER_OFFSET]
; Configure OSPEEDR register
LDR R1,=GPIOB_OSPEEDR_VALUE
STR R1,[R0, #OSPEEDR_OFFSET]
; Configure PUPDR register
LDR R1,=GPIOB_PUPDR_VALUE
STR R1,[R0, #PUPDR_OFFSET]
BX LR ; Return from subroutine
ENDP
; Subroutine to read GPIO inputs
Read_GPIO_Inputs PROC
; Implement GPIO read operations here
; Update switch states in code below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!