mirror of
https://github.com/UzixLS/famicom-dumper.git
synced 2025-07-19 07:21:16 +03:00
First commit
This commit is contained in:
157
Makefile
Normal file
157
Makefile
Normal file
@ -0,0 +1,157 @@
|
||||
#LFUSE = E4
|
||||
#HFUSE = DD
|
||||
MCU_PROGRAMMER = m64
|
||||
PROGRAMMER_TYPE = avr109
|
||||
PROGRAMMER_PORT = com10
|
||||
|
||||
PRG = famicom-dumper
|
||||
OBJ = dumper.o usart.o comm.o jtag.o
|
||||
#MCU_TARGET = at90s2313
|
||||
#MCU_TARGET = at90s2333
|
||||
#MCU_TARGET = at90s4414
|
||||
#MCU_TARGET = at90s4433
|
||||
#MCU_TARGET = at90s4434
|
||||
#MCU_TARGET = at90s8515
|
||||
#MCU_TARGET = at90s8535
|
||||
#MCU_TARGET = atmega128
|
||||
#MCU_TARGET = atmega1280
|
||||
#MCU_TARGET = atmega1281
|
||||
#MCU_TARGET = atmega16
|
||||
#MCU_TARGET = atmega163
|
||||
#MCU_TARGET = atmega164p
|
||||
#MCU_TARGET = atmega165
|
||||
#MCU_TARGET = atmega165p
|
||||
#MCU_TARGET = atmega168
|
||||
#MCU_TARGET = atmega169
|
||||
#MCU_TARGET = atmega169p
|
||||
#MCU_TARGET = atmega32
|
||||
#MCU_TARGET = atmega324p
|
||||
#MCU_TARGET = atmega325
|
||||
#MCU_TARGET = atmega3250
|
||||
#MCU_TARGET = atmega329
|
||||
#MCU_TARGET = atmega3290
|
||||
#MCU_TARGET = atmega48
|
||||
MCU_TARGET = atmega64
|
||||
#MCU_TARGET = atmega640
|
||||
#MCU_TARGET = atmega644
|
||||
#MCU_TARGET = atmega644p
|
||||
#MCU_TARGET = atmega645
|
||||
#MCU_TARGET = atmega6450
|
||||
#MCU_TARGET = atmega649
|
||||
#MCU_TARGET = atmega6490
|
||||
#MCU_TARGET = atmega8
|
||||
#MCU_TARGET = atmega8515
|
||||
#MCU_TARGET = atmega8535
|
||||
#MCU_TARGET = atmega88
|
||||
#MCU_TARGET = attiny2313
|
||||
#MCU_TARGET = attiny24
|
||||
#MCU_TARGET = attiny25
|
||||
#MCU_TARGET = attiny26
|
||||
#MCU_TARGET = attiny261
|
||||
#MCU_TARGET = attiny44
|
||||
#MCU_TARGET = attiny45
|
||||
#MCU_TARGET = attiny461
|
||||
#MCU_TARGET = attiny84
|
||||
#MCU_TARGET = attiny85
|
||||
#MCU_TARGET = attiny861
|
||||
OPTIMIZE = -O2
|
||||
|
||||
DEFS =
|
||||
LIBS =
|
||||
|
||||
# You should not have to change anything below here.
|
||||
|
||||
CC = avr-gcc
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
||||
override LDFLAGS = -Wl,-Map,$(PRG).map
|
||||
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
|
||||
all: $(PRG).elf lst text eeprom
|
||||
|
||||
$(PRG).elf: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
# dependency:
|
||||
demo.o: demo.c
|
||||
|
||||
clean:
|
||||
rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
|
||||
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
|
||||
|
||||
lst: $(PRG).lst
|
||||
|
||||
%.lst: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
# Rules for building the .text rom images
|
||||
|
||||
text: hex bin srec
|
||||
|
||||
hex: $(PRG).hex
|
||||
bin: $(PRG).bin
|
||||
srec: $(PRG).srec
|
||||
|
||||
%.hex: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O srec $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
||||
|
||||
# Rules for building the .eeprom rom images
|
||||
|
||||
eeprom: ehex ebin esrec
|
||||
|
||||
ehex: $(PRG)_eeprom.hex
|
||||
ebin: $(PRG)_eeprom.bin
|
||||
esrec: $(PRG)_eeprom.srec
|
||||
|
||||
%_eeprom.hex: %.elf
|
||||
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ \
|
||||
|| { echo empty $@ not generated; exit 0; }
|
||||
|
||||
%_eeprom.srec: %.elf
|
||||
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ \
|
||||
|| { echo empty $@ not generated; exit 0; }
|
||||
|
||||
%_eeprom.bin: %.elf
|
||||
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ \
|
||||
|| { echo empty $@ not generated; exit 0; }
|
||||
|
||||
# Every thing below here is used by avr-libc's build system and can be ignored
|
||||
# by the casual user.
|
||||
|
||||
FIG2DEV = fig2dev
|
||||
EXTRA_CLEAN_FILES = *.hex *.bin *.srec
|
||||
|
||||
dox: eps png pdf
|
||||
|
||||
eps: $(PRG).eps
|
||||
png: $(PRG).png
|
||||
pdf: $(PRG).pdf
|
||||
|
||||
%.eps: %.fig
|
||||
$(FIG2DEV) -L eps $< $@
|
||||
|
||||
%.pdf: %.fig
|
||||
$(FIG2DEV) -L pdf $< $@
|
||||
|
||||
%.png: %.fig
|
||||
$(FIG2DEV) -L png $< $@
|
||||
|
||||
program: hex
|
||||
avrdude -V -p $(MCU_PROGRAMMER) -c $(PROGRAMMER_TYPE) -P $(PROGRAMMER_PORT) -U flash:w:$(PRG).hex
|
||||
|
||||
reboot:
|
||||
famicom-dumper bootloader
|
||||
|
||||
reboot_program: reboot program
|
||||
|
||||
build: hex
|
239
board/famicom_dumper.drl
Normal file
239
board/famicom_dumper.drl
Normal file
@ -0,0 +1,239 @@
|
||||
; Drill file
|
||||
; Format: 2.4 (00.0000)
|
||||
M48
|
||||
INCH
|
||||
T01C0.0118
|
||||
T02C0.0283
|
||||
T03C0.0394
|
||||
T04C0.0433
|
||||
T05C0.0472
|
||||
T06C0.1181
|
||||
%
|
||||
G05
|
||||
G90
|
||||
T01
|
||||
X000830Y-020440
|
||||
X000830Y-018440
|
||||
X002830Y-018440
|
||||
X004830Y-018440
|
||||
X004830Y-020440
|
||||
X002830Y-020440
|
||||
X010210Y-015270
|
||||
X011220Y-015590
|
||||
X012220Y-015900
|
||||
X013190Y-016220
|
||||
X013040Y-017070
|
||||
X014200Y-016530
|
||||
X015190Y-016860
|
||||
X016190Y-017200
|
||||
X016500Y-018010
|
||||
X017200Y-017490
|
||||
X018200Y-017800
|
||||
X018150Y-018890
|
||||
X020180Y-018100
|
||||
X021160Y-018440
|
||||
X021460Y-019900
|
||||
X023460Y-019900
|
||||
X025460Y-019900
|
||||
X027460Y-019900
|
||||
X029460Y-019900
|
||||
X031460Y-019900
|
||||
X033460Y-019900
|
||||
X035460Y-019900
|
||||
X028160Y-017200
|
||||
X027160Y-016860
|
||||
X026170Y-016530
|
||||
X025160Y-016220
|
||||
X024190Y-015900
|
||||
X023180Y-015590
|
||||
X022180Y-015270
|
||||
X023170Y-009770
|
||||
X022600Y-007960
|
||||
X021440Y-007250
|
||||
X021120Y-006930
|
||||
X020810Y-006620
|
||||
X020490Y-006300
|
||||
X020180Y-005990
|
||||
X019860Y-005670
|
||||
X019550Y-005360
|
||||
X019230Y-005040
|
||||
X019550Y-003470
|
||||
X020180Y-002630
|
||||
X020490Y-001260
|
||||
X019900Y-000330
|
||||
X022060Y-001840
|
||||
X023460Y-001840
|
||||
X024550Y-002480
|
||||
X025790Y-002500
|
||||
X026420Y-002200
|
||||
X027050Y-002200
|
||||
X027780Y-001900
|
||||
X028410Y-000330
|
||||
X029780Y-001900
|
||||
X027050Y-004410
|
||||
X026420Y-003780
|
||||
X025220Y-003850
|
||||
X025160Y-004410
|
||||
X023960Y-004730
|
||||
X023640Y-004410
|
||||
X023330Y-004100
|
||||
X023010Y-003780
|
||||
X022740Y-000330
|
||||
X025570Y-000330
|
||||
X031460Y-005270
|
||||
X033460Y-007270
|
||||
X035460Y-007270
|
||||
X035460Y-005270
|
||||
X037240Y-002500
|
||||
X035460Y-001270
|
||||
X033460Y-001270
|
||||
X028600Y-007960
|
||||
X026600Y-007960
|
||||
X024600Y-007960
|
||||
X028780Y-010270
|
||||
X029620Y-011170
|
||||
X036800Y-011250
|
||||
X036800Y-009270
|
||||
X020170Y-009770
|
||||
X019230Y-008920
|
||||
X018920Y-009300
|
||||
X018600Y-009660
|
||||
X018280Y-009280
|
||||
X017970Y-009670
|
||||
X017660Y-009280
|
||||
X016670Y-009280
|
||||
X016670Y-009770
|
||||
X016670Y-010250
|
||||
X016670Y-010720
|
||||
X016670Y-011190
|
||||
X016670Y-011660
|
||||
X016670Y-008510
|
||||
X015710Y-008060
|
||||
X014700Y-008060
|
||||
X013710Y-008070
|
||||
X012730Y-008060
|
||||
X011690Y-008060
|
||||
X010690Y-008060
|
||||
X009700Y-008060
|
||||
X009170Y-007260
|
||||
X008510Y-008080
|
||||
X006700Y-007630
|
||||
X005030Y-007640
|
||||
X003440Y-009210
|
||||
X002240Y-010800
|
||||
X001460Y-007270
|
||||
X001460Y-005270
|
||||
X001460Y-003270
|
||||
X001460Y-001270
|
||||
X003460Y-001270
|
||||
X005460Y-001270
|
||||
X005460Y-003270
|
||||
X003460Y-003270
|
||||
X003460Y-005270
|
||||
X007120Y-005540
|
||||
X008790Y-005530
|
||||
X010600Y-005960
|
||||
X011190Y-006630
|
||||
X012170Y-006330
|
||||
X013200Y-005990
|
||||
X014170Y-005700
|
||||
X014590Y-005350
|
||||
X015140Y-005040
|
||||
X013600Y-004960
|
||||
X013640Y-003060
|
||||
X012170Y-003060
|
||||
X011300Y-002260
|
||||
X011300Y-001590
|
||||
X010690Y-003060
|
||||
X011220Y-003800
|
||||
X009880Y-003620
|
||||
X010190Y-006940
|
||||
X015030Y-002260
|
||||
X015030Y-001590
|
||||
X017180Y-002630
|
||||
X016860Y-004310
|
||||
X014610Y-018010
|
||||
T02
|
||||
X033880Y-006620
|
||||
X033880Y-005640
|
||||
T03
|
||||
X035920Y-003260
|
||||
X035920Y-001530
|
||||
T04
|
||||
X006070Y-019430
|
||||
X007070Y-019430
|
||||
X008070Y-019430
|
||||
X009070Y-019430
|
||||
X009070Y-018430
|
||||
X008070Y-018430
|
||||
X007070Y-018430
|
||||
X006070Y-018430
|
||||
X010070Y-018430
|
||||
X010070Y-019430
|
||||
T05
|
||||
X004180Y-014440
|
||||
X005180Y-014440
|
||||
X006180Y-014440
|
||||
X007180Y-014440
|
||||
X008180Y-014440
|
||||
X009180Y-014440
|
||||
X010180Y-014440
|
||||
X011180Y-014440
|
||||
X012180Y-014440
|
||||
X013180Y-014440
|
||||
X014180Y-014440
|
||||
X015180Y-014440
|
||||
X016180Y-014440
|
||||
X017180Y-014440
|
||||
X018180Y-014440
|
||||
X019180Y-014440
|
||||
X020180Y-014440
|
||||
X021180Y-014440
|
||||
X022180Y-014440
|
||||
X023180Y-014440
|
||||
X024180Y-014440
|
||||
X025180Y-014440
|
||||
X026180Y-014440
|
||||
X027180Y-014440
|
||||
X028180Y-014440
|
||||
X029180Y-014440
|
||||
X030180Y-014440
|
||||
X031180Y-014440
|
||||
X032180Y-014440
|
||||
X033180Y-014440
|
||||
X033180Y-012440
|
||||
X032180Y-012440
|
||||
X031180Y-012440
|
||||
X030180Y-012440
|
||||
X029180Y-012440
|
||||
X028180Y-012440
|
||||
X027180Y-012440
|
||||
X026180Y-012440
|
||||
X025180Y-012440
|
||||
X024180Y-012440
|
||||
X023180Y-012440
|
||||
X022180Y-012440
|
||||
X021180Y-012440
|
||||
X020180Y-012440
|
||||
X019180Y-012440
|
||||
X018180Y-012440
|
||||
X017180Y-012440
|
||||
X016180Y-012440
|
||||
X015180Y-012440
|
||||
X014180Y-012440
|
||||
X013180Y-012440
|
||||
X012180Y-012440
|
||||
X011180Y-012440
|
||||
X010180Y-012440
|
||||
X009180Y-012440
|
||||
X008180Y-012440
|
||||
X007180Y-012440
|
||||
X006180Y-012440
|
||||
X005180Y-012440
|
||||
X004180Y-012440
|
||||
T06
|
||||
X001260Y-019530
|
||||
X001260Y-006300
|
||||
X036220Y-006300
|
||||
X036220Y-019530
|
||||
M30
|
BIN
board/famicom_dumper.lay6
Normal file
BIN
board/famicom_dumper.lay6
Normal file
Binary file not shown.
56
board/famicom_dumper_board_outline.gbr
Normal file
56
board/famicom_dumper_board_outline.gbr
Normal file
@ -0,0 +1,56 @@
|
||||
%FSLAX34Y34*%
|
||||
%MOMM*%
|
||||
%LNCOPPER_TOP*%
|
||||
G71*
|
||||
G01*
|
||||
%ADD10C, 0.00*%
|
||||
%ADD11R, 1.10X2.10*%
|
||||
%ADD12R, 0.30X1.30*%
|
||||
%ADD13C, 0.40*%
|
||||
%ADD14C, 1.10*%
|
||||
%ADD15C, 1.20*%
|
||||
%ADD16C, 0.30*%
|
||||
%ADD17R, 2.50X2.00*%
|
||||
%ADD18R, 2.30X0.40*%
|
||||
%ADD19R, 3.10X1.20*%
|
||||
%ADD20C, 1.80*%
|
||||
%ADD21C, 0.80*%
|
||||
%ADD22R, 2.20X1.80*%
|
||||
%ADD23R, 1.60X2.00*%
|
||||
%ADD24C, 1.00*%
|
||||
%ADD25R, 1.50X0.40*%
|
||||
%ADD26C, 6.10*%
|
||||
%ADD27C, 1.50*%
|
||||
%ADD28C, 2.50*%
|
||||
%ADD29R, 1.20X2.30*%
|
||||
%ADD30R, 2.30X1.20*%
|
||||
%ADD31R, 3.20X4.30*%
|
||||
%ADD32C, 2.80*%
|
||||
%ADD33C, 7.70*%
|
||||
%ADD34C, 1.80*%
|
||||
%ADD35C, 1.60*%
|
||||
%ADD36C, 4.70*%
|
||||
%ADD37C, 1.40*%
|
||||
%ADD38C, 2.40*%
|
||||
%ADD39C, 3.00*%
|
||||
%ADD40C, 2.20*%
|
||||
%ADD41C, 4.40*%
|
||||
%ADD42R, 2.00X1.60*%
|
||||
%ADD43C, 0.70*%
|
||||
%ADD44C, 0.20*%
|
||||
%ADD45C, 3.00*%
|
||||
%ADD46C, 1.64*%
|
||||
%ADD47C, 2.44*%
|
||||
%ADD48C, 1.50*%
|
||||
%ADD49R, 1.20X0.80*%
|
||||
%ADD50R, 0.80X1.20*%
|
||||
%ADD51C, 2.10*%
|
||||
%ADD52R, 0.40X1.50*%
|
||||
%ADD53C, 0.50*%
|
||||
%LPD*%
|
||||
G54D10*
|
||||
X0Y0D02*
|
||||
X950000Y0D01*
|
||||
X950000Y-530000D01*
|
||||
X0Y-530000D01*
|
||||
X0Y0D01*
|
1983
board/famicom_dumper_copper_bottom.gbr
Normal file
1983
board/famicom_dumper_copper_bottom.gbr
Normal file
File diff suppressed because it is too large
Load Diff
3583
board/famicom_dumper_copper_top.gbr
Normal file
3583
board/famicom_dumper_copper_top.gbr
Normal file
File diff suppressed because it is too large
Load Diff
1535
board/famicom_dumper_silkscreen_top.gbr
Normal file
1535
board/famicom_dumper_silkscreen_top.gbr
Normal file
File diff suppressed because it is too large
Load Diff
272
board/famicom_dumper_soldermask_bottom.gbr
Normal file
272
board/famicom_dumper_soldermask_bottom.gbr
Normal file
@ -0,0 +1,272 @@
|
||||
%FSLAX34Y34*%
|
||||
%MOMM*%
|
||||
%LNSOLDERMASK_BOTTOM*%
|
||||
G71*
|
||||
G01*
|
||||
%ADD10C, 0.00*%
|
||||
%ADD11C, 2.70*%
|
||||
%ADD12C, 2.24*%
|
||||
%LPD*%
|
||||
G54D10*
|
||||
X0Y0D02*
|
||||
X950000Y0D01*
|
||||
X950000Y-530000D01*
|
||||
X0Y-530000D01*
|
||||
X0Y0D01*
|
||||
X842848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X817448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X792048Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X766648Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X741248Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X715848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X690448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X665048Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X639648Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X614248Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X588848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X563448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X538048Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X512648Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X487248Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X461848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X436448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X411048Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X385648Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X360248Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X334848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X309448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X284048Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X258648Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X233248Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X207848Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X182448Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X157047Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X131647Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X106247Y-366888D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X842848Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X817448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X792048Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X766648Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X741248Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X715848Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X690448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X665048Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X639648Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X614248Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X588848Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X563448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X538048Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X512648Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X436448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X411048Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X385648Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X360248Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X334848Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X309448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X284048Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X258648Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X233248Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X207848Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X182448Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X157047Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X131647Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X106247Y-316089D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X461848Y-316088D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X487248Y-316088D02*
|
||||
G54D11*
|
||||
D03*
|
||||
G36*
|
||||
X217900Y-505900D02*
|
||||
X217900Y-480900D01*
|
||||
X242900Y-480900D01*
|
||||
X242900Y-505900D01*
|
||||
X217900Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X192500Y-505900D02*
|
||||
X192500Y-480900D01*
|
||||
X217500Y-480900D01*
|
||||
X217500Y-505900D01*
|
||||
X192500Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X167100Y-505900D02*
|
||||
X167100Y-480900D01*
|
||||
X192100Y-480900D01*
|
||||
X192100Y-505900D01*
|
||||
X167100Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X167100Y-480500D02*
|
||||
X167100Y-455500D01*
|
||||
X192100Y-455500D01*
|
||||
X192100Y-480500D01*
|
||||
X167100Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X192500Y-480500D02*
|
||||
X192500Y-455500D01*
|
||||
X217500Y-455500D01*
|
||||
X217500Y-480500D01*
|
||||
X192500Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X217900Y-480500D02*
|
||||
X217900Y-455500D01*
|
||||
X242900Y-455500D01*
|
||||
X242900Y-480500D01*
|
||||
X217900Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X243300Y-505900D02*
|
||||
X243300Y-480900D01*
|
||||
X268300Y-480900D01*
|
||||
X268300Y-505900D01*
|
||||
X243300Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X243300Y-480500D02*
|
||||
X243300Y-455500D01*
|
||||
X268300Y-455500D01*
|
||||
X268300Y-480500D01*
|
||||
X243300Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X141700Y-505900D02*
|
||||
X141700Y-480900D01*
|
||||
X166700Y-480900D01*
|
||||
X166700Y-505900D01*
|
||||
X141700Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X141700Y-480500D02*
|
||||
X141700Y-455500D01*
|
||||
X166700Y-455500D01*
|
||||
X166700Y-480500D01*
|
||||
X141700Y-480500D01*
|
||||
G37*
|
||||
X860630Y-168070D02*
|
||||
G54D12*
|
||||
D03*
|
||||
X860630Y-143170D02*
|
||||
G54D12*
|
||||
D03*
|
||||
M02*
|
853
board/famicom_dumper_soldermask_top.gbr
Normal file
853
board/famicom_dumper_soldermask_top.gbr
Normal file
@ -0,0 +1,853 @@
|
||||
%FSLAX34Y34*%
|
||||
%MOMM*%
|
||||
%LNSOLDERMASK_TOP*%
|
||||
G71*
|
||||
G01*
|
||||
%ADD10C, 0.00*%
|
||||
%ADD11R, 0.50X1.50*%
|
||||
%ADD12R, 2.70X2.20*%
|
||||
%ADD13R, 2.50X0.60*%
|
||||
%ADD14R, 1.40X1.00*%
|
||||
%ADD15R, 1.00X1.40*%
|
||||
%ADD16R, 1.70X0.60*%
|
||||
%ADD17C, 2.70*%
|
||||
%ADD18R, 0.60X1.70*%
|
||||
%ADD19C, 2.24*%
|
||||
%LPD*%
|
||||
G54D10*
|
||||
X0Y0D02*
|
||||
X950000Y0D01*
|
||||
X950000Y-530000D01*
|
||||
X0Y-530000D01*
|
||||
X0Y0D01*
|
||||
X842610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X842610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X836110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X836110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X829610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X829610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X823110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X823110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X816610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X816610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X810110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X810110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X803610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X803610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X797110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X797110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X790610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X790610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X784110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X784110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X777610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X777610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X771110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X771110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X764610Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X764610Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X758110Y-27751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
X758110Y-105751D02*
|
||||
G54D11*
|
||||
D03*
|
||||
G36*
|
||||
X728072Y-79244D02*
|
||||
X728072Y-67244D01*
|
||||
X740072Y-67244D01*
|
||||
X740072Y-79244D01*
|
||||
X728072Y-79244D01*
|
||||
G37*
|
||||
G36*
|
||||
X728072Y-68844D02*
|
||||
X728072Y-56844D01*
|
||||
X740072Y-56844D01*
|
||||
X740072Y-68844D01*
|
||||
X728072Y-68844D01*
|
||||
G37*
|
||||
X934500Y-14579D02*
|
||||
G54D12*
|
||||
D03*
|
||||
X934500Y-103579D02*
|
||||
G54D12*
|
||||
D03*
|
||||
X887500Y-14579D02*
|
||||
G54D12*
|
||||
D03*
|
||||
X887500Y-103579D02*
|
||||
G54D12*
|
||||
D03*
|
||||
X886200Y-43179D02*
|
||||
G54D13*
|
||||
D03*
|
||||
X886200Y-51179D02*
|
||||
G54D13*
|
||||
D03*
|
||||
X886200Y-59179D02*
|
||||
G54D13*
|
||||
D03*
|
||||
X886200Y-67179D02*
|
||||
G54D13*
|
||||
D03*
|
||||
X886200Y-75179D02*
|
||||
G54D13*
|
||||
D03*
|
||||
X365572Y-81868D02*
|
||||
G54D14*
|
||||
D03*
|
||||
X466410Y-12140D02*
|
||||
G54D15*
|
||||
D03*
|
||||
X560072Y-72531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X842848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X817448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X792048Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X766648Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X741248Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X715848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X690448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X665048Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X639648Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X614248Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X588848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X563448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X538048Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X512648Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X487248Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X461848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X436448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X411048Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X385648Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X360248Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X334848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X309448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X284048Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X258648Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X233248Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X207848Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X182448Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X157047Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X131647Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X106247Y-366888D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X842848Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X817448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X792048Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X766648Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X741248Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X715848Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X690448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X665048Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X639648Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X614248Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X588848Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X563448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X538048Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X512648Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X436448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X411048Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X385648Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X360248Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X334848Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X309448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X284048Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X258648Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X233248Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X207848Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X182448Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X157047Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X131647Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X106247Y-316089D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X544372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X536372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X528372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X520372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X512372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X504372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X496372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X560072Y-64531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-72531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-80531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-88531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-96531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-104531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-112531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X488372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X496372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X504372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X512372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X520372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X528372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X536372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X409072Y-120331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-112331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-104331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-96331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-88331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-80331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-72331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-64331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-72331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-80331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-88331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-96331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-104331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-112331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X488372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X496372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X504372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X512372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X520372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X528372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X536372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X560072Y-120531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-112531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-104531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-96531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-88531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-80531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-72531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X544372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X536372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X528372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X520372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X512372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X504372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X496372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X560072Y-128531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-136531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-144531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-152531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-160531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-168531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-176531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-184531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-176531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-168531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-160531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-152531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-144531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X560072Y-136531D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X480372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X472372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X464372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X456372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X448372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X440372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X432372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X424372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X432372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X440372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X448372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X456372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X464372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X472372Y-48931D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X424372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X432372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X448372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X456372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X464372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X472372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X480372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X480372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X472372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X464372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X456372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X448372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X432372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X409072Y-184331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-176331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-168331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-160331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-152331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-144331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-136331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-128331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-136331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-144331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-152331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-160331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-168331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X409072Y-176331D02*
|
||||
G54D16*
|
||||
D03*
|
||||
X440372Y-200331D02*
|
||||
G54D18*
|
||||
D03*
|
||||
X461848Y-316088D02*
|
||||
G54D17*
|
||||
D03*
|
||||
X487248Y-316088D02*
|
||||
G54D17*
|
||||
D03*
|
||||
G36*
|
||||
X429500Y-503192D02*
|
||||
X448500Y-503192D01*
|
||||
X448500Y-522192D01*
|
||||
X429500Y-522192D01*
|
||||
X429500Y-503192D01*
|
||||
G37*
|
||||
G36*
|
||||
X451250Y-503192D02*
|
||||
X470250Y-503192D01*
|
||||
X470250Y-522192D01*
|
||||
X451250Y-522192D01*
|
||||
X451250Y-503192D01*
|
||||
G37*
|
||||
X624372Y-21239D02*
|
||||
G54D14*
|
||||
D03*
|
||||
X624372Y-35068D02*
|
||||
G54D14*
|
||||
D03*
|
||||
G36*
|
||||
X832019Y-5979D02*
|
||||
X844019Y-5979D01*
|
||||
X844019Y-17979D01*
|
||||
X832019Y-17979D01*
|
||||
X832019Y-5979D01*
|
||||
G37*
|
||||
G36*
|
||||
X842419Y-5979D02*
|
||||
X854419Y-5979D01*
|
||||
X854419Y-17979D01*
|
||||
X842419Y-17979D01*
|
||||
X842419Y-5979D01*
|
||||
G37*
|
||||
G36*
|
||||
X217900Y-505900D02*
|
||||
X217900Y-480900D01*
|
||||
X242900Y-480900D01*
|
||||
X242900Y-505900D01*
|
||||
X217900Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X192500Y-505900D02*
|
||||
X192500Y-480900D01*
|
||||
X217500Y-480900D01*
|
||||
X217500Y-505900D01*
|
||||
X192500Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X167100Y-505900D02*
|
||||
X167100Y-480900D01*
|
||||
X192100Y-480900D01*
|
||||
X192100Y-505900D01*
|
||||
X167100Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X167100Y-480500D02*
|
||||
X167100Y-455500D01*
|
||||
X192100Y-455500D01*
|
||||
X192100Y-480500D01*
|
||||
X167100Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X192500Y-480500D02*
|
||||
X192500Y-455500D01*
|
||||
X217500Y-455500D01*
|
||||
X217500Y-480500D01*
|
||||
X192500Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X217900Y-480500D02*
|
||||
X217900Y-455500D01*
|
||||
X242900Y-455500D01*
|
||||
X242900Y-480500D01*
|
||||
X217900Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X243300Y-505900D02*
|
||||
X243300Y-480900D01*
|
||||
X268300Y-480900D01*
|
||||
X268300Y-505900D01*
|
||||
X243300Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X243300Y-480500D02*
|
||||
X243300Y-455500D01*
|
||||
X268300Y-455500D01*
|
||||
X268300Y-480500D01*
|
||||
X243300Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X141700Y-505900D02*
|
||||
X141700Y-480900D01*
|
||||
X166700Y-480900D01*
|
||||
X166700Y-505900D01*
|
||||
X141700Y-505900D01*
|
||||
G37*
|
||||
G36*
|
||||
X141700Y-480500D02*
|
||||
X141700Y-455500D01*
|
||||
X166700Y-455500D01*
|
||||
X166700Y-480500D01*
|
||||
X141700Y-480500D01*
|
||||
G37*
|
||||
G36*
|
||||
X590082Y-65528D02*
|
||||
X590082Y-77528D01*
|
||||
X578082Y-77528D01*
|
||||
X578082Y-65528D01*
|
||||
X590082Y-65528D01*
|
||||
G37*
|
||||
G36*
|
||||
X590082Y-75928D02*
|
||||
X590082Y-87928D01*
|
||||
X578082Y-87928D01*
|
||||
X578082Y-75928D01*
|
||||
X590082Y-75928D01*
|
||||
G37*
|
||||
G36*
|
||||
X389925Y-77883D02*
|
||||
X389925Y-89883D01*
|
||||
X377925Y-89883D01*
|
||||
X377925Y-77883D01*
|
||||
X389925Y-77883D01*
|
||||
G37*
|
||||
G36*
|
||||
X389925Y-88283D02*
|
||||
X389925Y-100283D01*
|
||||
X377925Y-100283D01*
|
||||
X377925Y-88283D01*
|
||||
X389925Y-88283D01*
|
||||
G37*
|
||||
G36*
|
||||
X410137Y-502059D02*
|
||||
X398137Y-502059D01*
|
||||
X398137Y-490059D01*
|
||||
X410137Y-490059D01*
|
||||
X410137Y-502059D01*
|
||||
G37*
|
||||
G36*
|
||||
X399737Y-502059D02*
|
||||
X387737Y-502059D01*
|
||||
X387737Y-490059D01*
|
||||
X399737Y-490059D01*
|
||||
X399737Y-502059D01*
|
||||
G37*
|
||||
G36*
|
||||
X410116Y-485982D02*
|
||||
X398116Y-485982D01*
|
||||
X398116Y-473982D01*
|
||||
X410116Y-473982D01*
|
||||
X410116Y-485982D01*
|
||||
G37*
|
||||
G36*
|
||||
X399716Y-485982D02*
|
||||
X387716Y-485982D01*
|
||||
X387716Y-473982D01*
|
||||
X399716Y-473982D01*
|
||||
X399716Y-485982D01*
|
||||
G37*
|
||||
G36*
|
||||
X518333Y-522289D02*
|
||||
X499333Y-522289D01*
|
||||
X499333Y-503289D01*
|
||||
X518333Y-503289D01*
|
||||
X518333Y-522289D01*
|
||||
G37*
|
||||
G36*
|
||||
X496583Y-522289D02*
|
||||
X477583Y-522289D01*
|
||||
X477583Y-503289D01*
|
||||
X496583Y-503289D01*
|
||||
X496583Y-522289D01*
|
||||
G37*
|
||||
X860630Y-168070D02*
|
||||
G54D19*
|
||||
D03*
|
||||
X860630Y-143170D02*
|
||||
G54D19*
|
||||
D03*
|
||||
M02*
|
59
bootloader/chipdef.h
Normal file
59
bootloader/chipdef.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef CHIPDEF_H
|
||||
#define CHIPDEF_H
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
#if defined (SPMCSR)
|
||||
#define SPM_REG SPMCSR
|
||||
#elif defined (SPMCR)
|
||||
#define SPM_REG SPMCR
|
||||
#else
|
||||
#error "AVR processor does not provide bootloader support!"
|
||||
#endif
|
||||
|
||||
#define APP_END (FLASHEND - (BOOTSIZE * 2))
|
||||
|
||||
#if (SPM_PAGESIZE > UINT8_MAX)
|
||||
typedef uint16_t pagebuf_t;
|
||||
#else
|
||||
typedef uint8_t pagebuf_t;
|
||||
#endif
|
||||
|
||||
#if defined(__AVR_ATmega169__)
|
||||
#include "mega169.h"
|
||||
|
||||
#elif defined(__AVR_ATmega16__)
|
||||
#include "mega16.h"
|
||||
|
||||
#elif defined(__AVR_ATmega162__)
|
||||
#include "mega162.h"
|
||||
|
||||
#elif defined(__AVR_ATmega8__)
|
||||
#include "mega8.h"
|
||||
|
||||
#elif defined(__AVR_ATmega32__)
|
||||
#include "mega32.h"
|
||||
|
||||
#elif defined(__AVR_ATmega324P__)
|
||||
#include "mega324p.h"
|
||||
|
||||
#elif defined(__AVR_ATmega64__)
|
||||
#include "mega64.h"
|
||||
|
||||
#elif defined(__AVR_ATmega644__)
|
||||
#include "mega644.h"
|
||||
|
||||
#elif defined(__AVR_ATmega644P__)
|
||||
#include "mega644p.h"
|
||||
|
||||
#elif defined(__AVR_ATmega128__)
|
||||
#include "mega128.h"
|
||||
|
||||
#elif defined(__AVR_AT90CAN128__)
|
||||
#include "mega128can.h"
|
||||
|
||||
#else
|
||||
#error "no definition for MCU available in chipdef.h"
|
||||
#endif
|
||||
|
||||
#endif
|
169
bootloader/ldscripts_no_vector/avr1.x
Normal file
169
bootloader/ldscripts_no_vector/avr1.x
Normal file
@ -0,0 +1,169 @@
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:1)
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = 8K
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
/* Internal text space or external memory */
|
||||
/DISCARD/ : { *(.vectors); }
|
||||
.text :
|
||||
{
|
||||
/* *(.vectors) */
|
||||
__ctors_start = . ;
|
||||
*(.ctors)
|
||||
__ctors_end = . ;
|
||||
__dtors_start = . ;
|
||||
*(.dtors)
|
||||
__dtors_end = . ;
|
||||
*(.progmem.gcc*)
|
||||
*(.progmem*)
|
||||
. = ALIGN(2);
|
||||
*(.init0) /* Start here after reset. */
|
||||
*(.init1)
|
||||
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
||||
*(.init3)
|
||||
*(.init4) /* Initialize data and BSS. */
|
||||
*(.init5)
|
||||
*(.init6) /* C++ constructors. */
|
||||
*(.init7)
|
||||
*(.init8)
|
||||
*(.init9) /* Call main(). */
|
||||
*(.text)
|
||||
. = ALIGN(2);
|
||||
*(.text.*)
|
||||
. = ALIGN(2);
|
||||
*(.fini9) /* _exit() starts here. */
|
||||
*(.fini8)
|
||||
*(.fini7)
|
||||
*(.fini6) /* C++ destructors. */
|
||||
*(.fini5)
|
||||
*(.fini4)
|
||||
*(.fini3)
|
||||
*(.fini2)
|
||||
*(.fini1)
|
||||
*(.fini0) /* Infinite loop after program termination. */
|
||||
_etext = . ;
|
||||
} > text
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
PROVIDE (__data_start = .) ;
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(2);
|
||||
_edata = . ;
|
||||
PROVIDE (__data_end = .) ;
|
||||
} > data
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
PROVIDE (__bss_start = .) ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .) ;
|
||||
} > data
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
/* Global data not cleared after reset. */
|
||||
.noinit SIZEOF(.bss) + ADDR(.bss) :
|
||||
{
|
||||
PROVIDE (__noinit_start = .) ;
|
||||
*(.noinit*)
|
||||
PROVIDE (__noinit_end = .) ;
|
||||
_end = . ;
|
||||
PROVIDE (__heap_start = .) ;
|
||||
} > data
|
||||
.eeprom :
|
||||
{
|
||||
*(.eeprom*)
|
||||
__eeprom_end = . ;
|
||||
} > eeprom
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
}
|
169
bootloader/ldscripts_no_vector/avr2.x
Normal file
169
bootloader/ldscripts_no_vector/avr2.x
Normal file
@ -0,0 +1,169 @@
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:2)
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = 8K
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
/* Internal text space or external memory */
|
||||
/DISCARD/ : { *(.vectors); }
|
||||
.text :
|
||||
{
|
||||
/* *(.vectors) */
|
||||
__ctors_start = . ;
|
||||
*(.ctors)
|
||||
__ctors_end = . ;
|
||||
__dtors_start = . ;
|
||||
*(.dtors)
|
||||
__dtors_end = . ;
|
||||
*(.progmem.gcc*)
|
||||
*(.progmem*)
|
||||
. = ALIGN(2);
|
||||
*(.init0) /* Start here after reset. */
|
||||
*(.init1)
|
||||
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
||||
*(.init3)
|
||||
*(.init4) /* Initialize data and BSS. */
|
||||
*(.init5)
|
||||
*(.init6) /* C++ constructors. */
|
||||
*(.init7)
|
||||
*(.init8)
|
||||
*(.init9) /* Call main(). */
|
||||
*(.text)
|
||||
. = ALIGN(2);
|
||||
*(.text.*)
|
||||
. = ALIGN(2);
|
||||
*(.fini9) /* _exit() starts here. */
|
||||
*(.fini8)
|
||||
*(.fini7)
|
||||
*(.fini6) /* C++ destructors. */
|
||||
*(.fini5)
|
||||
*(.fini4)
|
||||
*(.fini3)
|
||||
*(.fini2)
|
||||
*(.fini1)
|
||||
*(.fini0) /* Infinite loop after program termination. */
|
||||
_etext = . ;
|
||||
} > text
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
PROVIDE (__data_start = .) ;
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(2);
|
||||
_edata = . ;
|
||||
PROVIDE (__data_end = .) ;
|
||||
} > data
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
PROVIDE (__bss_start = .) ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .) ;
|
||||
} > data
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
/* Global data not cleared after reset. */
|
||||
.noinit SIZEOF(.bss) + ADDR(.bss) :
|
||||
{
|
||||
PROVIDE (__noinit_start = .) ;
|
||||
*(.noinit*)
|
||||
PROVIDE (__noinit_end = .) ;
|
||||
_end = . ;
|
||||
PROVIDE (__heap_start = .) ;
|
||||
} > data
|
||||
.eeprom :
|
||||
{
|
||||
*(.eeprom*)
|
||||
__eeprom_end = . ;
|
||||
} > eeprom
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
}
|
169
bootloader/ldscripts_no_vector/avr3.x
Normal file
169
bootloader/ldscripts_no_vector/avr3.x
Normal file
@ -0,0 +1,169 @@
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:3)
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = 128K
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
/* Internal text space or external memory */
|
||||
/DISCARD/ : { *(.vectors); }
|
||||
.text :
|
||||
{
|
||||
/* *(.vectors) */
|
||||
__ctors_start = . ;
|
||||
*(.ctors)
|
||||
__ctors_end = . ;
|
||||
__dtors_start = . ;
|
||||
*(.dtors)
|
||||
__dtors_end = . ;
|
||||
*(.progmem.gcc*)
|
||||
*(.progmem*)
|
||||
. = ALIGN(2);
|
||||
*(.init0) /* Start here after reset. */
|
||||
*(.init1)
|
||||
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
||||
*(.init3)
|
||||
*(.init4) /* Initialize data and BSS. */
|
||||
*(.init5)
|
||||
*(.init6) /* C++ constructors. */
|
||||
*(.init7)
|
||||
*(.init8)
|
||||
*(.init9) /* Call main(). */
|
||||
*(.text)
|
||||
. = ALIGN(2);
|
||||
*(.text.*)
|
||||
. = ALIGN(2);
|
||||
*(.fini9) /* _exit() starts here. */
|
||||
*(.fini8)
|
||||
*(.fini7)
|
||||
*(.fini6) /* C++ destructors. */
|
||||
*(.fini5)
|
||||
*(.fini4)
|
||||
*(.fini3)
|
||||
*(.fini2)
|
||||
*(.fini1)
|
||||
*(.fini0) /* Infinite loop after program termination. */
|
||||
_etext = . ;
|
||||
} > text
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
PROVIDE (__data_start = .) ;
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(2);
|
||||
_edata = . ;
|
||||
PROVIDE (__data_end = .) ;
|
||||
} > data
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
PROVIDE (__bss_start = .) ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .) ;
|
||||
} > data
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
/* Global data not cleared after reset. */
|
||||
.noinit SIZEOF(.bss) + ADDR(.bss) :
|
||||
{
|
||||
PROVIDE (__noinit_start = .) ;
|
||||
*(.noinit*)
|
||||
PROVIDE (__noinit_end = .) ;
|
||||
_end = . ;
|
||||
PROVIDE (__heap_start = .) ;
|
||||
} > data
|
||||
.eeprom :
|
||||
{
|
||||
*(.eeprom*)
|
||||
__eeprom_end = . ;
|
||||
} > eeprom
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
}
|
169
bootloader/ldscripts_no_vector/avr4.x
Normal file
169
bootloader/ldscripts_no_vector/avr4.x
Normal file
@ -0,0 +1,169 @@
|
||||
/* MODIFIED LINKER SCRIPT - BOOTLOADER: without .vectors */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:4)
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = 8K
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
/* Internal text space or external memory */
|
||||
/DISCARD/ : { *(.vectors); }
|
||||
.text :
|
||||
{
|
||||
/* *(.vectors) */
|
||||
__ctors_start = . ;
|
||||
*(.ctors)
|
||||
__ctors_end = . ;
|
||||
__dtors_start = . ;
|
||||
*(.dtors)
|
||||
__dtors_end = . ;
|
||||
*(.progmem.gcc*)
|
||||
*(.progmem*)
|
||||
. = ALIGN(2);
|
||||
*(.init0) /* Start here after reset. */
|
||||
*(.init1)
|
||||
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
||||
*(.init3)
|
||||
*(.init4) /* Initialize data and BSS. */
|
||||
*(.init5)
|
||||
*(.init6) /* C++ constructors. */
|
||||
*(.init7)
|
||||
*(.init8)
|
||||
*(.init9) /* Call main(). */
|
||||
*(.text)
|
||||
. = ALIGN(2);
|
||||
*(.text.*)
|
||||
. = ALIGN(2);
|
||||
*(.fini9) /* _exit() starts here. */
|
||||
*(.fini8)
|
||||
*(.fini7)
|
||||
*(.fini6) /* C++ destructors. */
|
||||
*(.fini5)
|
||||
*(.fini4)
|
||||
*(.fini3)
|
||||
*(.fini2)
|
||||
*(.fini1)
|
||||
*(.fini0) /* Infinite loop after program termination. */
|
||||
_etext = . ;
|
||||
} > text
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
PROVIDE (__data_start = .) ;
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(2);
|
||||
_edata = . ;
|
||||
PROVIDE (__data_end = .) ;
|
||||
} > data
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
PROVIDE (__bss_start = .) ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .) ;
|
||||
} > data
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
/* Global data not cleared after reset. */
|
||||
.noinit SIZEOF(.bss) + ADDR(.bss) :
|
||||
{
|
||||
PROVIDE (__noinit_start = .) ;
|
||||
*(.noinit*)
|
||||
PROVIDE (__noinit_end = .) ;
|
||||
_end = . ;
|
||||
PROVIDE (__heap_start = .) ;
|
||||
} > data
|
||||
.eeprom :
|
||||
{
|
||||
*(.eeprom*)
|
||||
__eeprom_end = . ;
|
||||
} > eeprom
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
}
|
172
bootloader/ldscripts_no_vector/avr5.x
Normal file
172
bootloader/ldscripts_no_vector/avr5.x
Normal file
@ -0,0 +1,172 @@
|
||||
/* MODIFIED LINKER SCRIPT - BOOTLOADER: without .vectors */
|
||||
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
|
||||
OUTPUT_ARCH(avr:5)
|
||||
MEMORY
|
||||
{
|
||||
text (rx) : ORIGIN = 0, LENGTH = 128K
|
||||
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
|
||||
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
|
||||
/* Internal text space or external memory */
|
||||
|
||||
/* BOOTLOADER-MODIFICATION - not interrupt-vectors */
|
||||
/DISCARD/ : { *(.vectors) }
|
||||
.text :
|
||||
{
|
||||
/* *(.vectors) */ /* BOOTLOADER-MODIFICATION ! */
|
||||
__ctors_start = . ;
|
||||
*(.ctors)
|
||||
__ctors_end = . ;
|
||||
__dtors_start = . ;
|
||||
*(.dtors)
|
||||
__dtors_end = . ;
|
||||
*(.progmem.gcc*)
|
||||
*(.progmem*)
|
||||
. = ALIGN(2);
|
||||
*(.init0) /* Start here after reset. */
|
||||
*(.init1)
|
||||
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
||||
*(.init3)
|
||||
*(.init4) /* Initialize data and BSS. */
|
||||
*(.init5)
|
||||
*(.init6) /* C++ constructors. */
|
||||
*(.init7)
|
||||
*(.init8)
|
||||
*(.init9) /* Call main(). */
|
||||
*(.text)
|
||||
. = ALIGN(2);
|
||||
*(.text.*)
|
||||
. = ALIGN(2);
|
||||
*(.fini9) /* _exit() starts here. */
|
||||
*(.fini8)
|
||||
*(.fini7)
|
||||
*(.fini6) /* C++ destructors. */
|
||||
*(.fini5)
|
||||
*(.fini4)
|
||||
*(.fini3)
|
||||
*(.fini2)
|
||||
*(.fini1)
|
||||
*(.fini0) /* Infinite loop after program termination. */
|
||||
_etext = . ;
|
||||
} > text
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
PROVIDE (__data_start = .) ;
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(2);
|
||||
_edata = . ;
|
||||
PROVIDE (__data_end = .) ;
|
||||
} > data
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
PROVIDE (__bss_start = .) ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
PROVIDE (__bss_end = .) ;
|
||||
} > data
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
/* Global data not cleared after reset. */
|
||||
.noinit SIZEOF(.bss) + ADDR(.bss) :
|
||||
{
|
||||
PROVIDE (__noinit_start = .) ;
|
||||
*(.noinit*)
|
||||
PROVIDE (__noinit_end = .) ;
|
||||
_end = . ;
|
||||
PROVIDE (__heap_start = .) ;
|
||||
} > data
|
||||
.eeprom :
|
||||
{
|
||||
*(.eeprom*)
|
||||
__eeprom_end = . ;
|
||||
} > eeprom
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
}
|
BIN
bootloader/main
Normal file
BIN
bootloader/main
Normal file
Binary file not shown.
691
bootloader/main.c
Normal file
691
bootloader/main.c
Normal file
@ -0,0 +1,691 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* AVRPROG compatible boot-loader
|
||||
* Version : 0.85 (Dec. 2008)
|
||||
* Compiler : avr-gcc 4.1.2 / avr-libc 1.4.6
|
||||
* size : depends on features and startup ( minmal features < 512 words)
|
||||
* by : Martin Thomas, Kaiserslautern, Germany
|
||||
* eversmith@heizung-thomas.de
|
||||
* Additional code and improvements contributed by:
|
||||
* - Uwe Bonnes
|
||||
* - Bjoern Riemer
|
||||
* - Olaf Rempel
|
||||
*
|
||||
* License : Copyright (c) 2006-2008 M. Thomas, U. Bonnes, O. Rempel
|
||||
* Free to use. You have to mention the copyright
|
||||
* owners in source-code and documentation of derived
|
||||
* work. No warranty! (Yes, you can insert the BSD
|
||||
* license here)
|
||||
*
|
||||
* Tested with ATmega8, ATmega16, ATmega162, ATmega32, ATmega324P,
|
||||
* ATmega644, ATmega644P, ATmega128, AT90CAN128
|
||||
*
|
||||
* - Initial versions have been based on the Butterfly bootloader-code
|
||||
* by Atmel Corporation (Authors: BBrandal, PKastnes, ARodland, LHM)
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* See the makefile and readme.txt for information on how to adapt
|
||||
* the linker-settings to the selected Boot Size (BOOTSIZE=xxxx) and
|
||||
* the MCU-type. Other configurations futher down in this file.
|
||||
*
|
||||
* With BOOT_SIMPLE, minimal features and discarded int-vectors
|
||||
* this bootloader has should fit into a a 512 word (1024, 0x400 bytes)
|
||||
* bootloader-section.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) */
|
||||
#ifndef F_CPU
|
||||
// #define F_CPU 7372800
|
||||
//#define F_CPU (7372800/2)
|
||||
//#define F_CPU 11059200UL
|
||||
#define F_CPU 8000000UL
|
||||
#endif
|
||||
|
||||
/* UART <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UART <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 19200 */
|
||||
//#define BAUDRATE 9600
|
||||
#define BAUDRATE 19200
|
||||
//#define BAUDRATE 115200
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UART (<28><><EFBFBD> U2C)*/
|
||||
//#define UART_DOUBLESPEED
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UART <20><> mega128 / can128 / mega162 / mega324p / mega644p */
|
||||
//#define UART_USE_SECOND
|
||||
|
||||
/* <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
<20><><EFBFBD> AVRProg <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BOOT
|
||||
<20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> bootloader.
|
||||
avrdude <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> part-code <20><><EFBFBD> ISP */
|
||||
#define DEVTYPE DEVTYPE_BOOT
|
||||
//#define DEVTYPE DEVTYPE_ISP
|
||||
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
#define BLPORT PORTD
|
||||
#define BLDDR DDRD
|
||||
#define BLPIN PIND
|
||||
#define BLPNUM PIND7
|
||||
|
||||
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
|
||||
#define ENABLE_BOOT_LED
|
||||
#define BIPORT PORTB
|
||||
#define BIDDR DDRB
|
||||
#define BIPIN PINB
|
||||
#define BIPNUM PINB6
|
||||
#define BIPNUM2 PINB7
|
||||
|
||||
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
#define DISABLE_WDT_AT_STARTUP
|
||||
|
||||
/*
|
||||
* Watchdog-reset is issued at exit
|
||||
* define the timeout-value here (see avr-libc manual)
|
||||
*/
|
||||
#define EXIT_WDT_TIME WDTO_250MS
|
||||
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* SIMPLE-Mode - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>-<2D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
* <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* POWERSAVE-Mode - Startup is separated in two loops
|
||||
* which makes power-saving a little easier if no firmware
|
||||
* is on the chip. Needs more memory
|
||||
* BOOTICE-Mode - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JTAGICE <20><><EFBFBD><EFBFBD><EFBFBD> upgrade.ebn <20> <20><><EFBFBD><EFBFBD>16.
|
||||
* <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20> JTAG <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 7372800
|
||||
* <20> F_CPU <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JTAG ICE
|
||||
* WAIT-mode Bootloader <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
*/
|
||||
//#define START_SIMPLE
|
||||
#define START_WAIT
|
||||
//#define START_POWERSAVE
|
||||
//#define START_BOOTICE
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> START_WAIT */
|
||||
#define START_WAIT_UARTCHAR 'S'
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> START_WAIT mode ( t = WAIT_TIME * 10ms ) */
|
||||
#define WAIT_VALUE 800 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 300*10ms = 3000ms = 3sec */
|
||||
|
||||
/*
|
||||
* enable/disable readout of fuse and lock-bits
|
||||
* (AVRPROG has to detect the AVR correctly by device-code
|
||||
* to show the correct information).
|
||||
*/
|
||||
//#define ENABLEREADFUSELOCK
|
||||
|
||||
/* enable/disable write of lock-bits
|
||||
* WARNING: lock-bits can not be reseted by bootloader (as far as I know)
|
||||
* Only protection no unprotection, "chip erase" from bootloader only
|
||||
* clears the flash but does no real "chip erase" (this is not possible
|
||||
* with a bootloader as far as I know)
|
||||
* Keep this undefined!
|
||||
*/
|
||||
//#define WRITELOCKBITS
|
||||
|
||||
/*
|
||||
* define the following if the bootloader should not output
|
||||
* itself at flash read (will fake an empty boot-section)
|
||||
*/
|
||||
//#define READ_PROTECT_BOOTLOADER
|
||||
|
||||
#define VERSION_HIGH '0'
|
||||
#define VERSION_LOW '8'
|
||||
|
||||
#define GET_LOCK_BITS 0x0001
|
||||
#define GET_LOW_FUSE_BITS 0x0000
|
||||
#define GET_HIGH_FUSE_BITS 0x0003
|
||||
#define GET_EXTENDED_FUSE_BITS 0x0002
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> USART*/
|
||||
#ifdef UART_DOUBLESPEED
|
||||
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 4UL)) / ((uint32_t)(baudRate) * 8UL) - 1)
|
||||
|
||||
#else
|
||||
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 8UL)) / ((uint32_t)(baudRate) * 16UL) - 1)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/boot.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "chipdef.h"
|
||||
|
||||
uint8_t gBuffer[SPM_PAGESIZE];
|
||||
|
||||
#if defined(BOOTLOADERHASNOVECTORS)
|
||||
#warning "This Bootloader does not link interrupt vectors - see makefile"
|
||||
/* make the linker happy - it wants to see __vector_default */
|
||||
// void __vector_default(void) { ; }
|
||||
void __vector_default(void) { ; }
|
||||
#endif
|
||||
|
||||
static void sendchar(uint8_t data)
|
||||
{
|
||||
while (!(UART_STATUS & (1<<UART_TXREADY)));
|
||||
UART_DATA = data;
|
||||
}
|
||||
|
||||
static uint8_t recvchar(void)
|
||||
{
|
||||
while (!(UART_STATUS & (1<<UART_RXREADY)));
|
||||
return UART_DATA;
|
||||
}
|
||||
|
||||
static inline void eraseFlash(void)
|
||||
{
|
||||
// erase only main section (bootloader protection)
|
||||
uint32_t addr = 0;
|
||||
while (APP_END > addr)
|
||||
{
|
||||
boot_page_erase(addr); // Perform page erase
|
||||
boot_spm_busy_wait(); // Wait until the memory is erased.
|
||||
addr += SPM_PAGESIZE;
|
||||
}
|
||||
boot_rww_enable();
|
||||
}
|
||||
|
||||
static inline void recvBuffer(pagebuf_t size)
|
||||
{
|
||||
pagebuf_t cnt;
|
||||
uint8_t *tmp = gBuffer;
|
||||
|
||||
for (cnt = 0; cnt < sizeof(gBuffer); cnt++)
|
||||
{
|
||||
*tmp++ = (cnt < size) ? recvchar() : 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint16_t writeFlashPage(uint16_t waddr, pagebuf_t size)
|
||||
{
|
||||
uint32_t pagestart = (uint32_t)waddr<<1;
|
||||
uint32_t baddr = pagestart;
|
||||
uint16_t data;
|
||||
uint8_t *tmp = gBuffer;
|
||||
|
||||
do
|
||||
{
|
||||
data = *tmp++;
|
||||
data |= *tmp++ << 8;
|
||||
boot_page_fill(baddr, data); // call asm routine.
|
||||
|
||||
baddr += 2; // Select next word in memory
|
||||
size -= 2; // Reduce number of bytes to write by two
|
||||
}
|
||||
while (size); // Loop until all bytes written
|
||||
|
||||
boot_page_write(pagestart);
|
||||
boot_spm_busy_wait();
|
||||
boot_rww_enable(); // Re-enable the RWW section
|
||||
|
||||
return baddr>>1;
|
||||
}
|
||||
|
||||
static inline uint16_t writeEEpromPage(uint16_t address, pagebuf_t size)
|
||||
{
|
||||
uint8_t *tmp = gBuffer;
|
||||
|
||||
do
|
||||
{
|
||||
eeprom_write_byte( (uint8_t*)address, *tmp++ );
|
||||
address++; // Select next byte
|
||||
size--; // Decreas number of bytes to write
|
||||
}
|
||||
while (size); // Loop until all bytes written
|
||||
|
||||
// eeprom_busy_wait();
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
static inline uint16_t readFlashPage(uint16_t waddr, pagebuf_t size)
|
||||
{
|
||||
uint32_t baddr = (uint32_t)waddr<<1;
|
||||
uint16_t data;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
#ifndef READ_PROTECT_BOOTLOADER
|
||||
#warning "Bootloader not read-protected"
|
||||
|
||||
#if defined(RAMPZ)
|
||||
data = pgm_read_word_far(baddr);
|
||||
#else
|
||||
data = pgm_read_word_near(baddr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// don't read bootloader
|
||||
if ( baddr < APP_END )
|
||||
{
|
||||
#if defined(RAMPZ)
|
||||
data = pgm_read_word_far(baddr);
|
||||
#else
|
||||
data = pgm_read_word_near(baddr);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
data = 0xFFFF; // fake empty
|
||||
}
|
||||
#endif
|
||||
sendchar(data); // send LSB
|
||||
sendchar((data >> 8)); // send MSB
|
||||
baddr += 2; // Select next word in memory
|
||||
size -= 2; // Subtract two bytes from number of bytes to read
|
||||
}
|
||||
while (size); // Repeat until block has been read
|
||||
return baddr>>1;
|
||||
}
|
||||
|
||||
static inline uint16_t readEEpromPage(uint16_t address, pagebuf_t size)
|
||||
{
|
||||
do
|
||||
{
|
||||
sendchar( eeprom_read_byte( (uint8_t*)address ) );
|
||||
address++;
|
||||
size--; // Decrease number of bytes to read
|
||||
}
|
||||
while (size); // Repeat until block has been read
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
#if defined(ENABLEREADFUSELOCK)
|
||||
static uint8_t read_fuse_lock(uint16_t addr)
|
||||
{
|
||||
uint8_t mode = (1<<BLBSET) | (1<<SPMEN);
|
||||
uint8_t retval;
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"movw r30, %3\n\t" /* Z to addr */ \
|
||||
"sts %0, %2\n\t" /* set mode in SPM_REG */ \
|
||||
"lpm\n\t" /* load fuse/lock value into r0 */ \
|
||||
"mov %1,r0\n\t" /* save return value */ \
|
||||
: "=m" (SPM_REG),
|
||||
"=r" (retval)
|
||||
: "r" (mode),
|
||||
"r" (addr)
|
||||
: "r30", "r31", "r0"
|
||||
);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void send_boot(void)
|
||||
{
|
||||
sendchar('A');
|
||||
sendchar('V');
|
||||
sendchar('R');
|
||||
sendchar('B');
|
||||
sendchar('O');
|
||||
sendchar('O');
|
||||
sendchar('T');
|
||||
}
|
||||
|
||||
static void (*jump_to_app)(void) = 0x0000;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (MCUCSR & (1<<WDRF)) jump_to_app();
|
||||
MCUCSR = 0;
|
||||
uint16_t address = 0;
|
||||
uint8_t device = 0, val;
|
||||
|
||||
|
||||
|
||||
#ifdef ENABLE_BOOT_LED // LED ON
|
||||
BIPORT |= ((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
BIDDR |= ((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISABLE_WDT_AT_STARTUP
|
||||
#ifdef WDT_OFF_SPECIAL
|
||||
#warning "using target specific watchdog_off"
|
||||
bootloader_wdt_off();
|
||||
#else
|
||||
cli();
|
||||
wdt_reset();
|
||||
wdt_disable();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef START_POWERSAVE
|
||||
uint8_t OK = 1;
|
||||
#endif
|
||||
|
||||
BLDDR &= ~(1<<BLPNUM); // set as Input
|
||||
BLPORT |= (1<<BLPNUM); // Enable pullup
|
||||
|
||||
// Set baud rate
|
||||
UART_BAUD_HIGH = (UART_CALC_BAUDRATE(BAUDRATE)>>8) & 0xFF;
|
||||
UART_BAUD_LOW = (UART_CALC_BAUDRATE(BAUDRATE) & 0xFF);
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
UART_STATUS = ( 1<<UART_DOUBLE );
|
||||
#endif
|
||||
|
||||
UART_CTRL = UART_CTRL_DATA;
|
||||
UART_CTRL2 = UART_CTRL2_DATA;
|
||||
|
||||
#if defined(START_POWERSAVE)
|
||||
/*
|
||||
This is an adoption of the Butterfly Bootloader startup-sequence.
|
||||
It may look a little strange but separating the login-loop from
|
||||
the main parser-loop gives a lot a possibilities (timeout, sleep-modes
|
||||
etc.).
|
||||
*/
|
||||
for(;OK;)
|
||||
{
|
||||
if ((BLPIN & (1<<BLPNUM)))
|
||||
{
|
||||
// jump to main app if pin is not grounded
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
UART_STATUS &= ~( 1<<UART_DOUBLE );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_BOOT_LED // LED OFF
|
||||
BIPORT &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
BIDDR &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
#endif
|
||||
|
||||
jump_to_app(); // Jump to application sector
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
val = recvchar();
|
||||
/* ESC */
|
||||
if (val == 0x1B)
|
||||
{
|
||||
// AVRPROG connection
|
||||
// Wait for signon
|
||||
while (val != 'S')
|
||||
val = recvchar();
|
||||
|
||||
send_boot(); // Report signon
|
||||
OK = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendchar('?');
|
||||
}
|
||||
}
|
||||
// Power-Save code here
|
||||
}
|
||||
|
||||
#elif defined(START_SIMPLE)
|
||||
|
||||
if ((BLPIN & (1<<BLPNUM))) {
|
||||
// jump to main app if pin is not grounded
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
UART_STATUS &= ~( 1<<UART_DOUBLE );
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_BOOT_LED // LED OFF
|
||||
BIPORT &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
BIDDR &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
#endif
|
||||
|
||||
jump_to_app(); // Jump to application sector
|
||||
}
|
||||
|
||||
#elif defined(START_WAIT)
|
||||
|
||||
uint16_t cnt = 0;
|
||||
|
||||
while (1) {
|
||||
if (UART_STATUS & (1<<UART_RXREADY))
|
||||
if (UART_DATA == START_WAIT_UARTCHAR)
|
||||
break;
|
||||
|
||||
if (cnt++ >= WAIT_VALUE) {
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
|
||||
|
||||
#ifdef ENABLE_BOOT_LED // LED OFF
|
||||
BIPORT &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
BIDDR &= ~((1<<BIPNUM)|(1<<BIPNUM2));
|
||||
#endif
|
||||
jump_to_app(); // Jump to application sector
|
||||
}
|
||||
|
||||
_delay_ms(10);
|
||||
}
|
||||
send_boot();
|
||||
|
||||
#elif defined(START_BOOTICE)
|
||||
#warning "BOOTICE mode - no startup-condition"
|
||||
|
||||
#else
|
||||
#error "Select START_ condition for bootloader in main.c"
|
||||
#endif
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
val = recvchar();
|
||||
// Autoincrement?
|
||||
if (val == 'a')
|
||||
{
|
||||
sendchar('Y'); // Autoincrement is quicker
|
||||
|
||||
//write address
|
||||
}
|
||||
else if (val == 'A')
|
||||
{
|
||||
address = recvchar(); //read address 8 MSB
|
||||
address = (address<<8) | recvchar();
|
||||
sendchar('\r');
|
||||
|
||||
// Buffer load support
|
||||
}
|
||||
else if (val == 'b')
|
||||
{
|
||||
sendchar('Y'); // Report buffer load supported
|
||||
sendchar((sizeof(gBuffer) >> 8) & 0xFF); // Report buffer size in bytes
|
||||
sendchar(sizeof(gBuffer) & 0xFF);
|
||||
|
||||
// Start buffer load
|
||||
}
|
||||
else if (val == 'B')
|
||||
{
|
||||
pagebuf_t size;
|
||||
size = recvchar() << 8; // Load high byte of buffersize
|
||||
size |= recvchar(); // Load low byte of buffersize
|
||||
val = recvchar(); // Load memory type ('E' or 'F')
|
||||
recvBuffer(size);
|
||||
|
||||
if (device == DEVTYPE)
|
||||
{
|
||||
if (val == 'F')
|
||||
{
|
||||
address = writeFlashPage(address, size);
|
||||
}
|
||||
else if (val == 'E')
|
||||
{
|
||||
address = writeEEpromPage(address, size);
|
||||
}
|
||||
sendchar('\r');
|
||||
}
|
||||
else
|
||||
{
|
||||
sendchar(0);
|
||||
}
|
||||
|
||||
// Block read
|
||||
}
|
||||
else if (val == 'g')
|
||||
{
|
||||
pagebuf_t size;
|
||||
size = recvchar() << 8; // Load high byte of buffersize
|
||||
size |= recvchar(); // Load low byte of buffersize
|
||||
val = recvchar(); // Get memtype
|
||||
|
||||
if (val == 'F')
|
||||
{
|
||||
address = readFlashPage(address, size);
|
||||
}
|
||||
else if (val == 'E')
|
||||
{
|
||||
address = readEEpromPage(address, size);
|
||||
}
|
||||
|
||||
// Chip erase
|
||||
}
|
||||
else if (val == 'e')
|
||||
{
|
||||
if (device == DEVTYPE)
|
||||
{
|
||||
eraseFlash();
|
||||
}
|
||||
sendchar('\r');
|
||||
|
||||
// Exit upgrade
|
||||
}
|
||||
else if (val == 'E')
|
||||
{
|
||||
wdt_enable(EXIT_WDT_TIME); // Enable Watchdog Timer to give reset
|
||||
sendchar('\r');
|
||||
|
||||
#ifdef WRITELOCKBITS
|
||||
#warning "Extension 'WriteLockBits' enabled"
|
||||
// TODO: does not work reliably
|
||||
// write lockbits
|
||||
}
|
||||
else if (val == 'l')
|
||||
{
|
||||
if (device == DEVTYPE)
|
||||
{
|
||||
// write_lock_bits(recvchar());
|
||||
boot_lock_bits_set(recvchar()); // boot.h takes care of mask
|
||||
boot_spm_busy_wait();
|
||||
}
|
||||
sendchar('\r');
|
||||
#endif
|
||||
// Enter programming mode
|
||||
}
|
||||
else if (val == 'P')
|
||||
{
|
||||
sendchar('\r');
|
||||
|
||||
// Leave programming mode
|
||||
}
|
||||
else if (val == 'L')
|
||||
{
|
||||
sendchar('\r');
|
||||
// return programmer type
|
||||
}
|
||||
else if (val == 'p')
|
||||
{
|
||||
sendchar('S'); // always serial programmer
|
||||
|
||||
#ifdef ENABLEREADFUSELOCK
|
||||
#warning "Extension 'ReadFuseLock' enabled"
|
||||
// read "low" fuse bits
|
||||
}
|
||||
else if (val == 'F')
|
||||
{
|
||||
sendchar(read_fuse_lock(GET_LOW_FUSE_BITS));
|
||||
|
||||
// read lock bits
|
||||
}
|
||||
else if (val == 'r')
|
||||
{
|
||||
sendchar(read_fuse_lock(GET_LOCK_BITS));
|
||||
|
||||
// read high fuse bits
|
||||
}
|
||||
else if (val == 'N')
|
||||
{
|
||||
sendchar(read_fuse_lock(GET_HIGH_FUSE_BITS));
|
||||
// read extended fuse bits
|
||||
}
|
||||
else if (val == 'Q')
|
||||
{
|
||||
sendchar(read_fuse_lock(GET_EXTENDED_FUSE_BITS));
|
||||
#endif
|
||||
|
||||
// Return device type
|
||||
}
|
||||
else if (val == 't')
|
||||
{
|
||||
sendchar(DEVTYPE);
|
||||
sendchar(0);
|
||||
// clear and set LED ignored
|
||||
}
|
||||
else if ((val == 'x') || (val == 'y'))
|
||||
{
|
||||
recvchar();
|
||||
sendchar('\r');
|
||||
|
||||
// set device
|
||||
}
|
||||
else if (val == 'T')
|
||||
{
|
||||
device = recvchar();
|
||||
sendchar('\r');
|
||||
// Return software identifier
|
||||
}
|
||||
else if (val == 'S')
|
||||
{
|
||||
send_boot();
|
||||
|
||||
// Return Software Version
|
||||
}
|
||||
else if (val == 'V') {
|
||||
sendchar(VERSION_HIGH);
|
||||
sendchar(VERSION_LOW);
|
||||
|
||||
// Return Signature Bytes (it seems that
|
||||
// AVRProg expects the "Atmel-byte" 0x1E last
|
||||
// but shows it first in the dialog-window)
|
||||
}
|
||||
else if (val == 's')
|
||||
{
|
||||
sendchar(SIG_BYTE3);
|
||||
sendchar(SIG_BYTE2);
|
||||
sendchar(SIG_BYTE1);
|
||||
|
||||
/* ESC */
|
||||
}
|
||||
else if(val != 0x1b)
|
||||
{
|
||||
sendchar('?');
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
70
bootloader/main.hex
Normal file
70
bootloader/main.hex
Normal file
@ -0,0 +1,70 @@
|
||||
:10F8000011241FBECFEFD0E1DEBFCDBF12E0A0E0DC
|
||||
:10F81000B1E001C01D92A030B107E1F70E94327C37
|
||||
:10F820000C941E7E0C94147C08955D9BFECF81E4A5
|
||||
:10F830008CB95D9BFECF86E58CB95D9BFECF82E5E2
|
||||
:10F840008CB95D9BFECF82E48CB95D9BFECF8FE4CB
|
||||
:10F850008CB95D9BFECF8FE48CB95D9BFECF84E5B8
|
||||
:10F860008CB908952F923F924F925F926F927F9240
|
||||
:10F870008F929F92AF92BF92CF92DF92EF92FF92C0
|
||||
:10F880000F931F93DF93CF9300D00F92CDB7DEB7C6
|
||||
:10F8900004B603FE03C0E0E0F0E0099514BE88B3AF
|
||||
:10F8A000806C88BB87B3806C87BBF894A89598E17F
|
||||
:10F8B0000FB6F89491BD11BC0FBE8F98979A109215
|
||||
:10F8C000900089E189B99AB986E080939500CC24AB
|
||||
:10F8D000DD24EE24FF2400E21EE45F9B03C08CB114
|
||||
:10F8E0008335A9F020E2C21623E0D20648F09798AB
|
||||
:10F8F00088B38F7388BB87B38F7387BBF701099574
|
||||
:10F900000894C11CD11CC8010197F1F7E6CF0E94F1
|
||||
:10F91000157C1982AA24BB245F9BFECF9CB1913633
|
||||
:10F9200021F45D9BFECF39E5A2C0913479F45F9B51
|
||||
:10F93000FECF9CB15F9BFECF8CB15D9BFECF392E7D
|
||||
:10F940002224A82EBB24A228B3280EC1923659F433
|
||||
:10F950005D9BFECF89E58CB95D9BFECF91E09CB9A4
|
||||
:10F960005D9BFECF19C1923409F086C05F9BFECF2C
|
||||
:10F970009CB15F9BFECF8CB1592E4424C82EDD2450
|
||||
:10F98000C428D5285F9BFECF3CB180E090E0E0E04A
|
||||
:10F99000F1E08C159D0510F02FEF03C05F9BFECFAB
|
||||
:10F9A0002CB12083019621E08030920711F031962E
|
||||
:10F9B000F0CF6981663409F05CC0363409F039C093
|
||||
:10F9C000750100E010E0EE0CFF1C001F111FA801E4
|
||||
:10F9D0009701A0E0B1E08C9190E011969C90119776
|
||||
:10F9E000882488299929129661E0F9010C01609315
|
||||
:10F9F0006800E89511242E5F3F4F4F4F5F4F8EEF09
|
||||
:10FA00009FEFC80ED91EC114D10429F765E0F70194
|
||||
:10FA100060936800E8958091680080FDFCCF81E1EB
|
||||
:10FA200080936800E8955695479537952795590135
|
||||
:10FA30001BC03534C9F4DB82CA82850140E0E42E64
|
||||
:10FA400041E0F42EF70161917F01C8010E94117E0F
|
||||
:10FA50000F5F1F4F2A813B81215030403B832A8317
|
||||
:10FA6000232B81F7AC0CBD1C5D9BFECF3DE03CB968
|
||||
:10FA700053CF5D9BFECF90C0973609F047C05F9B88
|
||||
:10FA8000FECF9CB15F9BFECF8CB1792E6624C82E31
|
||||
:10FA9000DD24C628D7285F9BFECF8CB1863401F5C4
|
||||
:10FAA000C501A0E0B0E0880F991FAA1FBB1FFC0191
|
||||
:10FAB000259134915D9BFECF2CB95D9BFECF3CB967
|
||||
:10FAC0000296A11DB11DEEEFFFEFCE0EDF1EC11499
|
||||
:10FAD000D10469F7B695A795979587955C011CCFDA
|
||||
:10FAE000853409F019CF76018501C8010E94097E8D
|
||||
:10FAF0005D9BFECF8CB90F5F1F4F0894E108F108A2
|
||||
:10FB0000E114F10491F7AC0CBD1C06CF9536D1F48D
|
||||
:10FB1000F981F634A1F4E0E0F0E023E020936800FE
|
||||
:10FB2000E8958091680080FDFCCFE050FF4F38EFF2
|
||||
:10FB3000E030F30791F761E160936800E8955D9B21
|
||||
:10FB4000FECF19C0953461F4E8E1F0E02CE00FB687
|
||||
:10FB5000F894A895E1BD0FBE21BD5D9BFECF86CF79
|
||||
:10FB6000903529F45D9BFECF6DE06CB9D5CE9C3409
|
||||
:10FB700021F45D9BFECF8DE033C0903729F45D9B6F
|
||||
:10FB8000FECF93E59CB9C8CE943741F45D9BFECF80
|
||||
:10FB9000E6E4ECB95D9BFECF1CB8BECE892F88573A
|
||||
:10FBA000823038F45F9BFECF8CB15D9BFECFFDE0D1
|
||||
:10FBB00026C0943539F45F9BFECF2CB129835D9B21
|
||||
:10FBC000FECF54CF933519F40E94157CA5CE9635FF
|
||||
:10FBD00049F45D9BFECF60E36CB95D9BFECF88E38B
|
||||
:10FBE0008CB99ACE933769F45D9BFECF92E09CB9B5
|
||||
:10FBF0005D9BFECFE6E9ECB95D9BFECFFEE1FCB973
|
||||
:10FC00008BCE9B3109F488CE5D9BFECF2FE32CB9C0
|
||||
:10FC100083CEE199FECF9FBB8EBBE09A99278DB32F
|
||||
:10FC20000895262FE199FECF9FBB8EBB2DBB0FB64B
|
||||
:10FC3000F894E29AE19A0FBE01960895F894FFCFE6
|
||||
:040000030000F80001
|
||||
:00000001FF
|
679
bootloader/makefile
Normal file
679
bootloader/makefile
Normal file
@ -0,0 +1,679 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# Makefile for the AVRProg-compatible Bootloader
|
||||
#
|
||||
# based on the
|
||||
# WinAVR Sample makefile written by Eric B. Weddington, J<>rg Wunsch, et al.
|
||||
# Released to the Public Domain
|
||||
# Please read the make user manual!
|
||||
#
|
||||
# Additional material for this makefile was submitted by:
|
||||
# Tim Henigan
|
||||
# Peter Fleury
|
||||
# Reiner Patommel
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Markus Pfaff
|
||||
#
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB).
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio
|
||||
# 4.07 or greater).
|
||||
#
|
||||
# make program = Download the hex file to the device, using avrdude. Please
|
||||
# customize the avrdude settings below first!
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#
|
||||
|
||||
# user defined values
|
||||
|
||||
# MCU name
|
||||
F_CPU = 8000000UL
|
||||
BAUDRATE = 19200
|
||||
MCU = atmega64
|
||||
LFUSE = E4
|
||||
HFUSE = DC
|
||||
EFUSE = FF
|
||||
MCU_PROGRAMMER = m64
|
||||
PROGRAMMER_TYPE = avrisp2
|
||||
PROGRAMMER_PORT = usb
|
||||
|
||||
## MCU = atmega162
|
||||
## MCU = atmega169
|
||||
## MCU = atmega32
|
||||
## MCU = atmega324p
|
||||
## MCU = atmega64
|
||||
## MCU = atmega644
|
||||
## MCU = atmega644p
|
||||
## MCU = atmega128
|
||||
## MCU = at90can128
|
||||
|
||||
################## BOOTLOADER ######################
|
||||
# mt: Boot loader support. So far not done with a separate section
|
||||
# to get the interrupt vector into the bootloader area (for BOOTINTVEC=yes).
|
||||
# Bootloader address in datasheet and stk500 is given as
|
||||
# "word", gcc toolchain needs "byte"-address
|
||||
# (see LDFLAGS further down)
|
||||
|
||||
#/* Select Boot Size in Words (select one, comment out the others) */
|
||||
## NO! BOOTSIZE=128
|
||||
## NO! BOOTSIZE=256
|
||||
# BOOTSIZE=512
|
||||
BOOTSIZE=1024
|
||||
## BOOTSIZE=2048
|
||||
|
||||
# /* Select if bootloader should include the inverrupt-vectors
|
||||
# when selecting 'no' here, the bootloader must not use
|
||||
# any interrupts and the modified linker-scripts are used. */
|
||||
##BOOTINTVEC=yes
|
||||
BOOTINTVEC=no
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega8)
|
||||
BFD_MACH=avr4
|
||||
ifeq ($(BOOTSIZE), 128)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1F00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1800
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega16)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 128)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3F00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3800
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega162)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 128)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3F00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3800
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega169)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 128)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3F00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x3800
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega32)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega324p)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 256)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7E00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7C00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0x7000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega64)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0xFC00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF000
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 4096)
|
||||
MT_BOOTLOADER_ADDRESS = 0xE000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega644)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0xFC00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF000
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 4096)
|
||||
MT_BOOTLOADER_ADDRESS = 0xE000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega644p)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0xFC00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0xF000
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 4096)
|
||||
MT_BOOTLOADER_ADDRESS = 0xE000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), atmega128)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1FC00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1F800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1F000
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 4096)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1E000
|
||||
endif
|
||||
endif
|
||||
|
||||
##
|
||||
ifeq ($(MCU), at90can128)
|
||||
BFD_MACH=avr5
|
||||
ifeq ($(BOOTSIZE), 512)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1FC00
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 1024)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1F800
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 2048)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1F000
|
||||
endif
|
||||
ifeq ($(BOOTSIZE), 4096)
|
||||
MT_BOOTLOADER_ADDRESS = 0x1E000
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
#FORMAT = srec
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = main
|
||||
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c
|
||||
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
OPT = s
|
||||
|
||||
# Debugging format.
|
||||
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
||||
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
||||
DEBUG = stabs
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
EXTRAINCDIRS =
|
||||
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 - "ANSI" C
|
||||
# gnu89 - c89 plus GCC extensions
|
||||
# c99 - ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 - c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
# Place -D or -U options here
|
||||
CDEFS = -DBOOTSIZE=$(BOOTSIZE)
|
||||
|
||||
# Place -I options here
|
||||
CINCS =
|
||||
|
||||
|
||||
# Compiler flags.
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS) $(CINCS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||
CFLAGS += -Wall -Wstrict-prototypes
|
||||
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
|
||||
|
||||
# Assembler flags.
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -ahlms: create listing
|
||||
# -gstabs: have the assembler create line number information; note that
|
||||
# for use in COFF files, additional information about filenames
|
||||
# and function names needs to be present in the assembler source
|
||||
# files -- see avr-libc docs [FIXME: not yet described there]
|
||||
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||
|
||||
|
||||
|
||||
#Additional libraries.
|
||||
|
||||
# Minimalistic printf version
|
||||
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
|
||||
|
||||
# Floating point printf version (requires MATH_LIB = -lm below)
|
||||
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
|
||||
|
||||
PRINTF_LIB =
|
||||
|
||||
# Minimalistic scanf version
|
||||
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
|
||||
|
||||
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
|
||||
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
|
||||
|
||||
SCANF_LIB =
|
||||
|
||||
MATH_LIB = -lm
|
||||
|
||||
# External memory options
|
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
||||
# used for variables (.data/.bss) and heap (malloc()).
|
||||
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
|
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
||||
# only used for heap (malloc()).
|
||||
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
|
||||
|
||||
EXTMEMOPTS =
|
||||
|
||||
# Linker flags.
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||
LDFLAGS += $(EXTMEMOPTS)
|
||||
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
|
||||
|
||||
################## BOOTLOADER ######################
|
||||
# MT_BOOTLOADER_ADDRESS (=Start of Boot Loader section
|
||||
# in bytes - not words) as defined above.
|
||||
LDFLAGS += -Wl,--section-start=.text=$(MT_BOOTLOADER_ADDRESS)
|
||||
|
||||
# check if linker-scripts without interrupt-vectors should
|
||||
# be used and set linker-option, announce to C-code by define
|
||||
ifeq ($(BOOTINTVEC), no)
|
||||
LDFLAGS += -T./ldscripts_no_vector/$(BFD_MACH).x
|
||||
CFLAGS += -DBOOTLOADERHASNOVECTORS
|
||||
endif
|
||||
|
||||
|
||||
# Programming support using avrdude. Settings and variables.
|
||||
|
||||
# Programming hardware: alf avr910 avrisp bascom bsd
|
||||
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
|
||||
#
|
||||
# Type: avrdude -c ?
|
||||
# to get a full listing.
|
||||
#
|
||||
AVRDUDE_PROGRAMMER = stk500v2
|
||||
|
||||
# com1 = serial port. Use lpt1 to connect to parallel port.
|
||||
AVRDUDE_PORT = com1 # programmer connected to serial device
|
||||
#AVRDUDE_PORT = /dev/ttyS0 # programmer connected to serial device
|
||||
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
||||
|
||||
|
||||
# Uncomment the following if you want avrdude's erase cycle counter.
|
||||
# Note that this counter needs to be initialized first using -Yn,
|
||||
# see avrdude manual.
|
||||
#AVRDUDE_ERASE_COUNTER = -y
|
||||
|
||||
# Uncomment the following if you do /not/ wish a verification to be
|
||||
# performed after programming the device.
|
||||
#AVRDUDE_NO_VERIFY = -V
|
||||
|
||||
# Increase verbosity level. Please use this when submitting bug
|
||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
|
||||
# to submit bug reports.
|
||||
#AVRDUDE_VERBOSE = -v -v
|
||||
|
||||
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
||||
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Define directories, if needed.
|
||||
#DIRAVR = c:/winavr
|
||||
#DIRAVRBIN = $(DIRAVR)/bin
|
||||
#DIRAVRUTILS = $(DIRAVR)/utils/bin
|
||||
#DIRINC = .
|
||||
#DIRLIB = $(DIRAVR)/avr/lib
|
||||
|
||||
|
||||
# Define programs and commands.
|
||||
#SHELL = $(DIRAVRUTILS)/sh
|
||||
#NM = $(DIRAVRBIN)/avr-nm
|
||||
#CC = $(DIRAVRBIN)/avr-gcc
|
||||
#OBJCOPY = $(DIRAVRBIN)/avr-objcopy
|
||||
#OBJDUMP= $(DIRAVRBIN)/avr-objdump
|
||||
#SIZE = $(DIRAVRBIN)/avr-size
|
||||
#AVRDUDE = $(DIRAVRBIN)/avrdude.sh
|
||||
#REMOVE = rm -f
|
||||
#COPY = cp
|
||||
|
||||
# Define programs and commands.
|
||||
SHELL = sh
|
||||
CC = avr-gcc
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
SIZE = avr-size
|
||||
NM = avr-nm
|
||||
AVRDUDE = avrdude
|
||||
REMOVE = rm -f
|
||||
COPY = cp
|
||||
WINSHELL = cmd
|
||||
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_ERRORS_NONE = Errors: none
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_COFF = Converting to AVR COFF:
|
||||
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
|
||||
|
||||
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build sizeafter finished end
|
||||
|
||||
build: elf hex eep lss sym
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
finished:
|
||||
@echo $(MSG_ERRORS_NONE)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) -x -A $(TARGET).elf
|
||||
sizebefore:
|
||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||
|
||||
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion :
|
||||
@$(CC) --version
|
||||
|
||||
|
||||
|
||||
# Program the device.
|
||||
program: $(TARGET).hex $(TARGET).eep
|
||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||
|
||||
|
||||
|
||||
|
||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
||||
COFFCONVERT=$(OBJCOPY) --debugging \
|
||||
--change-section-address .data-0x800000 \
|
||||
--change-section-address .bss-0x800000 \
|
||||
--change-section-address .noinit-0x800000 \
|
||||
--change-section-address .eeprom-0x810000
|
||||
|
||||
|
||||
coff: $(TARGET).elf
|
||||
@echo
|
||||
@echo $(MSG_COFF) $(TARGET).cof
|
||||
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
|
||||
|
||||
|
||||
extcoff: $(TARGET).elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
|
||||
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
|
||||
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list finished end
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).hex
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).a90
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lnk
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(OBJ)
|
||||
$(REMOVE) $(LST)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) .dep/*
|
||||
|
||||
|
||||
|
||||
# Include the dependency files.
|
||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
build elf hex eep lss sym coff extcoff \
|
||||
clean clean_list program
|
||||
|
||||
program: hex
|
||||
avrdude -V -p $(MCU_PROGRAMMER) -c $(PROGRAMMER_TYPE) -P $(PROGRAMMER_PORT) -U flash:w:main.hex -U lfuse:w:0x$(LFUSE):m -U hfuse:w:0x$(HFUSE):m -U efuse:w:0x$(EFUSE):m
|
39
bootloader/mega128.h
Normal file
39
bootloader/mega128.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _MEGA128_H_
|
||||
#define _MEGA128_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x43
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x44
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x97
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
#else
|
||||
#define UART_BAUD_HIGH UBRR1H
|
||||
#define UART_BAUD_LOW UBRR1L
|
||||
#define UART_STATUS UCSR1A
|
||||
#define UART_TXREADY UDRE1
|
||||
#define UART_RXREADY RXC1
|
||||
#define UART_DOUBLE U2X1
|
||||
#define UART_CTRL UCSR1B
|
||||
#define UART_CTRL_DATA ((1<<TXEN1) | (1<<RXEN1))
|
||||
#define UART_CTRL2 UCSR1C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ11) | (1<<UCSZ10))
|
||||
#define UART_DATA UDR1
|
||||
#endif
|
||||
|
||||
#endif // #ifndef _MEGA128_H_
|
42
bootloader/mega128can.h
Normal file
42
bootloader/mega128can.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef _MEGA128CAN_H_
|
||||
#define _MEGA128CAN_H_
|
||||
|
||||
/* Dummy: use ATmega128 device-code for now,
|
||||
must be same as used in avrdude.conf */
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x43
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x44
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x97
|
||||
#define SIG_BYTE3 0x81
|
||||
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
#else
|
||||
#define UART_BAUD_HIGH UBRR1H
|
||||
#define UART_BAUD_LOW UBRR1L
|
||||
#define UART_STATUS UCSR1A
|
||||
#define UART_TXREADY UDRE1
|
||||
#define UART_RXREADY RXC1
|
||||
#define UART_DOUBLE U2X1
|
||||
#define UART_CTRL UCSR1B
|
||||
#define UART_CTRL_DATA ((1<<TXEN1) | (1<<RXEN1))
|
||||
#define UART_CTRL2 UCSR1C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ11) | (1<<UCSZ10))
|
||||
#define UART_DATA UDR1
|
||||
#endif
|
||||
|
||||
#endif // #ifndef _MEGA128CAN_H_
|
25
bootloader/mega16.h
Normal file
25
bootloader/mega16.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _MEGA16_H_
|
||||
#define _MEGA16_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x74
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x75
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE3 0x03
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
#define UART_TXREADY UDRE
|
||||
#define UART_RXREADY RXC
|
||||
#define UART_DOUBLE U2X
|
||||
#define UART_CTRL UCSRB
|
||||
#define UART_CTRL_DATA ((1<<TXEN) | (1<<RXEN))
|
||||
#define UART_CTRL2 UCSRC
|
||||
#define UART_CTRL2_DATA ((1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0))
|
||||
#define UART_DATA UDR
|
||||
|
||||
#endif // #ifndef _MEGA16_H_
|
45
bootloader/mega162.h
Normal file
45
bootloader/mega162.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef _MEGA162_H_
|
||||
#define _MEGA162_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
// documented code (AVR109 AppNote) but not supported by AVRProg 1.40
|
||||
// #define DEVTYPE_ISP 0x62
|
||||
// fake ATmega16 instead:
|
||||
#define DEVTYPE_ISP 0x74
|
||||
/* Part-Code Boot */
|
||||
// documented code but not supported by AVRProg 1.40
|
||||
// #define DEVTYPE_BOOT 0x63
|
||||
// fake ATmega16:
|
||||
#define DEVTYPE_BOOT 0x75
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE3 0x04
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ((1<<URSEL0) | (1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
#else
|
||||
#define UART_BAUD_HIGH UBRR1H
|
||||
#define UART_BAUD_LOW UBRR1L
|
||||
#define UART_STATUS UCSR1A
|
||||
#define UART_TXREADY UDRE1
|
||||
#define UART_RXREADY RXC1
|
||||
#define UART_DOUBLE U2X1
|
||||
#define UART_CTRL UCSR1B
|
||||
#define UART_CTRL_DATA ((1<<TXEN1) | (1<<RXEN1))
|
||||
#define UART_CTRL2 UCSR1C
|
||||
#define UART_CTRL2_DATA ( (1<<URSEL1) | (1<<UCSZ11) | (1<<UCSZ10))
|
||||
#define UART_DATA UDR1
|
||||
#endif
|
||||
|
||||
#endif // #ifndef _MEGA162_H_
|
23
bootloader/mega169.h
Normal file
23
bootloader/mega169.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef _MEGA169_H_
|
||||
#define _MEGA169_H_
|
||||
|
||||
#define DEVTYPE_ISP 0x78
|
||||
#define DEVTYPE_BOOT 0x79
|
||||
|
||||
#define SIG_BYTE3 0x1E
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE1 0x05
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
#define UART_TXREADY UDRE
|
||||
#define UART_RXREADY RXC
|
||||
#define UART_DOUBLE U2X
|
||||
#define UART_CTRL UCSRB
|
||||
#define UART_CTRL_DATA ((1<<TXEN) | (1<<RXEN))
|
||||
#define UART_CTRL2 UCSRC
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ1) | (1<<UCSZ0))
|
||||
#define UART_DATA UDR
|
||||
|
||||
#endif // #ifndef _MEGA169_H_
|
25
bootloader/mega32.h
Normal file
25
bootloader/mega32.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _MEGA32_H_
|
||||
#define _MEGA32_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x72
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x73
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x95
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
#define UART_TXREADY UDRE
|
||||
#define UART_RXREADY RXC
|
||||
#define UART_DOUBLE U2X
|
||||
#define UART_CTRL UCSRB
|
||||
#define UART_CTRL_DATA ((1<<TXEN) | (1<<RXEN))
|
||||
#define UART_CTRL2 UCSRC
|
||||
#define UART_CTRL2_DATA ((1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0))
|
||||
#define UART_DATA UDR
|
||||
|
||||
#endif // #ifndef _MEGA32_H_
|
17
bootloader/mega324p.h
Normal file
17
bootloader/mega324p.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef _MEGA324P_H_
|
||||
#define _MEGA324P_H_
|
||||
|
||||
/* I (M. Thomas) could not find an official Boot-ID
|
||||
for the ATmega324P so pretend it's an ATmega32 */
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x72
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x73
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x95
|
||||
#define SIG_BYTE3 0x08
|
||||
|
||||
#include "megaxx4p.h"
|
||||
|
||||
#endif // #ifndef _MEGA324P_H_
|
39
bootloader/mega64.h
Normal file
39
bootloader/mega64.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _MEGA64_H_
|
||||
#define _MEGA64_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x45
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x46
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x96
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
#else
|
||||
#define UART_BAUD_HIGH UBRR1H
|
||||
#define UART_BAUD_LOW UBRR1L
|
||||
#define UART_STATUS UCSR1A
|
||||
#define UART_TXREADY UDRE1
|
||||
#define UART_RXREADY RXC1
|
||||
#define UART_DOUBLE U2X1
|
||||
#define UART_CTRL UCSR1B
|
||||
#define UART_CTRL_DATA ((1<<TXEN1) | (1<<RXEN1))
|
||||
#define UART_CTRL2 UCSR1C
|
||||
#define UART_CTRL2_DATA ((1<<UCSZ11) | (1<<UCSZ10))
|
||||
#define UART_DATA UDR1
|
||||
#endif
|
||||
|
||||
#endif // #ifndef _MEGA64_H_
|
42
bootloader/mega644.h
Normal file
42
bootloader/mega644.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef _MEGA644_H_
|
||||
#define _MEGA644_H_
|
||||
|
||||
/* I (M. Thomas) could not find an official Boot-ID
|
||||
for the ATmega644 so pretend it's an ATmega64 */
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x45
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x46
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x96
|
||||
#define SIG_BYTE3 0x09
|
||||
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ( (1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
|
||||
#define WDT_OFF_SPECIAL
|
||||
static inline void bootloader_wdt_off(void)
|
||||
{
|
||||
cli();
|
||||
wdt_reset();
|
||||
/* Clear WDRF in MCUSR */
|
||||
MCUSR &= ~(1<<WDRF);
|
||||
/* Write logical one to WDCE and WDE */
|
||||
/* Keep old prescaler setting to prevent unintentional time-out */
|
||||
WDTCSR |= (1<<WDCE) | (1<<WDE);
|
||||
/* Turn off WDT */
|
||||
WDTCSR = 0x00;
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifndef _MEGA644_H_
|
17
bootloader/mega644p.h
Normal file
17
bootloader/mega644p.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef _MEGA644P_H_
|
||||
#define _MEGA644P_H_
|
||||
|
||||
/* I (M. Thomas) could not find an official Boot-ID
|
||||
for the ATmega644P so pretend it's an ATmega64 */
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x45
|
||||
/* Part-Code Boot */
|
||||
#define DEVTYPE_BOOT 0x46
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x96
|
||||
#define SIG_BYTE3 0x0A
|
||||
|
||||
#include "megaxx4p.h"
|
||||
|
||||
#endif // #ifndef _MEGA644P_H_
|
25
bootloader/mega8.h
Normal file
25
bootloader/mega8.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _MEGA8_H_
|
||||
#define _MEGA8_H_
|
||||
|
||||
/* Part-Code ISP */
|
||||
#define DEVTYPE_ISP 0x76
|
||||
/* Part-Code BOOT */
|
||||
#define DEVTYPE_BOOT 0x77
|
||||
|
||||
#define SIG_BYTE1 0x1E
|
||||
#define SIG_BYTE2 0x93
|
||||
#define SIG_BYTE3 0x07
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
#define UART_TXREADY UDRE
|
||||
#define UART_RXREADY RXC
|
||||
#define UART_DOUBLE U2X
|
||||
#define UART_CTRL UCSRB
|
||||
#define UART_CTRL_DATA ((1<<TXEN) | (1<<RXEN))
|
||||
#define UART_CTRL2 UCSRC
|
||||
#define UART_CTRL2_DATA ((1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0))
|
||||
#define UART_DATA UDR
|
||||
|
||||
#endif // #ifndef _MEGA8_H_
|
47
bootloader/megaxx4p.h
Normal file
47
bootloader/megaxx4p.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef _MEGAxx4_H_
|
||||
#define _MEGAxx4_H_
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
/* UART 0 */
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
#define UART_TXREADY UDRE0
|
||||
#define UART_RXREADY RXC0
|
||||
#define UART_DOUBLE U2X0
|
||||
#define UART_CTRL UCSR0B
|
||||
#define UART_CTRL_DATA ((1<<TXEN0) | (1<<RXEN0))
|
||||
#define UART_CTRL2 UCSR0C
|
||||
#define UART_CTRL2_DATA ( (1<<UCSZ01) | (1<<UCSZ00))
|
||||
#define UART_DATA UDR0
|
||||
#else
|
||||
/* UART 1 */
|
||||
#define UART_BAUD_HIGH UBRR1H
|
||||
#define UART_BAUD_LOW UBRR1L
|
||||
#define UART_STATUS UCSR1A
|
||||
#define UART_TXREADY UDRE1
|
||||
#define UART_RXREADY RXC1
|
||||
#define UART_DOUBLE U2X1
|
||||
#define UART_CTRL UCSR1B
|
||||
#define UART_CTRL_DATA ((1<<TXEN1) | (1<<RXEN1))
|
||||
#define UART_CTRL2 UCSR1C
|
||||
#define UART_CTRL2_DATA ( (1<<UCSZ11) | (1<<UCSZ10))
|
||||
#define UART_DATA UDR1
|
||||
#endif
|
||||
|
||||
#define WDT_OFF_SPECIAL
|
||||
|
||||
static inline void bootloader_wdt_off(void)
|
||||
{
|
||||
cli();
|
||||
wdt_reset();
|
||||
/* Clear WDRF in MCUSR */
|
||||
MCUSR &= ~(1<<WDRF);
|
||||
/* Write logical one to WDCE and WDE */
|
||||
/* Keep old prescaler setting to prevent unintentional time-out */
|
||||
WDTCSR |= (1<<WDCE) | (1<<WDE);
|
||||
/* Turn off WDT */
|
||||
WDTCSR = 0x00;
|
||||
}
|
||||
|
||||
#endif // #ifndef _MEGA644_H_
|
267
bootloader/readme.txt
Normal file
267
bootloader/readme.txt
Normal file
@ -0,0 +1,267 @@
|
||||
|
||||
======================================================
|
||||
|
||||
ATMEL AVR UART Bootloader for AVR-GCC/avr-libc
|
||||
|
||||
by Martin Thomas, Kaiserslautern, Germany
|
||||
mthomas@rhrk.uni-kl.de
|
||||
eversmith@heizung-thomas.de
|
||||
http://www.siwawi.arubi.uni-kl.de/avr_projects
|
||||
|
||||
** Addtional code and improvements contributed **
|
||||
** by Uwe Bonnes, Bjoern Riemer and Olaf Rempel. **
|
||||
|
||||
Eearly versions of this bootloader-code have been
|
||||
based on the AVR Butterfly bootloader-source REV02
|
||||
which has been available from atmel.com.
|
||||
|
||||
======================================================
|
||||
|
||||
|
||||
Programming-Software (on the "PC-Side"):
|
||||
|
||||
* AVRProg (included in AVRStudio) available at www.atmel.com.
|
||||
MS-Windows only. AVRProg can be used as stand-alone application.
|
||||
(avrprog.exe)
|
||||
|
||||
* avrdude available at http://savannah.nongnu.org/projects/avrdude/
|
||||
"Multiplattform"
|
||||
|
||||
* Installation instructions at the end of this file.
|
||||
|
||||
|
||||
3. Dec. 2008 - Version 0.85
|
||||
|
||||
* disable U2X before jump to app as suggested be Alexander D<>ller
|
||||
* moved UBRR-macros to main.c and changed them. Inspired by code from avr-libc setbaud.
|
||||
(macros which are commented out (//) are from Pavel Fertser)
|
||||
|
||||
6. Nov. 2008 - Version 0.84
|
||||
|
||||
* Added definitions for ATmega64 provided by Pavel Fertser - Thanks.
|
||||
|
||||
12. Apr. 2008 - Version 0.83
|
||||
|
||||
* Added definitions for ATmega644P and ATmega324P
|
||||
* Tested with ATmega324P, gcc 4.2.2, avr-libc 1.4.6
|
||||
* Added testapp to verify "exit bootloader" with
|
||||
watchdog (n.b.: watchdog-disable called early in testapp)
|
||||
|
||||
27. Jan. 2007 - Version 0.82
|
||||
|
||||
* Added definitions for ATmega644.
|
||||
* Using avr-lib's eeprom-functions (old "direct-access"-code
|
||||
has not been compatible with ATmega644).
|
||||
* Watchdog-disable at startup (configurable): avoids problems with
|
||||
repeated login to bootloader. Not needed if the bootloader is
|
||||
never re-entered again between an "exit programming" and
|
||||
a system-reset/power-toogle.
|
||||
* Additional watchdog disable-function for ATmega644.
|
||||
* Made watchdog-enable time at exit-programming a configuration-value
|
||||
(define).
|
||||
* Bootloader read-protection: if enabled the bootloader fakes
|
||||
an empty boot-section (configurable by define)
|
||||
Since more of the avr-libc functions's are used this version
|
||||
should be more portable for other AVRs but the size of the
|
||||
binary increases a little bit.
|
||||
Make sure to disable the watchdog early in the user-application
|
||||
esp. when using a "modern" AVR (i.e. ATmega48/88/168/644/324P/644P).
|
||||
|
||||
3. Dec. 2006 - Version 0.81
|
||||
|
||||
* Added definitions for ATmega162.
|
||||
* Fixed init for double-speed (bitmask). Thanks to Bernhard Roth
|
||||
|
||||
28. May 2006 - Version 0.8beta3
|
||||
|
||||
* Supports discarding of interrupt-vectors which saves some space
|
||||
if no interrupts are needed in the bootloader. Added option
|
||||
in makefile to enable this feature, modified LDFLAGS,
|
||||
additional code in main.c for a pseudo default_interrupt ISR.
|
||||
The modified linker-scripts have been contributed by
|
||||
Olaf Rempel (basicly just the .vector-section is not linked).
|
||||
* Reverted the order of signatur-byte-numbers in part-
|
||||
configurations to the usual order in the datasheet,
|
||||
also reverted in main.c for sending the signature.
|
||||
* Definitions for lock/fuse-readout.
|
||||
* Updated installation-instruction at the end of this file.
|
||||
* Added DEVTYPE_ISP/DEVTYPE_BOOT to part-configurations,
|
||||
added configuration-option for this in main.c.
|
||||
* A remark about the DEVTYPE: Usualy there are two
|
||||
Part-Codes/Device-Codes. One is for ISP: AVRProg shows
|
||||
the type of the AVR. The other code is for bootloading:
|
||||
AVRprog shows the type plus "BOOT". When a boot-device-code
|
||||
gets detected by AVRprog it "knows" how do handle the
|
||||
limited functionality of bootloaders. (When receiving the
|
||||
ISP-code AVRProg expects an AVR910-type programmer.)
|
||||
The offset between the codes is usualy 0x01 where the
|
||||
ISP-code is the smaller value, i.e. ATmega32 ISP-code
|
||||
is 0x72->"ATmega32" and boot-code is 0x73->"ATmega32 BOOT".
|
||||
When using avrdude the bootloader's device-code must match
|
||||
the device-code in the avrdude.conf. Check the avrdude-
|
||||
code to see if both codes (AVR910 and AVR109) are supported.
|
||||
-- I have got some e-mails from users which have been
|
||||
confused by this. Hopefully this explanation is good enough.
|
||||
* This bootloader lets the watchdog do a reset when the
|
||||
user selects "Exit programmer" (i.e. in AVRProg) after an
|
||||
update. Make sure to disable or reset the watchdog early in
|
||||
your application.
|
||||
|
||||
27. May 2006 - Version 0.8beta2
|
||||
|
||||
* More very well done improvements contributed by Olaf Rempel.
|
||||
* Olaf Rempel also modified the STARTUP_WAIT method.
|
||||
|
||||
21. May 2006 - Version 0.8beta
|
||||
|
||||
* Version contributed by Olaf Rempel. He has done a lot of modifications.
|
||||
-> "cleaner code", smaller binaries.
|
||||
|
||||
09. Feb. 2006 - Version 0.75
|
||||
|
||||
* additional STARTUP_WAIT support contributed by Bjoern Riemer
|
||||
|
||||
18. Aug. 2005 - Version 0.74
|
||||
|
||||
* AT90CAN128 support contributed by Uwe Bonnes
|
||||
* Makefile modifications contributed by Uwe Bonnes
|
||||
|
||||
23. Feb. 2005 - Version 0.7
|
||||
|
||||
* (Version 0.6 has never been available on the web-page)
|
||||
* ATmega128 support
|
||||
* code cleanup
|
||||
* This version has been tested with ATmega8, ATmega32 and
|
||||
ATmega128
|
||||
|
||||
7. Apr. 2004 - Version 0.5
|
||||
|
||||
* added different startup-methods
|
||||
* compatible with ATmega8 now
|
||||
* included makefile adapted to ATmega8 now
|
||||
(ATmega16 options still available)
|
||||
* fixed jump to application which did not work
|
||||
reliably before
|
||||
* tested with ATmega8
|
||||
* minimal options and startup-code result in
|
||||
bootloader-size < 512 words
|
||||
|
||||
6. Apr. 2004 - Version 0.4
|
||||
|
||||
* Buffered read of chars from UART during programming
|
||||
since eeprom-write is too slow for unbuffered
|
||||
operation. So EEPROM-upload does work now.
|
||||
* Added BOOTICE-mode to flash JTAGICE-compatible
|
||||
hardware (ATmega16@7,3Mhz) (if you know about BOOTICE,
|
||||
you may unterstand why this has been added, if not
|
||||
just keep the option disabled)
|
||||
* small changes in (my)boot.h (lock-bit-mask) found
|
||||
out during the development of the STK-500-compatible
|
||||
bootloader. But setting lock-bits still does not
|
||||
work with this bootloader.
|
||||
* read of the low-fuse byte works (high byte still TODO)
|
||||
* read of the lock-byte works (write still TODO)
|
||||
|
||||
27. Mar 2004 - Version 0.3
|
||||
|
||||
Felt that as much functions from avr-libc's boot.h
|
||||
as possible should be used without modifications.
|
||||
Latest CVS-version of boot.h is included.
|
||||
Only the read-routine is still "self-made" based
|
||||
on ATMELs assembler-code.
|
||||
EEPROM write on Mega16 does not work (and did not
|
||||
work with V0.2 too). May be caused by my old Mega16
|
||||
chip. Needs testing. Flash read/write and EEPROM
|
||||
read works. Still only tested with ATmega16.
|
||||
This version may not work with the ATmega169 any
|
||||
more.
|
||||
|
||||
24. Mar 2004 - Version 0.2
|
||||
|
||||
During the development of a data-logger application
|
||||
with the AVR-Butterfly there was a need to make
|
||||
some changes in the bootloader. The same problem
|
||||
again: no IAR compiler. The same way to solve the
|
||||
problem: a port of the code to avr-gcc/avr-libc.
|
||||
So this code is based on the ATMEL Butterfly
|
||||
bootloader source code Rev 0.2 for IAR.
|
||||
|
||||
The bootloader-port for the Butterfly which mimics
|
||||
the complete functionality of the original
|
||||
BF-bootloader is availabe at:
|
||||
www.siwawi.arubi.uni-kl.de/avr_projects
|
||||
|
||||
Atmel used a separate "lib" written in "pure"
|
||||
assembly to access the low-level functions
|
||||
for flash read/write. Well, so far I
|
||||
don't know how to use "mixed language sources"
|
||||
with the avr-gcc toolchain, so the low-level
|
||||
routines have been implemented as inline assembler.
|
||||
The avr-libc boot.h module written by Eric
|
||||
Weddington served as a template Three of the four
|
||||
low-level routines found in lowlevel.c come from
|
||||
boot.h with minimal changes. The read routine has
|
||||
been developed based on the ATMEL assembler code.
|
||||
|
||||
Ignore the fuse and lock-bit readout. Read and Set is
|
||||
not enabled (TODO).
|
||||
|
||||
|
||||
--------------- Installation -----------------
|
||||
|
||||
- Change the MCU type in the makefile.
|
||||
|
||||
- Change the boot(loader)-size in Makefile. The needed
|
||||
space depends on the features selected in main.c
|
||||
|
||||
- Set baudrate in main.c, a doublespeed configuration-option
|
||||
is available too.
|
||||
|
||||
- Change the F_CPU in main.c to the clock-frequency
|
||||
of your board. See the datasheet for frequencies
|
||||
with minimum error at the selected baudrate.
|
||||
|
||||
- Select the start-condition in main.c.
|
||||
|
||||
- Please use at least avr-gcc 3.3.1/avr-libc 1.0
|
||||
or WINAVR Sept. 2003 or later to compile and link
|
||||
this bootloader.
|
||||
|
||||
- Upload the hex-File to the AVR (STK500, STK200, SP12
|
||||
evertool, AVR910 etc.)
|
||||
|
||||
- Program the "Boot Flash section size" (BOOTSZ fuses)
|
||||
according to the boot-size selected in the makefile
|
||||
i.e. BOOTSZ=00 for boot-size 1024 words (2048 bytes)
|
||||
on ATmega16
|
||||
|
||||
- enable the BOOT Reset Vector fuse (BOOTRST=0)
|
||||
|
||||
- Set the lock bits to protect the bootloader from
|
||||
SPM-writes (Boot Loader Protection Mode 2 in STK500-
|
||||
plugin) so that it can not overwrite itself.
|
||||
|
||||
- Connect the AVR UART Pins via level-shifter/inverter
|
||||
(i.e. MAX232) to your PCs COM-Port.
|
||||
|
||||
- Reset the AVR while fullfilling the bootloader start-
|
||||
condition. (Default: selected pin connected to GND).
|
||||
The condition must be "true" until you see the
|
||||
AVRPROG dialog or avrdude connects.
|
||||
|
||||
- Start AVRPROG (AVRStudio/Tools or stand-alone avrprog.exe)
|
||||
AVRDUDE is supported too, check it's manual
|
||||
for command-line options. Read the text above for
|
||||
information about Device-Types and AVRDUDE
|
||||
|
||||
- AVRPROG or AVRDUDE should detect the bootloader.
|
||||
|
||||
- see AVRStudio's online-help for more information how
|
||||
to use AVRPROG
|
||||
|
||||
- make sure to EXIT from AVRPROG (button) to start
|
||||
your main-application or toogle power/reset.
|
||||
|
||||
|
||||
Feedback welcome, Good luck.
|
||||
Martin
|
142
comm.c
Normal file
142
comm.c
Normal file
@ -0,0 +1,142 @@
|
||||
#include "defines.h"
|
||||
#include <inttypes.h>
|
||||
#include <util/delay.h>
|
||||
#include "comm.h"
|
||||
#include "usart.h"
|
||||
|
||||
static uint8_t comm_send_crc;
|
||||
static unsigned int comm_send_length;
|
||||
static unsigned int comm_send_pos;
|
||||
|
||||
static int comm_recv_pos;
|
||||
static uint8_t comm_recv_crc;
|
||||
static uint8_t comm_recv_error;
|
||||
|
||||
volatile uint8_t comm_recv_command;
|
||||
volatile unsigned int comm_recv_length;
|
||||
volatile uint8_t recv_buffer[RECV_BUFFER];
|
||||
volatile uint8_t comm_recv_done;
|
||||
|
||||
static void comm_calc_send_crc(uint8_t inbyte)
|
||||
{
|
||||
uint8_t j;
|
||||
for (j=0;j<8;j++)
|
||||
{
|
||||
uint8_t mix = (comm_send_crc ^ inbyte) & 0x01;
|
||||
comm_send_crc >>= 1;
|
||||
if (mix)
|
||||
comm_send_crc ^= 0x8C;
|
||||
inbyte >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void comm_calc_recv_crc(uint8_t inbyte)
|
||||
{
|
||||
uint8_t j;
|
||||
for (j=0;j<8;j++)
|
||||
{
|
||||
uint8_t mix = (comm_recv_crc ^ inbyte) & 0x01;
|
||||
comm_recv_crc >>= 1;
|
||||
if (mix)
|
||||
comm_recv_crc ^= 0x8C;
|
||||
inbyte >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void comm_send_and_calc(uint8_t data)
|
||||
{
|
||||
comm_calc_send_crc(data);
|
||||
USART_TransmitByte(data);
|
||||
#ifdef SEND_DELAY
|
||||
_delay_us(SEND_DELAY);
|
||||
#endif
|
||||
}
|
||||
|
||||
void comm_start(uint8_t command, unsigned int length)
|
||||
{
|
||||
comm_send_crc = 0;
|
||||
comm_send_and_calc('F');
|
||||
comm_send_and_calc(command);
|
||||
comm_send_and_calc(length & 0xff);
|
||||
comm_send_and_calc((length >> 8) & 0xff);
|
||||
comm_send_length = length;
|
||||
comm_send_pos = 0;
|
||||
|
||||
if (!comm_send_length)
|
||||
USART_TransmitByte(comm_send_crc);
|
||||
}
|
||||
|
||||
void comm_send_byte(uint8_t data)
|
||||
{
|
||||
comm_send_and_calc(data);
|
||||
comm_send_pos++;
|
||||
|
||||
if (comm_send_pos == comm_send_length)
|
||||
USART_TransmitByte(comm_send_crc);
|
||||
}
|
||||
|
||||
void comm_proceed(uint8_t data)
|
||||
{
|
||||
if (comm_recv_error && data != 'F') return;
|
||||
comm_recv_error = 0;
|
||||
if (!comm_recv_pos)
|
||||
{
|
||||
comm_recv_crc = 0;
|
||||
comm_recv_done = 0;
|
||||
}
|
||||
comm_calc_recv_crc(data);
|
||||
unsigned int l = comm_recv_pos-4;
|
||||
switch (comm_recv_pos)
|
||||
{
|
||||
case 0:
|
||||
if (data != 'F')
|
||||
{
|
||||
comm_recv_error = 1;
|
||||
comm_start(COMMAND_ERROR_INVALID, 0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
comm_recv_command = data;
|
||||
break;
|
||||
case 2:
|
||||
comm_recv_length = data;
|
||||
break;
|
||||
case 3:
|
||||
comm_recv_length |= (uint16_t)data << 8;
|
||||
break;
|
||||
default:
|
||||
if (l >= RECV_BUFFER)
|
||||
{
|
||||
comm_recv_pos = 0;
|
||||
comm_recv_error = 1;
|
||||
comm_start(COMMAND_ERROR_OVERFLOW, 0);
|
||||
return;
|
||||
}
|
||||
else if (l < comm_recv_length)
|
||||
{
|
||||
recv_buffer[l] = data;
|
||||
} else if (l == comm_recv_length)
|
||||
{
|
||||
if (!comm_recv_crc)
|
||||
{
|
||||
comm_recv_done = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
comm_recv_error = 1;
|
||||
comm_start(COMMAND_ERROR_CRC, 0);
|
||||
}
|
||||
comm_recv_pos = 0;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
comm_recv_pos++;
|
||||
}
|
||||
|
||||
void comm_init()
|
||||
{
|
||||
comm_recv_pos = 0;
|
||||
comm_recv_done = 0;
|
||||
comm_recv_error = 0;
|
||||
}
|
54
comm.h
Normal file
54
comm.h
Normal file
@ -0,0 +1,54 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#define COMMAND_PRG_STARTED 0
|
||||
#define COMMAND_CHR_STARTED 1
|
||||
#define COMMAND_ERROR_INVALID 2
|
||||
#define COMMAND_ERROR_CRC 3
|
||||
#define COMMAND_ERROR_OVERFLOW 4
|
||||
#define COMMAND_PRG_INIT 5
|
||||
#define COMMAND_CHR_INIT 6
|
||||
#define COMMAND_PRG_READ_REQUEST 7
|
||||
#define COMMAND_PRG_READ_RESULT 8
|
||||
#define COMMAND_PRG_WRITE_REQUEST 9
|
||||
#define COMMAND_PRG_WRITE_DONE 10
|
||||
#define COMMAND_CHR_READ_REQUEST 11
|
||||
#define COMMAND_CHR_READ_RESULT 12
|
||||
#define COMMAND_CHR_WRITE_REQUEST 13
|
||||
#define COMMAND_CHR_WRITE_DONE 14
|
||||
#define COMMAND_PHI2_INIT 15
|
||||
#define COMMAND_PHI2_INIT_DONE 16
|
||||
#define COMMAND_MIRRORING_REQUEST 17
|
||||
#define COMMAND_MIRRORING_RESULT 18
|
||||
#define COMMAND_RESET 19
|
||||
#define COMMAND_RESET_ACK 20
|
||||
#define COMMAND_PRG_EPROM_WRITE_REQUEST 21
|
||||
#define COMMAND_CHR_EPROM_WRITE_REQUEST 22
|
||||
#define COMMAND_EPROM_PREPARE 23
|
||||
#define COMMAND_PRG_FLASH_ERASE_REQUEST 24
|
||||
#define COMMAND_PRG_FLASH_WRITE_REQUEST 25
|
||||
#define COMMAND_CHR_FLASH_ERASE_REQUEST 26
|
||||
#define COMMAND_CHR_FLASH_WRITE_REQUEST 27
|
||||
#define COMMAND_JTAG_SETUP 28
|
||||
#define COMMAND_JTAG_SHUTDOWN 29
|
||||
#define COMMAND_JTAG_EXECUTE 30
|
||||
#define COMMAND_JTAG_RESULT 31
|
||||
#define COMMAND_TEST_SET 32
|
||||
#define COMMAND_TEST_RESULT 33
|
||||
#define COMMAND_COOLBOY_READ_REQUEST 34
|
||||
#define COMMAND_COOLBOY_ERASE_REQUEST 35
|
||||
#define COMMAND_COOLBOY_WRITE_REQUEST 36
|
||||
#define COMMAND_COOLGIRL_ERASE_SECTOR_REQUEST 37
|
||||
#define COMMAND_COOLGIRL_WRITE_REQUEST 38
|
||||
|
||||
#define COMMAND_BOOTLOADER 0xFE
|
||||
#define COMMAND_DEBUG 0xFF
|
||||
|
||||
void comm_init();
|
||||
void comm_start(uint8_t command, unsigned int length);
|
||||
void comm_send_byte(uint8_t data);
|
||||
void comm_proceed(uint8_t data);
|
||||
|
||||
extern volatile uint8_t comm_recv_command;
|
||||
extern volatile unsigned int comm_recv_length;
|
||||
extern volatile uint8_t recv_buffer[RECV_BUFFER];
|
||||
extern volatile uint8_t comm_recv_done;
|
12
defines.h
Normal file
12
defines.h
Normal file
@ -0,0 +1,12 @@
|
||||
#define F_CPU 8000000UL
|
||||
//#define F_CPU 11059200UL
|
||||
//#define UART_BAUD 38400UL
|
||||
#define UART_BAUD 250000UL
|
||||
#define RECV_BUFFER 1050
|
||||
//#define SEND_DELAY 100
|
||||
|
||||
#define JTAG_PORT B
|
||||
#define TMS_PIN 2
|
||||
#define TCK_PIN 4
|
||||
#define TDO_PIN 3
|
||||
#define TDI_PIN 1
|
899
dumper.c
Normal file
899
dumper.c
Normal file
@ -0,0 +1,899 @@
|
||||
/* Famicom Dumper/Programmer
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2016 Cluster
|
||||
* http://clusterrr.com
|
||||
* clusterrr@clusterrr.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "defines.h"
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <util/delay.h>
|
||||
#include <inttypes.h>
|
||||
#include "usart.h"
|
||||
#include "comm.h"
|
||||
#include "jtag.h"
|
||||
|
||||
#define LED_RED_ON PORTB |= (1<<7)
|
||||
#define LED_RED_OFF PORTB &= ~(1<<7)
|
||||
#define LED_GREEN_ON PORTB |= (1<<6)
|
||||
#define LED_GREEN_OFF PORTB &= ~(1<<6)
|
||||
#define ROMSEL_HI PORTF |= (1<<1)
|
||||
#define ROMSEL_LOW PORTF &= ~(1<<1)
|
||||
#define PHI2_HI PORTF |= (1<<0)
|
||||
#define PHI2_LOW PORTF &= ~(1<<0)
|
||||
#define MODE_READ { PORTD = 0xFF; DDRD = 0; }
|
||||
#define MODE_WRITE DDRD = 0xFF
|
||||
#define PRG_READ PORTF |= (1<<7)
|
||||
#define PRG_WRITE PORTF &= ~(1<<7)
|
||||
#define CHR_READ_HI PORTF |= (1<<5)
|
||||
#define CHR_READ_LOW PORTF &= ~(1<<5)
|
||||
#define CHR_WRITE_HI PORTF |= (1<<2)
|
||||
#define CHR_WRITE_LOW PORTF &= ~(1<<2)
|
||||
|
||||
static void (*jump_to_bootloader)(void) = 0xF800;
|
||||
|
||||
ISR(USART0_RX_vect)
|
||||
{
|
||||
unsigned char b;
|
||||
while (UCSR0A & (1<<RXC0))
|
||||
{
|
||||
b = UDR0;
|
||||
comm_proceed(b);
|
||||
}
|
||||
}
|
||||
|
||||
static void phi2_init()
|
||||
{
|
||||
int i = 0x80;
|
||||
unsigned char h = PORTF |= (1<<0);
|
||||
unsigned char l = PORTF &= ~(1<<0);
|
||||
while(i != 0){
|
||||
PORTA = l;
|
||||
PORTA = h;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
static void set_address(unsigned int address)
|
||||
{
|
||||
unsigned char l = address & 0xFF;
|
||||
unsigned char h = address>>8;
|
||||
|
||||
PORTA = l;
|
||||
PORTC = h;
|
||||
|
||||
// PPU /A13
|
||||
if ((address >> 13) & 1)
|
||||
PORTF &= ~(1<<4);
|
||||
else
|
||||
PORTF |= 1<<4;
|
||||
}
|
||||
|
||||
static void set_romsel(unsigned int address)
|
||||
{
|
||||
if (address & 0x8000)
|
||||
{
|
||||
ROMSEL_LOW;
|
||||
} else {
|
||||
ROMSEL_HI;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char read_prg_byte(unsigned int address)
|
||||
{
|
||||
MODE_READ;
|
||||
PRG_READ;
|
||||
set_address(address);
|
||||
PHI2_HI;
|
||||
set_romsel(address);
|
||||
_delay_us(1);
|
||||
return PIND;
|
||||
}
|
||||
|
||||
static unsigned char read_chr_byte(unsigned int address)
|
||||
{
|
||||
MODE_READ;
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
set_address(address);
|
||||
CHR_READ_LOW;
|
||||
|
||||
_delay_us(1);
|
||||
|
||||
uint8_t result = PIND;
|
||||
|
||||
CHR_READ_HI;
|
||||
return result;
|
||||
}
|
||||
|
||||
static unsigned char read_coolboy_byte(unsigned int address)
|
||||
{
|
||||
MODE_READ;
|
||||
PRG_READ;
|
||||
set_address(address);
|
||||
PHI2_HI;
|
||||
ROMSEL_LOW;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
PORTB &= ~(1<<TCK_PIN);
|
||||
_delay_us(1);
|
||||
return PIND;
|
||||
}
|
||||
|
||||
static void read_prg_send(unsigned int address, unsigned int len)
|
||||
{
|
||||
LED_GREEN_ON;
|
||||
comm_start(COMMAND_PRG_READ_RESULT, len);
|
||||
while (len > 0)
|
||||
{
|
||||
comm_send_byte(read_prg_byte(address));
|
||||
len--;
|
||||
address++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
LED_GREEN_OFF;
|
||||
}
|
||||
|
||||
static void read_chr_send(unsigned int address, unsigned int len)
|
||||
{
|
||||
LED_GREEN_ON;
|
||||
comm_start(COMMAND_CHR_READ_RESULT, len);
|
||||
while (len > 0)
|
||||
{
|
||||
comm_send_byte(read_chr_byte(address));
|
||||
len--;
|
||||
address++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
LED_GREEN_OFF;
|
||||
}
|
||||
|
||||
static void read_coolboy_send(unsigned int address, unsigned int len)
|
||||
{
|
||||
LED_GREEN_ON;
|
||||
PORTB |= 1<<TCK_PIN;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
DDRB |= 1<<TCK_PIN;
|
||||
DDRB |= 1<<TDO_PIN;
|
||||
comm_start(COMMAND_PRG_READ_RESULT, len);
|
||||
while (len > 0)
|
||||
{
|
||||
comm_send_byte(read_coolboy_byte(address));
|
||||
len--;
|
||||
address++;
|
||||
}
|
||||
set_address(0);
|
||||
ROMSEL_HI;
|
||||
PORTB |= 1<<TCK_PIN;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
|
||||
jtag_shutdown();
|
||||
LED_GREEN_OFF;
|
||||
}
|
||||
|
||||
static void write_prg_byte(unsigned int address, uint8_t data)
|
||||
{
|
||||
PHI2_LOW;
|
||||
ROMSEL_HI;
|
||||
MODE_WRITE;
|
||||
PRG_WRITE;
|
||||
PORTD = data;
|
||||
set_address(address); // PHI2 low, ROMSEL always HIGH
|
||||
// _delay_us(1);
|
||||
|
||||
PHI2_HI;
|
||||
// _delay_us(1);
|
||||
set_romsel(address); // ROMSEL is low if need, PHI2 high
|
||||
|
||||
_delay_us(1); // WRITING
|
||||
|
||||
// PHI2 low, ROMSEL high
|
||||
PHI2_LOW;
|
||||
_delay_us(1);
|
||||
ROMSEL_HI;
|
||||
|
||||
// Back to read mode
|
||||
// _delay_us(1);
|
||||
PRG_READ;
|
||||
MODE_READ;
|
||||
set_address(0);
|
||||
|
||||
// Set phi2 to high state to keep cartridge unreseted
|
||||
// _delay_us(1);
|
||||
PHI2_HI;
|
||||
|
||||
// _delay_us(1);
|
||||
}
|
||||
|
||||
static void write_chr_byte(unsigned int address, uint8_t data)
|
||||
{
|
||||
PHI2_LOW;
|
||||
ROMSEL_HI;
|
||||
MODE_WRITE;
|
||||
PORTD = data;
|
||||
set_address(address); // PHI2 low, ROMSEL always HIGH
|
||||
//_delay_us(1);
|
||||
|
||||
CHR_WRITE_LOW;
|
||||
|
||||
//_delay_us(1); // WRITING
|
||||
|
||||
CHR_WRITE_HI;
|
||||
|
||||
//_delay_us(1);
|
||||
|
||||
MODE_READ;
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
|
||||
//_delay_us(1);
|
||||
}
|
||||
|
||||
static void write_prg(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
while (len > 0)
|
||||
{
|
||||
write_prg_byte(address, *data);
|
||||
address++;
|
||||
len--;
|
||||
data++;
|
||||
}
|
||||
//_delay_ms(1);
|
||||
LED_RED_OFF;
|
||||
}
|
||||
|
||||
static void write_chr(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
while (len > 0)
|
||||
{
|
||||
write_chr_byte(address, *data);
|
||||
address++;
|
||||
len--;
|
||||
data++;
|
||||
}
|
||||
//_delay_ms(1);
|
||||
LED_RED_OFF;
|
||||
}
|
||||
|
||||
static void write_prg_flash_command(unsigned int address, uint8_t data)
|
||||
{
|
||||
write_prg_byte(address | 0x8000, data);
|
||||
}
|
||||
|
||||
static void write_coolboy_flash_command(unsigned int address, uint8_t data)
|
||||
{
|
||||
PORTB |= 1<<TCK_PIN;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
ROMSEL_HI;
|
||||
PRG_READ;
|
||||
set_address(address);
|
||||
MODE_WRITE;
|
||||
PORTD = data;
|
||||
PHI2_HI;
|
||||
ROMSEL_LOW;
|
||||
_delay_us(1);
|
||||
|
||||
PORTB &= ~(1<<TDO_PIN);
|
||||
|
||||
_delay_us(1);
|
||||
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
set_address(0);
|
||||
ROMSEL_HI;
|
||||
MODE_READ;
|
||||
}
|
||||
|
||||
static void write_chr_flash_command(unsigned int address, uint8_t data)
|
||||
{
|
||||
write_chr_byte(address, data);
|
||||
}
|
||||
|
||||
static int write_prg_flash_byte(unsigned int address, uint8_t data)
|
||||
{
|
||||
write_prg_flash_command(0x0000, 0xF0);
|
||||
write_prg_flash_command(0x0555, 0xAA);
|
||||
write_prg_flash_command(0x02AA, 0x55);
|
||||
write_prg_flash_command(0x0555, 0xA0);
|
||||
|
||||
write_prg_flash_command(address, data);
|
||||
_delay_us(50);
|
||||
|
||||
int timeout = 0;
|
||||
uint8_t res, last_res = 0;
|
||||
while (timeout < 200)
|
||||
{
|
||||
res = read_prg_byte(address | 0x8000);
|
||||
ROMSEL_HI;
|
||||
if (res == last_res && last_res == data) break;
|
||||
last_res = res;
|
||||
_delay_us(50);
|
||||
timeout++;
|
||||
}
|
||||
//PHI2_LOW;
|
||||
ROMSEL_HI;
|
||||
set_address(0);
|
||||
|
||||
return timeout < 10;
|
||||
}
|
||||
|
||||
|
||||
static int write_chr_flash_byte(unsigned int address, uint8_t data)
|
||||
{
|
||||
write_chr_flash_command(0x0000, 0xF0);
|
||||
write_chr_flash_command(0x0555, 0xAA);
|
||||
write_chr_flash_command(0x02AA, 0x55);
|
||||
write_chr_flash_command(0x0555, 0xA0);
|
||||
write_chr_flash_command(address, data);
|
||||
|
||||
int timeout = 0;
|
||||
while (read_chr_byte(address | 0x8000) != data && timeout < 10)
|
||||
{
|
||||
_delay_us(100);
|
||||
timeout++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_LOW;
|
||||
ROMSEL_HI;
|
||||
|
||||
return timeout < 10;
|
||||
}
|
||||
|
||||
static int erase_prg_flash()
|
||||
{
|
||||
LED_RED_ON;
|
||||
write_prg_flash_command(0x0000, 0xF0);
|
||||
write_prg_flash_command(0x0AAA, 0xAA);
|
||||
write_prg_flash_command(0x0555, 0x55);
|
||||
write_prg_flash_command(0x0AAA, 0x80);
|
||||
write_prg_flash_command(0x0AAA, 0xAA);
|
||||
write_prg_flash_command(0x0555, 0x55);
|
||||
write_prg_flash_command(0x0AAA, 0x10);
|
||||
|
||||
int timeout = 0;
|
||||
while ((read_prg_byte(0x8000) != 0xFF) && (timeout < 300000))
|
||||
{
|
||||
_delay_ms(1);
|
||||
timeout++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
|
||||
LED_RED_OFF;
|
||||
return timeout < 300000;
|
||||
}
|
||||
|
||||
static int erase_coolboy_sector()
|
||||
{
|
||||
LED_RED_ON;
|
||||
PORTB |= 1<<TCK_PIN;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
DDRB |= 1<<TCK_PIN;
|
||||
DDRB |= 1<<TDO_PIN;
|
||||
ROMSEL_HI;
|
||||
|
||||
write_coolboy_flash_command(0x0000, 0xF0);
|
||||
write_coolboy_flash_command(0x0AAA, 0xAA);
|
||||
write_coolboy_flash_command(0x0555, 0x55);
|
||||
write_coolboy_flash_command(0x0AAA, 0x80);
|
||||
write_coolboy_flash_command(0x0AAA, 0xAA);
|
||||
write_coolboy_flash_command(0x0555, 0x55);
|
||||
write_coolboy_flash_command(0x0000, 0x30);
|
||||
|
||||
int timeout = 0;
|
||||
uint8_t debug;
|
||||
while (((debug = read_coolboy_byte(0x8000)) != 0xFF) && (timeout < 3000))
|
||||
{
|
||||
//comm_start(0xFF, 1);
|
||||
//comm_send_byte(debug);
|
||||
_delay_ms(1);
|
||||
timeout++;
|
||||
}
|
||||
|
||||
set_address(0);
|
||||
ROMSEL_HI;
|
||||
|
||||
jtag_shutdown();
|
||||
LED_RED_OFF;
|
||||
return timeout < 3000;
|
||||
}
|
||||
|
||||
static int erase_coolgirl_sector()
|
||||
{
|
||||
LED_RED_ON;
|
||||
write_prg_flash_command(0x0000, 0xF0);
|
||||
write_prg_flash_command(0x0AAA, 0xAA);
|
||||
write_prg_flash_command(0x0555, 0x55);
|
||||
write_prg_flash_command(0x0AAA, 0x80);
|
||||
write_prg_flash_command(0x0AAA, 0xAA);
|
||||
write_prg_flash_command(0x0555, 0x55);
|
||||
write_prg_flash_command(0x0000, 0x30);
|
||||
|
||||
int timeout = 0;
|
||||
uint8_t debug;
|
||||
while (((debug = read_prg_byte(0x8000)) != 0xFF) && (timeout < 3000))
|
||||
{
|
||||
//comm_start(0xFF, 1);
|
||||
//comm_send_byte(debug);
|
||||
_delay_ms(1);
|
||||
timeout++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
|
||||
LED_RED_OFF;
|
||||
return timeout < 3000;
|
||||
}
|
||||
|
||||
static int erase_chr_flash()
|
||||
{
|
||||
LED_RED_ON;
|
||||
write_chr_flash_command(0x0000, 0xF0);
|
||||
write_chr_flash_command(0x0555, 0xAA);
|
||||
write_chr_flash_command(0x02AA, 0x55);
|
||||
write_chr_flash_command(0x0555, 0x80);
|
||||
write_chr_flash_command(0x0555, 0xAA);
|
||||
write_chr_flash_command(0x02AA, 0x55);
|
||||
write_chr_flash_command(0x0555, 0x10);
|
||||
|
||||
int timeout = 0;
|
||||
while ((read_chr_byte(0) != 0xFF) && (timeout < 10000))
|
||||
{
|
||||
_delay_ms(1);
|
||||
timeout++;
|
||||
}
|
||||
set_address(0);
|
||||
PHI2_HI;
|
||||
ROMSEL_HI;
|
||||
|
||||
LED_RED_OFF;
|
||||
return timeout < 10000;
|
||||
}
|
||||
|
||||
static int write_prg_flash(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
int ok = 1;
|
||||
while (len > 0)
|
||||
{
|
||||
if (!write_prg_flash_byte(address, *data))
|
||||
{
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
address++;
|
||||
len--;
|
||||
data++;
|
||||
}
|
||||
LED_RED_OFF;
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int write_coolboy(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
PORTB |= 1<<TCK_PIN;
|
||||
PORTB |= 1<<TDO_PIN;
|
||||
DDRB |= 1<<TCK_PIN;
|
||||
DDRB |= 1<<TDO_PIN;
|
||||
ROMSEL_HI;
|
||||
uint8_t ok = 1;
|
||||
while (len > 0)
|
||||
{
|
||||
|
||||
//uint8_t count = len > 16 ? 16 : len;
|
||||
uint8_t count = 0;
|
||||
uint8_t* d = data;
|
||||
unsigned int a = address;
|
||||
unsigned int address_base = a & 0xFFE0;
|
||||
while (len > 0 && ((a & 0xFFE0) == address_base))
|
||||
{
|
||||
if (*d != 0xFF) count++;
|
||||
a++;
|
||||
len--;
|
||||
d++;
|
||||
}
|
||||
|
||||
if (count)
|
||||
{
|
||||
//write_prg_flash_command(0x0000, 0xF0);
|
||||
write_coolboy_flash_command(0x0AAA, 0xAA);
|
||||
write_coolboy_flash_command(0x0555, 0x55);
|
||||
write_coolboy_flash_command(0x0000, 0x25);
|
||||
write_coolboy_flash_command(0x0000, count-1);
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
if (*data != 0xFF)
|
||||
{
|
||||
write_coolboy_flash_command(address, *data);
|
||||
count--;
|
||||
}
|
||||
address++;
|
||||
data++;
|
||||
}
|
||||
|
||||
write_coolboy_flash_command(0x0000, 0x29);
|
||||
_delay_us(10);
|
||||
|
||||
long int timeout = 0;
|
||||
uint8_t res, last_res = 0;
|
||||
while (timeout < 100000)
|
||||
{
|
||||
res = read_coolboy_byte((address-1) | 0x8000);
|
||||
ROMSEL_HI;
|
||||
if (res == last_res && last_res == *(data-1)) break;
|
||||
last_res = res;
|
||||
_delay_us(10);
|
||||
timeout++;
|
||||
}
|
||||
if (timeout >= 100000)
|
||||
{
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
address = a;
|
||||
data = d;
|
||||
}
|
||||
ROMSEL_HI;
|
||||
jtag_shutdown();
|
||||
LED_RED_OFF;
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int write_coolgirl(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
ROMSEL_HI;
|
||||
uint8_t ok = 1;
|
||||
while (len > 0)
|
||||
{
|
||||
|
||||
//uint8_t count = len > 16 ? 16 : len;
|
||||
uint8_t count = 0;
|
||||
uint8_t* d = data;
|
||||
unsigned int a = address;
|
||||
unsigned int address_base = a & 0xFFE0;
|
||||
while (len > 0 && ((a & 0xFFE0) == address_base))
|
||||
{
|
||||
if (*d != 0xFF) count++;
|
||||
a++;
|
||||
len--;
|
||||
d++;
|
||||
}
|
||||
|
||||
if (count)
|
||||
{
|
||||
//write_prg_flash_command(0x0000, 0xF0);
|
||||
write_prg_flash_command(0x0AAA, 0xAA);
|
||||
write_prg_flash_command(0x0555, 0x55);
|
||||
write_prg_flash_command(0x0000, 0x25);
|
||||
write_prg_flash_command(0x0000, count-1);
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
if (*data != 0xFF)
|
||||
{
|
||||
write_prg_flash_command(address, *data);
|
||||
count--;
|
||||
}
|
||||
address++;
|
||||
data++;
|
||||
}
|
||||
|
||||
write_prg_flash_command(0x0000, 0x29);
|
||||
_delay_us(10);
|
||||
|
||||
long int timeout = 0;
|
||||
uint8_t res, last_res = 0;
|
||||
while (timeout < 100000)
|
||||
{
|
||||
res = read_prg_byte((address-1) | 0x8000);
|
||||
ROMSEL_HI;
|
||||
if (res == last_res && last_res == *(data-1)) break;
|
||||
last_res = res;
|
||||
_delay_us(10);
|
||||
timeout++;
|
||||
}
|
||||
if (timeout >= 100000)
|
||||
{
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
address = a;
|
||||
data = d;
|
||||
}
|
||||
ROMSEL_HI;
|
||||
LED_RED_OFF;
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int write_chr_flash(unsigned int address, unsigned int len, uint8_t* data)
|
||||
{
|
||||
LED_RED_ON;
|
||||
if (address >= 0x8000) address -= 0x8000;
|
||||
int ok = 1;
|
||||
while (len > 0)
|
||||
{
|
||||
if (!write_chr_flash_byte(address, *data))
|
||||
{
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
address++;
|
||||
len--;
|
||||
data++;
|
||||
}
|
||||
LED_RED_OFF;
|
||||
return ok;
|
||||
}
|
||||
|
||||
void get_mirroring()
|
||||
{
|
||||
comm_start(COMMAND_MIRRORING_RESULT, 4);
|
||||
LED_GREEN_ON;
|
||||
set_address(0);
|
||||
_delay_us(1);
|
||||
comm_send_byte((PINE >> 2) & 1);
|
||||
set_address(1<<10);
|
||||
_delay_us(1);
|
||||
comm_send_byte((PINE >> 2) & 1);
|
||||
set_address(1<<11);
|
||||
_delay_us(1);
|
||||
comm_send_byte((PINE >> 2) & 1);
|
||||
set_address((1<<10) | (1<<11));
|
||||
_delay_us(1);
|
||||
comm_send_byte((PINE >> 2) & 1);
|
||||
set_address(0);
|
||||
}
|
||||
|
||||
static void init_ports()
|
||||
{
|
||||
DDRB |= (1 << 6) | (1 << 7); // LEDS
|
||||
DDRF = 0b10110111; // CPU R/W, IRQ, PPU /RD, PPU /A13, CIRAM /CE, PPU /WR, /ROMSEL, PHI2
|
||||
PORTF = 0b11111111; // CPU R/W, IRQ, PPU /RD, PPU /A13, CIRAM /CE, PPU /WR, /ROMSEL, PHI2
|
||||
DDRE &= ~(1<<2); // CIRAM A10
|
||||
PORTE |= 1<<2; // CIRAM A10
|
||||
MODE_READ;
|
||||
set_address(0);
|
||||
DDRA = 0xFF; // Address low
|
||||
DDRC = 0xFF; // Address high
|
||||
}
|
||||
|
||||
static void reset_phi2()
|
||||
{
|
||||
LED_RED_ON;
|
||||
LED_GREEN_ON;
|
||||
PHI2_LOW;
|
||||
ROMSEL_HI;
|
||||
_delay_ms(1000);
|
||||
PHI2_HI;
|
||||
LED_RED_OFF;
|
||||
LED_GREEN_OFF;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
sei();
|
||||
USART_init();
|
||||
init_ports();
|
||||
jtag_shutdown();
|
||||
|
||||
LED_RED_OFF;
|
||||
LED_GREEN_OFF;
|
||||
|
||||
comm_init();
|
||||
comm_start(COMMAND_PRG_STARTED, 0);
|
||||
|
||||
uint16_t address;
|
||||
uint16_t length;
|
||||
|
||||
unsigned long int t = 0;
|
||||
char led_down = 0;
|
||||
int led_bright = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
TCCR1A |= (1<<COM1C1) | (1<<COM1B1) | (1<<WGM10);
|
||||
TCCR1B |= (1<<CS10);
|
||||
if (t++ >= 10000)
|
||||
{
|
||||
if (!led_down)
|
||||
{
|
||||
led_bright++;
|
||||
if (led_bright >= 110) led_down = 1;
|
||||
} else {
|
||||
led_bright--;
|
||||
if (!led_bright) led_down = 0;
|
||||
}
|
||||
if (led_bright >= 100) OCR1B = led_bright - 100;
|
||||
if (led_down)
|
||||
{
|
||||
int led_bright2 = 110-led_bright;
|
||||
if (led_bright2 <= 20)
|
||||
{
|
||||
if (led_bright2 > 10) led_bright2 = 20 - led_bright2;
|
||||
OCR1C = led_bright2*2;
|
||||
}
|
||||
}
|
||||
t = 0;
|
||||
}
|
||||
|
||||
if (comm_recv_done)
|
||||
{
|
||||
comm_recv_done = 0;
|
||||
t = led_down = led_bright = 0;
|
||||
TCCR1A = OCR1B = OCR1C = 0;
|
||||
|
||||
switch (comm_recv_command)
|
||||
{
|
||||
case COMMAND_PRG_INIT:
|
||||
comm_start(COMMAND_PRG_STARTED, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_PRG_READ_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
read_prg_send(address, length);
|
||||
break;
|
||||
|
||||
case COMMAND_PRG_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
write_prg(address, length, (uint8_t*)&recv_buffer[4]);
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_COOLBOY_READ_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
read_coolboy_send(address, length);
|
||||
break;
|
||||
|
||||
case COMMAND_PHI2_INIT:
|
||||
phi2_init();
|
||||
comm_start(COMMAND_PHI2_INIT_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_RESET:
|
||||
reset_phi2();
|
||||
comm_start(COMMAND_RESET_ACK, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_PRG_FLASH_ERASE_REQUEST:
|
||||
if (erase_prg_flash())
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_PRG_FLASH_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
if (write_prg_flash(address, length, (uint8_t*)&recv_buffer[4]))
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_COOLBOY_ERASE_REQUEST:
|
||||
if (erase_coolboy_sector())
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_COOLBOY_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
if (write_coolboy(address, length, (uint8_t*)&recv_buffer[4]))
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_COOLGIRL_ERASE_SECTOR_REQUEST:
|
||||
if (erase_coolgirl_sector())
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_COOLGIRL_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
if (write_coolgirl(address, length, (uint8_t*)&recv_buffer[4]))
|
||||
comm_start(COMMAND_PRG_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_CHR_INIT:
|
||||
comm_start(COMMAND_CHR_STARTED, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_CHR_READ_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
read_chr_send(address, length);
|
||||
break;
|
||||
|
||||
case COMMAND_CHR_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
write_chr(address, length, (uint8_t*)&recv_buffer[4]);
|
||||
comm_start(COMMAND_CHR_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_MIRRORING_REQUEST:
|
||||
get_mirroring();
|
||||
break;
|
||||
|
||||
/*
|
||||
case COMMAND_EPROM_PREPARE:
|
||||
write_eprom_prepare();
|
||||
break;
|
||||
|
||||
case COMMAND_CHR_EPROM_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
write_eprom(address, length, (uint8_t*)&recv_buffer[4]);
|
||||
comm_start(COMMAND_CHR_WRITE_DONE, 0);
|
||||
break;
|
||||
*/
|
||||
|
||||
case COMMAND_CHR_FLASH_ERASE_REQUEST:
|
||||
if (erase_chr_flash())
|
||||
comm_start(COMMAND_CHR_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_CHR_FLASH_WRITE_REQUEST:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
length = recv_buffer[2] | ((uint16_t)recv_buffer[3]<<8);
|
||||
if (write_chr_flash(address, length, (uint8_t*)&recv_buffer[4]))
|
||||
comm_start(COMMAND_CHR_WRITE_DONE, 0);
|
||||
break;
|
||||
|
||||
case COMMAND_JTAG_SETUP:
|
||||
jtag_setup();
|
||||
comm_start(COMMAND_JTAG_RESULT, 1);
|
||||
comm_send_byte(1);
|
||||
break;
|
||||
|
||||
case COMMAND_JTAG_SHUTDOWN:
|
||||
jtag_shutdown();
|
||||
comm_start(COMMAND_JTAG_RESULT, 1);
|
||||
comm_send_byte(1);
|
||||
break;
|
||||
|
||||
case COMMAND_JTAG_EXECUTE:
|
||||
address = recv_buffer[0] | ((uint16_t)recv_buffer[1]<<8);
|
||||
comm_start(COMMAND_JTAG_RESULT, 1);
|
||||
LED_RED_ON;
|
||||
comm_send_byte(jtag_execute(address, (uint8_t*) &recv_buffer[2]));
|
||||
LED_RED_OFF;
|
||||
break;
|
||||
case COMMAND_BOOTLOADER:
|
||||
cli();
|
||||
MCUCSR = 0;
|
||||
jump_to_bootloader();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
387
famicom-dumper.hex
Normal file
387
famicom-dumper.hex
Normal file
@ -0,0 +1,387 @@
|
||||
:100000000C9446000C9458000C9458000C94580022
|
||||
:100010000C9458000C9458000C9458000C94580000
|
||||
:100020000C9458000C9458000C9458000C945800F0
|
||||
:100030000C9458000C9458000C9458000C945800E0
|
||||
:100040000C9458000C9458000C943B080C945800E5
|
||||
:100050000C9458000C9458000C9458000C945800C0
|
||||
:100060000C9458000C9458000C9458000C945800B0
|
||||
:100070000C9458000C9458000C9458000C945800A0
|
||||
:100080000C9458000C9458000C94580011241FBE76
|
||||
:10009000CFEFD0E1DEBFCDBF15E0A0E0B1E001C001
|
||||
:1000A0001D92AC33B107E1F70E94BA010C940E0C1B
|
||||
:1000B0000C9400008BBB95BB95FD06C0809162003F
|
||||
:1000C0008061809362000895809162008F7E8093AA
|
||||
:1000D000620008950F931F938C018FEF82BB11BABA
|
||||
:1000E00080916200806880936200C8010E945A007B
|
||||
:1000F0008091620081608093620017FD0CC0809146
|
||||
:10010000620082608093620082E08A95F1F780B39A
|
||||
:100110001F910F910895809162008D7F80936200FE
|
||||
:10012000F3CF0F931F932FEF22BB11BA02E610E01B
|
||||
:10013000F8012081216020832081226020830E9499
|
||||
:100140005A00F80180818F7D808382E08A95F1F7E3
|
||||
:1001500080B39081906290831F910F9108950F93C7
|
||||
:100160001F932FEF22BB11BA02E610E0F8012081A5
|
||||
:10017000206820830E945A00F8018081816080837A
|
||||
:1001800080818D7F8083C39AC49882E08A95F1F73D
|
||||
:1001900080B31F910F9108950F931F938C0180914D
|
||||
:1001A00062008E7F80936200809162008260809303
|
||||
:1001B00062008FEF81BB809162008F778093620035
|
||||
:1001C00062BBC8010E945A008091620081608093E6
|
||||
:1001D000620017FD29C080916200826080936200F6
|
||||
:1001E00092E0892F8A95F1F7809162008E7F80934B
|
||||
:1001F00062009A95F1F780916200826080936200BC
|
||||
:10020000809162008068809362008FEF82BB11BA98
|
||||
:1002100080E090E00E945A008091620081608093AB
|
||||
:1002200062001F910F910895809162008D7F8093ED
|
||||
:100230006200D6CFFF920F931F9302E610E0F80101
|
||||
:1002400020812E7F2083208122602083FF24FA9446
|
||||
:10025000F1BA62BB0E945A00F80180818B7F8083D3
|
||||
:10026000808184608083F2BA11BA80E090E00E94BD
|
||||
:100270005A00F8018081816080831F910F91FF9067
|
||||
:10028000089590680E94CC000895EF92FF920F931A
|
||||
:100290001F93F62EC49AC39A02E610E0F80120815B
|
||||
:1002A000226020832081206820830E945A00EE244F
|
||||
:1002B000EA94E1BAF2BAF80180818160808380819A
|
||||
:1002C0008D7F808382E0982F9A95F1F7C3988A9565
|
||||
:1002D000F1F7C39A80E090E00E945A00F801808113
|
||||
:1002E00082608083E2BA11BA1F910F91FF90EF9064
|
||||
:1002F00008951F9382E164E070E00E94E608C69AC8
|
||||
:1003000080E090E00E945A0012E0812F8A95F1F778
|
||||
:1003100081B18695869581700E94CE0880E094E038
|
||||
:100320000E945A00812F8A95F1F781B186958695B2
|
||||
:1003300081700E94CE0880E098E00E945A00812FD0
|
||||
:100340008A95F1F781B18695869581700E94CE08D5
|
||||
:1003500080E09CE00E945A001A95F1F781B18695E1
|
||||
:10036000869581700E94CE0880E090E00E945A003D
|
||||
:100370001F9108953F924F925F926F927F928F925A
|
||||
:100380009F92AF92BF92CF92DF92EF92FF920F9324
|
||||
:100390001F93DF93CF93CDB7DEB7A8970FB6F8942E
|
||||
:1003A000DEBF0FBECDBF78940E94640887B3806C17
|
||||
:1003B00087BB87EB809361001FEF10936200129858
|
||||
:1003C0001A9A12BB11BA80E090E00E945A001ABB40
|
||||
:1003D00014BB0E94B609C798C6980E94AF0880E077
|
||||
:1003E00060E070E00E94E60855E8352E4AE1C42E30
|
||||
:1003F0008FB589628FBD8EB581608EBD21E030E002
|
||||
:1004000040E050E0E0E060E070E08091200188236F
|
||||
:1004100009F043C08FB589628FBD8EB581608EBDF6
|
||||
:10042000203187E2380780E0480780E0580708F469
|
||||
:100430005FC0EE2309F066C06F5F7F4F6E367105B7
|
||||
:100440000CF0E1E06436710534F06456704079BD1B
|
||||
:1004500068BD6C597F4FEE2309F44FC08EE690E0E3
|
||||
:10046000861B970B853191050CF047C08B309105A9
|
||||
:100470002CF024E130E0281B390BC901880F991FAB
|
||||
:10048000909379008093780020E030E040E050E0E5
|
||||
:1004900080912001882309F4BDCF10922001109291
|
||||
:1004A000790010927800809178009091790099BD40
|
||||
:1004B00088BD88B599B58FBD80912101893109F436
|
||||
:1004C00023C58A3148F58B3009F4AEC48C3008F06E
|
||||
:1004D00079C1863009F46EC4873008F0A6C1853032
|
||||
:1004E00009F086CF80E060E070E00E94E60880CFEF
|
||||
:1004F0002F5F3F4F4F4F5F4F88CF20E030E040E00D
|
||||
:1005000050E083CF6150704009F09CCF20E030E094
|
||||
:1005100040E050E0E0E079CF823209F4B6C48332A3
|
||||
:1005200008F090C08C3109F4ADC48D3108F00DC2D3
|
||||
:100530008A3109F433C28B3109F05ACF90912201EC
|
||||
:10054000809123018AA319A2A92EBB24E9A1FAA1B3
|
||||
:10055000AE2ABF2A90912401809125018CA31BA271
|
||||
:10056000892E99242BA13CA1822A932AC79AB7FCF1
|
||||
:100570007DC58114910409F45EC0EE24FF24870137
|
||||
:100580000A0D1B1DF701EE5DFE4FD48080E090E068
|
||||
:1005900060EF0E941A0185E595E06AEA0E941A015F
|
||||
:1005A0008AEA92E065E50E941A0185E595E060EA35
|
||||
:1005B0000E941A01C8016D2D0E941A01106866245C
|
||||
:1005C000772407C088EC90E00197F1F70894611C4C
|
||||
:1005D000711CC8010E949100D816A1F09AE069161A
|
||||
:1005E000710481F780E090E00E945A0080916200DF
|
||||
:1005F0008E7F8093620080916200826080936200AF
|
||||
:10060000C798F6CE80E090E00E945A008091620088
|
||||
:100610008E7F80936200809162008260809362008E
|
||||
:10062000EAE06E16710464F70894E11CF11C8E1464
|
||||
:100630009F0409F0A4CFC7988EE060E070E00E94AC
|
||||
:10064000E608D6CE853209F4ACC2863208F071C114
|
||||
:10065000833209F41CC3843209F0CACE30912201DE
|
||||
:100660002091230190912401809125018A8B198A80
|
||||
:10067000A92EBB2489899A89A82AB92AC79AC49A1B
|
||||
:10068000C39ABC9ABB9A8091620082608093620098
|
||||
:10069000A114B10409F4CDC42C8B1B8AE32FF0E024
|
||||
:1006A0002B893C89E22BF32BF8A7EFA396E2492E86
|
||||
:1006B00091E0592E2FA138A5207E32018FA098A459
|
||||
:1006C00010E005C0C401807E2817390789F4F301C2
|
||||
:1006D00080818F3F09F01F5F0894811C911C089452
|
||||
:1006E000A108B1080894611C711CA114B10451F750
|
||||
:1006F000112341F4A114B10409F49BC498A68FA25C
|
||||
:100700002301D8CF8AEA9AE06AEA0E94450185E58A
|
||||
:1007100095E065E50E94450180E090E065E20E9479
|
||||
:100720004501612F615080E090E00E94450101C0C9
|
||||
:100730002C01F20160816F3F29F08FA198A50E94E2
|
||||
:10074000450111502FA138A52F5F3F4F38A72FA388
|
||||
:10075000C2010196112361F780E090E069E20E94F6
|
||||
:1007600045018C2D8A95F1F7DD24EE24FF248701C5
|
||||
:100770008FA198A50197906898A78FA312C08C2D80
|
||||
:100780008A95F1F70894E11CF11C011D111DF0EA96
|
||||
:10079000EF16F6E8FF06F1E00F07F0E01F07E1F1C2
|
||||
:1007A000D92E8FA198A50E94AF00982F809162004A
|
||||
:1007B0008260809362009D1511F7F2018081D81646
|
||||
:1007C000F1F698CF813109F45FC2823108F067C039
|
||||
:1007D0008D3009F4F5C28F3009F00ACE80916200A5
|
||||
:1007E00081608093620030916200809162008E7F10
|
||||
:1007F000809362002091620080E890E02BBB3BBBBD
|
||||
:100800000197E1F780E160E070E00E94E608F0CD3A
|
||||
:1008100080E090E00E945A008091620082608093A4
|
||||
:1008200062000E94B609C798E3CD873009F486C2FA
|
||||
:10083000893009F0DDCD3091220120912301909182
|
||||
:100840002401809125018E831D82E92EFF248D8154
|
||||
:100850009E81E82AF92AC79AE114F104C9F0288791
|
||||
:100860001F82032F10E0EF81F8850E2B1F2BAA2487
|
||||
:10087000BB24F501EE5DFE4FC501800F911F648121
|
||||
:100880000E94CC000894A11CB11CEA14FB0489F757
|
||||
:10089000C7988AE060E070E00E94E608A9CD833145
|
||||
:1008A00009F4D0C1883109F0A3CDC79A80E090E067
|
||||
:1008B00060EF0E9441018AEA9AE06AEA0E944101DF
|
||||
:1008C00085E595E065E50E9441018AEA9AE060E8E5
|
||||
:1008D0000E9441018AEA9AE06AEA0E94410185E5A4
|
||||
:1008E00095E065E50E9441018AEA9AE060E10E9494
|
||||
:1008F000410104C080ED97E00197F1F780E090E8B6
|
||||
:100900000E946A008F3FB1F780E090E00E945A0099
|
||||
:1009100080916200816080936200809162008260B9
|
||||
:1009200080936200C7988AE060E070E00E94E60869
|
||||
:100930005FCD863209F47EC08E3F09F059CDF89420
|
||||
:1009400014BEE0E0F8EF099553CD8D31E1F08E3122
|
||||
:1009500009F04ECD00912201F09023018FE161E07A
|
||||
:1009600070E00E94E608C79AFEA21DA210E08DA1C9
|
||||
:100970009EA1802B912B64E271E00E94BD090E9430
|
||||
:10098000CE08C79835CD0E94B6098FE161E070E0CE
|
||||
:100990000E94E60881E00E94CE082ACDC79A80E036
|
||||
:1009A00090E060EF0E941A0185E595E06AEA0E94F6
|
||||
:1009B0001A018AEA92E065E50E941A0185E595E050
|
||||
:1009C00060E80E941A0185E595E06AEA0E941A0132
|
||||
:1009D0008AEA92E065E50E941A0185E595E060E10A
|
||||
:1009E0000E941A0100E010E00BC037E2003113074B
|
||||
:1009F00009F42DC380ED97E00197F1F70F5F1F4FCA
|
||||
:100A000080E090E00E9491008F3F79F780E090E0D5
|
||||
:100A10000E945A0080916200816080936200809100
|
||||
:100A20006200826080936200C798005117420CF008
|
||||
:100A3000DFCC02CE3091220120912301909124013C
|
||||
:100A4000809125018E8B1D8AA92EBB248D899E89BC
|
||||
:100A5000A82AB92AC79A80916200826080936200B6
|
||||
:100A6000A114B10409F4D9C2288F1F8AE32FF0E042
|
||||
:100A70002F89388DE22BF32BF8A7EFA386E2482EBF
|
||||
:100A800081E0582E2FA138A5207E32018FA098A496
|
||||
:100A900010E005C0C401807E2817390789F4F301EE
|
||||
:100AA00080818F3F09F01F5F0894811C911C08947E
|
||||
:100AB000A108B1080894611C711CA114B10451F77C
|
||||
:100AC000112341F4A114B10409F4A7C298A68FA27E
|
||||
:100AD0002301D8CF8AEA9AE06AEA0E94410185E5BB
|
||||
:100AE00095E065E50E94410180E090E065E20E94AA
|
||||
:100AF0004101612F615080E090E00E94410101C0FE
|
||||
:100B00002C01F20160816F3F29F08FA198A50E940E
|
||||
:100B1000410111502FA138A52F5F3F4F38A72FA3B8
|
||||
:100B2000C2010196112361F780E090E069E20E9422
|
||||
:100B300041018C2D8A95F1F7DD24EE24FF248701F5
|
||||
:100B40008FA198A50197906898A78FA312C08C2DAC
|
||||
:100B50008A95F1F70894E11CF11C011D111DF0EAC2
|
||||
:100B6000EF16F6E8FF06F1E00F07F0E01F0791F03F
|
||||
:100B7000D92E8FA198A50E946A00982F80916200BB
|
||||
:100B80008260809362009D1511F7F2018081D81672
|
||||
:100B9000F1F698CF80916200826080936200C798DE
|
||||
:100BA00027CCC79A80E090E060EF0E9441018AEA7A
|
||||
:100BB0009AE06AEA0E94410185E595E065E50E94B8
|
||||
:100BC00041018AEA9AE060E80E9441018AEA9AE0DB
|
||||
:100BD0006AEA0E94410185E595E065E50E944101D0
|
||||
:100BE00080E090E060E30E94410100E010E00BC073
|
||||
:100BF0002BE0083B120709F42AC280ED97E0019729
|
||||
:100C0000F1F70F5F1F4F80E090E80E946A008F3F6E
|
||||
:100C100079F780E090E00E945A0080916200816044
|
||||
:100C20008093620080916200826080936200C79826
|
||||
:100C3000085B1B400CF0DCCB8AE060E070E00E94B7
|
||||
:100C4000E608D6CBC79AC69A809162008E7F8093C1
|
||||
:100C500062008091620082608093620020E137E24E
|
||||
:100C600088EC90E00197F1F721503040C9F780916E
|
||||
:100C70006200816080936200C798C69884E160E05A
|
||||
:100C800070E00E94E608B4CB0E947901B1CBC79A0C
|
||||
:100C9000C49AC39ABC9ABB9A809162008260809386
|
||||
:100CA000620080E090E060EF0E9445018AEA9AE0ED
|
||||
:100CB0006AEA0E94450185E595E065E50E944501E7
|
||||
:100CC0008AEA9AE060E80E9445018AEA9AE06AEAC4
|
||||
:100CD0000E94450185E595E065E50E94450180E0BB
|
||||
:100CE00090E060E30E94450100E010E00BC09BE053
|
||||
:100CF000083B190709F48CCD80ED97E00197F1F7D7
|
||||
:100D00000F5F1F4F80E090E80E94AF008F3F79F7A0
|
||||
:100D100080E090E00E945A0080916200826080939F
|
||||
:100D200062000E94B609C798085B1B400CF060CBBC
|
||||
:100D30008AE060E070E00E94E6085ACBE090220171
|
||||
:100D4000F090230190912401809125018A831982DA
|
||||
:100D5000092F10E089819A81082B192BC69A88E007
|
||||
:100D6000B8010E94E60801151105A1F0FC821B8262
|
||||
:100D7000FF24EB81FC81EE2AFF2AC7010E946A0052
|
||||
:100D80000E94CE08015010400894E11CF11C01158E
|
||||
:100D9000110599F780E090E00E945A00809162006E
|
||||
:100DA0008160809362008091620082608093620023
|
||||
:100DB000C6981ECB81E060E070E00E94E60818CB88
|
||||
:100DC00030912201209123019091240180912501ED
|
||||
:100DD0008E8F1D8EE92EFF24ED8DFE8DEE2AFF2ACB
|
||||
:100DE000C79AE114F104C9F028A31F8E032F10E065
|
||||
:100DF0002F8D38A1022B132BAA24BB24F501EE5D05
|
||||
:100E0000FE4FC501800F911F64810E941A01089452
|
||||
:100E1000A11CB11CEA14FB0489F7C7988EE060E0BE
|
||||
:100E200070E00E94E608E4CAE0902201F0902301FD
|
||||
:100E300090912401809125018A8F198E092F10E04D
|
||||
:100E4000298D3A8D022B132BC69A8CE0B8010E9493
|
||||
:100E5000E6080115110509F49DCFFC8E1B8EFF24B9
|
||||
:100E60008B8D9C8DE82AF92AC7010E9491000E946F
|
||||
:100E7000CE08015010400894E11CF11C0115110529
|
||||
:100E800099F788CF0E94AC0980CDE0902201F090C4
|
||||
:100E9000230190912401809125018A871986092FC9
|
||||
:100EA00010E029853A85022B132BC69AC49AC39A5F
|
||||
:100EB000BC9ABB9A88E0B8010E94E60801151105AA
|
||||
:100EC000A1F0FC861B86FF248B859C85E82AF92AE5
|
||||
:100ED000C7010E94AF000E94CE0801501040089444
|
||||
:100EE000E11CF11C0115110599F780E090E00E94CA
|
||||
:100EF0005A0080916200826080936200C49AC39A13
|
||||
:100F00000E94B609C69874CA30912201209123012B
|
||||
:100F100090912401809125018E871D86692E77246A
|
||||
:100F2000ED85FE856E2A7F2AC79A6114710409F443
|
||||
:100F3000AFCC288B1F86832E99242F853889822A4F
|
||||
:100F4000932AAA24BB248501080D191DF501EE5D25
|
||||
:100F5000FE4FD48080E090E060EF0E94410185E583
|
||||
:100F600095E06AEA0E9441018AEA92E065E50E9402
|
||||
:100F7000410185E595E060EA0E944101C8016D2DBF
|
||||
:100F80000E944101832D8A95F1F7E12C20E8F22E91
|
||||
:100F9000E02AF12A10E0442455240BC0832D8A95C1
|
||||
:100FA000F1F70894411C511C88EC4816510451F18A
|
||||
:100FB000192FC7010E946A00982F809162008260F9
|
||||
:100FC00080936200911751F7D11641F7809162002A
|
||||
:100FD00082608093620080E090E00E945A003AE0D4
|
||||
:100FE000431651040CF00CCB0894A11CB11CA614A0
|
||||
:100FF000B70409F0A8CFC7988AE060E070E00E94CB
|
||||
:10100000E608F6C98091620082608093620080E009
|
||||
:1010100090E00E945A00C798EBC9809162008260FC
|
||||
:1010200080936200C7988AE060E070E00E94E60862
|
||||
:10103000DFC9809162008260809362000E94B609DD
|
||||
:10104000C7988AE060E070E00E94E608D1C980E0BD
|
||||
:1010500090E00E945A00809162008160809362005B
|
||||
:1010600080916200826080936200CACA80E090E84A
|
||||
:10107000A80EB91E7ECA1F920F920FB60F921124AE
|
||||
:101080002F933F934F935F936F937F938F939F9390
|
||||
:10109000AF93BF93EF93FF935F9B05C08CB10E940A
|
||||
:1010A0000B095F99FBCFFF91EF91BF91AF919F919A
|
||||
:1010B0008F917F916F915F914F913F912F910F9001
|
||||
:1010C0000FBE0F901F90189581E089B91092900083
|
||||
:1010D00088E98AB9E5E9F0E0808186608083089537
|
||||
:1010E0005D9BFECF8CB90895982F92959F709A3092
|
||||
:1010F00070F4905D8F708A3040F4805D5D9BFECF10
|
||||
:101100009CB95D9BFECF8CB90895895CF7CF995C43
|
||||
:10111000F1CFFC018081882339F05D9BFECF8CB933
|
||||
:10112000319680818823C9F708959C0141155105A6
|
||||
:101130006105710599F080E090E0A0E0B0E0F90170
|
||||
:10114000E80FF91FE0815D9BFECFECB90196A11D70
|
||||
:10115000B11D84179507A607B70788F30895109265
|
||||
:1011600006011092050110922001109208010895C5
|
||||
:10117000582F90910001382F20E04CE801C036959F
|
||||
:10118000892F8327969580FD94272F5F2830B9F704
|
||||
:1011900090930001852F0E94700808950E94B8085E
|
||||
:1011A0008091030190910401019690930401809332
|
||||
:1011B000030120910101309102018217930709F088
|
||||
:1011C0000895809100010E9470080895FF920F9386
|
||||
:1011D0001F93F82E8B011092000186E40E94B8083C
|
||||
:1011E0008F2D0E94B808802F0E94B808812F0E947E
|
||||
:1011F000B8081093020100930101109204011092AB
|
||||
:101200000301012B21F4809100010E9470081F91BD
|
||||
:101210000F91FF900895782F80910801882319F08D
|
||||
:10122000763409F00895109208014091050150911B
|
||||
:1012300006014115510509F440C030910701272FDF
|
||||
:1012400090E06CE801C02695832F8227369580FDBB
|
||||
:1012500036279F5F9830B9F7309307014130510529
|
||||
:1012600089F1423051050CF44AC04230510509F46D
|
||||
:101270003FC04330510579F1FA01349784E0EA31F7
|
||||
:10128000F80708F053C080911E0190911F01E817E4
|
||||
:10129000F90708F447C080911E0190911F01E817DB
|
||||
:1012A000F90791F4332309F04EC081E080932001C7
|
||||
:1012B00010920601109205010895109207011092F4
|
||||
:1012C0002001BBCF709321014F5F5F4F5093060108
|
||||
:1012D00040930501089520911E0130911F01972F21
|
||||
:1012E00080E0822B932B90931F0180931E01ECCF03
|
||||
:1012F000872F90E090931F0180931E01E5CF411549
|
||||
:10130000510509F0B9CF7634F9F281E080930801F4
|
||||
:1013100082E060E070E00E94E60840910501509193
|
||||
:101320000601D2CFEE5DFE4F7083CECF1092060144
|
||||
:101330001092050181E08093080184E060E070E094
|
||||
:101340000E94E608089581E08093080183E060E050
|
||||
:1013500070E00E94E608ACCF88B3817F88BB87B37A
|
||||
:10136000866187BBBB9810920901089588B3817E7E
|
||||
:1013700088BB87B3817E87BB08952F923F924F929F
|
||||
:101380005F926F927F928F929F92AF92BF92CF9215
|
||||
:10139000DF92EF92FF920F931F93DF93CF93CDB71E
|
||||
:1013A000DEB72A970FB6F894DEBF0FBECDBF9C8381
|
||||
:1013B0008B837E836D83181619060CF079C02090FC
|
||||
:1013C0001C0130901D0160901A0170901B0120914A
|
||||
:1013D0001801309119013A8329838090140190906B
|
||||
:1013E0001501A0901601B090170140911001509185
|
||||
:1013F00011016091120170911301E0900C01F090C5
|
||||
:101400000D0100910E0110910F0180910A01909140
|
||||
:101410000B019A87898750900901CC24DD24ED8146
|
||||
:10142000FE81EC0DFD1DE0819DEF591609F443C0CE
|
||||
:10143000AEEF5A1609F4C1C0552009F06EC05E2EF9
|
||||
:101440001A8619860894C11CD11C2B813C81C216B6
|
||||
:10145000D3062CF330921D0120921C0170921B01C7
|
||||
:1014600060921A0189819A819093190180931801E1
|
||||
:101470008092140190921501A0921601B09217016A
|
||||
:101480004093100150931101609312017093130166
|
||||
:10149000E0920C01F0920D0100930E0110930F01E8
|
||||
:1014A000A985BA85B0930B01A0930A015092090156
|
||||
:1014B00021E030E068C029853A85232B09F0BDC0C2
|
||||
:1014C0008E2E9924AA24BB2440E050E060E070E016
|
||||
:1014D000EE24FF248701D501C40186709070A070AE
|
||||
:1014E000B0700097A105B10509F480C08430910562
|
||||
:1014F000A105B10509F42DC182309105A105B10501
|
||||
:1015000009F427C10697A105B10509F469C0A985A9
|
||||
:10151000BA851196BA87A98795CF30921D0120927E
|
||||
:101520001C0170921B0160921A01A981BA81B093CB
|
||||
:101530001901A09318018092140190921501A092B4
|
||||
:101540001601B0921701409310015093110160935E
|
||||
:10155000120170931301E0920C01F0920D010093BF
|
||||
:101560000E0110930F01E985FA85F0930B01E093CA
|
||||
:101570000A015092090188B3817E88BB87B3817EBE
|
||||
:1015800087BB20E030E0C9012A960FB6F894DEBF91
|
||||
:101590000FBECDBFCF91DF911F910F91FF90EF90C4
|
||||
:1015A000DF90CF90BF90AF909F908F907F906F9083
|
||||
:1015B0005F904F903F902F90089529853A85232B77
|
||||
:1015C00009F05CC08E2F90E09A8389832224332413
|
||||
:1015D0006624772489859A8501969A87898732CFF0
|
||||
:1015E00029853A852830310509F091CF80FE95C0D4
|
||||
:1015F000C29AC49AE114F1040105110571F020E0CA
|
||||
:1016000030E088B390E1892788BB88B3892788BBFD
|
||||
:101610002F5F3F4F2E153F05A1F74115510561057D
|
||||
:10162000710549F080E090E022E02A95F1F70196FB
|
||||
:1016300084179507C9F755246ACF89859A85049739
|
||||
:1016400008F06DC081FC8BC08E2F90E0A0E0B0E070
|
||||
:1016500029853A852150304E220F331F220F331F28
|
||||
:10166000220F331F04C0880F991FAA1FBB1F2A9582
|
||||
:10167000D2F7482B592B6A2B7B2B2DCFA985BA8506
|
||||
:10168000119709F48DC02114310479F4E7FD0AC0E3
|
||||
:101690002E2E332429813A816216730608F49ACFDC
|
||||
:1016A000552498CFA1E02A2E312C8E2F90E0DC011A
|
||||
:1016B000A170B070F2E04F2E4E22E2FD6AC0EFEF53
|
||||
:1016C000FFEF2114310409F476C020E030E01EC0A1
|
||||
:1016D000C29A442001F1C19AC498C49A8FEFEF3F97
|
||||
:1016E000F80759F086B386958695869590E08170C7
|
||||
:1016F0009070E817F90709F061C00894611C711C2B
|
||||
:101700002F5F3F4F2215330508F055C0109701F7A2
|
||||
:10171000C298442001F7C198DFCFC2986ACF8E2FBC
|
||||
:1017200090E0A0E0B0E029853A852550304E220FA8
|
||||
:10173000331F220F331F220F331F04C0880F991F3E
|
||||
:10174000AA1FBB1F2A95D2F7482B592B6A2B7B2B3C
|
||||
:10175000C2CEE985FA85349709F0D4CE47CF8E2FD3
|
||||
:1017600090E0A0E0B0E029853A852150304E220F6C
|
||||
:10177000331F220F331F220F331F04C0880F991FFE
|
||||
:10178000AA1FBB1F2A95D2F7E82AF92A0A2B1B2B7E
|
||||
:10179000A2CEE695E695E695F0E0E170F07091CF87
|
||||
:1017A000E8871F82E981FA812F813885E22BF32BAC
|
||||
:1017B000FA83E9830FCF222433246CCF30921D01AA
|
||||
:1017C00020921C0170921B0160921A01A981BA81BA
|
||||
:1017D000B0931901A0931801809214019092150101
|
||||
:1017E000A0921601B092170140931001509311017D
|
||||
:1017F0006093120170931301E0920C01F0920D01BD
|
||||
:1018000000930E0110930F01E985FA85F0930B0107
|
||||
:10181000E0930A018EEF80930901ADCEF894FFCFDB
|
||||
:00000001FF
|
175
jtag.c
Normal file
175
jtag.c
Normal file
@ -0,0 +1,175 @@
|
||||
#include "defines.h"
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <inttypes.h>
|
||||
#include "jtag.h"
|
||||
#include "jtag_commands.h"
|
||||
|
||||
static uint8_t jtag_current_command = 0;
|
||||
static uint16_t jtag_pos = 0;
|
||||
static uint32_t jtag_tck_delay_value = 0;
|
||||
static uint32_t jtag_num_tck = 0;
|
||||
static uint32_t jtag_usecs = 0;
|
||||
static uint16_t jtag_multi_count = 0;
|
||||
static uint16_t jtag_multi_pos = 0;
|
||||
static uint16_t jtag_multi_multi = 0;
|
||||
|
||||
static void tck_delay(uint8_t tms, uint32_t num_tck, uint32_t usecs)
|
||||
{
|
||||
if (tms)
|
||||
PORT |= (1<<TMS_PIN);
|
||||
else
|
||||
PORT &= ~(1<<TMS_PIN);
|
||||
PORT |= 1<<TCK_PIN;
|
||||
int i;
|
||||
for (i = 0; i < num_tck; i++)
|
||||
{
|
||||
PORT ^= 1<<TCK_PIN;
|
||||
//_delay_us(1);
|
||||
PORT ^= 1<<TCK_PIN;
|
||||
//_delay_us(1);
|
||||
}
|
||||
for (i = 0; i < usecs; i++)
|
||||
_delay_us(1);
|
||||
}
|
||||
|
||||
static uint8_t pulse_tck(int tms, int tdi, int tdo)
|
||||
{
|
||||
if (tms)
|
||||
PORT |= (1<<TMS_PIN);
|
||||
else
|
||||
PORT &= ~(1<<TMS_PIN);
|
||||
if (tdi >= 0)
|
||||
{
|
||||
if (tdi)
|
||||
PORT |= (1<<TDI_PIN);
|
||||
else
|
||||
PORT &= ~(1<<TDI_PIN);
|
||||
}
|
||||
PORT &= ~(1<<TCK_PIN);
|
||||
//_delay_us(1);
|
||||
PORT |= 1<<TCK_PIN;
|
||||
//_delay_us(1);
|
||||
if (tdo < 0) return 1;
|
||||
return ((PORT_PIN >> TDO_PIN) & 1) == tdo;
|
||||
}
|
||||
|
||||
static int jtag_parse_byte(uint8_t data)
|
||||
{
|
||||
int i, tms, tdi, tdo;
|
||||
switch (jtag_current_command)
|
||||
{
|
||||
case 0:
|
||||
jtag_current_command = data;
|
||||
jtag_pos = 0;
|
||||
break;
|
||||
|
||||
case JTAG_PULSE_TCK_DELAY:
|
||||
if (jtag_pos == 0)
|
||||
{
|
||||
jtag_num_tck = 0;
|
||||
jtag_usecs = 0;
|
||||
jtag_tck_delay_value = data;
|
||||
} else {
|
||||
if ((jtag_pos < 4) && (jtag_tck_delay_value & 0b10)) // num_tck
|
||||
{
|
||||
jtag_num_tck |= (uint32_t)data << (8*(jtag_pos-1));
|
||||
} else if ((jtag_pos < 4) && !(jtag_tck_delay_value & 0b10)) // usecs
|
||||
{
|
||||
jtag_usecs |= (uint32_t)data << (8*(jtag_pos-1));
|
||||
} else {
|
||||
jtag_usecs |= (uint32_t)data << (8*(jtag_pos-5));
|
||||
}
|
||||
}
|
||||
if ( ((jtag_tck_delay_value & 0b110) == 0)
|
||||
|| (((((jtag_tck_delay_value & 0b110) == 0b100) || (jtag_tck_delay_value & 0b110) == 0b010)) && jtag_pos == 4)
|
||||
|| (((jtag_tck_delay_value & 0b110) == 0b110) && jtag_pos == 8)
|
||||
)
|
||||
{
|
||||
tck_delay(jtag_tck_delay_value&1, jtag_num_tck, jtag_usecs);
|
||||
jtag_current_command = 0;
|
||||
}
|
||||
jtag_pos++;
|
||||
break;
|
||||
|
||||
case JTAG_PULSE_TCK_MULTI:
|
||||
if (jtag_pos == 0)
|
||||
{
|
||||
jtag_multi_count = data;
|
||||
jtag_multi_pos = 0;
|
||||
jtag_multi_multi = 0;
|
||||
} else if (jtag_pos == 1)
|
||||
{
|
||||
jtag_multi_count |= (uint16_t)data << 8;
|
||||
} else {
|
||||
if (!jtag_multi_multi && !(data & 0x80))
|
||||
{
|
||||
jtag_multi_multi = data;
|
||||
} else {
|
||||
if (!jtag_multi_multi) jtag_multi_multi = 1;
|
||||
tms = data&1;
|
||||
tdi = (data>>1)&1;
|
||||
tdo = -1;
|
||||
if (data & (1<<2))
|
||||
{
|
||||
tdo = (data>>3)&1;
|
||||
}
|
||||
for (i = 0; i < jtag_multi_multi; i++)
|
||||
{
|
||||
if (!pulse_tck(tms, tdi, tdo)) return 0;
|
||||
jtag_multi_pos++;
|
||||
}
|
||||
jtag_multi_multi = 0;
|
||||
}
|
||||
if (jtag_multi_pos >= jtag_multi_count)
|
||||
jtag_current_command = 0;
|
||||
}
|
||||
jtag_pos++;
|
||||
break;
|
||||
|
||||
/*
|
||||
case JTAG_PULSE_TCK:
|
||||
tms = data&1;
|
||||
tdi = (data>>1)&1;
|
||||
tdo = -1;
|
||||
if (data & (1<<2))
|
||||
{
|
||||
tdo = (data>>3)&1;
|
||||
}
|
||||
if (!pulse_tck(tms, tdi, tdo)) return 0;
|
||||
jtag_current_command = 0;
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void jtag_setup()
|
||||
{
|
||||
PORT &= ~((1<<TMS_PIN) | (1<<TDO_PIN) | (1<<TDI_PIN)) | (1<<TCK_PIN);
|
||||
PORT_DDR |= (1<<TMS_PIN) | (1<<TCK_PIN) | (1<<TDI_PIN);
|
||||
PORT_DDR &= ~(1<<TDO_PIN);
|
||||
jtag_current_command = 0;
|
||||
}
|
||||
|
||||
void jtag_shutdown()
|
||||
{
|
||||
PORT &= ~((1<<TMS_PIN) | (1<<TCK_PIN) | (1<<TDO_PIN) | (1<<TDI_PIN));
|
||||
PORT_DDR &= ~((1<<TMS_PIN) | (1<<TCK_PIN) | (1<<TDO_PIN) | (1<<TDI_PIN));
|
||||
}
|
||||
|
||||
int jtag_execute(int count, uint8_t* data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (!jtag_parse_byte(data[i]))
|
||||
{
|
||||
jtag_shutdown();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
16
jtag.h
Normal file
16
jtag.h
Normal file
@ -0,0 +1,16 @@
|
||||
#include "defines.h"
|
||||
|
||||
#define CLUJTAG_CONCAT(a, b) a ## b
|
||||
#define CLUJTAG_OUTPORT(name) CLUJTAG_CONCAT(PORT, name)
|
||||
#define CLUJTAG_INPORT(name) CLUJTAG_CONCAT(PIN, name)
|
||||
#define CLUJTAG_DDRPORT(name) CLUJTAG_CONCAT(DDR, name)
|
||||
|
||||
#define PORT CLUJTAG_OUTPORT(JTAG_PORT)
|
||||
#define PORT_DDR CLUJTAG_DDRPORT(JTAG_PORT)
|
||||
#define PORT_PIN CLUJTAG_INPORT(JTAG_PORT)
|
||||
#define PORT_LED CLUJTAG_OUTPORT(LED_PORT)
|
||||
#define PORT_LED_DDR CLUJTAG_DDRPORT(LED_PORT)
|
||||
|
||||
void jtag_setup();
|
||||
void jtag_shutdown();
|
||||
int jtag_execute(int count, uint8_t* data);
|
7
jtag_commands.h
Normal file
7
jtag_commands.h
Normal file
@ -0,0 +1,7 @@
|
||||
#define JTAG_PULSE_TCK_DELAY 0xFD
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD>: 0<><30><EFBFBD> - TMS, 1<><31><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCK, 2<><32><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCK, <20><><EFBFBD><EFBFBD><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD> usec
|
||||
|
||||
#define JTAG_PULSE_TCK_MULTI 0xFE
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD>: <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> 1-127 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>: 0<><30><EFBFBD> - TMS, 1<><31><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> TDI, 2<><32><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TDI, 3<><33><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> TDO, 4<><34><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TDO
|
||||
// <20><><EFBFBD><EFBFBD> 7<><37><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 1<><31><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> TDI, 2<><32><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TDI, 3<><33><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> TDI, 4<><34><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TDO
|
BIN
schematics/famicom_dumper.dch
Normal file
BIN
schematics/famicom_dumper.dch
Normal file
Binary file not shown.
BIN
schematics/famicom_dumper.png
Normal file
BIN
schematics/famicom_dumper.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
54
usart.c
Normal file
54
usart.c
Normal file
@ -0,0 +1,54 @@
|
||||
#include "defines.h"
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
void USART_init(void)
|
||||
{
|
||||
unsigned int bd = (F_CPU / (16UL * UART_BAUD)) - 1;
|
||||
UBRR0L = bd & 0xFF;
|
||||
UBRR0H = bd >> 8;
|
||||
|
||||
UCSR0B = _BV(TXEN0) | _BV(RXEN0) | _BV(RXCIE0); /* tx/rx enable */
|
||||
// UCSRC = 1<<URSEL|1<<UCSZ0|1<<UCSZ1;
|
||||
UCSR0C |= /*_BV(UMSEL0) |*/ _BV(UCSZ01) | _BV(UCSZ00);
|
||||
//UCSRA = _BV(U2X);
|
||||
}
|
||||
|
||||
void USART_TransmitByte( unsigned char data )
|
||||
{
|
||||
/* Wait for empty transmit buffer */
|
||||
while ( !( UCSR0A & (1<<UDRE0)) );
|
||||
/* Put data into buffer, sends the data */
|
||||
UDR0 = data;
|
||||
}
|
||||
|
||||
void USART_TransmitHex( unsigned char data )
|
||||
{
|
||||
unsigned char h = data>>4;
|
||||
char ho = (h < 10) ? (h+'0') : (h+'A'-10);
|
||||
unsigned char l = data & 0xF;
|
||||
char lo = (l < 10) ? (l+'0') : (l+'A'-10);
|
||||
while ( !( UCSR0A & (1<<UDRE0)) );
|
||||
UDR0 = ho;
|
||||
while ( !( UCSR0A & (1<<UDRE0)) );
|
||||
UDR0 = lo;
|
||||
}
|
||||
|
||||
void USART_TransmitText(char* data)
|
||||
{
|
||||
while (*data != 0)
|
||||
{
|
||||
/* Wait for empty transmit buffer */
|
||||
while ( !( UCSR0A & (1<<UDRE0)) );
|
||||
/* Put data into buffer, sends the data */
|
||||
UDR0 = *data;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
void USART_Transmit(void* p, unsigned long int len)
|
||||
{
|
||||
unsigned char* buff = (unsigned char*)p;
|
||||
unsigned long int b;
|
||||
for (b = 0; b < len; b++) USART_TransmitByte(buff[b]);
|
||||
}
|
Reference in New Issue
Block a user