From b99a4646ec4c6bf35119c2dc7a3411c83c63533f Mon Sep 17 00:00:00 2001 From: Guilliam Lutz Date: Wed, 10 Feb 2021 17:46:27 +0100 Subject: [PATCH 1/5] begin 2.5 --- Microcontrollers/Microcontrollers.atsln | 10 +- .../opdracht 2.3/opdracht 2.3.cproj | 20 ++-- Microcontrollers/opdracht 2.5/ldc.c | 16 +++ Microcontrollers/opdracht 2.5/ldc.h | 6 ++ .../opdracht 2.5.componentinfo.xml | 42 ++++++++ .../opdracht 2.5/opdracht 2.5.cproj | 102 ++++++++++++++++++ 6 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 Microcontrollers/opdracht 2.5/ldc.c create mode 100644 Microcontrollers/opdracht 2.5/ldc.h create mode 100644 Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml create mode 100644 Microcontrollers/opdracht 2.5/opdracht 2.5.cproj diff --git a/Microcontrollers/Microcontrollers.atsln b/Microcontrollers/Microcontrollers.atsln index c5df7a3..1c17037 100644 --- a/Microcontrollers/Microcontrollers.atsln +++ b/Microcontrollers/Microcontrollers.atsln @@ -17,7 +17,7 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.1", "opdracht 2. EndProject Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}" EndProject -Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{9154C165-89AB-43CF-8C28-23147BC26FDC}" +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{C1797223-6702-4148-917B-0CF584136D87}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -53,10 +53,10 @@ Global {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Debug|AVR.Build.0 = Debug|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.ActiveCfg = Release|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.Build.0 = Release|AVR - {9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.ActiveCfg = Debug|AVR - {9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.Build.0 = Debug|AVR - {9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.ActiveCfg = Release|AVR - {9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.Build.0 = Release|AVR + {C1797223-6702-4148-917B-0CF584136D87}.Debug|AVR.ActiveCfg = Debug|AVR + {C1797223-6702-4148-917B-0CF584136D87}.Debug|AVR.Build.0 = Debug|AVR + {C1797223-6702-4148-917B-0CF584136D87}.Release|AVR.ActiveCfg = Release|AVR + {C1797223-6702-4148-917B-0CF584136D87}.Release|AVR.Build.0 = Release|AVR EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj index 947eaff..49874c3 100644 --- a/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj +++ b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj @@ -4,7 +4,7 @@ 2.0 7.0 com.microchip.xc8 - {9154c165-89ab-43cf-8c28-23147bc26fdc} + {c1797223-6702-4148-917b-0cf584136d87} ATmega128 none Executable @@ -30,15 +30,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/Microcontrollers/opdracht 2.5/ldc.c b/Microcontrollers/opdracht 2.5/ldc.c new file mode 100644 index 0000000..d079fcc --- /dev/null +++ b/Microcontrollers/opdracht 2.5/ldc.c @@ -0,0 +1,16 @@ +/* + * main.c + * + * Created: 2/10/2021 2:04:13 PM + * Author: User + */ + +#include + +int main(void) +{ + while(1) + { + //TODO:: Please write your application code + } +} \ No newline at end of file diff --git a/Microcontrollers/opdracht 2.5/ldc.h b/Microcontrollers/opdracht 2.5/ldc.h new file mode 100644 index 0000000..ec51ec8 --- /dev/null +++ b/Microcontrollers/opdracht 2.5/ldc.h @@ -0,0 +1,6 @@ +/* + * ldc.h + * + * Created: 10-2-2021 14:06:38 + * Author: User + */ diff --git a/Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml b/Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml new file mode 100644 index 0000000..bbcc667 --- /dev/null +++ b/Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml @@ -0,0 +1,42 @@ + + + + + + + Device + Startup + + + Atmel + 1.6.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8\avr\include\avr\iom128.h + + header + XC + JdJ7J9I/SJh965SEyyyVYw== + + xc8/avr/include/avr/iom128.h + + + + + ATmega_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc + 1.6.364 + true + ATmega128 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj new file mode 100644 index 0000000..c7cb592 --- /dev/null +++ b/Microcontrollers/opdracht 2.5/opdracht 2.5.cproj @@ -0,0 +1,102 @@ + + + + 2.0 + 7.0 + com.microchip.xc8 + {a8e029a0-3e6c-453c-ac34-4d6f411bed60} + ATmega128 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + opdracht 2.5 + opdracht 2.5 + opdracht 2.5 + XC8_2.31 + true + false + true + true + + + true + + 2 + 0 + 0 + + + + + + + + + + + + + + + + + + True + True + True + + + (%24DeviceMacro) + NDEBUG + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + + + + + True + True + + + (%24DeviceMacro) + DEBUG + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + + + + + + compile + + + compile + + + + \ No newline at end of file From a26e370acb45846a2c5791d47be76300f6988998 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 10 Feb 2021 20:17:23 +0100 Subject: [PATCH 2/5] added opdr 2.4 --- Microcontrollers/Microcontrollers.atsln | 16 ++++-- .../opdracht 2.3/Debug/opdracht 2.3.lss | 54 +++++++++---------- .../opdracht 2.3/opdracht 2.3.cproj | 2 +- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/Microcontrollers/Microcontrollers.atsln b/Microcontrollers/Microcontrollers.atsln index 1c17037..8366812 100644 --- a/Microcontrollers/Microcontrollers.atsln +++ b/Microcontrollers/Microcontrollers.atsln @@ -17,7 +17,9 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.1", "opdracht 2. EndProject Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}" EndProject -Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{C1797223-6702-4148-917B-0CF584136D87}" +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}" +EndProject +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.4", "opdracht 2.4\opdracht 2.4.cproj", "{0FA0C637-5AC0-44F3-999B-49C114B97183}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -53,10 +55,14 @@ Global {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Debug|AVR.Build.0 = Debug|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.ActiveCfg = Release|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.Build.0 = Release|AVR - {C1797223-6702-4148-917B-0CF584136D87}.Debug|AVR.ActiveCfg = Debug|AVR - {C1797223-6702-4148-917B-0CF584136D87}.Debug|AVR.Build.0 = Debug|AVR - {C1797223-6702-4148-917B-0CF584136D87}.Release|AVR.ActiveCfg = Release|AVR - {C1797223-6702-4148-917B-0CF584136D87}.Release|AVR.Build.0 = Release|AVR + {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.ActiveCfg = Debug|AVR + {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.Build.0 = Debug|AVR + {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.ActiveCfg = Release|AVR + {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.Build.0 = Release|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.ActiveCfg = Debug|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.Build.0 = Debug|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.ActiveCfg = Release|AVR + {0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.Build.0 = Release|AVR EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss b/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss index 700c25e..d0ae71f 100644 --- a/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss +++ b/Microcontrollers/opdracht 2.3/Debug/opdracht 2.3.lss @@ -137,7 +137,7 @@ Disassembly of section .text: Disassembly of section .text: 000002fe <__bad_interrupt>: - 2fe: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> + 2fe: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> Disassembly of section .text.__vector_1: @@ -165,13 +165,13 @@ Disassembly of section .text.__vector_1: 126: df 93 push r29 128: cd b7 in r28, 0x3d ; 61 12a: de b7 in r29, 0x3e ; 62 - 12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> 134: 01 96 adiw r24, 0x01 ; 1 - 136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> - 13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__DATA_REGION_ORIGIN__> - 13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1> + 13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata> + 13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> 146: 0e 94 3a 01 call 0x274 ; 0x274 14a: 00 00 nop 14c: df 91 pop r29 @@ -222,13 +222,13 @@ Disassembly of section .text.__vector_2: 1a6: df 93 push r29 1a8: cd b7 in r28, 0x3d ; 61 1aa: de b7 in r29, 0x3e ; 62 - 1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> 1b4: 01 97 sbiw r24, 0x01 ; 1 - 1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> - 1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <__DATA_REGION_ORIGIN__> - 1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1> + 1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata> + 1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> 1c6: 0e 94 3a 01 call 0x274 ; 0x274 1ca: 00 00 nop 1cc: df 91 pop r29 @@ -361,20 +361,20 @@ Disassembly of section .text.main: 240: fc 01 movw r30, r24 242: 20 83 st Z, r18 244: 78 94 sei - 246: 80 e3 ldi r24, 0x30 ; 48 - 248: 90 e0 ldi r25, 0x00 ; 0 - 24a: fc 01 movw r30, r24 - 24c: 80 81 ld r24, Z - 24e: 83 30 cpi r24, 0x03 ; 3 - 250: d1 f7 brne .-12 ; 0x246 - 252: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 256: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> - 25a: 89 2b or r24, r25 - 25c: a1 f3 breq .-24 ; 0x246 - 25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> - 262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <__DATA_REGION_ORIGIN__> - 266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <__DATA_REGION_ORIGIN__> - 26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <__DATA_REGION_ORIGIN__+0x1> + 246: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 24a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> + 24e: 89 2b or r24, r25 + 250: d1 f3 breq .-12 ; 0x246 + 252: 80 e3 ldi r24, 0x30 ; 48 + 254: 90 e0 ldi r25, 0x00 ; 0 + 256: fc 01 movw r30, r24 + 258: 80 81 ld r24, Z + 25a: 83 30 cpi r24, 0x03 ; 3 + 25c: a1 f7 brne .-24 ; 0x246 + 25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <_edata+0x1> + 262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <_edata> + 266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata> + 26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1> 26e: 0e 94 3a 01 call 0x274 ; 0x274 272: e9 cf rjmp .-46 ; 0x246 diff --git a/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj index 49874c3..93b2609 100644 --- a/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj +++ b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj @@ -4,7 +4,7 @@ 2.0 7.0 com.microchip.xc8 - {c1797223-6702-4148-917b-0cf584136d87} + {e0046ce4-d6f8-435f-9c6e-72e6eb89ccb3} ATmega128 none Executable From c2b532b8ae60f86e442cde77a715c7f558acce4d Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 10 Feb 2021 20:17:58 +0100 Subject: [PATCH 3/5] added opdr 2.4 --- Microcontrollers/opdracht 2.4/Debug/Makefile | 125 ++++++++++ .../opdracht 2.4/Debug/makedep.mk | 6 + .../opdracht 2.4/Debug/memoryfile.xml | 17 ++ .../opdracht 2.4/Debug/opdracht 2.4.eep | 1 + .../opdracht 2.4/Debug/opdracht 2.4.lss | 235 ++++++++++++++++++ Microcontrollers/opdracht 2.4/main.c | 79 ++++++ .../opdracht 2.4.componentinfo.xml | 42 ++++ .../opdracht 2.4/opdracht 2.4.cproj | 87 +++++++ 8 files changed, 592 insertions(+) create mode 100644 Microcontrollers/opdracht 2.4/Debug/Makefile create mode 100644 Microcontrollers/opdracht 2.4/Debug/makedep.mk create mode 100644 Microcontrollers/opdracht 2.4/Debug/memoryfile.xml create mode 100644 Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep create mode 100644 Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss create mode 100644 Microcontrollers/opdracht 2.4/main.c create mode 100644 Microcontrollers/opdracht 2.4/opdracht 2.4.componentinfo.xml create mode 100644 Microcontrollers/opdracht 2.4/opdracht 2.4.cproj diff --git a/Microcontrollers/opdracht 2.4/Debug/Makefile b/Microcontrollers/opdracht 2.4/Debug/Makefile new file mode 100644 index 0000000..fcf2cfb --- /dev/null +++ b/Microcontrollers/opdracht 2.4/Debug/Makefile @@ -0,0 +1,125 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL := cmd.exe +RM := rm -rf + +USER_OBJS := + +LIBS := +PROJ := + +O_SRCS := +C_SRCS := +S_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +PREPROCESSING_SRCS := +OBJS := +OBJS_AS_ARGS := +C_DEPS := +C_DEPS_AS_ARGS := +EXECUTABLES := +OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := +AVR_APP_PATH :=$$$AVR_APP_PATH$$$ +QUOTE := " +ADDITIONAL_DEPENDENCIES:= +OUTPUT_FILE_DEP:= +LIB_DEP:= +LINKER_SCRIPT_DEP:= + +# Every subdirectory with source files must be described here +SUBDIRS := + + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../main.c + + +PREPROCESSING_SRCS += + + +ASM_SRCS += + + +OBJS += \ +main.o + +OBJS_AS_ARGS += \ +main.o + +C_DEPS += \ +main.d + +C_DEPS_AS_ARGS += \ +main.d + +OUTPUT_FILE_PATH +=opdracht\ 2.4.elf + +OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.4.elf" + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= + +LINKER_SCRIPT_DEP+= + + +# AVR32/GNU C Compiler +./main.o: .././main.c + @echo Building file: $< + @echo Invoking: XC8 C Compiler : 2.31 + $(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -c -x c -funsigned-char -funsigned-bitfields -mext=cci -D__ATmega128__ -DDEBUG -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + + + + +# AVR32/GNU Preprocessing Assembler + + + +# AVR32/GNU Assembler + + + + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) + +$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP) + @echo Building target: $@ + @echo Invoking: XC8 C Linker : 2.31 + $(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -Wl,-Map="opdracht 2.4.map" -funsigned-char -funsigned-bitfields -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums --memorysummary,memoryfile.xml + @echo Finished building target: $@ + "C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 2.4.elf" "opdracht 2.4.hex" + "C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 2.4.elf" "opdracht 2.4.eep" || exit 0 + "C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.4.elf" > "opdracht 2.4.lss" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "opdracht 2.4.elf" "opdracht 2.4.hex" "opdracht 2.4.eep" "opdracht 2.4.map" "opdracht 2.4.usersignatures" "opdracht 2.4.a" "opdracht 2.4.lss" + \ No newline at end of file diff --git a/Microcontrollers/opdracht 2.4/Debug/makedep.mk b/Microcontrollers/opdracht 2.4/Debug/makedep.mk new file mode 100644 index 0000000..6a14fde --- /dev/null +++ b/Microcontrollers/opdracht 2.4/Debug/makedep.mk @@ -0,0 +1,6 @@ +################################################################################ +# Automatically-generated file. Do not edit or delete the file +################################################################################ + +main.c + diff --git a/Microcontrollers/opdracht 2.4/Debug/memoryfile.xml b/Microcontrollers/opdracht 2.4/Debug/memoryfile.xml new file mode 100644 index 0000000..779875d --- /dev/null +++ b/Microcontrollers/opdracht 2.4/Debug/memoryfile.xml @@ -0,0 +1,17 @@ + + + + + bytes + 131072 + 468 + 130604 + + + bytes + 4096 + 144 + 3952 + + + diff --git a/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep b/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss b/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss new file mode 100644 index 0000000..05f745d --- /dev/null +++ b/Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss @@ -0,0 +1,235 @@ + +opdracht 2.4.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 000001d4 00000248 2**0 + ALLOC, LOAD, DATA + 1 .text 000000ec 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 0000002f 00000000 00000000 00000248 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000028 00000000 00000000 00000277 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000b85 00000000 00000000 0000029f 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 00000854 00000000 00000000 00000e24 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000002b1 00000000 00000000 00001678 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000034 00000000 00000000 0000192c 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 0000027d 00000000 00000000 00001960 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 000000b2 00000000 00000000 00001bdd 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000030 00000000 00000000 00001c8f 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .text 00000004 00000140 00000140 000001b4 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001cc0 2**2 + CONTENTS, READONLY, DEBUGGING + 13 .text.wait 0000001e 00000122 00000122 00000196 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 14 .text.main 00000036 000000ec 000000ec 00000160 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 15 .data.segments 00000090 00800100 00000144 000001b8 2**0 + CONTENTS, ALLOC, LOAD, DATA + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 0c 94 4a 00 jmp 0x94 ; 0x94 <__ctors_end> + 4: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 8: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 10: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 14: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 18: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 1c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 20: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 24: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 28: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 2c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 30: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 34: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 38: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 3c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 40: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 44: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 48: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 4c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 50: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 54: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 58: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 5c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 60: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 64: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 68: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 6c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 70: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 74: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 78: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 7c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 80: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 84: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + 88: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt> + +0000008c <.dinit>: + 8c: 01 00 .word 0x0001 ; ???? + 8e: 01 90 ld r0, Z+ + 90: 00 01 movw r0, r0 + 92: 44 00 .word 0x0044 ; ???? + +00000094 <__ctors_end>: + 94: 11 24 eor r1, r1 + 96: 1f be out 0x3f, r1 ; 63 + 98: cf ef ldi r28, 0xFF ; 255 + 9a: d0 e1 ldi r29, 0x10 ; 16 + 9c: de bf out 0x3e, r29 ; 62 + 9e: cd bf out 0x3d, r28 ; 61 + +000000a0 <__do_copy_data>: + a0: ec e8 ldi r30, 0x8C ; 140 + a2: f0 e0 ldi r31, 0x00 ; 0 + a4: 40 e0 ldi r20, 0x00 ; 0 + a6: 19 c0 rjmp .+50 ; 0xda <__do_clear_bss+0x8> + a8: b7 91 elpm r27, Z+ + aa: a7 91 elpm r26, Z+ + ac: 37 91 elpm r19, Z+ + ae: 27 91 elpm r18, Z+ + b0: 07 91 elpm r16, Z+ + b2: 07 fd sbrc r16, 7 + b4: 0e c0 rjmp .+28 ; 0xd2 <__do_clear_bss> + b6: 97 91 elpm r25, Z+ + b8: 87 91 elpm r24, Z+ + ba: ef 01 movw r28, r30 + bc: f9 2f mov r31, r25 + be: e8 2f mov r30, r24 + c0: 0b bf out 0x3b, r16 ; 59 + c2: 07 90 elpm r0, Z+ + c4: 0d 92 st X+, r0 + c6: a2 17 cp r26, r18 + c8: b3 07 cpc r27, r19 + ca: d9 f7 brne .-10 ; 0xc2 <__do_copy_data+0x22> + cc: fe 01 movw r30, r28 + ce: 1b be out 0x3b, r1 ; 59 + d0: 04 c0 rjmp .+8 ; 0xda <__do_clear_bss+0x8> + +000000d2 <__do_clear_bss>: + d2: 1d 92 st X+, r1 + d4: a2 17 cp r26, r18 + d6: b3 07 cpc r27, r19 + d8: e1 f7 brne .-8 ; 0xd2 <__do_clear_bss> + da: e3 39 cpi r30, 0x93 ; 147 + dc: f4 07 cpc r31, r20 + de: 21 f7 brne .-56 ; 0xa8 <__do_copy_data+0x8> + e0: 0e 94 76 00 call 0xec ; 0xec <_etext> + e4: 0c 94 74 00 jmp 0xe8 ; 0xe8 <_exit> + +000000e8 <_exit>: + e8: f8 94 cli + +000000ea <__stop_program>: + ea: ff cf rjmp .-2 ; 0xea <__stop_program> + +Disassembly of section .text: + +00000140 <__bad_interrupt>: + 140: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> + +Disassembly of section .text.wait: + +00000122 : +waits a specific amount of miliseconds */ +/************************************************************************/ +void wait( int ms ) + +{ + for (int i=0; i + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + 128: e3 ec ldi r30, 0xC3 ; 195 + 12a: f9 e0 ldi r31, 0x09 ; 9 + 12c: 31 97 sbiw r30, 0x01 ; 1 + 12e: f1 f7 brne .-4 ; 0x12c + 130: 00 c0 rjmp .+0 ; 0x132 + 132: 00 00 nop + 134: 2f 5f subi r18, 0xFF ; 255 + 136: 3f 4f sbci r19, 0xFF ; 255 + 138: 28 17 cp r18, r24 + 13a: 39 07 cpc r19, r25 + 13c: ac f3 brlt .-22 ; 0x128 + { + _delay_ms( 1 ); // library function (max 30 ms at 8MHz) + } +} + 13e: 08 95 ret + +Disassembly of section .text.main: + +000000ec
: + +int main( void ) +{ + DDRA = 0xFF; + ec: 8f ef ldi r24, 0xFF ; 255 + ee: 8a bb out 0x1a, r24 ; 26 + while (1==1) + { + // Set index to begin of pattern array + int index = 0; + // as long as delay has meaningful content + for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++) + f0: 00 e0 ldi r16, 0x00 ; 0 + f2: 10 e0 ldi r17, 0x00 ; 0 + + + while (1==1) + { + // Set index to begin of pattern array + int index = 0; + f4: c0 e0 ldi r28, 0x00 ; 0 + f6: d0 e0 ldi r29, 0x00 ; 0 + // as long as delay has meaningful content + for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++) + f8: 10 c0 rjmp .+32 ; 0x11a + { + // Write data to PORTA + PORTA = segments[index].data; + fa: fe 01 movw r30, r28 + fc: ee 0f add r30, r30 + fe: ff 1f adc r31, r31 + 100: ec 0f add r30, r28 + 102: fd 1f adc r31, r29 + 104: e0 50 subi r30, 0x00 ; 0 + 106: ff 4f sbci r31, 0xFF ; 255 + 108: 80 81 ld r24, Z + 10a: 8b bb out 0x1b, r24 ; 27 + // wait + wait(segments[index].delay); + 10c: 81 81 ldd r24, Z+1 ; 0x01 + 10e: 92 81 ldd r25, Z+2 ; 0x02 + 110: 0e 94 91 00 call 0x122 ; 0x122 + // increment for next round + index++; + 114: 21 96 adiw r28, 0x01 ; 1 + while (1==1) + { + // Set index to begin of pattern array + int index = 0; + // as long as delay has meaningful content + for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++) + 116: 0f 5f subi r16, 0xFF ; 255 + 118: 1f 4f sbci r17, 0xFF ; 255 + 11a: 00 33 cpi r16, 0x30 ; 48 + 11c: 11 05 cpc r17, r1 + 11e: 68 f3 brcs .-38 ; 0xfa + 120: e7 cf rjmp .-50 ; 0xf0 diff --git a/Microcontrollers/opdracht 2.4/main.c b/Microcontrollers/opdracht 2.4/main.c new file mode 100644 index 0000000..f77fa31 --- /dev/null +++ b/Microcontrollers/opdracht 2.4/main.c @@ -0,0 +1,79 @@ +/* --------------------------------------------------------------------------- +** This software is in the public domain, furnished "as is", without technical +** support, and with no warranty, express or implied, as to its usefulness for +** any purpose. +** +** lookup.c +** +** Beschrijving: Ledpatroon op PORTD dmv table lookup (scheiding logica en data) +** Target: AVR mcu +** Build: avr-gcc -std=c99 -Wall -O3 -mmcu=atmega128 -D F_CPU=8000000UL -c switch.c +** avr-gcc -g -mmcu=atmega128 -o lookup.elf lookup.o +** avr-objcopy -O ihex lookup.elf lookup.hex +** or type 'make' +** Author: dkroeske@gmail.com +** -------------------------------------------------------------------------*/ + +#define F_CPU 10e6 +#include +#include +#include + +typedef struct { + unsigned char data; + unsigned int delay; + } SEGMENT_DELAY; + +SEGMENT_DELAY segments[] = { + /* go around the outer layer twice */ + // 0 a b c d e f + {0x00,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100}, + /* then fill it starting at a */ + {0x01,100},{0x03,100},{0x07,100},{0x0F,100},{0x1F,100},{0x3F,100},{0b00111110,100},{0b00111100,100},{0b00111000,100},{0b00110000,100},{0b00100000,100}, + /* blink the 3 horizontal bars 2 times from top to bottom*/ + {0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50}, + {0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50}, + {0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50} + /* go in a figure 8 pattern pattern*/ + +}; + + +/************************************************************************/ +/* wait method +waits a specific amount of miliseconds */ +/************************************************************************/ +void wait( int ms ) + +{ + for (int i=0; i + + + + + + Device + Startup + + + Atmel + 1.6.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8\avr\include\avr\iom128.h + + header + XC + JdJ7J9I/SJh965SEyyyVYw== + + xc8/avr/include/avr/iom128.h + + + + + ATmega_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc + 1.6.364 + true + ATmega128 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/Microcontrollers/opdracht 2.4/opdracht 2.4.cproj b/Microcontrollers/opdracht 2.4/opdracht 2.4.cproj new file mode 100644 index 0000000..f7f985b --- /dev/null +++ b/Microcontrollers/opdracht 2.4/opdracht 2.4.cproj @@ -0,0 +1,87 @@ + + + + 2.0 + 7.0 + com.microchip.xc8 + {0fa0c637-5ac0-44f3-999b-49c114b97183} + ATmega128 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + opdracht 2.4 + opdracht 2.4 + opdracht 2.4 + XC8_2.31 + true + false + true + true + + + true + + 2 + 0 + 0 + + + + + + True + True + True + + + (%24DeviceMacro) + NDEBUG + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + + + + + True + True + + + (%24DeviceMacro) + DEBUG + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + + + + + + compile + + + + \ No newline at end of file From 0c2250f0449822524b028bd5fa725de0cb5ee6a2 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 10 Feb 2021 20:20:32 +0100 Subject: [PATCH 4/5] remove comment --- Microcontrollers/opdracht 2.4/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Microcontrollers/opdracht 2.4/main.c b/Microcontrollers/opdracht 2.4/main.c index f77fa31..1b73113 100644 --- a/Microcontrollers/opdracht 2.4/main.c +++ b/Microcontrollers/opdracht 2.4/main.c @@ -34,7 +34,6 @@ SEGMENT_DELAY segments[] = { {0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50}, {0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50}, {0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50} - /* go in a figure 8 pattern pattern*/ }; From f1418a3c8e58dd59e1b833ac31e3abf5f0772089 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 10 Feb 2021 20:24:39 +0100 Subject: [PATCH 5/5] add comments --- Microcontrollers/opdracht 2.4/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Microcontrollers/opdracht 2.4/main.c b/Microcontrollers/opdracht 2.4/main.c index 1b73113..28d5c48 100644 --- a/Microcontrollers/opdracht 2.4/main.c +++ b/Microcontrollers/opdracht 2.4/main.c @@ -53,14 +53,14 @@ void wait( int ms ) int main( void ) { - DDRA = 0xFF; + DDRA = 0xFF; // set PORTA to all output while (1==1) { // Set index to begin of pattern array int index = 0; - // as long as delay has meaningful content + // loop through the array for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++) { // Write data to PORTA @@ -71,6 +71,7 @@ int main( void ) index++; } } + /*we need to free the memory taken up by the array, otherwise it won't clear properly*/ free(segments);