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)
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
@@ -68,6 +69,7 @@ CSRCS= \
$(SRCDIR)/sd_card.c \
$(SRCDIR)/wait.c \
$(SRCDIR)/s19reader.c \
$(SRCDIR)/flash.c \
$(SRCDIR)/basflash.c
ASRCS= \
@@ -85,7 +87,7 @@ 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 \
@@ -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

View File

@@ -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_ */