mein code in task2
This commit is contained in:
@@ -9259,3 +9259,72 @@ Command-line arguments: -os linux -ws gtk -arch x86_64
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2026-03-20 18:06:39.545
|
||||
!MESSAGE Started RMI Server, listening on port 41337
|
||||
!SESSION 2026-03-21 13:54:00.770 -----------------------------------------------
|
||||
eclipse.buildId=Version 1.16.0
|
||||
java.version=17.0.11
|
||||
java.vendor=Eclipse Adoptium
|
||||
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
|
||||
Command-line arguments: -os linux -ws gtk -arch x86_64
|
||||
|
||||
!ENTRY org.eclipse.core.resources 2 10035 2026-03-21 13:54:03.586
|
||||
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 4 4 2026-03-21 13:54:07.401
|
||||
!MESSAGE CubeMX plugin appears to be active, Log4j initialization might be too late.
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 1 1 2026-03-21 13:54:07.402
|
||||
!MESSAGE Log4j2 initialized with config file /home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/.metadata/.log4j2.xml
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2026-03-21 13:54:12.808
|
||||
!MESSAGE Started RMI Server, listening on port 41337
|
||||
!SESSION 2026-03-24 14:01:44.656 -----------------------------------------------
|
||||
eclipse.buildId=Version 1.16.0
|
||||
java.version=17.0.11
|
||||
java.vendor=Eclipse Adoptium
|
||||
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
|
||||
Command-line arguments: -os linux -ws gtk -arch x86_64
|
||||
|
||||
!ENTRY org.eclipse.core.resources 2 10035 2026-03-24 14:01:47.209
|
||||
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 4 4 2026-03-24 14:01:50.655
|
||||
!MESSAGE CubeMX plugin appears to be active, Log4j initialization might be too late.
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 1 1 2026-03-24 14:01:50.656
|
||||
!MESSAGE Log4j2 initialized with config file /home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/.metadata/.log4j2.xml
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2026-03-24 14:01:55.388
|
||||
!MESSAGE Started RMI Server, listening on port 41337
|
||||
!SESSION 2026-03-24 14:11:26.431 -----------------------------------------------
|
||||
eclipse.buildId=Version 1.16.0
|
||||
java.version=17.0.11
|
||||
java.vendor=Eclipse Adoptium
|
||||
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
|
||||
Command-line arguments: -os linux -ws gtk -arch x86_64
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 4 4 2026-03-24 14:11:31.118
|
||||
!MESSAGE CubeMX plugin appears to be active, Log4j initialization might be too late.
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 1 1 2026-03-24 14:11:31.119
|
||||
!MESSAGE Log4j2 initialized with config file /home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/.metadata/.log4j2.xml
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2026-03-24 14:11:45.929
|
||||
!MESSAGE Started RMI Server, listening on port 41337
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:15:22.829
|
||||
!MESSAGE Error - No active DSF-Session. tmpSessionId = 3 (contextManager row 121)
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:15:22.830
|
||||
!MESSAGE Existing sessions are:
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:17:18.477
|
||||
!MESSAGE Error - No active DSF-Session. tmpSessionId = 6 (contextManager row 121)
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:17:18.477
|
||||
!MESSAGE Existing sessions are:
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:18:01.013
|
||||
!MESSAGE Error - No active DSF-Session. tmpSessionId = 7 (contextManager row 121)
|
||||
|
||||
!ENTRY com.st.stm32cube.ide.mcu.debug 4 0 2026-03-24 14:18:01.013
|
||||
!MESSAGE Existing sessions are:
|
||||
|
||||
@@ -51,3 +51,4 @@
|
||||
*** 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 -----------------------------------------
|
||||
|
||||
Binary file not shown.
@@ -323,3 +323,233 @@ Finished building: default.size.stdout
|
||||
|
||||
Finished building: task1.list
|
||||
|
||||
16:09:45 **** Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
240 0 0 240 f0 task2.elf
|
||||
Target all ready
|
||||
18:20:32 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
task2.s: Assembler messages:
|
||||
task2.s:128: Error: ARM register expected -- `movs '
|
||||
make: *** [makefile:74: task2.o] Error 1
|
||||
"make -j12 all" terminated with exit code 2. Build might be incomplete.
|
||||
18:20:48 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:21:57 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:22:48 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
240 0 0 240 f0 task2.elf
|
||||
Target all ready
|
||||
18:23:22 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:23:42 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:23:54 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:24:03 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:24:24 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:24:36 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:25:04 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:25:26 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:25:42 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:26:11 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
260 0 0 260 104 task2.elf
|
||||
Target all ready
|
||||
18:26:34 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
264 0 0 264 108 task2.elf
|
||||
Target all ready
|
||||
18:26:57 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
248 0 0 248 f8 task2.elf
|
||||
Target all ready
|
||||
18:27:24 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
18:29:47 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
240 0 0 240 f0 task2.elf
|
||||
Target all ready
|
||||
18:35:13 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
240 0 0 240 f0 task2.elf
|
||||
Target all ready
|
||||
18:35:46 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
18:35:51 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:12:30 **** Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:12:55 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:13:16 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:13:43 **** Clean-only build of configuration Debug for project task1 ****
|
||||
make -j12 clean
|
||||
rm -rf ./Startup/startup_stm32g431kbtx.d ./Startup/startup_stm32g431kbtx.o ./Startup/syscalls.cyclo ./Startup/syscalls.d ./Startup/syscalls.o ./Startup/syscalls.su ./Startup/sysmem.cyclo ./Startup/sysmem.d ./Startup/sysmem.o ./Startup/sysmem.su
|
||||
rm -rf ./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 -rf default.size.stdout task1.elf task1.list task1.map
|
||||
|
||||
14:13:44 **** Clean-only build of configuration Debug for project task2 ****
|
||||
make -j12 clean
|
||||
14:13:44 **** Clean-only build of configuration Debug for project task3 ****
|
||||
make -j12 clean
|
||||
makefile:62: *** multiple target patterns. Stop.
|
||||
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||
14:13:44 **** Clean-only build of configuration Debug for project task4 ****
|
||||
make -j12 clean
|
||||
makefile:62: *** multiple target patterns. Stop.
|
||||
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||
14:14:11 **** Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
arm-none-eabi-as -o task2.o task2.s -march=armv7-m -mcpu=cortex-m4 -adglns -g -mthumb --warn > task2.als
|
||||
arm-none-eabi-ld -o task2.elf -T ldscript_rom.ld task2.o -g -Map task2.map --cref -static
|
||||
arm-none-eabi-objdump -htdr -j .text -j .data -j .bss -j .vectortable -j .exhand task2.elf > task2.lst
|
||||
arm-none-eabi-size task2.elf
|
||||
text data bss dec hex filename
|
||||
240 0 0 240 f0 task2.elf
|
||||
Target all ready
|
||||
14:15:19 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:15:29 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:16:17 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:17:15 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:17:57 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
14:19:07 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
15:01:24 **** Incremental Build of configuration Debug for project task1 ****
|
||||
make -j12 all
|
||||
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"
|
||||
arm-none-eabi-gcc -o "task1.elf" @"objects.list" -mcpu=cortex-m4 -T"/home/tobii/02_Uni/09_Mikrocomputertechnik/praktikum/mct_bei_workspace_25w/task1/STM32G431KBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="task1.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: task1.elf
|
||||
|
||||
arm-none-eabi-size task1.elf
|
||||
arm-none-eabi-objdump -h -S task1.elf > "task1.list"
|
||||
text data bss dec hex filename
|
||||
1692 0 1568 3260 cbc task1.elf
|
||||
Finished building: default.size.stdout
|
||||
|
||||
Finished building: task1.list
|
||||
14:13:43 **** Clean-only build of configuration Debug for project task1 ****
|
||||
make -j12 clean
|
||||
rm -rf ./Startup/startup_stm32g431kbtx.d ./Startup/startup_stm32g431kbtx.o ./Startup/syscalls.cyclo ./Startup/syscalls.d ./Startup/syscalls.o ./Startup/syscalls.su ./Startup/sysmem.cyclo ./Startup/sysmem.d ./Startup/sysmem.o ./Startup/sysmem.su
|
||||
rm -rf ./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 -rf default.size.stdout task1.elf task1.list task1.map
|
||||
|
||||
|
||||
15:01:24 Build Finished. 0 errors, 0 warnings. (took 330ms)
|
||||
14:13:44 Build Finished. 0 errors, 0 warnings. (took 187ms)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
11:52:45 **** Clean-only build of configuration Debug for project task2 ****
|
||||
make -j12 clean
|
||||
14:19:07 **** Incremental Build of configuration Debug for project task2 ****
|
||||
make -j12 all
|
||||
Target all ready
|
||||
|
||||
11:52:45 Build Finished. 0 errors, 0 warnings. (took 126ms)
|
||||
14:19:07 Build Finished. 0 errors, 0 warnings. (took 182ms)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
11:52:45 **** Clean-only build of configuration Debug for project task3 ****
|
||||
14:13:44 **** Clean-only build of configuration Debug for project task3 ****
|
||||
make -j12 clean
|
||||
makefile:62: *** multiple target patterns. Stop.
|
||||
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||
|
||||
11:52:45 Build Failed. 1 errors, 0 warnings. (took 126ms)
|
||||
14:13:44 Build Failed. 1 errors, 0 warnings. (took 186ms)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
11:52:46 **** Clean-only build of configuration Debug for project task4 ****
|
||||
14:13:44 **** Clean-only build of configuration Debug for project task4 ****
|
||||
make -j12 clean
|
||||
makefile:62: *** multiple target patterns. Stop.
|
||||
"make -j12 clean" terminated with exit code 2. Build might be incomplete.
|
||||
|
||||
11:52:46 Build Failed. 1 errors, 0 warnings. (took 127ms)
|
||||
14:13:44 Build Failed. 1 errors, 0 warnings. (took 186ms)
|
||||
|
||||
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
-212
@@ -1,212 +0,0 @@
|
||||
/* ***************************************************************************************
|
||||
* Project: task1 - C:GPIO
|
||||
* File: task1.c
|
||||
*
|
||||
* Language: C
|
||||
*
|
||||
* Hardware: STefi Light v1.1
|
||||
* Processor: STM32G431KBT6U
|
||||
*
|
||||
* Author: Manuel Lederhofer
|
||||
* Datum: 10.09.2021
|
||||
*
|
||||
* Version: 2.1
|
||||
* History:
|
||||
* 10.09.2021 ML create project
|
||||
* 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U
|
||||
* 18.02.2025 TK changed projectname to "C: GPIO)
|
||||
*
|
||||
* Status: under development
|
||||
*
|
||||
* Description:
|
||||
* Blinks the red LED of STefi Light, currently.
|
||||
* This file contains the main routine and the initialization.
|
||||
*
|
||||
* 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 --------------------------------------- */
|
||||
#define LOOPS_PER_MS 1244 // NOP-loops for delay()
|
||||
#define WAITTIME 333
|
||||
|
||||
/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */
|
||||
/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */
|
||||
int state = 0;
|
||||
|
||||
/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */
|
||||
|
||||
/* ------------------------------------ PROTOTYPES ------------------------------------ */
|
||||
static void GPIO_init(void);
|
||||
static void delay(const uint16_t ms);
|
||||
|
||||
/* ------------------------------------ M A I N --------------------------------------- */
|
||||
int main(void)
|
||||
{
|
||||
/* --- initialization --- */
|
||||
__disable_irq(); // disable interrupts globally
|
||||
|
||||
GPIO_init();
|
||||
|
||||
__enable_irq(); // enable interrupts globally
|
||||
|
||||
/* --- one time tasks --- */
|
||||
|
||||
//s0 Hilfvariablen auserhalb von while deklarieren
|
||||
int running = 0; //0 Lauflicht aus, 1 Lauflicht an
|
||||
int lastButtonState = 1; // Hilfsvariable zur Flankenerkennung
|
||||
|
||||
/* --- infinite processing loop --- */
|
||||
while (1)
|
||||
{
|
||||
int buttonState = GPIOB->IDR & (1 << 0);
|
||||
|
||||
// fallende Flanke erkennen
|
||||
if (lastButtonState && !buttonState)
|
||||
{
|
||||
running ^= 1; // toggle running
|
||||
/* delay(50); // entprellen */
|
||||
}
|
||||
|
||||
lastButtonState = buttonState;
|
||||
|
||||
|
||||
if(running)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
state++;
|
||||
GPIOA->ODR &= ~(1 << 0);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 0);
|
||||
break;
|
||||
case 1:
|
||||
state++;
|
||||
GPIOA->ODR &= ~(1 << 1);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 1);
|
||||
break;
|
||||
case 2:
|
||||
state++;
|
||||
GPIOA->ODR &= ~(1 << 2);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 2);
|
||||
break;
|
||||
case 3:
|
||||
state++;
|
||||
GPIOA->ODR &= ~(1 << 3);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 3);
|
||||
break;
|
||||
case 4:
|
||||
state++;
|
||||
GPIOA->ODR &= ~(1 << 2);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 2);
|
||||
break;
|
||||
case 5:
|
||||
state=0;
|
||||
GPIOA->ODR &= ~(1 << 1);
|
||||
delay(WAITTIME);
|
||||
GPIOA->ODR |= (1 << 1);
|
||||
break;
|
||||
|
||||
case 99:
|
||||
GPIOA->ODR |= MASK_LED_ALL;
|
||||
while(1){
|
||||
if((GPIOB->IDR & (1 << 0)) == 0){
|
||||
delay(150);
|
||||
state=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//aktuell geht er mit drücken durch die cases
|
||||
// wegen break geht er ganz aus der if bedingung raus, nicht nur ausm switch case
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */
|
||||
|
||||
/* ------------------------------------ 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)
|
||||
{
|
||||
/* enable port clocks */
|
||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A
|
||||
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOBEN; //Taster versuch
|
||||
|
||||
/* --- LEDs --- */
|
||||
GPIOA->ODR |= MASK_LED_ALL;
|
||||
GPIOA->MODER &= ~(3 << 0);
|
||||
GPIOA->MODER |= (1 << 0); // set LED pin to output
|
||||
|
||||
/* LED1 als Output */
|
||||
GPIOA->MODER &= ~(3 << 2); // Versuch: LED 1 Mode löschen :klappt so
|
||||
GPIOA->MODER |= (1 << 2); // Versuch: LED 1 PA1 = output :klappt so
|
||||
|
||||
/* LED2 als Output */
|
||||
GPIOA->MODER &= ~(3 << 4); // Versuch: LED 2 Mode löschen :klappt
|
||||
GPIOA->MODER |= (1 << 4); // Versuch: LED 2 PA1 = output :klappt
|
||||
|
||||
/* LED3 als output */
|
||||
GPIOA->MODER &= ~(3 << 6);
|
||||
GPIOA->MODER |= (1 << 6);
|
||||
|
||||
/* s0 (PB0) als Input Versuch */
|
||||
GPIOB->MODER &= ~(3 << 0);
|
||||
|
||||
/* Pull-Up Aktivieren Versuch */
|
||||
GPIOB->PUPDR &= ~(3 << 0);
|
||||
GPIOB->PUPDR |= (1 << 0); // 01 = Pull-Up
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------ *\
|
||||
* 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)
|
||||
{
|
||||
if((GPIOB->IDR & (1 << 0) && state != 99) == 0){
|
||||
state = 99;
|
||||
break;
|
||||
}
|
||||
for (uint16_t j = 0; j < LOOPS_PER_MS; ++j)
|
||||
{
|
||||
__asm("NOP");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************ E O F ***************************************** */
|
||||
+324
@@ -0,0 +1,324 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+315
@@ -0,0 +1,315 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
#****************************************************************************************#
|
||||
# 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 *******************************************#
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,4 +5,4 @@
|
||||
//org.eclipse.debug.core.PREFERRED_DELEGATES/org.eclipse.cdt.launch.remoteApplicationLaunchType=org.eclipse.rse.remotecdt.dsf.debug,debug,;
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.debug.core.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE=false
|
||||
prefWatchExpressions=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<watchExpressions/>\r\n
|
||||
prefWatchExpressions=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<watchExpressions/>\n
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
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/os=win32
|
||||
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
|
||||
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\:task1,org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task2
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:A3_Timer/activeLaunchMode=run
|
||||
org.eclipse.cdt.dsf.gdb.gdbRemotedescriptorType\:task1/activeLaunchMode=run
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
IMPORT_FILES_AND_FOLDERS_RELATIVE=true
|
||||
IMPORT_FILES_AND_FOLDERS_TYPE=23,1
|
||||
eclipse.preferences.version=1
|
||||
platformState=1772304866316
|
||||
platformState=1772304866322
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<launchHistory>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
|
||||
<mruHistory>
|
||||
<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="/task1/task1.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>
|
||||
@@ -24,8 +24,8 @@
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
|
||||
<mruHistory>
|
||||
<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="/task1/task1.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>
|
||||
|
||||
File diff suppressed because one or more lines are too long
+3
@@ -0,0 +1,3 @@
|
||||
<?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>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
1774358097434 Rename resource 'task2.s'
|
||||
1774358106409 Rename resource 'task2_efe.s'
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Mar 20 18:06:30 CET 2026
|
||||
#Tue Mar 24 14:11:27 CET 2026
|
||||
org.eclipse.core.runtime=2
|
||||
org.eclipse.platform=4.30.0.v20231201-0110
|
||||
|
||||
Reference in New Issue
Block a user