This commit is contained in:
@@ -48,7 +48,8 @@ MAPFILE=bas.map
|
||||
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
|
||||
LDCFILE=bas.lk
|
||||
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
|
||||
# below for the definition of TARGET_ADDRESS
|
||||
@@ -67,7 +68,8 @@ CSRCS= \
|
||||
$(SRCDIR)/ff.c \
|
||||
$(SRCDIR)/sd_card.c \
|
||||
$(SRCDIR)/wait.c \
|
||||
$(SRCDIR)/s19reader.c\
|
||||
$(SRCDIR)/s19reader.c \
|
||||
$(SRCDIR)/flash.c \
|
||||
$(SRCDIR)/basflash.c
|
||||
|
||||
ASRCS= \
|
||||
@@ -85,11 +87,11 @@ OBJS=$(COBJS) $(AOBJS)
|
||||
|
||||
all: $(FLASH_EXEC)
|
||||
ram: $(RAM_EXEC)
|
||||
.PHONY basflash: $(BASFLASH_EXEC)
|
||||
bfl: $(BASFLASH_EXEC)
|
||||
|
||||
.PHONY clean:
|
||||
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19\
|
||||
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19\
|
||||
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19 \
|
||||
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19 \
|
||||
$(BASFLASH_EXEC) $(BASFLASH_EXEC).elf $(BASFLASH_EXEC).s19 \
|
||||
$(OBJS) $(MAPFILE) $(LDCFILE) depend
|
||||
|
||||
@@ -106,6 +108,7 @@ else
|
||||
endif
|
||||
|
||||
$(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 $@
|
||||
ifeq ($(COMPILE_ELF),Y)
|
||||
$(OBJCOPY) -O srec $@ $@.s19
|
||||
|
||||
@@ -25,33 +25,33 @@
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void chip_erase(uint8_t *address)
|
||||
{
|
||||
* (address + 0xaaa) = 0xaa;
|
||||
* (address + 0x555) = 0x55;
|
||||
* (address + 0xaaa) = 0x80;
|
||||
* (address + 0xaaa) = 0xaa;
|
||||
* (address + 0x555) = 0x55;
|
||||
* (address + 0xaaa) = 0x10;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x80;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x10;
|
||||
}
|
||||
|
||||
void sector_erase(uint8_t *address, uint16_t sector)
|
||||
{
|
||||
* (address + 0xaaa) = 0xaa;
|
||||
* (address + 0x555) = 0x55;
|
||||
* (address + 0xaaa) = 0x80;
|
||||
* (address + 0xaaa) = 0xaa;
|
||||
* (address + 0x555) = 0x55;
|
||||
* (address + sector) = 0x30;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x80;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + sector) = 0x30;
|
||||
|
||||
do {
|
||||
;
|
||||
} while (* (uint32_t *) (address + sector) != 0xffffffff);
|
||||
} while (* (volatile uint32_t *) (address + sector) != 0xffffffff);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
* MX28LV640DB.alg
|
||||
bra lab0x5a
|
||||
move.w #0xaa,d0
|
||||
@@ -107,3 +107,4 @@ lab0x88:
|
||||
nop
|
||||
halt
|
||||
nop
|
||||
#endif /* _NOT_USED_ */
|
||||
|
||||
Reference in New Issue
Block a user