CC = ckcore-elf-gcc
AS = ckcore-elf-as
LD = ckcore-elf-ld
CFLAGS = -mbig-endian -c -O2 -g
ASFLAGS = -mbig-endian
OBJECT = tinyloader.o tiny_spi.o tiny_main.o vectors.o \
main.o pll_config.o tinyloader2.o \
compress.o unzip_main.o 6102.o
TEMP_FILE1 := main.TM1
TEMP_FILE2 := main.TM2
all :flash ready
flash : bootloader.elf
ckcore-elf-objcopy bootloader.elf bootloader.bin -O binary -S -g -R .note -R .comment \
--change-section-lma .loadertext=0x60000000 \ --change-section-lma .loadertext2=0x60000800 \
--change-section-lma .text=0x60010000
xxd -c4 -p bootloader.bin > TEMP_FILE1
sed -e '2c300155AA' TEMP_FILE1 > TEMP_FILE2
xxd -r -c4 -p TEMP_FILE2 > bootloader.bin rm -f TEMP_FILE1
rm -f TEMP_FILE2
ready : main.elf
ckcore-elf-objcopy main.elf 6102.bin -O binary -S -g -R .loadertext -R .loaderbss
gzip -n9 6102.bin
bin2h 6102.bin.gz 6102.c
bootloader.elf : $(OBJECT)
$(LD) -T link.ld -EB $(OBJECT) -o $@
bootloader.txt : bootloader.elf
ckcore-elf-objdump -D $^ > $@
%.o : %.c
$(CC) $(CFLAGS) $^ -o $@
%.o : %.S
$(CC) $(CFLAGS) $^ -o $@
clean:
rm -f *.o *.srec *.hex bootloader.elf *.gz
红色的部分不是很清楚 请讲解下 !!顺便能总体讲解下 更好!!!!!