Compare commits
No commits in common. "dev_efe" and "master" have entirely different histories.
15704
.metadata/.bak_0.log
15704
.metadata/.bak_0.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_1.log
15709
.metadata/.bak_1.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_2.log
15709
.metadata/.bak_2.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_3.log
15709
.metadata/.bak_3.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_4.log
15709
.metadata/.bak_4.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_5.log
15709
.metadata/.bak_5.log
File diff suppressed because it is too large
Load Diff
15709
.metadata/.bak_6.log
15709
.metadata/.bak_6.log
File diff suppressed because it is too large
Load Diff
12440
.metadata/.log
12440
.metadata/.log
File diff suppressed because it is too large
Load Diff
@ -49,12 +49,3 @@
|
|||||||
*** SESSION Feb. 28, 2026 20:03:36.773 -----------------------------------------
|
*** SESSION Feb. 28, 2026 20:03:36.773 -----------------------------------------
|
||||||
*** SESSION März 01, 2026 11:22:28.450 -----------------------------------------
|
*** SESSION März 01, 2026 11:22:28.450 -----------------------------------------
|
||||||
*** SESSION März 01, 2026 11:55:48.249 -----------------------------------------
|
*** SESSION März 01, 2026 11:55:48.249 -----------------------------------------
|
||||||
*** SESSION März 13, 2026 10:49:11.272 -----------------------------------------
|
|
||||||
*** SESSION März 16, 2026 12:55:55.445 -----------------------------------------
|
|
||||||
*** SESSION März 24, 2026 14:01:49.132 -----------------------------------------
|
|
||||||
*** SESSION März 24, 2026 14:11:29.704 -----------------------------------------
|
|
||||||
*** SESSION März 24, 2026 14:21:04.465 -----------------------------------------
|
|
||||||
*** SESSION Apr. 08, 2026 12:56:29.546 -----------------------------------------
|
|
||||||
*** SESSION Apr. 13, 2026 14:00:30.843 -----------------------------------------
|
|
||||||
*** SESSION Apr. 14, 2026 12:01:47.228 -----------------------------------------
|
|
||||||
*** SESSION Apr. 14, 2026 14:00:09.577 -----------------------------------------
|
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -7,8 +7,4 @@
|
|||||||
<section name="CResourceRenameRefactoringInputPage">
|
<section name="CResourceRenameRefactoringInputPage">
|
||||||
<item key="updateReferences" value="true"/>
|
<item key="updateReferences" value="true"/>
|
||||||
</section>
|
</section>
|
||||||
<section name="org.eclipse.cdt.ui.text.hover.CMacroExpansionExploration.internal">
|
|
||||||
<item key="size.width" value="1254"/>
|
|
||||||
<item key="size.height" value="180"/>
|
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,40 +1,10 @@
|
|||||||
15:21:31 **** Build of configuration Debug for project task1 ****
|
11:56:08 **** Incremental Build of configuration Debug for project task1 ****
|
||||||
make -j12 all
|
make -j12 all
|
||||||
arm-none-eabi-gcc "../Src/sketch.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/sketch.d" -MT"Src/sketch.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/sketch.o"
|
arm-none-eabi-size task1.elf
|
||||||
arm-none-eabi-gcc "../Src/task1.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/task1.d" -MT"Src/task1.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/task1.o"
|
text data bss dec hex filename
|
||||||
../Src/sketch.c: In function 'main':
|
1144 0 1568 2712 a98 task1.elf
|
||||||
../Src/sketch.c:11:42: error: expected expression before ')' token
|
Finished building: default.size.stdout
|
||||||
11 | while(/*schalter nicht gedrückt*/){}
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:12:9: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
|
|
||||||
12 | delay(10);
|
|
||||||
| ^~~~~
|
|
||||||
../Src/sketch.c:13:39: error: expected expression before ')' token
|
|
||||||
13 | while(/*schalter losgelassen*/){}
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:18:39: error: request for member 'length' in something not a structure or union
|
|
||||||
18 | for(int i; i < reihenfolge.length - 1 && aktiv = 1; i ++){
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:20:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
|
|
||||||
20 | if(i = 0){/*alles bis auf LED0 auschalten*/}
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:21:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
|
|
||||||
21 | if(i = 1){/*..*/}
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:24:44: error: expected expression before ')' token
|
|
||||||
24 | if(/*schalter gerückt*/){
|
|
||||||
| ^
|
|
||||||
../Src/sketch.c:32:42: error: expected expression before ')' token
|
|
||||||
32 | while(/*Taster gedrückt*/){}
|
|
||||||
| ^
|
|
||||||
make: *** [Src/subdir.mk:25: Src/sketch.o] Error 1
|
|
||||||
make: *** Waiting for unfinished jobs....
|
|
||||||
../Src/task1.c: In function 'GPIO_init':
|
|
||||||
../Src/task1.c:169:22: error: expected expression before '<<' token
|
|
||||||
169 | GPIOA->MODER &= ~(3 ^<< 2); // Versuch: LED 1 Mode löschen :klappt so
|
|
||||||
| ^~
|
|
||||||
make: *** [Src/subdir.mk:25: Src/task1.o] Error 1
|
|
||||||
"make -j12 all" terminated with exit code 2. Build might be incomplete.
|
|
||||||
|
|
||||||
15:21:32 Build Failed. 9 errors, 3 warnings. (took 171ms)
|
11:56:08 Build Finished. 0 errors, 0 warnings. (took 119ms)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
15:21:32 **** Build of configuration Debug for project task2 ****
|
11:52:45 **** Clean-only build of configuration Debug for project task2 ****
|
||||||
make -j12 all
|
make -j12 clean
|
||||||
Target all ready
|
|
||||||
|
|
||||||
15:21:32 Build Finished. 0 errors, 0 warnings. (took 175ms)
|
11:52:45 Build Finished. 0 errors, 0 warnings. (took 126ms)
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,7 @@
|
|||||||
17:16:03 **** Incremental Build of configuration Debug for project task3 ****
|
11:52:45 **** Clean-only build of configuration Debug for project task3 ****
|
||||||
make -j12 all
|
make -j12 clean
|
||||||
arm-none-eabi-gcc "../Src/task3.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/task3.d" -MT"Src/task3.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/task3.o"
|
makefile:62: *** multiple target patterns. Stop.
|
||||||
arm-none-eabi-gcc -o "task3.elf" @"objects.list" -mcpu=cortex-m4 -T"/home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/task3/STM32G431KBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="task3.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||||
Finished building target: task3.elf
|
|
||||||
|
|
||||||
arm-none-eabi-size task3.elf
|
|
||||||
arm-none-eabi-objdump -h -S task3.elf > "task3.list"
|
|
||||||
text data bss dec hex filename
|
|
||||||
1696 0 1576 3272 cc8 task3.elf
|
|
||||||
Finished building: default.size.stdout
|
|
||||||
|
|
||||||
Finished building: task3.list
|
|
||||||
|
|
||||||
|
|
||||||
17:16:03 Build Finished. 0 errors, 0 warnings. (took 278ms)
|
11:52:45 Build Failed. 1 errors, 0 warnings. (took 126ms)
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,7 @@
|
|||||||
15:21:32 **** Build of configuration Debug for project task4 ****
|
11:52:46 **** Clean-only build of configuration Debug for project task4 ****
|
||||||
make -j12 all
|
make -j12 clean
|
||||||
arm-none-eabi-gcc -mcpu=cortex-m4 -g3 -DDEBUG -c -x assembler-with-cpp -MMD -MP -MF"Startup/startup_stm32g431kbtx.d" -MT"Startup/startup_stm32g431kbtx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Startup/startup_stm32g431kbtx.o" "../Startup/startup_stm32g431kbtx.s"
|
makefile:62: *** multiple target patterns. Stop.
|
||||||
arm-none-eabi-gcc "../Startup/syscalls.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Startup/syscalls.d" -MT"Startup/syscalls.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Startup/syscalls.o"
|
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||||
arm-none-eabi-gcc "../Startup/sysmem.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Startup/sysmem.d" -MT"Startup/sysmem.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Startup/sysmem.o"
|
|
||||||
arm-none-eabi-gcc "../Src/task4.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/task4.d" -MT"Src/task4.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/task4.o"
|
|
||||||
arm-none-eabi-gcc "../Src/task4_it.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DSTM32G431KBTx -DSTM32 -DSTM32G4 -DNUCLEO_G431KB -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/task4_it.d" -MT"Src/task4_it.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/task4_it.o"
|
|
||||||
arm-none-eabi-gcc -o "task4.elf" @"objects.list" -mcpu=cortex-m4 -T"/home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/task4/STM32G431KBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="task4.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
|
||||||
Finished building target: task4.elf
|
|
||||||
|
|
||||||
arm-none-eabi-size task4.elf
|
|
||||||
arm-none-eabi-objdump -h -S task4.elf > "task4.list"
|
|
||||||
text data bss dec hex filename
|
|
||||||
968 0 1568 2536 9e8 task4.elf
|
|
||||||
Finished building: default.size.stdout
|
|
||||||
|
|
||||||
Finished building: task4.list
|
|
||||||
|
|
||||||
|
|
||||||
15:21:32 Build Finished. 0 errors, 0 warnings. (took 272ms)
|
11:52:46 Build Failed. 1 errors, 0 warnings. (took 127ms)
|
||||||
|
|
||||||
|
|||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #3]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,238 +0,0 @@
|
|||||||
/* ***************************************************************************************
|
|
||||||
# Project: task3 - C: Timer & Interrupts
|
|
||||||
# File: task3_it.s
|
|
||||||
#
|
|
||||||
# Language: C
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.1
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file,
|
|
||||||
# change ASM pseudo commands from .space to .org
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 17.02.2025 TK move ASM:Interrupts to task2, replace with C:Interrupts
|
|
||||||
# 24.06.2025 TK remove Systick
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
************************************************************************************** */
|
|
||||||
|
|
||||||
/* ------------------------------------ INCLUDES -------------------------------------- */
|
|
||||||
#include "stm32g431xx.h"
|
|
||||||
#include "STefi-Light.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ DEFINES --------------------------------------- */
|
|
||||||
/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */
|
|
||||||
extern void* _estack; // initial stack pointer from ldscript
|
|
||||||
extern void* Reset_Handler; // exception handler from startup code
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */
|
|
||||||
/* ------------------------------------ PROTOTYPES ------------------------------------ */
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ GLOBAL FUNCTIONS (Exceptions Handlers) -------- */
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: void ISR_error(void)
|
|
||||||
*
|
|
||||||
* Default interrupt handler for core interrupts.
|
|
||||||
* Enables the green and red LED on the STefi Light board.
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
void ISR_error(void)
|
|
||||||
{
|
|
||||||
/* init */
|
|
||||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // PA: clock on (LEDs)
|
|
||||||
GPIOA->ODR |= 0x0F;
|
|
||||||
GPIOA->MODER = (GPIOA->MODER & 0xFFFFFF00) | 0x11;
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{ /* light up the LEDs permanently */
|
|
||||||
GPIOA->ODR &= ~((1 << 2) | (1 << 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: void ISR_default(void)
|
|
||||||
*
|
|
||||||
* Default interrupt handler for non-core interrupts.
|
|
||||||
* Enables the blue and yellow LED on the STefi Light board.
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
void ISR_default(void)
|
|
||||||
{
|
|
||||||
/* init */
|
|
||||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // PA: clock on (LEDs)
|
|
||||||
GPIOA->ODR |= 0x0F;
|
|
||||||
GPIOA->MODER = (GPIOA->MODER & 0xFFFFFF00) | 0x44;
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{ /* light up the LEDs permanently */
|
|
||||||
GPIOA->ODR &= ~((1 << 3) | (1 << 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: Timer
|
|
||||||
*
|
|
||||||
* Timer interrupt is used for ...
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ INTERRUPT VECTOR TABLE ------------------------ */
|
|
||||||
|
|
||||||
__attribute__ ((section (".isr_vector")))
|
|
||||||
void (* const paIsrFunc[118])(void) =
|
|
||||||
{
|
|
||||||
/* --- core vectors --- */
|
|
||||||
(void *)&_estack, /* 00 (0x00000000) initial stack pointer */
|
|
||||||
(void *)&Reset_Handler, /* 01 (0x00000004) (prio: -3) initial program counter (leads to first command to execute) */
|
|
||||||
ISR_error, /* 02 (0x00000008) (prio: -2) non-maskable interrupt */
|
|
||||||
ISR_error, /* 03 (0x0000000C) (prio: -1) hard fault exception */
|
|
||||||
ISR_error, /* 04 (0x00000010) memory management */
|
|
||||||
ISR_error, /* 05 (0x00000014) bus fault - pre-fetch fault, memory access fault */
|
|
||||||
ISR_error, /* 06 (0x00000018) usage fault - undefined instruction or illegal state */
|
|
||||||
ISR_error, /* 07 (0x0000001C) reserved vector 7 */
|
|
||||||
ISR_error, /* 08 (0x00000020) reserved vector 8 */
|
|
||||||
ISR_error, /* 09 (0x00000024) reserved vector 9 */
|
|
||||||
ISR_error, /* 10 (0x00000028) reserved vector 10 */
|
|
||||||
ISR_error, /* 11 (0x0000002C) system service call via SWI instruction */
|
|
||||||
ISR_error, /* 12 (0x00000030) monitor */
|
|
||||||
ISR_error, /* 13 (0x00000034) reserved vector 13 */
|
|
||||||
ISR_error, /* 14 (0x00000038) pendable service call exception */
|
|
||||||
ISR_error, /* 15 (0x0000003C) SysTick exception */
|
|
||||||
/* --- non-core vectors --- */
|
|
||||||
ISR_default, /* 0 (0x00000040) window watchdog interrupt */
|
|
||||||
ISR_default, /* 1 (0x00000044) PVD through EXTI line 16 interrupt */
|
|
||||||
ISR_default, /* 2 (0x00000048) RTC/TAMP/CSS on LSE through EXTI line 19 interrupt */
|
|
||||||
ISR_default, /* 3 (0x0000004C) RTC Wakeup timer through EXTI line 20 interrupt */
|
|
||||||
ISR_default, /* 4 (0x00000050) Flash global interrupt */
|
|
||||||
ISR_default, /* 5 (0x00000054) RCC global interrupt */
|
|
||||||
EXTI_IRQHandler, /* 6 (0x00000058) EXTI Line 0 interrupt */
|
|
||||||
ISR_default, /* 7 (0x0000005C) EXTI Line 1 interrupt */
|
|
||||||
ISR_default, /* 8 (0x00000060) EXTI Line 2 interrupt */
|
|
||||||
ISR_default, /* 9 (0x00000064) EXTI Line 3 interrupt */
|
|
||||||
ISR_default, /* 10 (0x00000068) EXTI Line 4 interrupt */
|
|
||||||
ISR_default, /* 11 (0x0000006C) DMA1 channel 1 interrupt */
|
|
||||||
ISR_default, /* 12 (0x00000070) DMA1 channel 2 interrupt */
|
|
||||||
ISR_default, /* 13 (0x00000074) DMA1 channel 3 interrupt */
|
|
||||||
ISR_default, /* 14 (0x00000078) DMA1 channel 4 interrupt */
|
|
||||||
ISR_default, /* 15 (0x0000007C) DMA1 channel 5 interrupt */
|
|
||||||
ISR_default, /* 16 (0x00000080) DMA1 channel 6 interrupt */
|
|
||||||
ISR_default, /* 17 (0x00000084) DMA1 channel 7 interrupt */
|
|
||||||
ISR_default, /* 18 (0x00000088) ADC1 + ADC2 global interrupt */
|
|
||||||
ISR_default, /* 19 (0x0000008C) USB high priority interrupts */
|
|
||||||
ISR_default, /* 20 (0x00000090) USB low priority interrupts */
|
|
||||||
ISR_default, /* 21 (0x00000094) FDCAN1 interrupt 0 */
|
|
||||||
ISR_default, /* 22 (0x00000098) FDCAN1 interrupt 1 */
|
|
||||||
ISR_default, /* 23 (0x0000009C) EXTI line [9:5] interrupts */
|
|
||||||
ISR_default, /* 24 (0x000000A0) TIM1 break + TIM15 global interrupts */
|
|
||||||
ISR_default, /* 25 (0x000000A4) TIM1 update + TIM16 global interrupts */
|
|
||||||
ISR_default, /* 26 (0x000000A8) TIM1 trigger, commutation, direction change, index + TIM17 interrupts */
|
|
||||||
ISR_default, /* 27 (0x000000AC) TIM1 capture compare interrupt */
|
|
||||||
ISR_default, /* 28 (0x000000B0) TIM2 global interrupt */
|
|
||||||
ISR_default, /* 29 (0x000000B4) TIM3 global interrupt */
|
|
||||||
ISR_default, /* 30 (0x000000B8) TIM4 global interrupt */
|
|
||||||
ISR_default, /* 31 (0x000000BC) I2C1 event + EXTI line 23 interrupts */
|
|
||||||
ISR_default, /* 32 (0x000000C0) I2C1 error interrupt */
|
|
||||||
ISR_default, /* 33 (0x000000C4) I2C2 event + EXTI line 24 interrupts */
|
|
||||||
ISR_default, /* 34 (0x000000C8) I2C2 error interrupt */
|
|
||||||
ISR_default, /* 35 (0x000000CC) SPI1 global interrupt */
|
|
||||||
ISR_default, /* 36 (0x000000D0) SPI2 global interrupt */
|
|
||||||
ISR_default, /* 37 (0x000000D4) USART1 global + EXTI line 25 interrupts */
|
|
||||||
ISR_default, /* 38 (0x000000D8) USART2 global + EXTI line 26 interrupts */
|
|
||||||
ISR_default, /* 39 (0x000000DC) USART3 global + EXTI line 28 interrupts */
|
|
||||||
ISR_default, /* 40 (0x000000E0) EXTI line [15:10] interrupts */
|
|
||||||
ISR_default, /* 41 (0x000000E4) RTC alarms interrupts */
|
|
||||||
ISR_default, /* 42 (0x000000E8) USB wakeup from suspend trough EXTI line 18 interrupt */
|
|
||||||
ISR_default, /* 43 (0x000000EC) TIM8 break, transition error, index error interrupts */
|
|
||||||
ISR_default, /* 44 (0x000001F0) TIM8 update interrupt */
|
|
||||||
ISR_default, /* 45 (0x000001F4) TIM8 trigger, commutation, direction change, index interrupts */
|
|
||||||
ISR_default, /* 46 (0x000001F8) TIM8 capture compare interrupt */
|
|
||||||
ISR_default, /* 47 (0x000001FC) ADC3 global interrupt */
|
|
||||||
ISR_default, /* 48 (0x00000100) FSMC global interrupt */
|
|
||||||
ISR_default, /* 49 (0x00000104) LPTIM1 global interrupt */
|
|
||||||
ISR_default, /* 50 (0x00000108) TIM5 global interrupt */
|
|
||||||
ISR_default, /* 51 (0x0000010C) SPI3 global interrupt */
|
|
||||||
ISR_default, /* 52 (0x00000110) UART4 global + EXTI line 34 interrupts */
|
|
||||||
ISR_default, /* 53 (0x00000114) UART5 global + EXTI line 35 interrupts */
|
|
||||||
TIM6_DAC_IRQHandler, /* 54 (0x00000118) TIM6 + DAC1/3 underrun global interrupts */
|
|
||||||
ISR_default, /* 55 (0x0000011C) TIM7 + DAC2/4 underrun global interrupts */
|
|
||||||
ISR_default, /* 56 (0x00000120) DMA2 channel 1 interrupt */
|
|
||||||
ISR_default, /* 57 (0x00000124) DMA2 channel 2 interrupt */
|
|
||||||
ISR_default, /* 58 (0x00000128) DMA2 channel 3 interrupt */
|
|
||||||
ISR_default, /* 59 (0x0000012C) DMA2 channel 4 interrupt */
|
|
||||||
ISR_default, /* 60 (0x00000130) DMA2 channel 5 interrupt */
|
|
||||||
ISR_default, /* 61 (0x00000134) ADC4 global interrupt */
|
|
||||||
ISR_default, /* 62 (0x00000138) ADC5 global interrupt */
|
|
||||||
ISR_default, /* 63 (0x0000013C) UCPD1 global + EXTI line 43 interrupts */
|
|
||||||
ISR_default, /* 64 (0x00000140) COMP1/COMP2/COMP3 through EXTI lines 21/22/29 interrupts */
|
|
||||||
ISR_default, /* 65 (0x00000144) COMP4/COMP5/COMP6 through EXTI lines 30/31/32 interrupts */
|
|
||||||
ISR_default, /* 66 (0x00000148) COMP7 through EXTI line 33 interrupt */
|
|
||||||
ISR_default, /* 67 (0x0000014C) HRTIM master timer interrupt (hrtim_it1) */
|
|
||||||
ISR_default, /* 68 (0x00000150) HRTIM timer A interrupt (hrtim_it2) */
|
|
||||||
ISR_default, /* 69 (0x00000154) HRTIM timer B interrupt (hrtim_it3) */
|
|
||||||
ISR_default, /* 70 (0x00000158) HRTIM timer C interrupt (hrtim_it4) */
|
|
||||||
ISR_default, /* 71 (0x0000015C) HRTIM timer D interrupt (hrtim_it5) */
|
|
||||||
ISR_default, /* 72 (0x00000160) HRTIM timer E interrupt (hrtim_it6) */
|
|
||||||
ISR_default, /* 73 (0x00000164) HRTIM fault interrupt (hrtim_it8) */
|
|
||||||
ISR_default, /* 74 (0x00000168) HRTIM timer F interrupt (hrtim_it7) */
|
|
||||||
ISR_default, /* 75 (0x0000016C) CRS interrupt */
|
|
||||||
ISR_default, /* 76 (0x00000170) SAI */
|
|
||||||
ISR_default, /* 77 (0x00000174) TIM20 break, transition error, index error interrupts */
|
|
||||||
ISR_default, /* 78 (0x00000178) TIM20 update interrupt */
|
|
||||||
ISR_default, /* 79 (0x0000017C) TIM20 trigger, commutation, direction change, index interrupts */
|
|
||||||
ISR_default, /* 80 (0x00000180) TIM20 capture compare interrupt */
|
|
||||||
ISR_default, /* 81 (0x00000184) Floating point interrupt */
|
|
||||||
ISR_default, /* 82 (0x00000188) I2C4 event + EXTI line 4 interrupts */
|
|
||||||
ISR_default, /* 83 (0x0000018C) I2C4 error interrupt */
|
|
||||||
ISR_default, /* 84 (0x00000190) SPI4 global interrupt */
|
|
||||||
ISR_default, /* 85 (0x00000194) AES global interrupt */
|
|
||||||
ISR_default, /* 86 (0x00000198) FDCAN2 interrupt 0 */
|
|
||||||
ISR_default, /* 87 (0x0000019C) FDCAN2 interrupt 1 */
|
|
||||||
ISR_default, /* 88 (0x000001A0) FDCAN3 interrupt 0 */
|
|
||||||
ISR_default, /* 89 (0x000001A4) FDCAN3 interrupt 1 */
|
|
||||||
ISR_default, /* 90 (0x000001A8) RNG global interrupt */
|
|
||||||
ISR_default, /* 91 (0x000001AC) LPUART global interrupt */
|
|
||||||
ISR_default, /* 92 (0x000001B0) I2C3 event + EXTI line 27 interrupts */
|
|
||||||
ISR_default, /* 93 (0x000001B4) I2C3 error interrupt */
|
|
||||||
ISR_default, /* 94 (0x000001B8) DMAMUX overrun interrupt */
|
|
||||||
ISR_default, /* 95 (0x000001BC) QUADSPI global interrupt */
|
|
||||||
ISR_default, /* 96 (0x000001C0) DMA1 channel 8 interrupt */
|
|
||||||
ISR_default, /* 97 (0x000001C4) DMA2 channel 6 interrupt */
|
|
||||||
ISR_default, /* 98 (0x000001C8) DMA2 channel 7 interrupt */
|
|
||||||
ISR_default, /* 99 (0x000001CC) DMA2 channel 8 interrupt */
|
|
||||||
ISR_default, /* 100 (0x000001D0) Cordic interrupt */
|
|
||||||
ISR_default /* 101 (0x000001D4) FMAC interrupt */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************ E O F ***************************************** */
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x04
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* sketch.c
|
|
||||||
*
|
|
||||||
* Created on: Mar 18, 2026
|
|
||||||
* Author: tobii
|
|
||||||
*/
|
|
||||||
int reihenfolge[6] = {0, 1, 2, 3, 2, 1};
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
while(1){
|
|
||||||
while(/*schalter gedrückt*/){}
|
|
||||||
delay();
|
|
||||||
while(/*schalter losgelassen*/){}
|
|
||||||
delay();
|
|
||||||
|
|
||||||
int aktiv = 1;
|
|
||||||
while(aktiv){
|
|
||||||
for(int i; i < reihenfolge.length - 1 && aktiv = 1; i ++){
|
|
||||||
//alle LED einschalten
|
|
||||||
if(i = 0){/*alles bis auf LED0 auschalten*/}
|
|
||||||
if(i = 1){/*..*/}
|
|
||||||
//...
|
|
||||||
for(int zähler = 0; zähler < 333 && aktiv == 1; zähler++){
|
|
||||||
if(/*schalter gerückt*/){
|
|
||||||
aktiv = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
delay(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(/*Taster gedrückt*/){}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,205 +1,147 @@
|
|||||||
/* ***************************************************************************************
|
/* ***************************************************************************************
|
||||||
* Project: task1 - C:GPIO
|
* Project: task1 - C:GPIO
|
||||||
* File: task1.c
|
* File: task1.c
|
||||||
*
|
*
|
||||||
* Language: C
|
* Language: C
|
||||||
*
|
*
|
||||||
* Hardware: STefi Light v1.1
|
* Hardware: STefi Light v1.1
|
||||||
* Processor: STM32G431KBT6U
|
* Processor: STM32G431KBT6U
|
||||||
*
|
*
|
||||||
* Author: Manuel Lederhofer
|
* Author: Manuel Lederhofer
|
||||||
* Datum: 10.09.2021
|
* Datum: 10.09.2021
|
||||||
*
|
*
|
||||||
* Version: 2.1
|
* Version: 2.1
|
||||||
* History:
|
* History:
|
||||||
* 10.09.2021 ML create project
|
* 10.09.2021 ML create project
|
||||||
* 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
* 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
||||||
* 18.02.2025 TK changed projectname to "C: GPIO)
|
* 18.02.2025 TK changed projectname to "C: GPIO)
|
||||||
*
|
*
|
||||||
* Status: under development
|
* Status: under development
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Blinks the red LED of STefi Light, currently.
|
* Blinks the red LED of STefi Light, currently.
|
||||||
* This file contains the main routine and the initialization.
|
* This file contains the main routine and the initialization.
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
* - MCU speed at startup is 16 MHz
|
* - MCU speed at startup is 16 MHz
|
||||||
*
|
*
|
||||||
* Todo:
|
* Todo:
|
||||||
* - Change the example code to match the description and requirements
|
* - Change the example code to match the description and requirements
|
||||||
* of the requested application in the lab exercise guide.
|
* of the requested application in the lab exercise guide.
|
||||||
*
|
*
|
||||||
************************************************************************************** */
|
************************************************************************************** */
|
||||||
|
|
||||||
/* ------------------------------------ INCLUDES -------------------------------------- */
|
/* ------------------------------------ INCLUDES -------------------------------------- */
|
||||||
#include "stm32g431xx.h"
|
#include "stm32g431xx.h"
|
||||||
#include "STefi-Light.h"
|
#include "STefi-Light.h"
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ DEFINES --------------------------------------- */
|
/* ------------------------------------ DEFINES --------------------------------------- */
|
||||||
#define LOOPS_PER_MS 1244 // NOP-loops for delay()
|
#define LOOPS_PER_MS 1244 // NOP-loops for delay()
|
||||||
#define WAITTIME 500
|
#define WAITTIME 500
|
||||||
#define FIRST_LED 0
|
|
||||||
#define LAST_LED 3
|
|
||||||
#define UP 1
|
/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */
|
||||||
#define DOWN -1
|
/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */
|
||||||
|
int state = 0;
|
||||||
|
/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */
|
||||||
/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */
|
|
||||||
/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */
|
|
||||||
int state = 0;
|
/* ------------------------------------ PROTOTYPES ------------------------------------ */
|
||||||
/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */
|
static void GPIO_init(void);
|
||||||
|
static void delay(const uint16_t ms);
|
||||||
|
|
||||||
/* ------------------------------------ PROTOTYPES ------------------------------------ */
|
|
||||||
static void GPIO_init(void);
|
/* ------------------------------------ M A I N --------------------------------------- */
|
||||||
static void delay(const uint16_t ms);
|
int main(void)
|
||||||
static void blink(const unint numLED);
|
{
|
||||||
|
/* --- initialization --- */
|
||||||
|
__disable_irq(); // disable interrupts globally
|
||||||
/* ------------------------------------ M A I N --------------------------------------- */
|
|
||||||
int main(void)
|
GPIO_init();
|
||||||
{
|
|
||||||
/* --- initialization --- */
|
__enable_irq(); // enable interrupts globally
|
||||||
__disable_irq(); // disable interrupts globally
|
|
||||||
|
|
||||||
GPIO_init();
|
/* --- one time tasks --- */
|
||||||
|
|
||||||
__enable_irq(); // enable interrupts globally
|
|
||||||
|
/* --- infinite processing loop --- */
|
||||||
|
while (1)
|
||||||
/* --- one time tasks --- */
|
{
|
||||||
|
/* ... add your code to implement the lab assignment ... */
|
||||||
|
|
||||||
/* --- infinite processing loop --- */
|
switch (state) {
|
||||||
|
case 0:
|
||||||
while (1)
|
GPIOA->ODR &= ~(1 << 1); // LED0 on
|
||||||
{
|
|
||||||
/* ... add your code to implement the lab assignment ... */
|
state++;
|
||||||
int direction;
|
break;
|
||||||
|
case 1:
|
||||||
while(1){
|
delay(WAITTIME); // wait
|
||||||
if(i == FIRST_LED){
|
state++;
|
||||||
direction = UP;
|
break;
|
||||||
}
|
case 2:
|
||||||
else if(i == LAST_LED){
|
GPIOA->ODR |= (1 << 1); // LED0 off
|
||||||
direction = DOWN;
|
delay(WAITTIME); // wait
|
||||||
}
|
state = 0;
|
||||||
|
break;
|
||||||
blink(i); //One full LED blink cylce
|
default:
|
||||||
|
break;
|
||||||
if(direction == UP){
|
}
|
||||||
i++;
|
}
|
||||||
}
|
|
||||||
else if(direction == DOWN){
|
return 1;
|
||||||
i--;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
switch (state) {
|
/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */
|
||||||
case 0:
|
|
||||||
GPIOA->ODR &= ~(1 << 0); // LED0 on
|
/* ------------------------------------------------------------------------------------ *\
|
||||||
GPIOA->ODR &= ~(1 << 1);
|
* method: static void GPIO_init(void)
|
||||||
GPIOA->ODR &= ~(1 << 2);
|
*
|
||||||
GPIOA->ODR &= ~(1 << 3);
|
* Initializes GPIOs on STefi Light for pins with peripherals attached.
|
||||||
|
*
|
||||||
state++;
|
* requires: - nothing -
|
||||||
break;
|
* parameters: - none -
|
||||||
case 1:
|
* returns: - nothing -
|
||||||
delay(WAITTIME); // wait
|
\* ------------------------------------------------------------------------------------ */
|
||||||
state++;
|
static void GPIO_init(void)
|
||||||
break;
|
{
|
||||||
case 2:
|
/* enable port clocks */
|
||||||
GPIOA->ODR |= (1 << 0); // LED0 off
|
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A
|
||||||
GPIOA->ODR |= (1 << 1);
|
|
||||||
GPIOA->ODR |= (1 << 2);
|
|
||||||
GPIOA->ODR |= (1 << 3);
|
/* --- LEDs --- */
|
||||||
delay(WAITTIME); // wait
|
//GPIOA->ODR |= MASK_LED_RED;
|
||||||
state = 0;
|
GPIOA->ODR |= MASK_LED_YELLOW;
|
||||||
break;
|
GPIOA->MODER &= ~(3 << 0);
|
||||||
default:
|
GPIOA->MODER |= (1 << 1); // set LED pin to output
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
/* ------------------------------------------------------------------------------------ *\
|
||||||
return 1;
|
* method: static void delay(const uint16_t ms)
|
||||||
}
|
*
|
||||||
|
* Realizes a millisecond delay by very bad busy-wait.
|
||||||
|
*
|
||||||
/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */
|
* requires: - nothing -
|
||||||
|
* parameters: ms - delay time in milliseconds
|
||||||
|
* returns: - nothing -
|
||||||
/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */
|
\* ------------------------------------------------------------------------------------ */
|
||||||
|
static void delay(const uint16_t ms)
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
{
|
||||||
* method: static void GPIO_init(void)
|
for (uint16_t i = 0; i < ms; ++i)
|
||||||
*
|
{
|
||||||
* Initializes GPIOs on STefi Light for pins with peripherals attached.
|
for (uint16_t j = 0; j < LOOPS_PER_MS; ++j)
|
||||||
*
|
{
|
||||||
* requires: - nothing -
|
__asm("NOP");
|
||||||
* parameters: - none -
|
}
|
||||||
* returns: - nothing -
|
}
|
||||||
\* ------------------------------------------------------------------------------------ */
|
}
|
||||||
static void GPIO_init(void)
|
|
||||||
{
|
|
||||||
/* enable port clocks */
|
/* ************************************ E O F ***************************************** */
|
||||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A
|
|
||||||
int i = FIRST_LED;
|
|
||||||
|
|
||||||
/* --- LEDs --- */
|
|
||||||
GPIOA->ODR |= MASK_LED_ALL;
|
|
||||||
GPIOA->MODER &= ~(3 << 0);
|
|
||||||
GPIOA->MODER &= ~(3 << 2);
|
|
||||||
GPIOA->MODER &= ~(3 << 4);
|
|
||||||
GPIOA->MODER &= ~(3 << 6);
|
|
||||||
GPIOA->MODER |= (1 << 0); // set LED pin to output
|
|
||||||
GPIOA->MODER |= (1 << 2);
|
|
||||||
GPIOA->MODER |= (1 << 4);
|
|
||||||
GPIOA->MODER |= (1 << 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: static void delay(const uint16_t ms)
|
|
||||||
*
|
|
||||||
* Realizes a millisecond delay by very bad busy-wait.
|
|
||||||
*
|
|
||||||
* requires: - nothing -
|
|
||||||
* parameters: ms - delay time in milliseconds
|
|
||||||
* returns: - nothing -
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
static void delay(const uint16_t ms)
|
|
||||||
{
|
|
||||||
for (uint16_t i = 0; i < ms; ++i)
|
|
||||||
{
|
|
||||||
for (uint16_t j = 0; j < LOOPS_PER_MS; ++j)
|
|
||||||
{
|
|
||||||
__asm("NOP");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void blink(const uint numLED)
|
|
||||||
{
|
|
||||||
switch (state) {
|
|
||||||
case 0:
|
|
||||||
GPIOA->ODR &= ~(1 << numLED); // LEDX on
|
|
||||||
state++;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
delay(WAITTIME); // wait
|
|
||||||
state++;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
GPIOA->ODR |= (1 << numLED); // LEDX off
|
|
||||||
delay(WAITTIME); // wait
|
|
||||||
state = default;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************ E O F ***************************************** */
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #2]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,328 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
// Zusätzliche und benötigte Adressen
|
|
||||||
.equ RCC_AHB2ENR, 0x4002104C
|
|
||||||
.equ RCC_APB2ENR, 0x40021060
|
|
||||||
|
|
||||||
.equ GPIOA_MODER, 0x48000000
|
|
||||||
.equ GPIOA_ODR, 0x48000014
|
|
||||||
|
|
||||||
.equ GPIOC_MODER, 0x48000800
|
|
||||||
.equ GPIOC_PUPDR, 0x4800080C
|
|
||||||
.equ GPIOC_IDR, 0x48000810
|
|
||||||
|
|
||||||
.equ SYSCFG_BASE, 0x40010000
|
|
||||||
.equ SYSCFG_EXTICR4, (SYSCFG_BASE + 0x14)
|
|
||||||
|
|
||||||
.equ EXTI_BASE, 0x40010400
|
|
||||||
.equ EXTI_IMR1, (EXTI_BASE + 0x00)
|
|
||||||
.equ EXTI_FTSR1, (EXTI_BASE + 0x0C)
|
|
||||||
.equ EXTI_PR1, (EXTI_BASE + 0x14)
|
|
||||||
|
|
||||||
.equ NVIC_ISER1, 0xE000E104
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
.space 0xD0 // padding 208 Bytes bis Offset 0xE0 (EXTI15_10 IRQ 40)
|
|
||||||
.word _ISR_S0_S1 // gemeinsamer Interrupt für PC13 (S0) und PC14 (S1)
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR
|
|
||||||
MOVS r2, #0x05 // Bit 0 (GPIOA) und Bit 2 (GPIOC)
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs (PA0-PA3)
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
LDR r2, =0x000000FF // Maske PA0-PA3
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
LDR r2, =0x00000055 // Maske Output 0101 0101
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
MOVS r2, #0x0F // Maske LED0-3
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- buttons (PC13, PC14 als Input)
|
|
||||||
LDR r1, =GPIOC_MODER
|
|
||||||
LDR r2, =0x3C000000 // Maske Bits 26-29
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- Pull-Up für PC13, PC14
|
|
||||||
LDR r1, =GPIOC_PUPDR
|
|
||||||
LDR r2, =0x3C000000
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
LDR r2, =0x14000000 // 01 = Pull-Up für PC13 (Bits 27:26) und PC14 (Bits 29:28)
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
LDR r1, =RCC_APB2ENR
|
|
||||||
MOVS r2, #0x01
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
LDR r1, =SYSCFG_EXTICR4
|
|
||||||
LDR r2, =0x00000FF0 // Maske für EXTI13 (Bits 7:4) und EXTI14 (Bits 11:8)
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
LDR r2, =0x00000220 // Port C (0010) für EXTI13 und EXTI14
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
LDR r1, =EXTI_FTSR1 // Fallende Flanke
|
|
||||||
LDR r2, =0x00006000 // Bits 13 und 14
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
LDR r1, =EXTI_IMR1 // Maskierung aufheben
|
|
||||||
LDR r2, =0x00006000
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
LDR r1, =NVIC_ISER1
|
|
||||||
LDR r2, =0x00000100 // Bit 8 für IRQ 40 (EXTI15_10)
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
WFI
|
|
||||||
B main
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
LDR r0, =106000 // Entprell-Zeit ~20ms
|
|
||||||
.L1:
|
|
||||||
SUBS r0, r0, #1
|
|
||||||
BNE .L1
|
|
||||||
BX lr
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP
|
|
||||||
B stop
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1:
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
LDR r1, =RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r2, #0xFF
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
MOVS r2, #0x44
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
MOVS r2, #0x0A
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
LDR r1, =RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r2, #0xFF
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
MOVS r2, #0x11
|
|
||||||
ORRS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
MOVS r2, #0x05
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0_S1, %function
|
|
||||||
_ISR_S0_S1:
|
|
||||||
PUSH {r4, r5, lr} // Wichtig: Register sichern gemäß AAPCS
|
|
||||||
|
|
||||||
_check_S0:
|
|
||||||
LDR r4, =EXTI_PR1
|
|
||||||
LDR r5, [r4, #0]
|
|
||||||
LDR r2, =0x2000 // Maske für S0 (PC13 / Bit 13)
|
|
||||||
TST r5, r2
|
|
||||||
BEQ _check_S1 // Wenn Bit 13 nicht gesetzt, überspringen
|
|
||||||
|
|
||||||
#--- do the work S0
|
|
||||||
BL delay // Entprellen
|
|
||||||
|
|
||||||
LDR r0, =GPIOC_IDR
|
|
||||||
LDR r1, [r0, #0]
|
|
||||||
LDR r2, =0x2000
|
|
||||||
TST r1, r2
|
|
||||||
BNE _clear_S0 // Abbruch, wenn High (Taster prellt / schon losgelassen)
|
|
||||||
|
|
||||||
LDR r0, =GPIOA_ODR
|
|
||||||
LDR r1, [r0, #0]
|
|
||||||
MOVS r2, #0x09 // LED0 & LED3 toggeln (1001)
|
|
||||||
EORS r1, r2
|
|
||||||
STR r1, [r0, #0]
|
|
||||||
|
|
||||||
_clear_S0:
|
|
||||||
#--- clear interrupt flag S0
|
|
||||||
LDR r4, =EXTI_PR1
|
|
||||||
LDR r5, =0x2000
|
|
||||||
STR r5, [r4, #0]
|
|
||||||
|
|
||||||
_check_S1:
|
|
||||||
LDR r4, =EXTI_PR1
|
|
||||||
LDR r5, [r4, #0]
|
|
||||||
LDR r2, =0x4000 // Maske für S1 (PC14 / Bit 14)
|
|
||||||
TST r5, r2
|
|
||||||
BEQ _leave_ISR // Wenn Bit 14 nicht gesetzt, Ende
|
|
||||||
|
|
||||||
#--- do the work S1
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
LDR r0, =GPIOC_IDR
|
|
||||||
LDR r1, [r0, #0]
|
|
||||||
LDR r2, =0x4000
|
|
||||||
TST r1, r2
|
|
||||||
BNE _clear_S1 // Abbruch, wenn High
|
|
||||||
|
|
||||||
LDR r0, =GPIOA_ODR
|
|
||||||
LDR r1, [r0, #0]
|
|
||||||
MOVS r2, #0x06 // LED1 & LED2 toggeln (0110)
|
|
||||||
EORS r1, r2
|
|
||||||
STR r1, [r0, #0]
|
|
||||||
|
|
||||||
_clear_S1:
|
|
||||||
#--- clear interrupt flag S1
|
|
||||||
LDR r4, =EXTI_PR1
|
|
||||||
LDR r5, =0x4000
|
|
||||||
STR r5, [r4, #0]
|
|
||||||
|
|
||||||
_leave_ISR:
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r4, r5, pc} // Register wiederherstellen und zurückkehren
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2:
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x05
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
# LDR r1, =GPIOB_MODER
|
|
||||||
# MOVS r3, #0x03
|
|
||||||
# LDR r0, [r1, #1]
|
|
||||||
# BICS r0, r3
|
|
||||||
# MOVS r3, #0x01
|
|
||||||
# ORRS r0, r0, r3
|
|
||||||
# STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x03
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOB_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x01
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,764 +0,0 @@
|
|||||||
#*****************************************************************************************
|
|
||||||
# Project: task2 - switch triggered LEDs
|
|
||||||
# File: G431_addr.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 20.08.2015
|
|
||||||
#
|
|
||||||
# Version: 3.0
|
|
||||||
# History:
|
|
||||||
# 20.08.2015 ML create file
|
|
||||||
# 07.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML change from absolute addresses to BASE + OFFSET notation and
|
|
||||||
# add more timer modules
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# Connects assembly addresses for STM32G431 MCU to symbolic register names
|
|
||||||
# used in the datasheets.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - default MCU speed at startup is 16 MHz.
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - none -
|
|
||||||
#*****************************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# MCU Bus Base Addresses
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ APB1_BASE, 0x40000000
|
|
||||||
.equ APB2_BASE, 0x40010000
|
|
||||||
.equ AHB1_BASE, 0x40020000
|
|
||||||
.equ AHB2_BASE, 0x48000000
|
|
||||||
.equ AHB3_BASE, 0xA0000000 //!!! FSMC + QSPI registers = AHB3 ?
|
|
||||||
.equ PPB_BASE, 0xE0000000 /* Cortex M4 with FPU Internal Peripherals */
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# System Configuration Controller
|
|
||||||
#
|
|
||||||
# address space: 0x4001_0000 .. 0x4001_0029
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ SYSCFG_BASE, APB2_BASE
|
|
||||||
|
|
||||||
.equ SYSCFG_MEMRMP, SYSCFG_BASE + 0x00
|
|
||||||
.equ SYSCFG_CFGR1, SYSCFG_BASE + 0x04
|
|
||||||
.equ SYSCFG_EXTICR1, SYSCFG_BASE + 0x08
|
|
||||||
.equ SYSCFG_EXTICR2, SYSCFG_BASE + 0x0C
|
|
||||||
.equ SYSCFG_EXTICR3, SYSCFG_BASE + 0x10
|
|
||||||
.equ SYSCFG_EXTICR4, SYSCFG_BASE + 0x14
|
|
||||||
.equ SYSCFG_SCSR, SYSCFG_BASE + 0x18
|
|
||||||
.equ SYSCFG_CFGR2, SYSCFG_BASE + 0x1C
|
|
||||||
.equ SYSCFG_SWPR, SYSCFG_BASE + 0x20
|
|
||||||
.equ SYSCFG_SKR, SYSCFG_BASE + 0x24
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# Extended Interrupts And Events Controller
|
|
||||||
#
|
|
||||||
# address space: 0x4001_0400 .. 0x4001_07FF
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ EXTI_BASE, APB2_BASE + 0x400
|
|
||||||
|
|
||||||
.equ EXTI_IMR1, EXTI_BASE + 0x00
|
|
||||||
.equ EXTI_EMR1, EXTI_BASE + 0x04
|
|
||||||
.equ EXTI_RTSR1, EXTI_BASE + 0x08
|
|
||||||
.equ EXTI_FTSR1, EXTI_BASE + 0x0C
|
|
||||||
.equ EXTI_SWIER1, EXTI_BASE + 0x10
|
|
||||||
.equ EXTI_PR1, EXTI_BASE + 0x14
|
|
||||||
|
|
||||||
.equ EXTI_IMR2, EXTI_BASE + 0x20
|
|
||||||
.equ EXTI_EMR2, EXTI_BASE + 0x24
|
|
||||||
.equ EXTI_RTSR2, EXTI_BASE + 0x28
|
|
||||||
.equ EXTI_FTSR2, EXTI_BASE + 0x2C
|
|
||||||
.equ EXTI_SWIER2, EXTI_BASE + 0x30
|
|
||||||
.equ EXTI_PR2, EXTI_BASE + 0x34
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# TIM module common configuration
|
|
||||||
#
|
|
||||||
# Every timer has 1 KB address space:
|
|
||||||
#
|
|
||||||
# TIM2 .. TIM7: 0x4000_0000 .. 0x4000_17FF (APB1)
|
|
||||||
# TIM1: 0x4001_2C00 .. 0x4001_2FFF (APB2)
|
|
||||||
# TIM8: 0x4001_3400 .. 0x4001_37FF (APB2)
|
|
||||||
# TIM15 .. TIM17: 0x4001_4000 .. 0x4001_4BFF (APB2)
|
|
||||||
# TIM20: 0x4001_5000 .. 0x4001_53FF (APB2)
|
|
||||||
#
|
|
||||||
# note:
|
|
||||||
# TIM2 + TIM5 are 32 bit timers. All others have a width of 16 bit.
|
|
||||||
# Below, the timers on one line share a common register set description.
|
|
||||||
#
|
|
||||||
# TIM 1, 8, 20 advances control timers
|
|
||||||
# TIM 2, 3, 4, 5 general purpose timers (TIM2/5 = 32 bit)
|
|
||||||
# TIM 15 general purpose timers
|
|
||||||
# TIM 16, 17 general purpose timers
|
|
||||||
# TIM 6, 7 basic timers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ TIM_CR1_OFFSET, 0x00
|
|
||||||
.equ TIM_CR2_OFFSET, 0x04
|
|
||||||
.equ TIM_SMCR_OFFSET, 0x08
|
|
||||||
.equ TIM_DIER_OFFSET, 0x0C
|
|
||||||
.equ TIM_SR_OFFSET, 0x10
|
|
||||||
.equ TIM_EGR_OFFSET, 0x14
|
|
||||||
.equ TIM_CCMR1_OFFSET, 0x18
|
|
||||||
.equ TIM_CCMR2_OFFSET, 0x1C
|
|
||||||
.equ TIM_CCER_OFFSET, 0x20
|
|
||||||
.equ TIM_CNT_OFFSET, 0x24
|
|
||||||
.equ TIM_PSC_OFFSET, 0x28
|
|
||||||
.equ TIM_ARR_OFFSET, 0x2C
|
|
||||||
.equ TIM_RCR_OFFSET, 0x30
|
|
||||||
.equ TIM_CCR1_OFFSET, 0x34
|
|
||||||
.equ TIM_CCR2_OFFSET, 0x38
|
|
||||||
.equ TIM_CCR3_OFFSET, 0x3C
|
|
||||||
.equ TIM_CCR4_OFFSET, 0x40
|
|
||||||
.equ TIM_BDTR_OFFSET, 0x44
|
|
||||||
.equ TIM_CCR5_OFFSET, 0x48
|
|
||||||
.equ TIM_CCR6_OFFSET, 0x4C
|
|
||||||
.equ TIM_CCMR3_OFFSET, 0x50
|
|
||||||
.equ TIM_DTR2_OFFSET, 0x54
|
|
||||||
.equ TIM_ECR_OFFSET, 0x58
|
|
||||||
.equ TIM_TISEL_OFFSET, 0x5C
|
|
||||||
.equ TIM_AF1_OFFSET, 0x60
|
|
||||||
.equ TIM_AF2_OFFSET, 0x64
|
|
||||||
.equ TIM_OR1_OFFSET, 0x68
|
|
||||||
|
|
||||||
.equ TIM_DCR_OFFSET, 0x3DC
|
|
||||||
.equ TIM_DMAR_OFFSET, 0x3E0
|
|
||||||
|
|
||||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM2 / address space: 0x4000_0000 .. 0x4000_03FF
|
|
||||||
|
|
||||||
.equ TIM2_BASE, APB1_BASE
|
|
||||||
|
|
||||||
.equ TIM2_CR1, TIM2_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM2_CR2, TIM2_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM2_SMCR, TIM2_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM2_DIER, TIM2_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM2_SR, TIM2_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM2_EGR, TIM2_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM2_CCMR1, TIM2_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM2_CCMR2, TIM2_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM2_CCER, TIM2_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM2_CNT, TIM2_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM2_PSC, TIM2_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM2_ARR, TIM2_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM2_CCR1, TIM2_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM2_CCR2, TIM2_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM2_CCR3, TIM2_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM2_CCR4, TIM2_BASE + TIM_CCR4_OFFSET
|
|
||||||
|
|
||||||
.equ TIM2_ECR, TIM2_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM2_TISEL, TIM2_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM2_AF1, TIM2_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM2_AF2, TIM2_BASE + TIM_ECR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM2_DCR, TIM2_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM2_DMAR, TIM2_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM3 / address space: 0x4000_0400 .. 0x4000_07FF
|
|
||||||
|
|
||||||
.equ TIM3_BASE, APB1_BASE + 0x400
|
|
||||||
|
|
||||||
.equ TIM3_CR1, TIM3_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM3_CR2, TIM3_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM3_SMCR, TIM3_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM3_DIER, TIM3_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM3_SR, TIM3_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM3_EGR, TIM3_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM3_CCMR1, TIM3_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM3_CCMR2, TIM3_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM3_CCER, TIM3_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM3_CNT, TIM3_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM3_PSC, TIM3_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM3_ARR, TIM3_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM3_CCR1, TIM3_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM3_CCR2, TIM3_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM3_CCR3, TIM3_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM3_CCR4, TIM3_BASE + TIM_CCR4_OFFSET
|
|
||||||
|
|
||||||
.equ TIM3_ECR, TIM3_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM3_TISEL, TIM3_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM3_AF1, TIM3_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM3_AF2, TIM3_BASE + TIM_ECR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM3_DCR, TIM3_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM3_DMAR, TIM3_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM4 / address space: 0x4000_0800 .. 0x4000_0BFF
|
|
||||||
|
|
||||||
.equ TIM4_BASE, APB1_BASE + 0x800
|
|
||||||
|
|
||||||
.equ TIM4_CR1, TIM4_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM4_CR2, TIM4_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM4_SMCR, TIM4_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM4_DIER, TIM4_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM4_SR, TIM4_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM4_EGR, TIM4_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM4_CCMR1, TIM4_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM4_CCMR2, TIM4_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM4_CCER, TIM4_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM4_CNT, TIM4_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM4_PSC, TIM4_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM4_ARR, TIM4_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM4_CCR1, TIM4_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM4_CCR2, TIM4_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM4_CCR3, TIM4_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM4_CCR4, TIM4_BASE + TIM_CCR4_OFFSET
|
|
||||||
|
|
||||||
.equ TIM4_ECR, TIM4_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM4_TISEL, TIM4_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM4_AF1, TIM4_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM4_AF2, TIM4_BASE + TIM_ECR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM4_DCR, TIM4_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM4_DMAR, TIM4_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM5 / address space: 0x4000_0C00 .. 0x4000_0FFF
|
|
||||||
|
|
||||||
.equ TIM5_BASE, APB1_BASE + 0xC00
|
|
||||||
|
|
||||||
.equ TIM5_CR1, TIM5_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM5_CR2, TIM5_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM5_SMCR, TIM5_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM5_DIER, TIM5_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM5_SR, TIM5_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM5_EGR, TIM5_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM5_CCMR1, TIM5_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM5_CCMR2, TIM5_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM5_CCER, TIM5_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM5_CNT, TIM5_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM5_PSC, TIM5_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM5_ARR, TIM5_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM5_CCR1, TIM5_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM5_CCR2, TIM5_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM5_CCR3, TIM5_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM5_CCR4, TIM5_BASE + TIM_CCR4_OFFSET
|
|
||||||
|
|
||||||
.equ TIM5_ECR, TIM5_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM5_TISEL, TIM5_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM5_AF1, TIM5_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM5_AF2, TIM5_BASE + TIM_ECR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM5_DCR, TIM5_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM5_DMAR, TIM5_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Basic Timer - TIM6 / address space: 0x4000_1000 .. 0x4000_13FF
|
|
||||||
|
|
||||||
.equ TIM6_BASE, APB1_BASE + 0x1000
|
|
||||||
|
|
||||||
.equ TIM6_CR1, TIM6_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM6_CR2, TIM6_BASE + TIM_CR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM6_DIER, TIM6_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM6_SR, TIM6_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM6_EGR, TIM6_BASE + TIM_EGR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM6_CNT, TIM6_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM6_PSC, TIM6_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM6_ARR, TIM6_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
#--- Basic Timer - TIM7 / address space: 0x4000_1400 .. 0x4000_17FF
|
|
||||||
|
|
||||||
.equ TIM7_BASE, APB1_BASE + 0x1400
|
|
||||||
|
|
||||||
.equ TIM7_CR1, TIM7_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM7_CR2, TIM7_BASE + TIM_CR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM7_DIER, TIM7_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM7_SR, TIM7_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM7_EGR, TIM7_BASE + TIM_EGR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM7_CNT, TIM7_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM7_PSC, TIM7_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM7_ARR, TIM7_BASE + TIM_ARR_OFFSET
|
|
||||||
|
|
||||||
#--- Advanced Control Timer - TIM1 / address space: 0x4001_2C00 .. 0x4001_2FFF
|
|
||||||
|
|
||||||
.equ TIM1_BASE, APB2_BASE + 0x2C00
|
|
||||||
|
|
||||||
.equ TIM1_CR1, TIM1_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM1_CR2, TIM1_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM1_SMCR, TIM1_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM1_DIER, TIM1_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM1_SR, TIM1_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM1_EGR, TIM1_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM1_CCMR1, TIM1_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM1_CCMR2, TIM1_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM1_CCER, TIM1_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM1_CNT, TIM1_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM1_PSC, TIM1_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM1_ARR, TIM1_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM1_RCR, TIM1_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM1_CCR1, TIM1_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM1_CCR2, TIM1_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM1_CCR3, TIM1_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM1_CCR4, TIM1_BASE + TIM_CCR4_OFFSET
|
|
||||||
.equ TIM1_BDTR, TIM1_BASE + TIM_BDTR_OFFSET
|
|
||||||
.equ TIM1_CCR5, TIM1_BASE + TIM_CCR5_OFFSET
|
|
||||||
.equ TIM1_CCR6, TIM1_BASE + TIM_CCR6_OFFSET
|
|
||||||
.equ TIM1_CCMR3, TIM1_BASE + TIM_CCMR3_OFFSET
|
|
||||||
.equ TIM1_DTR2, TIM1_BASE + TIM_DTR2_OFFSET
|
|
||||||
.equ TIM1_ECR, TIM1_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM1_TISEL, TIM1_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM1_AF1, TIM1_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM1_AF2, TIM1_BASE + TIM_AF2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM1_DCR, TIM1_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM1_DMAR, TIM1_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Advanced Control Timer - TIM8 / address space: 0x4001_3400 .. 0x4001_37FF
|
|
||||||
|
|
||||||
.equ TIM8_BASE, APB2_BASE + 0x3400
|
|
||||||
|
|
||||||
.equ TIM8_CR1, TIM8_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM8_CR2, TIM8_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM8_SMCR, TIM8_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM8_DIER, TIM8_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM8_SR, TIM8_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM8_EGR, TIM8_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM8_CCMR1, TIM8_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM8_CCMR2, TIM8_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM8_CCER, TIM8_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM8_CNT, TIM8_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM8_PSC, TIM8_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM8_ARR, TIM8_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM8_RCR, TIM8_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM8_CCR1, TIM8_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM8_CCR2, TIM8_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM8_CCR3, TIM8_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM8_CCR4, TIM8_BASE + TIM_CCR4_OFFSET
|
|
||||||
.equ TIM8_BDTR, TIM8_BASE + TIM_BDTR_OFFSET
|
|
||||||
.equ TIM8_CCR5, TIM8_BASE + TIM_CCR5_OFFSET
|
|
||||||
.equ TIM8_CCR6, TIM8_BASE + TIM_CCR6_OFFSET
|
|
||||||
.equ TIM8_CCMR3, TIM8_BASE + TIM_CCMR3_OFFSET
|
|
||||||
.equ TIM8_DTR2, TIM8_BASE + TIM_DTR2_OFFSET
|
|
||||||
.equ TIM8_ECR, TIM8_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM8_TISEL, TIM8_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM8_AF1, TIM8_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM8_AF2, TIM8_BASE + TIM_AF2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM8_DCR, TIM8_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM8_DMAR, TIM8_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Advanced Control Timer - TIM20 / address space: 0x4001_5000 .. 0x4001_53FF
|
|
||||||
|
|
||||||
.equ TIM20_BASE, APB2_BASE + 0x5000
|
|
||||||
|
|
||||||
.equ TIM20_CR1, TIM20_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM20_CR2, TIM20_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM20_SMCR, TIM20_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM20_DIER, TIM20_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM20_SR, TIM20_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM20_EGR, TIM20_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM20_CCMR1, TIM20_BASE + TIM_CCMR1_OFFSET
|
|
||||||
.equ TIM20_CCMR2, TIM20_BASE + TIM_CCMR2_OFFSET
|
|
||||||
.equ TIM20_CCER, TIM20_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM20_CNT, TIM20_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM20_PSC, TIM20_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM20_ARR, TIM20_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM20_RCR, TIM20_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM20_CCR1, TIM20_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM20_CCR2, TIM20_BASE + TIM_CCR2_OFFSET
|
|
||||||
.equ TIM20_CCR3, TIM20_BASE + TIM_CCR3_OFFSET
|
|
||||||
.equ TIM20_CCR4, TIM20_BASE + TIM_CCR4_OFFSET
|
|
||||||
.equ TIM20_BDTR, TIM20_BASE + TIM_BDTR_OFFSET
|
|
||||||
.equ TIM20_CCR5, TIM20_BASE + TIM_CCR5_OFFSET
|
|
||||||
.equ TIM20_CCR6, TIM20_BASE + TIM_CCR6_OFFSET
|
|
||||||
.equ TIM20_CCMR3, TIM20_BASE + TIM_CCMR3_OFFSET
|
|
||||||
.equ TIM20_DTR2, TIM20_BASE + TIM_DTR2_OFFSET
|
|
||||||
.equ TIM20_ECR, TIM20_BASE + TIM_ECR_OFFSET
|
|
||||||
.equ TIM20_TISEL, TIM20_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM20_AF1, TIM20_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM20_AF2, TIM20_BASE + TIM_AF2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM20_DCR, TIM20_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM20_DMAR, TIM20_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM15 / address space: 0x4001_4000 .. 0x4001_43FF
|
|
||||||
|
|
||||||
.equ TIM15_BASE, APB2_BASE + 0x4000
|
|
||||||
|
|
||||||
.equ TIM15_CR1, TIM15_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM15_CR2, TIM15_BASE + TIM_CR2_OFFSET
|
|
||||||
.equ TIM15_SMCR, TIM15_BASE + TIM_SMCR_OFFSET
|
|
||||||
.equ TIM15_DIER, TIM15_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM15_SR, TIM15_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM15_EGR, TIM15_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM15_CCMR1, TIM15_BASE + TIM_CCMR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM15_CCER, TIM15_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM15_CNT, TIM15_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM15_PSC, TIM15_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM15_ARR, TIM15_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM15_RCR, TIM15_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM15_CCR1, TIM15_BASE + TIM_CCR1_OFFSET
|
|
||||||
.equ TIM15_CCR2, TIM15_BASE + TIM_CCR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM15_BDTR, TIM15_BASE + TIM_BDTR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM15_DTR2, TIM15_BASE + TIM_DTR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM15_TISEL, TIM15_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM15_AF1, TIM15_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM15_AF2, TIM15_BASE + TIM_AF2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM15_DCR, TIM15_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM15_DMAR, TIM15_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM16 / address space: 0x4001_4400 .. 0x4001_47FF
|
|
||||||
|
|
||||||
.equ TIM16_BASE, APB2_BASE + 0x4400
|
|
||||||
|
|
||||||
.equ TIM16_CR1, TIM16_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM16_CR2, TIM16_BASE + TIM_CR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_DIER, TIM16_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM16_SR, TIM16_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM16_EGR, TIM16_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM16_CCMR1, TIM16_BASE + TIM_CCMR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_CCER, TIM16_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM16_CNT, TIM16_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM16_PSC, TIM16_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM16_ARR, TIM16_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM16_RCR, TIM16_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM16_CCR1, TIM16_BASE + TIM_CCR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_BDTR, TIM16_BASE + TIM_BDTR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_DTR2, TIM16_BASE + TIM_DTR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_TISEL, TIM16_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM16_AF1, TIM16_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM16_AF2, TIM16_BASE + TIM_AF2_OFFSET
|
|
||||||
.equ TIM16_OR1, TIM16_BASE + TIM_OR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM16_DCR, TIM16_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM16_DMAR, TIM16_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#--- Genral Purpose Timer - TIM17 / address space: 0x4001_4800 .. 0x4001_4BFF
|
|
||||||
|
|
||||||
.equ TIM17_BASE, APB2_BASE + 0x4800
|
|
||||||
|
|
||||||
.equ TIM17_CR1, TIM17_BASE + TIM_CR1_OFFSET
|
|
||||||
.equ TIM17_CR2, TIM17_BASE + TIM_CR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_DIER, TIM17_BASE + TIM_DIER_OFFSET
|
|
||||||
.equ TIM17_SR, TIM17_BASE + TIM_SR_OFFSET
|
|
||||||
.equ TIM17_EGR, TIM17_BASE + TIM_EGR_OFFSET
|
|
||||||
.equ TIM17_CCMR1, TIM17_BASE + TIM_CCMR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_CCER, TIM17_BASE + TIM_CCER_OFFSET
|
|
||||||
.equ TIM17_CNT, TIM17_BASE + TIM_CNT_OFFSET
|
|
||||||
.equ TIM17_PSC, TIM17_BASE + TIM_PSC_OFFSET
|
|
||||||
.equ TIM17_ARR, TIM17_BASE + TIM_ARR_OFFSET
|
|
||||||
.equ TIM17_RCR, TIM17_BASE + TIM_RCR_OFFSET
|
|
||||||
.equ TIM17_CCR1, TIM17_BASE + TIM_CCR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_BDTR, TIM17_BASE + TIM_BDTR_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_DTR2, TIM17_BASE + TIM_DTR2_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_TISEL, TIM17_BASE + TIM_TISEL_OFFSET
|
|
||||||
.equ TIM17_AF1, TIM17_BASE + TIM_AF1_OFFSET
|
|
||||||
.equ TIM17_AF2, TIM17_BASE + TIM_AF2_OFFSET
|
|
||||||
.equ TIM17_OR1, TIM17_BASE + TIM_OR1_OFFSET
|
|
||||||
|
|
||||||
.equ TIM17_DCR, TIM17_BASE + TIM_DCR_OFFSET
|
|
||||||
.equ TIM17_DMAR, TIM17_BASE + TIM_DMAR_OFFSET
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# Reset and Clock Control
|
|
||||||
#
|
|
||||||
# address space: 0x4002_1000 .. 0x4002_13FF
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ RCC_BASE, AHB1_BASE + 0x1000
|
|
||||||
|
|
||||||
.equ RCC_CR, RCC_BASE + 0x00
|
|
||||||
.equ RCC_ICSCR, RCC_BASE + 0x04
|
|
||||||
.equ RCC_CFGR, RCC_BASE + 0x08
|
|
||||||
.equ RCC_PLLCFGR, RCC_BASE + 0x0C
|
|
||||||
|
|
||||||
.equ RCC_CIER, RCC_BASE + 0x18
|
|
||||||
.equ RCC_CIFR, RCC_BASE + 0x1C
|
|
||||||
.equ RCC_CICR, RCC_BASE + 0x20
|
|
||||||
|
|
||||||
.equ RCC_AHB1RSTR, RCC_BASE + 0x28
|
|
||||||
.equ RCC_AHB2RSTR, RCC_BASE + 0x2C
|
|
||||||
.equ RCC_AHB3RSTR, RCC_BASE + 0x30
|
|
||||||
|
|
||||||
.equ RCC_APB1RSTR1, RCC_BASE + 0x38
|
|
||||||
.equ RCC_APB1RSTR2, RCC_BASE + 0x3C
|
|
||||||
.equ RCC_APB2RSTR, RCC_BASE + 0x40
|
|
||||||
|
|
||||||
.equ RCC_AHB1ENR, RCC_BASE + 0x48
|
|
||||||
.equ RCC_AHB2ENR, RCC_BASE + 0x4C
|
|
||||||
.equ RCC_AHB3ENR, RCC_BASE + 0x50
|
|
||||||
|
|
||||||
.equ RCC_APB1ENR1, RCC_BASE + 0x58
|
|
||||||
.equ RCC_APB1ENR2, RCC_BASE + 0x5C
|
|
||||||
.equ RCC_APB2ENR, RCC_BASE + 0x60
|
|
||||||
|
|
||||||
.equ RCC_AHB1SMENR, RCC_BASE + 0x68
|
|
||||||
.equ RCC_AHB2SMENR, RCC_BASE + 0x6C
|
|
||||||
.equ RCC_AHB3SMENR, RCC_BASE + 0x70
|
|
||||||
|
|
||||||
.equ RCC_APB1SMENR1, RCC_BASE + 0x78
|
|
||||||
.equ RCC_APB1SMENR2, RCC_BASE + 0x7C
|
|
||||||
.equ RCC_APB2SMENR, RCC_BASE + 0x80
|
|
||||||
|
|
||||||
.equ RCC_CCIPR, RCC_BASE + 0x88
|
|
||||||
|
|
||||||
.equ RCC_BDCR, RCC_BASE + 0x90
|
|
||||||
.equ RCC_CSR, RCC_BASE + 0x94
|
|
||||||
.equ RCC_CRRCR, RCC_BASE + 0x98
|
|
||||||
.equ RCC_CCIPR2, RCC_BASE + 0x9C
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# GPIO module common configuration
|
|
||||||
#
|
|
||||||
# address space: 0x4800_0000 .. 0x4800_1FFF
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ GPIO_BASE, AHB2_BASE
|
|
||||||
|
|
||||||
.equ GPIO_MODER_OFFSET, 0x00
|
|
||||||
.equ GPIO_OTYPER_OFFSET, 0x04
|
|
||||||
.equ GPIO_OSPEEDR_OFFSET, 0x08
|
|
||||||
.equ GPIO_PUPDR_OFFSET, 0x0C
|
|
||||||
.equ GPIO_IDR_OFFSET, 0x10
|
|
||||||
.equ GPIO_ODR_OFFSET, 0x14
|
|
||||||
.equ GPIO_BSRR_OFFSET, 0x18
|
|
||||||
.equ GPIO_LCKR_OFFSET, 0x1C
|
|
||||||
.equ GPIO_AFRL_OFFSET, 0x20
|
|
||||||
.equ GPIO_AFRH_OFFSET, 0x24
|
|
||||||
.equ GPIO_BRR_OFFSET, 0x28
|
|
||||||
|
|
||||||
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
||||||
|
|
||||||
#--- Port A GPIO configuration / address space: 0x4800_0000 .. 0x4800_03FF
|
|
||||||
|
|
||||||
.equ GPIOA_BASE, GPIO_BASE
|
|
||||||
|
|
||||||
.equ GPIOA_MODER, GPIOA_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOA_OTYPER, GPIOA_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOA_OSPEEDR, GPIOA_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOA_PUPDR, GPIOA_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOA_IDR, GPIOA_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOA_ODR, GPIOA_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOA_BSRR, GPIOA_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOA_LCKR, GPIOA_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOA_AFRL, GPIOA_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOA_AFRH, GPIOA_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOA_BRR, GPIOA_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port B GPIO configuration / address space: 0x4800_0400 .. 0x4800_07FF
|
|
||||||
|
|
||||||
.equ GPIOB_BASE, GPIO_BASE + 0x400
|
|
||||||
|
|
||||||
.equ GPIOB_MODER, GPIOB_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOB_OTYPER, GPIOB_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOB_OSPEEDR, GPIOB_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOB_PUPDR, GPIOB_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOB_IDR, GPIOB_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOB_ODR, GPIOB_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOB_BSRR, GPIOB_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOB_LCKR, GPIOB_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOB_AFRL, GPIOB_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOB_AFRH, GPIOB_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOB_BRR, GPIOB_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port C GPIO configuration / address space: 0x4800_0800 .. 0x4800_0BFF
|
|
||||||
|
|
||||||
.equ GPIOC_BASE, GPIO_BASE + 0x800
|
|
||||||
|
|
||||||
.equ GPIOC_MODER, GPIOC_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOC_OTYPER, GPIOC_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOC_OSPEEDR, GPIOC_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOC_PUPDR, GPIOC_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOC_IDR, GPIOC_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOC_ODR, GPIOC_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOC_BSRR, GPIOC_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOC_LCKR, GPIOC_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOC_AFRL, GPIOC_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOC_AFRH, GPIOC_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOC_BRR, GPIOC_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port D GPIO configuration / address space: 0x4800_0C00 .. 0x4800_0FFF
|
|
||||||
|
|
||||||
.equ GPIOD_BASE, GPIO_BASE + 0xC00
|
|
||||||
|
|
||||||
.equ GPIOD_MODER, GPIOD_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOD_OTYPER, GPIOD_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOD_OSPEEDR, GPIOD_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOD_PUPDR, GPIOD_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOD_IDR, GPIOD_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOD_ODR, GPIOD_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOD_BSRR, GPIOD_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOD_LCKR, GPIOD_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOD_AFRL, GPIOD_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOD_AFRH, GPIOD_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOD_BRR, GPIOD_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port E GPIO configuration / address space: 0x4800_1000 .. 0x4800_13FF
|
|
||||||
|
|
||||||
.equ GPIOE_BASE, GPIO_BASE + 0x1000
|
|
||||||
|
|
||||||
.equ GPIOE_MODER, GPIOE_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOE_OTYPER, GPIOE_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOE_OSPEEDR, GPIOE_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOE_PUPDR, GPIOE_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOE_IDR, GPIOE_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOE_ODR, GPIOE_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOE_BSRR, GPIOE_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOE_LCKR, GPIOE_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOE_AFRL, GPIOE_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOE_AFRH, GPIOE_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOE_BRR, GPIOE_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port F GPIO configuration / address space: 0x4800_1400 .. 0x4800_17FF
|
|
||||||
|
|
||||||
.equ GPIOF_BASE, GPIO_BASE + 0x1400
|
|
||||||
|
|
||||||
.equ GPIOF_MODER, GPIOF_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOF_OTYPER, GPIOF_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOF_OSPEEDR, GPIOF_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOF_PUPDR, GPIOF_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOF_IDR, GPIOF_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOF_ODR, GPIOF_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOF_BSRR, GPIOF_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOF_LCKR, GPIOF_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOF_AFRL, GPIOF_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOF_AFRH, GPIOF_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOF_BRR, GPIOF_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#--- Port G GPIO configuration / address space: 0x4800_1800 .. 0x4800_1BFF
|
|
||||||
|
|
||||||
.equ GPIOG_BASE, GPIO_BASE + 0x1800
|
|
||||||
|
|
||||||
.equ GPIOG_MODER, GPIOG_BASE + GPIO_MODER_OFFSET
|
|
||||||
.equ GPIOG_OTYPER, GPIOG_BASE + GPIO_OTYPER_OFFSET
|
|
||||||
.equ GPIOG_OSPEEDR, GPIOG_BASE + GPIO_OSPEEDR_OFFSET
|
|
||||||
.equ GPIOG_PUPDR, GPIOG_BASE + GPIO_PUPDR_OFFSET
|
|
||||||
.equ GPIOG_IDR, GPIOG_BASE + GPIO_IDR_OFFSET
|
|
||||||
.equ GPIOG_ODR, GPIOG_BASE + GPIO_ODR_OFFSET
|
|
||||||
.equ GPIOG_BSRR, GPIOG_BASE + GPIO_BSRR_OFFSET
|
|
||||||
.equ GPIOG_LCKR, GPIOG_BASE + GPIO_LCKR_OFFSET
|
|
||||||
.equ GPIOG_AFRL, GPIOG_BASE + GPIO_AFRL_OFFSET
|
|
||||||
.equ GPIOG_AFRH, GPIOG_BASE + GPIO_AFRH_OFFSET
|
|
||||||
.equ GPIOG_BRR, GPIOG_BASE + GPIO_BRR_OFFSET
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# System Control Space
|
|
||||||
#
|
|
||||||
# address space: 0xE000_E000 .. 0xE000_EFFF
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ SCS_BASE, PPB_BASE + 0xE000
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# System Timer (SysTick)
|
|
||||||
#
|
|
||||||
# address space: 0xE000_E010 .. 0xE000_E01F
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ STK_BASE, SCS_BASE + 10 // 0xE000_E010
|
|
||||||
|
|
||||||
.equ STK_CTRL, SCS_BASE + 0x00
|
|
||||||
.equ STK_LOAD, SCS_BASE + 0x04
|
|
||||||
.equ STK_VAL, SCS_BASE + 0x08
|
|
||||||
.equ STK_CALIB, SCS_BASE + 0x0C
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# Nested Vector Interrupt Controller
|
|
||||||
#
|
|
||||||
# address space: 0xE000_E100 .. 0xE000_E4EF
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ NVIC_BASE, SCS_BASE + 0x100 // 0xE000_E100
|
|
||||||
|
|
||||||
.equ NVIC_ISER0, NVIC_BASE + 0x00
|
|
||||||
.equ NVIC_ISER1, NVIC_BASE + 0x04
|
|
||||||
.equ NVIC_ISER2, NVIC_BASE + 0x08
|
|
||||||
.equ NVIC_ISER3, NVIC_BASE + 0x0C
|
|
||||||
|
|
||||||
.equ NVIC_ICER0, NVIC_BASE + 0x80
|
|
||||||
.equ NVIC_ICER1, NVIC_BASE + 0x84
|
|
||||||
.equ NVIC_ICER2, NVIC_BASE + 0x88
|
|
||||||
.equ NVIC_ICER3, NVIC_BASE + 0x8C
|
|
||||||
|
|
||||||
.equ NVIC_ISPR0, NVIC_BASE + 0x100
|
|
||||||
.equ NVIC_ISPR1, NVIC_BASE + 0x104
|
|
||||||
.equ NVIC_ISPR2, NVIC_BASE + 0x108
|
|
||||||
.equ NVIC_ISPR3, NVIC_BASE + 0x10C
|
|
||||||
|
|
||||||
.equ NVIC_ICPR0, NVIC_BASE + 0x180
|
|
||||||
.equ NVIC_ICPR1, NVIC_BASE + 0x184
|
|
||||||
.equ NVIC_ICPR2, NVIC_BASE + 0x188
|
|
||||||
.equ NVIC_ICPR3, NVIC_BASE + 0x18C
|
|
||||||
|
|
||||||
.equ NVIC_IABR0, NVIC_BASE + 0x200
|
|
||||||
.equ NVIC_IABR1, NVIC_BASE + 0x204
|
|
||||||
.equ NVIC_IABR2, NVIC_BASE + 0x208
|
|
||||||
.equ NVIC_IABR3, NVIC_BASE + 0x20C
|
|
||||||
|
|
||||||
.equ NVIC_IPR0, NVIC_BASE + 0x300
|
|
||||||
.equ NVIC_IPR1, NVIC_BASE + 0x304
|
|
||||||
.equ NVIC_IPR2, NVIC_BASE + 0x308
|
|
||||||
.equ NVIC_IPR3, NVIC_BASE + 0x30C
|
|
||||||
.equ NVIC_IPR4, NVIC_BASE + 0x310
|
|
||||||
.equ NVIC_IPR5, NVIC_BASE + 0x314
|
|
||||||
.equ NVIC_IPR6, NVIC_BASE + 0x318
|
|
||||||
.equ NVIC_IPR7, NVIC_BASE + 0x31C
|
|
||||||
.equ NVIC_IPR8, NVIC_BASE + 0x320
|
|
||||||
.equ NVIC_IPR9, NVIC_BASE + 0x324
|
|
||||||
.equ NVIC_IPR10, NVIC_BASE + 0x328
|
|
||||||
.equ NVIC_IPR11, NVIC_BASE + 0x32C
|
|
||||||
.equ NVIC_IPR12, NVIC_BASE + 0x330
|
|
||||||
.equ NVIC_IPR13, NVIC_BASE + 0x334
|
|
||||||
.equ NVIC_IPR14, NVIC_BASE + 0x338
|
|
||||||
.equ NVIC_IPR15, NVIC_BASE + 0x33C
|
|
||||||
.equ NVIC_IPR16, NVIC_BASE + 0x340
|
|
||||||
.equ NVIC_IPR17, NVIC_BASE + 0x344
|
|
||||||
.equ NVIC_IPR18, NVIC_BASE + 0x348
|
|
||||||
.equ NVIC_IPR19, NVIC_BASE + 0x34C
|
|
||||||
.equ NVIC_IPR20, NVIC_BASE + 0x350
|
|
||||||
.equ NVIC_IPR21, NVIC_BASE + 0x354
|
|
||||||
.equ NVIC_IPR22, NVIC_BASE + 0x358
|
|
||||||
.equ NVIC_IPR23, NVIC_BASE + 0x35C
|
|
||||||
.equ NVIC_IPR24, NVIC_BASE + 0x360
|
|
||||||
.equ NVIC_IPR25, NVIC_BASE + 0x364
|
|
||||||
|
|
||||||
.equ STIR, NVIC_BASE + 0xE00
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
# MCU Debug Component
|
|
||||||
#
|
|
||||||
# address space: 0xE004_2000 .. 0xE004_2013
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.equ DBGMCU_BASE, PPB_BASE + 0x42000
|
|
||||||
|
|
||||||
.equ DBGMCU_IDCODE, DBGMCU_BASE + 0x00
|
|
||||||
.equ DBGMCU_CR, DBGMCU_BASE + 0x04
|
|
||||||
.equ DBGMCU_APB1FZR1, DBGMCU_BASE + 0x08
|
|
||||||
.equ DBGMCU_APB1FZR2, DBGMCU_BASE + 0x0C
|
|
||||||
.equ DBGMCU_APB2DZR, DBGMCU_BASE + 0x10
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x02
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,314 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,233 +0,0 @@
|
|||||||
/* ***************************************************************************************
|
|
||||||
# Project: task3 - C: Timer & Interrupts
|
|
||||||
# File: task3.s
|
|
||||||
#
|
|
||||||
# Language: C
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.1
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file,
|
|
||||||
# change ASM pseudo commands from .space to .org
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 17.02.2025 TK move ASM:Interrupts to task2, replace with C:Timer & Interrupts
|
|
||||||
# 24.06.2025 TK remove "... put your code here ...", remove Systick
|
|
||||||
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Measurements:
|
|
||||||
# Timers used :
|
|
||||||
# Current with WFI :
|
|
||||||
# Current without WFI :
|
|
||||||
#
|
|
||||||
************************************************************************************** */
|
|
||||||
|
|
||||||
/* ------------------------------------ INCLUDES -------------------------------------- */
|
|
||||||
#include "stm32g431xx.h"
|
|
||||||
#include "STefi-Light.h"
|
|
||||||
|
|
||||||
#define ROT_AN (GPIOA->BSRR = (1UL<<16))
|
|
||||||
#define ROT_AUS (GPIOA->BSRR = (1UL<<0))
|
|
||||||
#define GELB_AN (GPIOA->BSRR = (1UL<<17))
|
|
||||||
#define GELB_AUS (GPIOA->BSRR = (1UL<<1))
|
|
||||||
#define GRÜN_AN (GPIOA->BSRR = (1UL<<18))
|
|
||||||
#define GRÜN_AUS (GPIOA->BSRR = (1UL<<2))
|
|
||||||
#define BLAU_AN (GPIOA->BSRR = (1UL<<19))
|
|
||||||
#define BLAU_AUS (GPIOA->BSRR = (1UL<<3))
|
|
||||||
|
|
||||||
/* ------------------------------------ DEFINES --------------------------------------- */
|
|
||||||
/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */
|
|
||||||
/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */
|
|
||||||
volatile uint32_t timer_ticks = 0;
|
|
||||||
volatile uint8_t ampel_aktiv = 0;
|
|
||||||
volatile uint32_t lbp = 0;
|
|
||||||
/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ PROTOTYPES ------------------------------------ */
|
|
||||||
static void GPIO_init(void);
|
|
||||||
void Timer_init(void);
|
|
||||||
void EXTI_init(void);
|
|
||||||
|
|
||||||
/* ------------------------------------ M A I N --------------------------------------- */
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
/* --- initialization --- */
|
|
||||||
__disable_irq(); // disable interrupts globally
|
|
||||||
|
|
||||||
GPIO_init();
|
|
||||||
Timer_init();
|
|
||||||
EXTI_init();
|
|
||||||
|
|
||||||
__enable_irq(); // enable interrupts globally
|
|
||||||
|
|
||||||
lbp = 0;
|
|
||||||
|
|
||||||
GRÜN_AN;
|
|
||||||
ROT_AUS;
|
|
||||||
GELB_AUS;
|
|
||||||
BLAU_AUS;
|
|
||||||
/* --- one time tasks --- */
|
|
||||||
|
|
||||||
|
|
||||||
/* --- infinite processing loop --- */
|
|
||||||
while (1){
|
|
||||||
|
|
||||||
__WFI();
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */
|
|
||||||
void EXTI_IRQHandler(void){
|
|
||||||
if(EXTI->PR1 & EXTI_PR1_PIF0){
|
|
||||||
EXTI->PR1 = EXTI_PR1_PIF0;
|
|
||||||
|
|
||||||
if((timer_ticks - lbp)> 200){
|
|
||||||
lbp = timer_ticks;
|
|
||||||
|
|
||||||
if(ampel_aktiv == 0){
|
|
||||||
timer_ticks = 0;
|
|
||||||
ampel_aktiv=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TIM6_DAC_IRQHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TIM6_DAC_IRQHandler(void){
|
|
||||||
if(TIM6->SR & (1<<0)){
|
|
||||||
TIM6->SR &= ~(1U<<0);
|
|
||||||
|
|
||||||
timer_ticks++;
|
|
||||||
|
|
||||||
if(ampel_aktiv == 1){
|
|
||||||
switch(timer_ticks){
|
|
||||||
case 10000:
|
|
||||||
GRÜN_AUS;
|
|
||||||
GELB_AN;
|
|
||||||
break;
|
|
||||||
case 11000:
|
|
||||||
GELB_AUS;
|
|
||||||
ROT_AN;
|
|
||||||
break;
|
|
||||||
case 12000:
|
|
||||||
break;
|
|
||||||
case 27000:
|
|
||||||
BLAU_AUS;
|
|
||||||
GELB_AN;
|
|
||||||
break;
|
|
||||||
case 28000:
|
|
||||||
ROT_AUS;
|
|
||||||
GELB_AUS;
|
|
||||||
GRÜN_AN;
|
|
||||||
ampel_aktiv = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(timer_ticks >=12000 && timer_ticks < 27000){
|
|
||||||
if(timer_ticks % 1000 == 0){
|
|
||||||
BLAU_AN;
|
|
||||||
}
|
|
||||||
else if(timer_ticks % 1000 == 500){
|
|
||||||
BLAU_AUS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: static void GPIO_init(void)
|
|
||||||
*
|
|
||||||
* Initializes GPIOs on STefi Light for pins with peripherals attached.
|
|
||||||
*
|
|
||||||
* requires: - nothing -
|
|
||||||
* parameters: - none -
|
|
||||||
* returns: - nothing -
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
static void GPIO_init(void)
|
|
||||||
{
|
|
||||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN | RCC_AHB2ENR_GPIOBEN;
|
|
||||||
|
|
||||||
// LEDs PA0-PA3 Output (01)
|
|
||||||
GPIOA->MODER &= ~(0xFF);
|
|
||||||
GPIOA->MODER |= 0x55;
|
|
||||||
|
|
||||||
// Initial alle aus (Low-Active: 1 = AUS)
|
|
||||||
GPIOA->ODR |= 0x0F;
|
|
||||||
|
|
||||||
// S0 (PB0) Input (00) mit Pull-Up (01)
|
|
||||||
GPIOB->MODER &= ~(3 << 0);
|
|
||||||
GPIOB->PUPDR |= (1 << 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Timer_init(void) {
|
|
||||||
RCC->APB1ENR1 |= RCC_APB1ENR1_TIM6EN;
|
|
||||||
|
|
||||||
// 16MHz Systemtakt. 16MHz / 16 (PSC+1) = 1MHz.
|
|
||||||
// Bei 1MHz sind 1000 Ticks (ARR+1) exakt 1 Millisekunde.
|
|
||||||
TIM6->PSC = 15;
|
|
||||||
TIM6->ARR = 999;
|
|
||||||
TIM6->DIER |=(1<<0);
|
|
||||||
NVIC_EnableIRQ(TIM6_DAC_IRQn);
|
|
||||||
TIM6->CR1 |= (1<<0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EXTI_init(void) {
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
|
||||||
SYSCFG->EXTICR[0] = (SYSCFG->EXTICR[0] & ~(0xF)) | 0x1;
|
|
||||||
EXTI->IMR1 |= (1<<0);
|
|
||||||
EXTI->FTSR1 |= (1<<0);
|
|
||||||
NVIC_EnableIRQ(EXTI0_IRQn);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ *\
|
|
||||||
* method: static void SysTick_init(void)
|
|
||||||
*
|
|
||||||
* At system startup SysTick runs with 1 MHz down to 0.
|
|
||||||
*
|
|
||||||
* Register names differ in datasheets.
|
|
||||||
* ST / CMSIS: ARM:
|
|
||||||
* - SysTick->CALIB - STK_CALIB
|
|
||||||
* - SysTick->CTRL - STK_CSR
|
|
||||||
* - SysTick->LOAD - STK_RVR
|
|
||||||
* - SysTick->VAL - STK_CVR
|
|
||||||
*
|
|
||||||
* requires: - nothing -
|
|
||||||
* parameters: - none -
|
|
||||||
* returns: - nothing -
|
|
||||||
\* ------------------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************ E O F ***************************************** */
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
# LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
# MOVS r2, #0x03 // prepare mask
|
|
||||||
# LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
# BICS r0, r2 // delete bits
|
|
||||||
# MOVS r2, #0x01 // load configuration mask
|
|
||||||
# ORRS r0, r0, r2 // apply mask
|
|
||||||
# STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOB_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #2]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #2]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x03
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
/*
|
|
||||||
* sketch.c
|
|
||||||
*
|
|
||||||
* Created on: Mar 18, 2026
|
|
||||||
* Author: tobii
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,324 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
LDR r1, =GPIO_IDR
|
|
||||||
MOVS
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r2
|
|
||||||
EORS r0, r0, r3
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,323 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x01
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r2
|
|
||||||
EORS r0, r0, r3
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
# LDR r1, =GPIOA_MODER
|
|
||||||
# MOVS r3, #0x05
|
|
||||||
# LDR r0, [r1, #1]
|
|
||||||
# BICS r0, r3
|
|
||||||
# MOVS r3, #0x01
|
|
||||||
# ORRS r0, r0, r3
|
|
||||||
# STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* sketch.c
|
|
||||||
*
|
|
||||||
* Created on: Mar 18, 2026
|
|
||||||
* Author: tobii
|
|
||||||
*/
|
|
||||||
int reihenfolge[6] = {0, 1, 2, 3, 2, 1};
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
while(1){
|
|
||||||
while(/*schalter gedrückt*/){}
|
|
||||||
delay();
|
|
||||||
while(/*schalter losgelassen*/){}
|
|
||||||
delay();
|
|
||||||
|
|
||||||
int aktiv = 1;
|
|
||||||
while(aktiv){
|
|
||||||
for(int i; i < reihenfolge.length - 1; i ++){
|
|
||||||
//alle LED einschalten
|
|
||||||
if(i = 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,315 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
LDR r1, =GPIO_IDR
|
|
||||||
MOVS
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r2
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
@ -1,325 +0,0 @@
|
|||||||
#****************************************************************************************#
|
|
||||||
# Project: task2 - ASM: Interrupts
|
|
||||||
# File: task2.s
|
|
||||||
#
|
|
||||||
# Language: ASM
|
|
||||||
#
|
|
||||||
# Hardware: STefi Light v1.1
|
|
||||||
# Processor: STM32G431KBT6U
|
|
||||||
#
|
|
||||||
# Author: Manuel Lederhofer
|
|
||||||
# Datum: 31.10.2014
|
|
||||||
#
|
|
||||||
# Version: 6.0
|
|
||||||
# History:
|
|
||||||
# 31.10.2014 ML create file
|
|
||||||
# 27.09.2018 ML edit comments, extend vector table
|
|
||||||
# 18.12.2018 ML port from MKL05Z32VLC4 to STM32L476RG
|
|
||||||
# 27.02.2019 ML move section of exception handlers to bottom of file
|
|
||||||
# 25.09.2019 ML minor changes for a better code and comment understanding
|
|
||||||
# 04.09.2020 HL port from STM32L476RG to STM32F411xE
|
|
||||||
# 21.09.2020 ML tidy up, comments and formatting
|
|
||||||
# 29.09.2021 ML port from STM32F411xE to STM32F042K6T6
|
|
||||||
# 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
|
||||||
# 10.02.2025 TK remove ASM:Polling,move ASM:Interrupts to task2
|
|
||||||
# 24.06.2025 TK remove /* ... place your code here ... */
|
|
||||||
#
|
|
||||||
# Status: working
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# See the description and requirements of the requested application
|
|
||||||
# in the lab exercise guide.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - MCU speed at startup is 16 MHz
|
|
||||||
#
|
|
||||||
# ToDo:
|
|
||||||
# - Change the example code to match the description and requirements
|
|
||||||
# of the requested application in the lab exercise guide.
|
|
||||||
#****************************************************************************************#
|
|
||||||
|
|
||||||
.include "G431_addr.s"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .vectortable,"a" // vector table at begin of ROM
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
.word 0x20004000 // initial Stack Pointer: 0x20000000 (RAM base) + 0x4000 (16K SRAM1 length)
|
|
||||||
.word 0x08000401 // initial Program Counter
|
|
||||||
.word _ISR_NMI // non-masking interrupt
|
|
||||||
.word _ISR_HARDF // hard fault interrupt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* N.B.
|
|
||||||
Look at the .space or the .org assembler directive to insert the address of the
|
|
||||||
ISRs at the right place in the vector table. Verify your settings by the help of
|
|
||||||
the list file. */
|
|
||||||
|
|
||||||
.word _ISR_S0
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.text // section .text (default section for program code)
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global init
|
|
||||||
.type init, %function
|
|
||||||
init:
|
|
||||||
CPSID i // disable interrupts globally
|
|
||||||
|
|
||||||
MOVS r0, #0 // safely initialize the GPRs
|
|
||||||
MOVS r1, #0
|
|
||||||
MOVS r2, #0
|
|
||||||
MOVS r3, #0
|
|
||||||
MOVS r4, #0
|
|
||||||
MOVS r5, #0
|
|
||||||
MOVS r6, #0
|
|
||||||
MOVS r7, #0
|
|
||||||
MOV r8, r0
|
|
||||||
MOV r9, r0
|
|
||||||
MOV r10, r0
|
|
||||||
MOV r11, r0
|
|
||||||
MOV r12, r0
|
|
||||||
|
|
||||||
#--- enable port clocking
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask for adjusting port clock gating (A: LEDs)
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for ports
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- port init
|
|
||||||
#- LEDs
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0x03 // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x01 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // apply mask
|
|
||||||
STR r0, [r1, #0] // apply result to port A mode register
|
|
||||||
|
|
||||||
LDR r1, =GPIOA_MODER
|
|
||||||
MOVS r3, #0x05
|
|
||||||
LDR r0, [r1, #1]
|
|
||||||
BICS r0, r3
|
|
||||||
MOVS r3, #0x02
|
|
||||||
ORRS r0, r0, r3
|
|
||||||
STR r0, [r1, #1]
|
|
||||||
|
|
||||||
#- switch LED off
|
|
||||||
LDR r1, =GPIOA_ODR // load port A output data register
|
|
||||||
MOVS r2, #0x01 // load mask for LED
|
|
||||||
LDR r0, [r1, #0] // get current value of GPIOA
|
|
||||||
ORRS r0, r0, r2 // configure pin state
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#- buttons
|
|
||||||
|
|
||||||
/* ... place your code here ... */
|
|
||||||
|
|
||||||
|
|
||||||
#--- button interrupt config
|
|
||||||
|
|
||||||
#- enable clock for SYSCFG module
|
|
||||||
|
|
||||||
|
|
||||||
#- connect GPIO pins of the buttons to EXTended Interrupt controller lines (EXTI)
|
|
||||||
# in SYSCFG module (SYSCFG_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- configure lines in EXTI module (EXTI_* registers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#- NVIC: set interrupt priority, clear pending bits
|
|
||||||
# and enable interrupts for buttons (see: PM, ch. 4.3, NVIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CPSIE i // enable interrupts globally
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global main
|
|
||||||
.type main, %function
|
|
||||||
main:
|
|
||||||
LDR r1, =GPIOA_ODR
|
|
||||||
EORS r0, r0, r3
|
|
||||||
|
|
||||||
STR r0, [r1, #0]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BL delay
|
|
||||||
|
|
||||||
|
|
||||||
B main
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.thumb_func
|
|
||||||
.global delay
|
|
||||||
.type delay, %function
|
|
||||||
delay:
|
|
||||||
MOVS r6, #0 // ...
|
|
||||||
LDR r7, =2000000 // ...
|
|
||||||
.L1:
|
|
||||||
ADDS r6, r6, #1 // ...
|
|
||||||
CMP r6, r7 // ...
|
|
||||||
BNE .L1 // ...
|
|
||||||
BX lr // ...
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.global stop
|
|
||||||
stop:
|
|
||||||
NOP // do nothing (NOP is here to avoid a debugger crash, only)
|
|
||||||
B stop // if this line is reached, something went wrong
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp1: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.section .exhand,"ax" // section for exception handlers
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_NMI, %function
|
|
||||||
_ISR_NMI:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x44 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x0A // load mask for blue and yellow LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_NMI
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_HARDF, %function
|
|
||||||
_ISR_HARDF:
|
|
||||||
#--- enable clock
|
|
||||||
LDR r1, =RCC_AHB2ENR // load address of RCC_AHB2ENR
|
|
||||||
MOV r2, #0x01 // load mask
|
|
||||||
LDR r0, [r1, #0] // get current value of RCC_AHB2ENR
|
|
||||||
ORRS r0, r0, r2 // configure clock gating for port
|
|
||||||
STR r0, [r1, #0] // apply settings
|
|
||||||
|
|
||||||
#--- init pins
|
|
||||||
LDR r1, =GPIOA_MODER // load port A mode register address
|
|
||||||
MOVS r2, #0xFF // prepare mask
|
|
||||||
LDR r0, [r1, #0] // get current value of port A mode register
|
|
||||||
BICS r0, r0, r2 // delete bits
|
|
||||||
MOVS r2, #0x11 // load configuration mask
|
|
||||||
ORRS r0, r0, r2 // configure pins
|
|
||||||
STR r0, [r1, #0] // apply settings to port A mode register
|
|
||||||
|
|
||||||
#--- switch some LEDs on
|
|
||||||
LDR r1, =GPIOA_ODR // load port A data output register address
|
|
||||||
MOVS r2, #0x05 // load mask for red and green LED
|
|
||||||
LDR r0, [r1, #0]
|
|
||||||
BICS r0, r0, r2
|
|
||||||
STR r0, [r1, #0] // switch LEDs on
|
|
||||||
|
|
||||||
B _ISR_HARDF
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S0, %function
|
|
||||||
_ISR_S0:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.align 2
|
|
||||||
.syntax unified
|
|
||||||
.thumb
|
|
||||||
.type _ISR_S1, %function
|
|
||||||
_ISR_S1:
|
|
||||||
PUSH {lr} // save special content
|
|
||||||
|
|
||||||
#--- do the work
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- clear interrupt flag
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- leave ISR
|
|
||||||
POP {r1} // get special content back
|
|
||||||
BX r1 // go back to where we came from
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
.lp2: // this label is only to nicify the line up in the .lst file
|
|
||||||
.ltorg
|
|
||||||
#----------------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
.end
|
|
||||||
|
|
||||||
#************************************** E O F *******************************************#
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.core.resources/.root/63.tree
Normal file
BIN
.metadata/.plugins/org.eclipse.core.resources/.root/63.tree
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.core.resources/63.snap
Normal file
BIN
.metadata/.plugins/org.eclipse.core.resources/63.snap
Normal file
Binary file not shown.
@ -1,12 +1,21 @@
|
|||||||
StringVariablePreferencePage=184,154,153,122,
|
StringVariablePreferencePage=184,154,153,122,
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.debug.ui.MemoryHistoryKnownColor=235,235,235
|
||||||
|
org.eclipse.debug.ui.MemoryHistoryUnknownColor=170,175,185
|
||||||
org.eclipse.debug.ui.MemoryView.orientation=0
|
org.eclipse.debug.ui.MemoryView.orientation=0
|
||||||
|
org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND=150,80,115
|
||||||
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<launchPerspectives/>\n
|
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<launchPerspectives/>\n
|
||||||
|
org.eclipse.debug.ui.changedDebugElement=255,128,128
|
||||||
|
org.eclipse.debug.ui.consoleBackground=53,53,53
|
||||||
|
org.eclipse.debug.ui.errorColor=225,30,70
|
||||||
|
org.eclipse.debug.ui.inColor=140,175,210
|
||||||
|
org.eclipse.debug.ui.outColor=235,235,235
|
||||||
org.eclipse.debug.ui.save_dirty_editors_before_launch=always
|
org.eclipse.debug.ui.save_dirty_editors_before_launch=always
|
||||||
org.eclipse.debug.ui.switch_perspective_on_suspend=always
|
org.eclipse.debug.ui.switch_perspective_on_suspend=always
|
||||||
org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<viewBindings>\n <view id\="org.eclipse.debug.ui.ExpressionView">\n <perspective id\="org.eclipse.debug.ui.DebugPerspective" userAction\="opened"/>\n </view>\n</viewBindings>\n
|
org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<viewBindings>\n <view id\="org.eclipse.debug.ui.ExpressionView">\n <perspective id\="org.eclipse.debug.ui.DebugPerspective" userAction\="opened"/>\n </view>\n</viewBindings>\n
|
||||||
|
overriddenByCSS=,org.eclipse.debug.ui.MemoryHistoryKnownColor,org.eclipse.debug.ui.MemoryHistoryUnknownColor,org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND,org.eclipse.debug.ui.changedDebugElement,org.eclipse.debug.ui.consoleBackground,org.eclipse.debug.ui.errorColor,org.eclipse.debug.ui.inColor,org.eclipse.debug.ui.outColor,
|
||||||
pref_state_memento.org.eclipse.debug.ui.BreakpointView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.BreakpointView">\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="org.eclipse.debug.ui.check"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
pref_state_memento.org.eclipse.debug.ui.BreakpointView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.BreakpointView">\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="org.eclipse.debug.ui.check"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
||||||
pref_state_memento.org.eclipse.debug.ui.DebugVieworg.eclipse.debug.ui.DebugView=<?xml version\="1.0" encoding\="UTF-8"?>\n<DebugViewMemento org.eclipse.debug.ui.BREADCRUMB_DROPDOWN_AUTO_EXPAND\="false"/>
|
pref_state_memento.org.eclipse.debug.ui.DebugVieworg.eclipse.debug.ui.DebugView=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<DebugViewMemento org.eclipse.debug.ui.BREADCRUMB_DROPDOWN_AUTO_EXPAND\="false"/>
|
||||||
pref_state_memento.org.eclipse.debug.ui.ExpressionView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.ExpressionView">\n<INTEGER IMemento.internal.id\="initialChildCountLimitForCollections" INTEGER\="100"/>\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="PRESENTATION_SHOW_LOGICAL_STRUCTURES"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
pref_state_memento.org.eclipse.debug.ui.ExpressionView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.ExpressionView">\n<INTEGER IMemento.internal.id\="initialChildCountLimitForCollections" INTEGER\="100"/>\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="PRESENTATION_SHOW_LOGICAL_STRUCTURES"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
||||||
pref_state_memento.org.eclipse.debug.ui.ModuleView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684"/>
|
pref_state_memento.org.eclipse.debug.ui.ModuleView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684"/>
|
||||||
pref_state_memento.org.eclipse.debug.ui.RegisterView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__DESCRIPTION" SIZE\="222"/>\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__NAME" SIZE\="222"/>\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__VALUE" SIZE\="222"/>\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.RegisterView">\n<STRING IMemento.internal.id\="CurrentNumericStyle" STRING\="HEX.Format"/>\n<PERSISTABLE IMemento.internal.id\="org.eclipse.cdt.dsf.ui.elementFormatPersistable" PERSISTABLE\="org.eclipse.cdt.dsf.ui.simpleMapPersistableFactory">\n<type>java.lang.String</type>\n</PERSISTABLE>\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="PRESENTATION_SHOW_LOGICAL_STRUCTURES"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
pref_state_memento.org.eclipse.debug.ui.RegisterView=<?xml version\="1.0" encoding\="UTF-8"?>\n<VariablesViewMemento org.eclipse.debug.ui.SASH_DETAILS_PART\="315" org.eclipse.debug.ui.SASH_VIEW_PART\="684">\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__DESCRIPTION" SIZE\="222"/>\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__NAME" SIZE\="222"/>\n<COLUMN_SIZES IMemento.internal.id\="org.eclipse.cdt.dsf.ui.COLUMN_ID__VALUE" SIZE\="222"/>\n<PRESENTATION_CONTEXT_PROPERTIES IMemento.internal.id\="org.eclipse.debug.ui.RegisterView">\n<STRING IMemento.internal.id\="CurrentNumericStyle" STRING\="HEX.Format"/>\n<PERSISTABLE IMemento.internal.id\="org.eclipse.cdt.dsf.ui.elementFormatPersistable" PERSISTABLE\="org.eclipse.cdt.dsf.ui.simpleMapPersistableFactory">\n<type>java.lang.String</type>\n</PERSISTABLE>\n<BOOLEAN BOOLEAN\="true" IMemento.internal.id\="PRESENTATION_SHOW_LOGICAL_STRUCTURES"/>\n</PRESENTATION_CONTEXT_PROPERTIES>\n</VariablesViewMemento>
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/arch=x86_64
|
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/arch=x86_64
|
||||||
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/name=Local
|
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/name=Local
|
||||||
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/os=win32
|
LaunchTargetManager/org.eclipse.launchbar.core.launchTargetType.local,Local/os=win32
|
||||||
configDescList=org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task4,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3 Debug
|
configDescList=org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3 Debug,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task4,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:A3_Timer/activeLaunchMode=run
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:A3_Timer/activeLaunchMode=run
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1/activeLaunchMode=run
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1/activeLaunchMode=run
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1/activeLaunchTarget=null\:---
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1/activeLaunchTarget=null\:---
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2/activeLaunchMode=run
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2/activeLaunchMode=run
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2/activeLaunchTarget=null\:---
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2/activeLaunchTarget=null\:---
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3\ Debug/activeLaunchMode=debug
|
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3/activeLaunchMode=run
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3/activeLaunchMode=run
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3/activeLaunchTarget=null\:---
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task3/activeLaunchTarget=null\:---
|
||||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task4/activeLaunchMode=run
|
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task4/activeLaunchMode=run
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
EXIT_PROMPT_ON_CLOSE_LAST_WINDOW=false
|
|
||||||
IMPORT_FILES_AND_FOLDERS_RELATIVE=true
|
IMPORT_FILES_AND_FOLDERS_RELATIVE=true
|
||||||
IMPORT_FILES_AND_FOLDERS_TYPE=23,1
|
IMPORT_FILES_AND_FOLDERS_TYPE=23,1
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
platformState=1772304866334
|
platformState=1772304866304
|
||||||
quickStart=false
|
quickStart=false
|
||||||
tipsAndTricks=true
|
tipsAndTricks=true
|
||||||
|
|||||||
@ -6,17 +6,17 @@ PLUGINS_NOT_ACTIVATED_ON_STARTUP=
|
|||||||
UIActivities.org.eclipse.cdt.debug.dsfgdbActivity=true
|
UIActivities.org.eclipse.cdt.debug.dsfgdbActivity=true
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
editors=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<editors>\r\n<descriptor id\="org.eclipse.ui.browser.editorSupport" image\="$nl$/icons/obj16/internal_browser.png" internal\="false" label\="Web Browser" launcher\="org.eclipse.ui.internal.browser.BrowserLauncher" openMode\="4" open_in_place\="false" plugin\="org.eclipse.ui.browser"/>\r\n<descriptor class\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor" id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor" image\="icons/dts_icon.png" internal\="true" label\="Device Tree Editor" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.ide.mpu.linux.ide"/>\r\n<descriptor class\="com.st.stm32cube.common.mx.editor.CubeMxEditor" id\="com.st.stm32cube.common.mx.startCubeMx" image\="icons/MicroXplorer.png" internal\="true" label\="Device Configuration Tool" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.common.mx"/>\r\n<descriptor class\="com.st.stm32cube.ide.mcu.linker.ui.ui.editors.LDMultiEditorPart" id\="com.st.stm32cube.ide.mcu.ldeditor.ui.editors.LDPageEditor" image\="icons/ldscript_icon.png" internal\="true" label\="Linker Script Editor" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.ide.mcu.linker"/>\r\n</editors>
|
editors=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<editors>\r\n<descriptor id\="org.eclipse.ui.browser.editorSupport" image\="$nl$/icons/obj16/internal_browser.png" internal\="false" label\="Web Browser" launcher\="org.eclipse.ui.internal.browser.BrowserLauncher" openMode\="4" open_in_place\="false" plugin\="org.eclipse.ui.browser"/>\r\n<descriptor class\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor" id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor" image\="icons/dts_icon.png" internal\="true" label\="Device Tree Editor" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.ide.mpu.linux.ide"/>\r\n<descriptor class\="com.st.stm32cube.common.mx.editor.CubeMxEditor" id\="com.st.stm32cube.common.mx.startCubeMx" image\="icons/MicroXplorer.png" internal\="true" label\="Device Configuration Tool" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.common.mx"/>\r\n<descriptor class\="com.st.stm32cube.ide.mcu.linker.ui.ui.editors.LDMultiEditorPart" id\="com.st.stm32cube.ide.mcu.ldeditor.ui.editors.LDPageEditor" image\="icons/ldscript_icon.png" internal\="true" label\="Linker Script Editor" openMode\="1" open_in_place\="false" plugin\="com.st.stm32cube.ide.mcu.linker"/>\r\n</editors>
|
||||||
org.eclipse.cdt.debug.ui.ModulesDetailPaneFont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.debug.ui.ModulesDetailPaneFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.cdt.internal.ui.compare.AsmMergeViewer=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.internal.ui.compare.AsmMergeViewer=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.cdt.internal.ui.compare.CMergeViewer=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.internal.ui.compare.CMergeViewer=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.cdt.make.internal.ui.compare.MakefileMergeViewer=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.make.internal.ui.compare.MakefileMergeViewer=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.cdt.ui.buildconsole.ConsoleFont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.ui.buildconsole.ConsoleFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.cdt.ui.editors.textfont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.cdt.ui.editors.textfont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.compare.contentmergeviewer.TextMergeViewer=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.compare.contentmergeviewer.TextMergeViewer=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.debug.ui.DetailPaneFont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.debug.ui.DetailPaneFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.debug.ui.MemoryViewTableFont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.debug.ui.MemoryViewTableFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.debug.ui.consoleFont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.debug.ui.consoleFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.jface.textfont=1|Consolas|14.0|0|GTK|1|;
|
org.eclipse.jface.textfont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
org.eclipse.ui.commands=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<org.eclipse.ui.commands>\r\n<keyBinding contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="CTRL+F11"/>\r\n<keyBinding commandId\="org.eclipse.ui.project.buildProject" contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+B"/>\r\n<keyBinding commandId\="org.eclipse.debug.ui.commands.RunLast" contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+R"/>\r\n</org.eclipse.ui.commands>
|
org.eclipse.ui.commands=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<org.eclipse.ui.commands>\r\n<keyBinding contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="CTRL+F11"/>\r\n<keyBinding commandId\="org.eclipse.ui.project.buildProject" contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+B"/>\r\n<keyBinding commandId\="org.eclipse.debug.ui.commands.RunLast" contextId\="org.eclipse.ui.contexts.window" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+R"/>\r\n</org.eclipse.ui.commands>
|
||||||
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41
|
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41
|
||||||
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45
|
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45
|
||||||
@ -29,4 +29,4 @@ org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=59,64,66
|
|||||||
org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR=187,187,187
|
org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR=187,187,187
|
||||||
org.eclipse.ui.workbench.texteditor.blockSelectionModeFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
org.eclipse.ui.workbench.texteditor.blockSelectionModeFont=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
resourcetypes=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<editors version\="3.1">\r\n<info extension\="shtml" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="dtsi" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor"/>\r\n</info>\r\n<info extension\="dts" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor"/>\r\n</info>\r\n<info extension\="htm" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="html" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="ioc" name\="*">\r\n<editor id\="com.st.stm32cube.common.mx.startCubeMx"/>\r\n</info>\r\n<info extension\="ld" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mcu.ldeditor.ui.editors.LDPageEditor"/>\r\n</info>\r\n</editors>
|
resourcetypes=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<editors version\="3.1">\r\n<info extension\="shtml" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="dtsi" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor"/>\r\n</info>\r\n<info extension\="dts" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mpu.linux.ide.editor.DTSEditor"/>\r\n</info>\r\n<info extension\="htm" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="html" name\="*">\r\n<editor id\="org.eclipse.ui.browser.editorSupport"/>\r\n</info>\r\n<info extension\="ioc" name\="*">\r\n<editor id\="com.st.stm32cube.common.mx.startCubeMx"/>\r\n</info>\r\n<info extension\="ld" name\="*">\r\n<editor id\="com.st.stm32cube.ide.mcu.ldeditor.ui.editors.LDPageEditor"/>\r\n</info>\r\n</editors>
|
||||||
terminal.views.view.font.definition=1|Consolas|14.0|0|GTK|1|;
|
terminal.views.view.font.definition=1|Consolas|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|49|Consolas;
|
||||||
|
|||||||
@ -2,10 +2,14 @@
|
|||||||
<launchHistory>
|
<launchHistory>
|
||||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
|
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
|
||||||
<mruHistory>
|
<mruHistory>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3 Debug.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task1/task1.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task2/task2.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3 Debug.launch"/> "/>
|
||||||
</mruHistory>
|
</mruHistory>
|
||||||
<favorites>
|
<favorites>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task1/task1.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task2/task2.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3.launch"/> "/>
|
||||||
</favorites>
|
</favorites>
|
||||||
@ -20,10 +24,14 @@
|
|||||||
</launchGroup>
|
</launchGroup>
|
||||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
|
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
|
||||||
<mruHistory>
|
<mruHistory>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3 Debug.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task1/task1.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task2/task2.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3 Debug.launch"/> "/>
|
||||||
</mruHistory>
|
</mruHistory>
|
||||||
<favorites>
|
<favorites>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task1/task1.launch"/> "/>
|
||||||
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task2/task2.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task4/task4.launch"/> "/>
|
||||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3.launch"/> "/>
|
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="false" path="/task3/task3.launch"/> "/>
|
||||||
</favorites>
|
</favorites>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<session version="1.0">
|
|
||||||
<refactoring comment="Delete resource 'task2/task2_tobi.s'" deleteContents="false" description="Delete resource 'task2/task2_tobi.s'" element1="/task2/task2_tobi.s" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1774360637158"/>
|
|
||||||
</session>
|
|
||||||
@ -1 +0,0 @@
|
|||||||
1774360637158 Delete resource 'task2/task2_tobi.s'
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<session version="1.0">
<refactoring comment="Rename resource 'task2/task2.s' to 'task2_tobi.s'" description="Rename resource 'task2.s'" flags="7" id="org.eclipse.ltk.core.refactoring.rename.resource" input="task2.s" name="task2_tobi.s" stamp="1774358097434" updateReferences="true"/>
<refactoring comment="Rename resource 'task2/task2_efe.s' to 'task2.s'" description="Rename resource 'task2_efe.s'" flags="7" id="org.eclipse.ltk.core.refactoring.rename.resource" input="task2_efe.s" name="task2.s" stamp="1774358106409" updateReferences="true"/>
|
|
||||||
</session>
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
1774358097434 Rename resource 'task2.s'
|
|
||||||
1774358106409 Rename resource 'task2_efe.s'
|
|
||||||
@ -1,15 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<section name="Workbench">
|
<section name="Workbench">
|
||||||
<section name="RefactoringWizard.preview">
|
<section name="RefactoringWizard.preview">
|
||||||
<item key="width" value="600"/>
|
<item key="width" value="600"/>
|
||||||
<item key="height" value="400"/>
|
<item key="height" value="400"/>
|
||||||
</section>
|
</section>
|
||||||
<section name="ShowRefactoringHistoryWizard">
|
<section name="ShowRefactoringHistoryWizard">
|
||||||
<item key="org.eclipse.ltk.ui.refactoring.sortRefactorings" value="true"/>
|
<item key="org.eclipse.ltk.ui.refactoring.sortRefactorings" value="true"/>
|
||||||
</section>
|
</section>
|
||||||
<section name="RefactoringStatusDialog">
|
<section name="RefactoringStatusDialog">
|
||||||
<item key="DIALOG_WIDTH" value="816"/>
|
<item key="DIALOG_WIDTH" value="816"/>
|
||||||
<item key="DIALOG_HEIGHT" value="490"/>
|
<item key="DIALOG_HEIGHT" value="490"/>
|
||||||
<item key="DIALOG_FONT_NAME" value="1|Segoe UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Segoe UI"/>
|
<item key="DIALOG_FONT_NAME" value="1|Segoe UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Segoe UI"/>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
<section name="CleanDialogSettings">
|
<section name="CleanDialogSettings">
|
||||||
<item key="BUILD_NOW" value="false"/>
|
<item key="BUILD_NOW" value="false"/>
|
||||||
<item key="BUILD_ALL" value="true"/>
|
<item key="BUILD_ALL" value="true"/>
|
||||||
<item key="TOGGLE_SELECTED" value="true"/>
|
<item key="TOGGLE_SELECTED" value="false"/>
|
||||||
<item key="DIALOG_WIDTH" value="731"/>
|
<item key="DIALOG_WIDTH" value="731"/>
|
||||||
<item key="DIALOG_HEIGHT" value="569"/>
|
<item key="DIALOG_HEIGHT" value="569"/>
|
||||||
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
|
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
|
||||||
|
|||||||
@ -1,37 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<section name="Workbench">
|
<section name="Workbench">
|
||||||
<section name="org.eclipse.ui.texteditor.FindReplaceDialog">
|
<section name="org.eclipse.ui.texteditor.FindReplaceDialog">
|
||||||
<item key="selection" value="RCC_AHB2ENR"/>
|
<item key="selection" value="r1"/>
|
||||||
<item key="wrap" value="true"/>
|
<item key="wrap" value="true"/>
|
||||||
<item key="casesensitive" value="false"/>
|
<item key="casesensitive" value="false"/>
|
||||||
<item key="wholeword" value="false"/>
|
<item key="wholeword" value="false"/>
|
||||||
<item key="incremental" value="false"/>
|
<item key="incremental" value="false"/>
|
||||||
<item key="isRegEx" value="false"/>
|
<item key="isRegEx" value="false"/>
|
||||||
<list key="findhistory">
|
<list key="findhistory">
|
||||||
<item value="RCC_AHB2ENR"/>
|
<item value="r1"/>
|
||||||
<item value="RCC"/>
|
<item value="4f f0 90 43"/>
|
||||||
<item value="r1"/>
|
<item value="4f f0 "/>
|
||||||
<item value="4f f0 90 43"/>
|
<item value="4f f0"/>
|
||||||
<item value="4f f0 "/>
|
<item value="f04f"/>
|
||||||
<item value="4f f0"/>
|
<item value="4ff0 9043"/>
|
||||||
<item value="f04f"/>
|
<item value="4ff0"/>
|
||||||
<item value="4ff0 9043"/>
|
<item value="Measurements:"/>
|
||||||
<item value="4ff0"/>
|
<item value="/* ... place your code here ... */"/>
|
||||||
<item value="Measurements:"/>
|
<item value="/* ... put your code here ... */"/>
|
||||||
<item value="/* ... place your code here ... */"/>
|
<item value="task1"/>
|
||||||
<item value="/* ... put your code here ... */"/>
|
</list>
|
||||||
<item value="task1"/>
|
<list key="replacehistory">
|
||||||
</list>
|
<item value=""/>
|
||||||
<list key="replacehistory">
|
<item value="task3"/>
|
||||||
<item value=""/>
|
</list>
|
||||||
<item value="task3"/>
|
</section>
|
||||||
</list>
|
<section name="org.eclipse.ui.texteditor.FindReplaceDialog_dialogBounds">
|
||||||
</section>
|
<item key="DIALOG_X_ORIGIN" value="1353"/>
|
||||||
<section name="org.eclipse.ui.texteditor.FindReplaceDialog_dialogBounds">
|
<item key="DIALOG_Y_ORIGIN" value="470"/>
|
||||||
<item key="DIALOG_X_ORIGIN" value="1353"/>
|
<item key="DIALOG_WIDTH" value="322"/>
|
||||||
<item key="DIALOG_Y_ORIGIN" value="470"/>
|
<item key="DIALOG_HEIGHT" value="391"/>
|
||||||
<item key="DIALOG_WIDTH" value="453"/>
|
<item key="DIALOG_FONT_NAME" value="1|Segoe UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Segoe UI"/>
|
||||||
<item key="DIALOG_HEIGHT" value="494"/>
|
</section>
|
||||||
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
|
</section>
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
#Tue Apr 14 14:00:08 CEST 2026
|
#Mon Mar 09 11:19:41 CET 2026
|
||||||
org.eclipse.core.runtime=2
|
org.eclipse.core.runtime=2
|
||||||
org.eclipse.platform=4.30.0.v20231201-0110
|
org.eclipse.platform=4.30.0.v20231201-0110
|
||||||
|
|||||||
@ -1,110 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<FRAME GUID="2FB25471-B62C-4EE6-BD43-F819C095ACF8" FORMAT="0000" APP_VERSION="2.2.0.8" CHECKSUM="48FC0BB7AAC12F0C">
|
|
||||||
<PROJECT FORMAT="1.00" NAME="MCT_Ablaufplaene" AUTHOR="tobis" CREATED="2026.03.16 18:21:51" MODIFIED="2026.03.16 21:54:22">
|
|
||||||
<DIAGRAMS>
|
|
||||||
<DIAGRAM FORMAT="1.00" ID="0" NAME="Task 1" CREATED="2026.03.16 18:22:10" MODIFIED="2026.03.16 21:54:22">
|
|
||||||
<LAYOUT FORMAT="1.00" COLUMNS="3" ROWS="13">
|
|
||||||
<ENTRIES>
|
|
||||||
<ENTRY COLUMN="0" ROW="0" ANCHOR="True">
|
|
||||||
<FIGURE SUBTYPE="PapTitle" FORMAT="1.00" ID="0">
|
|
||||||
<TEXT><![CDATA[Task 1]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="1">
|
|
||||||
<FIGURE SUBTYPE="PapStart" FORMAT="1.00" ID="1">
|
|
||||||
<TEXT><![CDATA[Start]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="2">
|
|
||||||
<FIGURE SUBTYPE="PapLoopStart" FORMAT="1.00" ID="5" ASSOCIATE="6">
|
|
||||||
<TEXT><![CDATA[while(1)]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="3">
|
|
||||||
<FIGURE SUBTYPE="PapInput" FORMAT="1.00" ID="10">
|
|
||||||
<TEXT><![CDATA[Eingabe von S0]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="4">
|
|
||||||
<FIGURE SUBTYPE="PapCondition" FORMAT="1.00" ID="4">
|
|
||||||
<TEXT><![CDATA[S0 gedrückt?]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="5">
|
|
||||||
<FIGURE SUBTYPE="PapActivity" FORMAT="1.00" ID="46">
|
|
||||||
<TEXT><![CDATA[LED0 AN]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="6">
|
|
||||||
<FIGURE SUBTYPE="PapCondition" FORMAT="1.00" ID="32">
|
|
||||||
<TEXT><![CDATA[S0 gedrückt?]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="7">
|
|
||||||
<FIGURE SUBTYPE="PapLoopStart" FORMAT="1.00" ID="35" ASSOCIATE="36">
|
|
||||||
<TEXT><![CDATA[while(1)]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="8">
|
|
||||||
<FIGURE SUBTYPE="PapCondition" FORMAT="1.00" ID="38">
|
|
||||||
<TEXT><![CDATA[S0 gedrückt?]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="9">
|
|
||||||
<FIGURE SUBTYPE="PapComment" FORMAT="1.00" ID="45">
|
|
||||||
<TEXT><![CDATA[NEIN]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="10">
|
|
||||||
<FIGURE SUBTYPE="PapLoopEnd" FORMAT="1.00" ID="36" ASSOCIATE="35">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="11">
|
|
||||||
<FIGURE SUBTYPE="PapLoopEnd" FORMAT="1.00" ID="6" ASSOCIATE="5">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="0" ROW="12">
|
|
||||||
<FIGURE SUBTYPE="PapEnd" FORMAT="1.00" ID="2">
|
|
||||||
<TEXT><![CDATA[Ende]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="1" ROW="4">
|
|
||||||
<FIGURE SUBTYPE="PapConnector" FORMAT="1.00" ID="13">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="2" ROW="5">
|
|
||||||
<FIGURE SUBTYPE="PapConnector" FORMAT="1.00" ID="29">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="2" ROW="6">
|
|
||||||
<FIGURE SUBTYPE="PapConnector" FORMAT="1.00" ID="24">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
<ENTRY COLUMN="2" ROW="8">
|
|
||||||
<FIGURE SUBTYPE="PapConnector" FORMAT="1.00" ID="40">
|
|
||||||
<TEXT><![CDATA[]]></TEXT>
|
|
||||||
</FIGURE>
|
|
||||||
</ENTRY>
|
|
||||||
</ENTRIES>
|
|
||||||
</LAYOUT>
|
|
||||||
<CONNECTIONS>
|
|
||||||
<CONNECTION FORMAT="1.00" ID="9" FROM="1" TO="5" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="11" FROM="10" TO="4" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="12" FROM="5" TO="10" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="14" FROM="4" TO="13" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="27" FROM="32" TO="24" TEXT="nein" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="30" FROM="24" TO="29" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="37" FROM="35" TO="38" TEXT="" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="39" FROM="38" TO="36" TEXT="nein" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="41" FROM="38" TO="40" TEXT="ja" />
|
|
||||||
<CONNECTION FORMAT="1.00" ID="42" FROM="40" TO="24" TEXT="" />
|
|
||||||
</CONNECTIONS>
|
|
||||||
</DIAGRAM>
|
|
||||||
</DIAGRAMS>
|
|
||||||
</PROJECT>
|
|
||||||
</FRAME>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
|||||||
= 4.1 Aufgabe 1 - C: GPIO
|
|
||||||
== Vorbereitungsfragen:
|
|
||||||
=== a. Wozu werden Pull-Up Widerstände bei der Abfrage von Tastern benötigt?
|
|
||||||
=== b. Wie werden Taster entprellt?
|
|
||||||
=== c. Wie wird ein einzelnes Bit in einem 32-bit Wort getoggelt, ohne die anderen Bits zu verändern?
|
|
||||||
`int x ^= (1 << 0);`
|
|
||||||
=== d. Was ist speziell bei der Programmierung von Mikrocontrollern unter dem Begriff Initialisierung zu verstehen?
|
|
||||||
=== e. An Welchen Pors des Mikrocontrollers sind die LEDS und Taster der STefi Light Patine angeschlossen?
|
|
||||||
=== f. Studieren Sie die wichtigsten Quelltextdateien des C-Projektes task1.c und Stefi-Light.h. Welche Register und welche Bits werden hier beschrieben? Suchen Sie in der ST-Dokumentation (Reference Manual) die beiden relevanten Kapitel heraus und vollziehen Sie die Bedeutung der getätigten Einstellungen nach.
|
|
||||||
=== g. Wie muss ein Pin konfiguriert werden damit er als Eingang verwendet werden kann?
|
|
||||||
=== h. Erstellen Sie ein detailliertes Flussdiagramm für Ihre Lauflicht-Applikation
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
= 3.2 Aufgabe 2 - ASM: Interrupts, Entprellen
|
|
||||||
== Aufgabenstellung:
|
|
||||||
Das Programm soll per Tastendruck den Zustand der LEDs wechseln. Taster *S1* soll *LED0* und *LED3* ein-bzw. auschalten, Taster *S1 LED1* und *LED2*
|
|
||||||
== Vorbereitungsfragen:
|
|
||||||
=== a. Welche vier Einträge stehen am Beginn der ARM Exception Vector Table?
|
|
||||||
#table(
|
|
||||||
columns: (1fr, auto, auto),
|
|
||||||
inset: 10pt,
|
|
||||||
align: horizon,
|
|
||||||
table.header(
|
|
||||||
[*Postion*], [*Vektor*], [*Beschreibung*]
|
|
||||||
),
|
|
||||||
[0], [WWDG],
|
|
||||||
=== b. Wie viele Interrupt-Prioritätsstufen unterstützt ein ARM-Controller maximal?
|
|
||||||
=== c. An welchen Positionen in der Exception Vector Table stehen die Adressen der ISRs für die Tasten? (ST Dokumentation)
|
|
||||||
=== d. Schauen Sie sich das Prellen eines Tasters an und überlegen Sie sich eine Lösung.
|
|
||||||
=== e. Erstellen Sie ein komplettes Flussdiagramm für Ihren Lösungsansatz.
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1558684269450950684" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="422947886521367905" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
Src/sketch.o: ../Src/sketch.c
|
|
||||||
Binary file not shown.
@ -5,17 +5,14 @@
|
|||||||
|
|
||||||
# Add inputs and outputs from these tool invocations to the build variables
|
# Add inputs and outputs from these tool invocations to the build variables
|
||||||
C_SRCS += \
|
C_SRCS += \
|
||||||
../Src/sketch.c \
|
|
||||||
../Src/task1.c \
|
../Src/task1.c \
|
||||||
../Src/task1_it.c
|
../Src/task1_it.c
|
||||||
|
|
||||||
OBJS += \
|
OBJS += \
|
||||||
./Src/sketch.o \
|
|
||||||
./Src/task1.o \
|
./Src/task1.o \
|
||||||
./Src/task1_it.o
|
./Src/task1_it.o
|
||||||
|
|
||||||
C_DEPS += \
|
C_DEPS += \
|
||||||
./Src/sketch.d \
|
|
||||||
./Src/task1.d \
|
./Src/task1.d \
|
||||||
./Src/task1_it.d
|
./Src/task1_it.d
|
||||||
|
|
||||||
@ -27,7 +24,7 @@ Src/%.o Src/%.su Src/%.cyclo: ../Src/%.c Src/subdir.mk
|
|||||||
clean: clean-Src
|
clean: clean-Src
|
||||||
|
|
||||||
clean-Src:
|
clean-Src:
|
||||||
-$(RM) ./Src/sketch.cyclo ./Src/sketch.d ./Src/sketch.o ./Src/sketch.su ./Src/task1.cyclo ./Src/task1.d ./Src/task1.o ./Src/task1.su ./Src/task1_it.cyclo ./Src/task1_it.d ./Src/task1_it.o ./Src/task1_it.su
|
-$(RM) ./Src/task1.cyclo ./Src/task1.d ./Src/task1.o ./Src/task1.su ./Src/task1_it.cyclo ./Src/task1_it.d ./Src/task1_it.o ./Src/task1_it.su
|
||||||
|
|
||||||
.PHONY: clean-Src
|
.PHONY: clean-Src
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
../Src/task1.c:56:5:main 5
|
||||||
|
../Src/task1.c:112:13:GPIO_init 1
|
||||||
|
../Src/task1.c:135:13:delay 3
|
||||||
BIN
task1/Debug/Src/task1.o
Normal file
BIN
task1/Debug/Src/task1.o
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
../Src/task1.c:56:5:main 8 static,ignoring_inline_asm
|
||||||
|
../Src/task1.c:112:13:GPIO_init 4 static
|
||||||
|
../Src/task1.c:135:13:delay 24 static,ignoring_inline_asm
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user