Week 3 Self Assessment Quiz Questions 1.[2] In the most basic and general sense, what does the utility "make" do? - If the target is a file - If the target is a "phony target" with no dependencies 2.[2] In the rule below, label: target, prerequisite, command, where the tab goes. $(PRG).hex: $(PRG).elf $(OBJCOPY) -j .text -j .data -O ihex $< $@ 3.[4] When an interrupt occurs on the Mega128, just before vectoring to the ISR, the CPU hardware clears the global interrupt bit (GIE), and the program counter is loaded with the address of the corresponding vector which is usually a jump instruction. After the jump is taken and the ISR entered, at least two "housekeeping chores" need to be taken care of. What are they? Be specific. 4.[2] The last instruction of an interrupt service routine is _____________ and its function is to ________________________________________________. 5.[2] What are function prototypes for? 6.[6] What are the steps that the mega128 takes in response to an interrupt? 7.[5] What do the ISR preamble and postamble do and how do they get there? 8.[2] How do you clear an interrupt flag if interrupts are not enabled? 9.[4] What does the "volatile" modifier indicate to the compiler? What is it used for? 10.[4] The article "Debugging Embedded C", lists the four phases in the process of debugging. Name two of them. 11.[3] Does the other in which targets/dependencies are listed make any difference? 12.[2] How are variables dereferenced in a makefile. 13.[2] How do you continue a line in a makefile? 14.[3] Give the syntax of a makefile rule. 15.[4] What is a makefile phony target? 16.[3] What does avr-libc consist of? 17.[2] What information does make use to know if it should create a new ".o" file from a ".c" file? 18.[8] For the makefile below, write out the commands that would be executed. Do this in the order of execution. Assume that quiz_code.c has initially been compiled by typing "make all" and that no compile errors occurred. List all the "switches" to the commands that are executed. a.[10] "make all" b.[10] "make program" c.[10] "make clean" # $@ file name of target, i.e., left hand side of : # $< name of first prerequisite # $? name of all the prerequisites that are newer than the target # $^, $+ names of all the prerequisites PRG = quiz_code OBJ = $(PRG).o MCU_TARGET = atmega128 OPTIMIZE = -O2 # options are 1, 2, 3, s CC = avr-gcc OBJCOPY = avr-objcopy OBJDUMP = avr-objdump override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) override LDFLAGS = -Wl,-Map,$(PRG).map all: $(PRG).elf lst $(PRG).elf: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ program: $(PRG).hex avrdude -c usbasp -p m128 -e -U flash:w:$(PRG).hex -v $(PRG).hex: $(PRG).elf $(OBJCOPY) -j .text -j .data -O ihex $< $@ lst: $(PRG).lst %.lst: %.elf $(OBJDUMP) -h -S $< > $@ clean: rm -rf *.o $(PRG).elf rm -rf *.lst *.map