commit 22c387214b570daced9e11058ac42788e5714f6a Author: Schrom01 Date: Fri Oct 28 07:48:37 2022 +0200 initial commit diff --git a/CTP_ALUBranchInstructions_en.pdf b/CTP_ALUBranchInstructions_en.pdf new file mode 100644 index 0000000..d6b7a5d Binary files /dev/null and b/CTP_ALUBranchInstructions_en.pdf differ diff --git a/bcd/app/main.s b/bcd/app/main.s new file mode 100644 index 0000000..0a07caa --- /dev/null +++ b/bcd/app/main.s @@ -0,0 +1,80 @@ +; ------------------------------------------------------------------ +; -- _____ ______ _____ - +; -- |_ _| | ____|/ ____| - +; -- | | _ __ | |__ | (___ Institute of Embedded Systems - +; -- | | | '_ \| __| \___ \ Zurich University of - +; -- _| |_| | | | |____ ____) | Applied Sciences - +; -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - +; ------------------------------------------------------------------ +; -- +; -- main.s +; -- +; -- CT1 P06 "ALU und Sprungbefehle" mit MUL +; -- +; -- $Id: main.s 4857 2019-09-10 17:30:17Z akdi $ +; ------------------------------------------------------------------ +;Directives + PRESERVE8 + THUMB + +; ------------------------------------------------------------------ +; -- Address Defines +; ------------------------------------------------------------------ + +ADDR_LED_15_0 EQU 0x60000100 +ADDR_LED_31_16 EQU 0x60000102 +ADDR_DIP_SWITCH_7_0 EQU 0x60000200 +ADDR_DIP_SWITCH_15_8 EQU 0x60000201 +ADDR_7_SEG_BIN_DS3_0 EQU 0x60000114 +ADDR_BUTTONS EQU 0x60000210 + +ADDR_LCD_RED EQU 0x60000340 +ADDR_LCD_GREEN EQU 0x60000342 +ADDR_LCD_BLUE EQU 0x60000344 +LCD_BACKLIGHT_FULL EQU 0xffff +LCD_BACKLIGHT_OFF EQU 0x0000 + +; ------------------------------------------------------------------ +; -- myCode +; ------------------------------------------------------------------ + AREA myCode, CODE, READONLY + + ENTRY + +main PROC + export main + +; STUDENTS: To be programmed + + + + +; END: To be programmed + + B main + ENDP + +;---------------------------------------------------- +; Subroutines +;---------------------------------------------------- + +;---------------------------------------------------- +; pause for disco_lights +pause PROC + PUSH {R0, R1} + LDR R1, =1 + LDR R0, =0x000FFFFF + +loop + SUBS R0, R0, R1 + BCS loop + + POP {R0, R1} + BX LR + ALIGN + ENDP + +; ------------------------------------------------------------------ +; End of code +; ------------------------------------------------------------------ + END diff --git a/bcd/bcd.uvoptx b/bcd/bcd.uvoptx new file mode 100644 index 0000000..f9f421b --- /dev/null +++ b/bcd/bcd.uvoptx @@ -0,0 +1,213 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ST-LINKIII-KEIL_SWO + -U -O206 -S0 -C0 -A0 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + app + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + .\app\main.s + main.s + 0 + 0 + + + + + ::Device + 1 + 0 + 0 + 1 + + + + ::HAL + 1 + 0 + 0 + 1 + + +
diff --git a/bcd/bcd.uvprojx b/bcd/bcd.uvprojx new file mode 100644 index 0000000..91192e8 --- /dev/null +++ b/bcd/bcd.uvprojx @@ -0,0 +1,549 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x4 + ARM-ADS + 6180000::V6.18::ARMCLANG + 6180000::V6.18::ARMCLANG + 1 + + + CT_Board_HS14_M0 + STMicroelectronics + InES.CTBoard14_DFP.4.0.2 + https://ennis.zhaw.ch/pack/ + IROM(0x08000000,0x200000) IRAM(0x20000000,0x30000) IRAM2(0x10000000,0x10000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + 0 + + + + + + + + + + + $$Device:CT_Board_HS14_M0$SVD\STM32F429x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\ + mul + 1 + 0 + 0 + 1 + 1 + .\build\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP-MPU + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 1 + 0x8000000 + 0x200000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x200000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 0 + 0x10000000 + 0x10000 + + + + + + 1 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + --diag_suppress 6314 + + + + + + + + app + + + main.s + 2 + .\app\main.s + + + + + ::Device + + + ::HAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\Device\CT_Board_HS14_M0\datainit_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\startup_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\system_ctboard.c + + + + + + + + RTE\Device\CT_Board_HS14_M4\system_ctboard.c + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_fmc.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_gpio.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_pwr.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_rcc.c + + + + + + + + RTE\HAL\CT_Board_HS14_M4\hal_fmc.c + + + + + + RTE\HAL\CT_Board_HS14_M4\hal_gpio.c + + + + + + RTE\HAL\CT_Board_HS14_M4\hal_pwr.c + + + + + + RTE\HAL\CT_Board_HS14_M4\hal_rcc.c + + + + + + + + + + + <Project Info> + 0 + 1 + + + + +
diff --git a/optional/app/main.s b/optional/app/main.s new file mode 100644 index 0000000..27de2b1 --- /dev/null +++ b/optional/app/main.s @@ -0,0 +1,168 @@ +; ------------------------------------------------------------------ +; -- _____ ______ _____ - +; -- |_ _| | ____|/ ____| - +; -- | | _ __ | |__ | (___ Institute of Embedded Systems - +; -- | | | '_ \| __| \___ \ Zurich University of - +; -- _| |_| | | | |____ ____) | Applied Sciences - +; -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland - +; ------------------------------------------------------------------ +; -- +; -- main.s +; -- +; -- CT1 P06 "ALU Befehle" Optionales beobachten der Flags und Befehle +; -- +; -- $Id: main.s 532 2014-08-28 16:19:30Z fert $ +; ------------------------------------------------------------------ +;Directives + PRESERVE8 + THUMB + +; ------------------------------------------------------------------ +; -- myCode +; ------------------------------------------------------------------ + AREA myCode, CODE, READONLY + + ENTRY + +main PROC + export main + + ;----------------------------------------------------------- + ; Logische, Shift, Rotate Befehle + + LDR R0, =0x0000FFFF + LDR R1, =0x0000FFFF + LDR R2, =1 + + EORS R0, R1 + LSLS R0, R1, #16 + + ORRS R0, R0, R1 + LSLS R0, R0, R2 + + ASRS R0, R0, R2 + ASRS R0, R0, R2 + LSRS R0, R0, R2 + + LDR R1, =0x00000004 + MVNS R1, R1 + ANDS R0, R0, R1 + + LSRS R0, R0, R2 + RORS R0, R0, R2 + RORS R0, R0, R2 + RORS R0, R0, R2 + + ;----------------------------------------------------------- + ; Addition, Subtraktion + + LDR R0, =0x80000000 + LDR R1, =0x80000000 + LDR R2, =0 + + ADDS R0, R0, R1 + ADCS R0, R0, R2 + SUBS R0, R0, R1 + + SUBS R0, R0, #2 + LDR R2, =1 + SBCS R0, R0, R2 + LSRS R1, R1, R2 + SBCS R0, R0, R2 + + ;----------------------------------------------------------- + ; Vergleiche + + LDR R1, =0 + CMP R1, R2 + CMP R2, R1 + + ORRS R1, R1, R2 + CMP R1, R2 + CMP R2, R1 + + LDR R1, =0xFFFFFFFF + CMN R1, R2 + + ;----------------------------------------------------------- + ; JUMB/BRANCH Befehle + + ;----------------------------------------------------------- + ; EXAMPLE 1 + + BCC do_not_branch_address + BCS example_2 + LDR R0, =0 + + ;----------------------------------------------------------- + ; EXAMPLE 2 + +example_2 + BNE do_not_branch_address + BEQ example_3 + LDR R0, =0 + + ;----------------------------------------------------------- + ; EXAMPLE 3 + +example_3 + LDR R0, =3 +loop + SUBS R0, R0, R2 + BNE loop + + ;----------------------------------------------------------- + ; EXAMPLE 4 SWITCH CASE WITH JUMP TABLE + +example_4 + ALIGN +TABLE DCD case0, case1, case2, case3, case4, case5 ; init table + + LDR R1, =1 ; R1 holding where to switch to + +switch_statement + LDR R0, =TABLE ; R0 base address of jump table + LSLS R1, R1, #2 ; byte Displacement to word displacement + LDR R0, [R0, R1] ; jump to corresponding address + BX R0 +case0 + LDR R1, =2 + B end_switch_statement +case1 + LDR R1, =4 + B end_switch_statement +case2 + LDR R1, =5 + B end_switch_statement +case3 + B example_5 ; leaving this jump demo +case4 + LDR R1, =0 + B end_switch_statement +case5 + LDR R1, =3 + B end_switch_statement + +end_switch_statement + B switch_statement ; do some more examples via jump table + ALIGN + + ;----------------------------------------------------------- + ; EXAMPLE 5 + +example_5 ; switch case (how the compiler does it) + import switch_case_example + BL switch_case_example + + ;----------------------------------------------------------- + ; ...once more... ? :-) + +do_not_branch_address + B main + ALIGN + ENDP + +; ------------------------------------------------------------------ +; End of code +; ------------------------------------------------------------------ + END \ No newline at end of file diff --git a/optional/app/switch_case.c b/optional/app/switch_case.c new file mode 100644 index 0000000..bca32f3 --- /dev/null +++ b/optional/app/switch_case.c @@ -0,0 +1,51 @@ +extern void switch_case_example(void); + +void switch_case_example(void) +{ + int test = 1; + + while (1) { + switch (test) { + case 0: + test = 5; + break; + + case 1: + test = 4; + break; + + case 2: + test = 3; + break; + + case 3: + test = 0; + break; + + case 4: + test = 2; + break; + + case 5: + test = 8; + break; + + case 6: + test = 40; + break; + + case 7: + test = 6; + break; + + case 8: + test = 7; + break; + + + + default: + return; + } + } +} diff --git a/optional/optional.uvoptx b/optional/optional.uvoptx new file mode 100644 index 0000000..46a80b1 --- /dev/null +++ b/optional/optional.uvoptx @@ -0,0 +1,225 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ST-LINKIII-KEIL_SWO + -U -O206 -S0 -C0 -A0 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + app + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + .\app\main.s + main.s + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + .\app\switch_case.c + switch_case.c + 0 + 0 + + + + + ::Device + 0 + 0 + 0 + 1 + + + + ::HAL + 0 + 0 + 0 + 1 + + +
diff --git a/optional/optional.uvprojx b/optional/optional.uvprojx new file mode 100644 index 0000000..06579d2 --- /dev/null +++ b/optional/optional.uvprojx @@ -0,0 +1,524 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x4 + ARM-ADS + 6180000::V6.18::ARMCLANG + 6180000::V6.18::ARMCLANG + 1 + + + CT_Board_HS14_M0 + STMicroelectronics + InES.CTBoard14_DFP.4.0.2 + https://ennis.zhaw.ch/pack/ + IROM(0x08000000,0x200000) IRAM(0x20000000,0x30000) IRAM2(0x10000000,0x10000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:CT_Board_HS14_M0$Flash\STM32F4xx_2048.FLM)) + 0 + + + + + + + + + + + $$Device:CT_Board_HS14_M0$SVD\STM32F429x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\ + mul + 1 + 0 + 0 + 1 + 1 + .\build\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -MPU + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 1 + 0x8000000 + 0x200000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x200000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x30000 + + + 0 + 0x10000000 + 0x10000 + + + + + + 1 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + --diag_suppress 6314 + + + + + + + + app + + + main.s + 2 + .\app\main.s + + + switch_case.c + 1 + .\app\switch_case.c + + + + + ::Device + + + ::HAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\Device\CT_Board_HS14_M0\datainit_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\startup_ctboard.s + + + + + + + + RTE\Device\CT_Board_HS14_M0\system_ctboard.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_fmc.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_gpio.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_pwr.c + + + + + + + + RTE\HAL\CT_Board_HS14_M0\hal_rcc.c + + + + + + + + + + + + + <Project Info> + 0 + 1 + + + + +