I'm trying to use this approach.
https://www.raphnet.net/programm...
If I use the normal ISR I'm good
Working method.
ISR (INT2_vect ) { PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug } EICRA = (1<<ISC20); EIMSK = (1<<INT2); sei();//enable interrupts.
When my pin changes I get my debug.
Here is how I changed it, but I'm not understanding the MCUCR register from the documentation nor do I know how to convert this over to my chip (atmega32u4).
Code wise I think I do the same thing.
void fastint(void) __attribute__((naked)) __attribute__((section(".boot"))); void fastint(void) { PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug PORTF |= 0x01; PORTF &= ~0x01;//debug asm volatile( --- )::); } EICRA = (1<<ISC20); EIMSK = (1<<INT2); MCUCR |= (1<<IVCE); MCUCR |= (1<<IVSEL); sei();//enable interrupts.
He says
The atmega8 supports moving the interrupt vector from address 0x0000 to the start of the bootloader section. The effective address depends on how the "fuses" are configured. In my case, the address is 0x1800 (Word address 0xC00).
I'm using a atmega32u4 and it has its own boot FLIP. So confused there...
fuses
0xf4
0xd9
0x5e
Than he says
I created a .boot section by adding -Wl,--section-start=.boot=0x1800 when linking. The interrupt handler "function" that I will place there will therefore have to be marked with __attribute__((section(".boot"))).
So does that mean I need to add to the make file. I'm just using a basic LUFA make.
MCU = atmega32u4
ARCH = AVR8
BOARD = MINIMUS
F_CPU = 16000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = bridge
SRC = bridge.c conPad.c psx.c wii.c wiimote.c gc.c gen.c nes.c ../shared/bridge_protocal.c $(LUFA_SRC_USB)
LUFA_PATH = ../shared/LUFA
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
LD_FLAGS =# Default target
all:# Include LUFA build script makefiles
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
include $(LUFA_PATH)/Build/lufa_doxygen.mk
include $(LUFA_PATH)/Build/lufa_dfu.mk
include $(LUFA_PATH)/Build/lufa_hid.mk
include $(LUFA_PATH)/Build/lufa_avrdude.mk
Do I put this line in the optimization replace the s? He also mentioned using -Os