Skip to content

Commit a6a40e5

Browse files
committed
vector table
1 parent e6759af commit a6a40e5

File tree

6 files changed

+595
-322
lines changed

6 files changed

+595
-322
lines changed

SW/libs/Serial/Makefile

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
DEBUG_FLAGS = -Os -g
2-
#DEBUG=1
3-
#BOARD_TAG = nano
4-
#BOARD_SUB = atmega328
5-
BOARD_TAG = mega
6-
BOARD_SUB = atmega2560
7-
MONITOR_BAUDRATE=115200
8-
#MONITOR_BAUDRATE=9600
9-
TARGET = FORTH
10-
ISP_PROG=usbasp
11-
USER_LIB_PATH= ../libs/
12-
# USER_LIB_PATH= $(ARDMK_DIR)/libs/
13-
14-
#DEFINES += -DOUTPUT_TARGET=OUTPUT_TARGET_terminal -D__PORTABLE_GRAPHIC__
15-
DEFINES += -DOUTPUT_TARGET=OUTPUT_TARGET_vram -D__PORTABLE_GRAPHIC__
16-
CFLAGS += $(DEFINES)
17-
CXXFLAGS += $(DEFINES)
18-
ASFLAGS += $(DEFINES)
19-
include ../Makefile
20-
# include $(ARDMK_DIR)/Arduino.mk
21-
22-
23-
$(TARGET_ELF): $(VERSION_HEADER)
24-
25-
asm.S: words.inc
26-
# words.inc: words.4th
27-
#./forth2inc.py
28-
29-
all: disassm tags
30-
#tags:
31-
#ctags -R .
1+
BUILD = build-mega-atmega2560
2+
3+
MCU = atmega2560
4+
CC = avr-gcc
5+
OBJCOPY = avr-objcopy
6+
OBJDUMP = avr-objdump
7+
8+
CFLAGS = -mmcu=$(MCU) -Wall -Os -nostartfiles
9+
10+
.PHONY: all clean upload
11+
12+
all: $(BUILD)/ $(BUILD)/program.hex program.dis
13+
14+
$(BUILD)/:
15+
mkdir -p $(BUILD)/
16+
17+
$(BUILD)/program.elf: $(BUILD)/vectors_table.o $(BUILD)/isr_stub.o $(BUILD)/usart0.o $(BUILD)/usart0_echo.o
18+
$(CC) $(CFLAGS) -o $@ $^
19+
20+
$(BUILD)/%.o: %.S Makefile
21+
$(CC) $(CFLAGS) -c $< -o $@
22+
23+
$(BUILD)/program.hex: $(BUILD)/program.elf Makefile
24+
$(OBJCOPY) -O ihex $< $@
25+
26+
program.dis: $(BUILD)/program.elf Makefile
27+
$(OBJDUMP) --disassemble --source --line-numbers --demangle -z --section=.text --section=.data --section=.bss $< > $@
28+
29+
upload: $(BUILD)/program.hex
30+
/usr/bin/avrdude -v -V -p atmega2560 -D -c wiring -b 115200 -P /dev/ttyACM0 -U flash:w:$<:i
31+
32+
monitor:
33+
picocom -b 115200 --flow n --noreset --quiet /dev/ttyACM0
34+
35+
upload_monitor: upload monitor
36+
37+
clean:
38+
rm -f *.o *.elf *.hex *.dis $(BUILD)/

SW/libs/Serial/isr_stub.S

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
2+
.section .text
3+
4+
.weak RESET
5+
RESET :; 0 Reset
6+
7+
.weak INT0_ISR
8+
INT0_ISR :; 1 External Interrupt Request 0
9+
10+
.weak INT1_ISR
11+
INT1_ISR :; 2 External Interrupt Request 1
12+
13+
.weak INT2_ISR
14+
INT2_ISR :; 3 External Interrupt Request 2
15+
16+
.weak INT3_ISR
17+
INT3_ISR :; 4 External Interrupt Request 3
18+
19+
.weak INT4_ISR
20+
INT4_ISR :; 5 External Interrupt Request 4
21+
22+
.weak INT5_ISR
23+
INT5_ISR :; 6 External Interrupt Request 5
24+
25+
.weak INT6_ISR
26+
INT6_ISR :; 7 External Interrupt Request 6
27+
28+
.weak INT7_ISR
29+
INT7_ISR :; 8 External Interrupt Request 7
30+
31+
.weak PCINT0_ISR
32+
PCINT0_ISR :; 9 Pin Change Interrupt Request 0
33+
34+
.weak PCINT1_ISR
35+
PCINT1_ISR :; 10 Pin Change Interrupt Request 1
36+
37+
.weak PCINT2_ISR
38+
PCINT2_ISR :; 11 Pin Change Interrupt Request 2
39+
40+
.weak WDT_ISR
41+
WDT_ISR :; 12 Watchdog Time-out Interrupt
42+
43+
.weak TIMER2_COMPA_ISR
44+
TIMER2_COMPA_ISR :; 13 Timer/Counter2 Compare Match A
45+
46+
.weak TIMER2_COMPB_ISR
47+
TIMER2_COMPB_ISR :; 14 Timer/Counter2 Compare Match B
48+
49+
.weak TIMER2_OVF_ISR
50+
TIMER2_OVF_ISR :; 15 Timer/Counter2 Overflow
51+
52+
.weak TIMER1_CAPT_ISR
53+
TIMER1_CAPT_ISR :; 16 Timer/Counter1 Capture Event
54+
55+
.weak TIMER1_COMPA_ISR
56+
TIMER1_COMPA_ISR :; 17 Timer/Counter1 Compare Match A
57+
58+
.weak TIMER1_COMPB_ISR
59+
TIMER1_COMPB_ISR :; 18 Timer/Counter1 Compare Match B
60+
61+
.weak TIMER1_COMPC_ISR
62+
TIMER1_COMPC_ISR :; 19 Timer/Counter1 Compare Match C
63+
64+
.weak TIMER1_OVF_ISR
65+
TIMER1_OVF_ISR :; 20 Timer/Counter1 Overflow
66+
67+
.weak TIMER0_COMPA_ISR
68+
TIMER0_COMPA_ISR :; 21 TimerCounter0 Compare Match A
69+
70+
.weak TIMER0_COMPB_ISR
71+
TIMER0_COMPB_ISR :; 22 TimerCounter0 Compare Match B
72+
73+
.weak TIMER0_OVF_ISR
74+
TIMER0_OVF_ISR :; 23 TimerCounter0 Overflow
75+
76+
.weak SPI_STC_ISR
77+
SPI_STC_ISR :; 24 SPI Serial Transfer Complete
78+
79+
.weak USART0_RX_ISR
80+
USART0_RX_ISR :; 25 USART0 Rx Complete
81+
82+
.weak USART0_UDRE_ISR
83+
USART0_UDRE_ISR :; 26 USART0, Data Register Empty
84+
85+
.weak USART0_TX_ISR
86+
USART0_TX_ISR :; 27 USART0, Tx Complete
87+
88+
.weak ANALOG_COMP_ISR
89+
ANALOG_COMP_ISR :; 28 Analog Comparator
90+
91+
.weak ADC_ISR
92+
ADC_ISR :; 29 ADC Conversion Complete
93+
94+
.weak EE_READY_ISR
95+
EE_READY_ISR :; 30 EEPROM Ready
96+
97+
.weak TIMER3_CAPT_ISR
98+
TIMER3_CAPT_ISR :; 31 Timer/Counter3 Capture Event
99+
100+
.weak TIMER3_COMPA_ISR
101+
TIMER3_COMPA_ISR :; 32 Timer/Counter3 Compare Match A
102+
103+
.weak TIMER3_COMPB_ISR
104+
TIMER3_COMPB_ISR :; 33 Timer/Counter3 Compare Match B
105+
106+
.weak TIMER3_COMPC_ISR
107+
TIMER3_COMPC_ISR :; 34 Timer/Counter3 Compare Match C
108+
109+
.weak TIMER3_OVF_ISR
110+
TIMER3_OVF_ISR :; 35 Timer/Counter3 Overflow
111+
112+
.weak USART1_RX_ISR
113+
USART1_RX_ISR :; 36 USART1 Rx Complete
114+
115+
.weak USART1_UDRE_ISR
116+
USART1_UDRE_ISR :; 37 USART1, Data Register Empty
117+
118+
.weak USART1_TX_ISR
119+
USART1_TX_ISR :; 38 USART1, Tx Complete
120+
121+
.weak TWI_ISR
122+
TWI_ISR :; 39 2-wire Serial Interface
123+
124+
.weak SPM_READY_ISR
125+
SPM_READY_ISR :; 40 Store Program Memory Ready
126+
127+
.weak TIMER4_CAPT_ISR
128+
TIMER4_CAPT_ISR :; 41 Timer/Counter4 Capture Event
129+
130+
.weak TIMER4_COMPA_ISR
131+
TIMER4_COMPA_ISR :; 42 Timer/Counter4 Compare Match A
132+
133+
.weak TIMER4_COMPB_ISR
134+
TIMER4_COMPB_ISR :; 43 Timer/Counter4 Compare Match B
135+
136+
.weak TIMER4_COMPC_ISR
137+
TIMER4_COMPC_ISR :; 44 Timer/Counter4 Compare Match C
138+
139+
.weak TIMER4_OVF_ISR
140+
TIMER4_OVF_ISR :; 45 Timer/Counter4 Overflow
141+
142+
.weak TIMER5_CAPT_ISR
143+
TIMER5_CAPT_ISR :; 46 Timer/Counter5 Capture Event
144+
145+
.weak TIMER5_COMPA_ISR
146+
TIMER5_COMPA_ISR :; 47 Timer/Counter5 Compare Match A
147+
148+
.weak TIMER5_COMPB_ISR
149+
TIMER5_COMPB_ISR :; 48 Timer/Counter5 Compare Match B
150+
151+
.weak TIMER5_COMPC_ISR
152+
TIMER5_COMPC_ISR :; 49 Timer/Counter5 Compare Match C
153+
154+
.weak TIMER5_OVF_ISR
155+
TIMER5_OVF_ISR :; 50 Timer/Counter5 Overflow
156+
157+
.weak USART2_RX_ISR
158+
USART2_RX_ISR :; 51 USART2 Rx Complete
159+
160+
.weak USART2_UDRE_ISR
161+
USART2_UDRE_ISR :; 52 USART2, Data Register Empty
162+
163+
.weak USART2_TX_ISR
164+
USART2_TX_ISR :; 53 USART2, Tx Complete
165+
166+
.weak USART3_RX_ISR
167+
USART3_RX_ISR :; 54 USART3 Rx Complete
168+
169+
.weak USART3_UDRE_ISR
170+
USART3_UDRE_ISR :; 55 USART3, Data Register Empty
171+
172+
.weak USART3_TX_ISR
173+
USART3_TX_ISR :; 56 USART3, Tx Complete
174+
175+
176+
reti

SW/libs/Serial/run.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
# vim: fileencoding=utf-8:nomodified:nowrap:textwidth=0:foldmethod=marker:foldcolumn=4:syntax=sh:filetype=sh:ruler:showcmd:lcs=tab\:|- list
33
#
4-
avr-gcc -mmcu=atmega2560 -nostartfiles -o program.elf usart0_echo.S
4+
avr-gcc -c -mmcu=atmega2560 -nostartfiles -o usart0.o usart0.S
5+
avr-gcc -c -mmcu=atmega2560 -nostartfiles -o program.o usart0_echo.S
6+
avr-gcc -mmcu=atmega2560 -nostartfiles -o program.elf program.o usart0.o
57
avr-objdump --disassemble --source --line-numbers --demangle -z --section=.text --section=.data --section=.bss program.elf > program.dis
8+
avr-objcopy -O ihex program.elf program.hex
69
#
710

0 commit comments

Comments
 (0)