- fixed bootloader makefile

- interupts disabled after bootloader
- enable interrupts in board file


git-svn-id: http://moon:8086/svn/mips@109 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-20 18:39:10 +00:00
parent 5261f6a93a
commit 6b228be3f7
6 changed files with 10 additions and 29 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ $(BUILD_DIR)/%.o : %.S
$(BUILD_DIR)/bootloader.elf: $(OBJS-$(BOARD)) bootloader.c $(BUILD_DIR)/bootloader.elf: $(OBJS-$(BOARD)) bootloader.c
$(CC) $(CFLAGS) -o $(BUILD_DIR)/bootloader.o -g -c bootloader.c $(CC) $(CFLAGS) -o $(BUILD_DIR)/bootloader.o -g -c bootloader.c
$(LD) $(LFLAGS) $(LIB_DIRS) $(OBJS-$(BOARD)) bootloader.o -o $@ $(LIBS) >$@.map $(LD) $(LFLAGS) $(LIB_DIRS) $(OBJS-$(BOARD)) $(BUILD_DIR)/bootloader.o -o $@ $(LIBS) >$@.map
$(OBJDUMP) -D $@ > $@.dis $(OBJDUMP) -D $@ > $@.dis
$(OBJCOPY) $@ -j ROM --output-target=binary $@.ROM.bin $(OBJCOPY) $@ -j ROM --output-target=binary $@.ROM.bin
$(OBJCOPY) -O srec $@ $@.srec $(OBJCOPY) -O srec $@ $@.srec
@@ -67,7 +67,7 @@ $(BUILD_DIR)/bootloader.elf: $(OBJS-$(BOARD)) bootloader.c
$(BUILD_DIR)/bootloader_with_flash.elf: $(OBJS-$(BOARD)) bootloader_with_flash.c ../cfiflash.c $(BUILD_DIR)/bootloader_with_flash.elf: $(OBJS-$(BOARD)) bootloader_with_flash.c ../cfiflash.c
$(CC) $(CFLAGS) -o $(BUILD_DIR)/bootloader_with_flash.o -g -c bootloader_with_flash.c $(CC) $(CFLAGS) -o $(BUILD_DIR)/bootloader_with_flash.o -g -c bootloader_with_flash.c
$(CC) $(CFLAGS) -o $(BUILD_DIR)/cfiflash.o -g -c ../cfiflash.c $(CC) $(CFLAGS) -o $(BUILD_DIR)/cfiflash.o -g -c ../cfiflash.c
$(LD) $(LFLAGS) $(LIB_DIRS) $(OBJS-$(BOARD)) cfiflash.o bootloader_with_flash.o -o $@ $(LIBS) >$@.map $(LD) $(LFLAGS) $(LIB_DIRS) $(OBJS-$(BOARD)) $(BUILD_DIR)/cfiflash.o $(BUILD_DIR)/bootloader_with_flash.o -o $@ $(LIBS) >$@.map
$(OBJDUMP) -D $@ > $@.dis $(OBJDUMP) -D $@ > $@.dis
$(OBJCOPY) $@ -j ROM --output-target=binary $@.ROM.bin $(OBJCOPY) $@ -j ROM --output-target=binary $@.ROM.bin
$(OBJCOPY) -O srec $@ $@.srec $(OBJCOPY) -O srec $@ $@.srec
+5 -9
View File
@@ -152,7 +152,7 @@ void Exec_at(void *pEntry)
( (
// Enable User Mode and Interrupts on RFE // Enable User Mode and Interrupts on RFE
// Exception Vector = 0xBFC00080 // Exception Vector = 0xBFC00080
"li $26, 0x1000000C\n" "li $26, 0x10000008\n"
"mtc0 $26, $12\n" "mtc0 $26, $12\n"
); );
@@ -178,13 +178,6 @@ void PrintCPUinfo(void)
char *cpu_type_str[7] = {"invalid", "R2000", "R3000", "R6000", "R4000", "reserved", "R6000A"}; char *cpu_type_str[7] = {"invalid", "R2000", "R3000", "R6000", "R4000", "reserved", "R6000A"};
// Print Status register
result = CP0_SR_read();
sputs("Status : ");
print_word(result);
sputs("\n");
// Print Revision // Print Revision
result = CP0_PRID_read(); result = CP0_PRID_read();
rev_id = (result >> 8) & 0xFF; rev_id = (result >> 8) & 0xFF;
@@ -201,6 +194,8 @@ void PrintCPUinfo(void)
sputs("\n"); sputs("\n");
// Print Status register
sputs("Status : ");print_word(CP0_SR_read());sputs("\n");
} }
#define MAX_IMG_SIZE (1024*1024) // bytes #define MAX_IMG_SIZE (1024*1024) // bytes
@@ -220,7 +215,8 @@ int main(int argc, char *argv[])
volatile uint32_t *pSdram32 = (uint32_t*)SDRAM_BASE; volatile uint32_t *pSdram32 = (uint32_t*)SDRAM_BASE;
sputs("\nMIPS bootloader\n"); sputs("\nMIPS bootloader\n");
PrintCPUinfo();
// ---------------------------------------------------------- // ----------------------------------------------------------
sputs("Loading image from flash at ");print_word((int)pFlashMem);sputs("\n"); sputs("Loading image from flash at ");print_word((int)pFlashMem);sputs("\n");
img_hdr = *((flash_img_hdr_t*)pFlashMem); img_hdr = *((flash_img_hdr_t*)pFlashMem);
-11
View File
@@ -11,17 +11,6 @@ _start:
# set stack pointer # set stack pointer
la $sp, stack_ptr la $sp, stack_ptr
# Set status register
# Kernel mode (SR[1]=0), Int disabled(SR[0]=0), after RFE into main
li $26, 0x1040000C
mtc0 $26, $12
li $26, 0x00000000
mtc0 $26, $13
mfc0 $26, $15
nop
mtc0 $26, $31
# Invalidate I-Cache # Invalidate I-Cache
cop0 32 cop0 32
+2 -1
View File
@@ -91,7 +91,8 @@ void board_init(void)
// Setup interrupt support // Setup interrupt support
interrupt_init(); interrupt_init();
interrupt_enable_all();
// Do some initializations here // Do some initializations here
} }
+1
View File
@@ -91,6 +91,7 @@ void board_init(void)
// Setup interrupt support // Setup interrupt support
interrupt_init(); interrupt_init();
interrupt_enable_all();
// Do some initializations here // Do some initializations here
} }
-6
View File
@@ -56,12 +56,6 @@ $install: lw $v0, 0($t1)
jalr $k0 jalr $k0
nop nop
# Set kernel-mode and enable interrupts
mfc0 $a0, $12
li $a1, 3
or $a0, $a1
mtc0 $a0, $12
# Set environment # Set environment
li $a0, 1 li $a0, 1
la $a1, argv la $a1, argv