This commit is contained in:
Markus Fröschle
2012-12-20 11:30:48 +00:00
parent 023972adb0
commit 74b7072916
3 changed files with 24 additions and 20 deletions

View File

@@ -48,7 +48,8 @@ MAPFILE=bas.map
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC) # Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
LDCFILE=bas.lk LDCFILE=bas.lk
LDCSRC=bas.lk.in LDCSRC=bas.lk.in
LDCBFS=basflash.lk LDCBSRC=basflash.lk.in
LDCBFS=bashflash.lk
# this Makefile can create the BaS to flash or an arbitrary ram address (for BDM debugging). See # this Makefile can create the BaS to flash or an arbitrary ram address (for BDM debugging). See
# below for the definition of TARGET_ADDRESS # below for the definition of TARGET_ADDRESS
@@ -67,7 +68,8 @@ CSRCS= \
$(SRCDIR)/ff.c \ $(SRCDIR)/ff.c \
$(SRCDIR)/sd_card.c \ $(SRCDIR)/sd_card.c \
$(SRCDIR)/wait.c \ $(SRCDIR)/wait.c \
$(SRCDIR)/s19reader.c\ $(SRCDIR)/s19reader.c \
$(SRCDIR)/flash.c \
$(SRCDIR)/basflash.c $(SRCDIR)/basflash.c
ASRCS= \ ASRCS= \
@@ -85,11 +87,11 @@ OBJS=$(COBJS) $(AOBJS)
all: $(FLASH_EXEC) all: $(FLASH_EXEC)
ram: $(RAM_EXEC) ram: $(RAM_EXEC)
.PHONY basflash: $(BASFLASH_EXEC) bfl: $(BASFLASH_EXEC)
.PHONY clean: .PHONY clean:
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19\ @ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19 \
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19\ $(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19 \
$(BASFLASH_EXEC) $(BASFLASH_EXEC).elf $(BASFLASH_EXEC).s19 \ $(BASFLASH_EXEC) $(BASFLASH_EXEC).elf $(BASFLASH_EXEC).s19 \
$(OBJS) $(MAPFILE) $(LDCFILE) depend $(OBJS) $(MAPFILE) $(LDCFILE) depend
@@ -106,6 +108,7 @@ else
endif endif
$(BASFLASH_EXEC): $(OBJS) $(LDCBFL) $(BASFLASH_EXEC): $(OBJS) $(LDCBFL)
$(CPP) -P -DTARGET_ADDRESS=$(BF_TARGET_ADDRESS) -DFORMAT=$(FORMAT) $(LDCBSRC) -o $(LDCBFS)
$(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCBFS) -o $@ $(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCBFS) -o $@
ifeq ($(COMPILE_ELF),Y) ifeq ($(COMPILE_ELF),Y)
$(OBJCOPY) -O srec $@ $@.s19 $(OBJCOPY) -O srec $@ $@.s19

View File

@@ -25,33 +25,33 @@
* Copyright 2012 M. Froeschle * Copyright 2012 M. Froeschle
*/ */
#include <stdint.h>
void chip_erase(uint8_t *address) void chip_erase(uint8_t *address)
{ {
* (address + 0xaaa) = 0xaa; * (volatile uint8_t *) (address + 0xaaa) = 0xaa;
* (address + 0x555) = 0x55; * (volatile uint8_t *) (address + 0x555) = 0x55;
* (address + 0xaaa) = 0x80; * (volatile uint8_t *) (address + 0xaaa) = 0x80;
* (address + 0xaaa) = 0xaa; * (volatile uint8_t *) (address + 0xaaa) = 0xaa;
* (address + 0x555) = 0x55; * (volatile uint8_t *) (address + 0x555) = 0x55;
* (address + 0xaaa) = 0x10; * (volatile uint8_t *) (address + 0xaaa) = 0x10;
} }
void sector_erase(uint8_t *address, uint16_t sector) void sector_erase(uint8_t *address, uint16_t sector)
{ {
* (address + 0xaaa) = 0xaa; * (volatile uint8_t *) (address + 0xaaa) = 0xaa;
* (address + 0x555) = 0x55; * (volatile uint8_t *) (address + 0x555) = 0x55;
* (address + 0xaaa) = 0x80; * (volatile uint8_t *) (address + 0xaaa) = 0x80;
* (address + 0xaaa) = 0xaa; * (volatile uint8_t *) (address + 0xaaa) = 0xaa;
* (address + 0x555) = 0x55; * (volatile uint8_t *) (address + 0x555) = 0x55;
* (address + sector) = 0x30; * (volatile uint8_t *) (address + sector) = 0x30;
do { do {
; ;
} while (* (uint32_t *) (address + sector) != 0xffffffff); } while (* (volatile uint32_t *) (address + sector) != 0xffffffff);
} }
#ifdef _NOT_USED_
* MX28LV640DB.alg * MX28LV640DB.alg
bra lab0x5a bra lab0x5a
move.w #0xaa,d0 move.w #0xaa,d0
@@ -107,3 +107,4 @@ lab0x88:
nop nop
halt halt
nop nop
#endif /* _NOT_USED_ */