Quellcode durchsuchen

abcmem: update the MMU setup; overlay test image with dram_bss

abcmem: actually present a reasonable memory map, and reserve memory
for the ABC80 extension memory.

max80.ld: overlay dram_bss with the test image. Once we load the test
image there is no going back anyway, and the big thing is to have it
in ROM.
H. Peter Anvin vor 3 Jahren
Ursprung
Commit
a5b7b041ad
11 geänderte Dateien mit 5252 neuen und 5217 gelöschten Zeilen
  1. BIN
      fpga/output_files/max80.jbc
  2. BIN
      fpga/output_files/max80.jic
  3. BIN
      fpga/output_files/max80.pof
  4. BIN
      fpga/output_files/max80.sof
  5. 2 2
      fw/Makefile
  6. 2 0
      fw/abcio.h
  7. 43 0
      fw/abcmem.c
  8. 5192 5192
      fw/boot.mif
  9. 0 2
      fw/diskcache.c
  10. 1 17
      fw/main.c
  11. 12 4
      fw/max80.ld

BIN
fpga/output_files/max80.jbc


BIN
fpga/output_files/max80.jic


BIN
fpga/output_files/max80.pof


BIN
fpga/output_files/max80.sof


+ 2 - 2
fw/Makefile

@@ -42,7 +42,7 @@ ROMOBJS  = $(ROMS:.rom=.o)
 max80.elf: head.o die.o main.o dummy.o irqtable.o irqasm.o sbrk.o \
 	  console.o rtc.o romcopy.o \
 	  sdcard.o diskcache.o \
-	  abcio.o abcdisk.o \
+	  abcio.o abcdisk.o abcmem.o \
 	  memset.o memcpy.o \
 	  runtest.o start_test.o \
 	  $(ROMOBJS) \
@@ -52,7 +52,7 @@ max80.elf: head.o die.o main.o dummy.o irqtable.o irqasm.o sbrk.o \
 testimg.elf: head.o die.o test/main.o dummy.o irqtable.o irqasm.o sbrk.o \
 	  console.o rtc.o romcopy.o \
 	  sdcard.o diskcache.o \
-	  abcio.o abcdisk.o \
+	  abcio.o abcdisk.o abcmem.o \
 	  memset.o memcpy.o \
 	  testdata.o \
 	  fatfs.a

+ 2 - 0
fw/abcio.h

@@ -45,4 +45,6 @@ void abc_init(void);
 void abcdisk_init(void);
 void abcdisk_io_poll(void);
 
+void abc_init_memmap(void);
+
 #endif /* ABCIO_H */

+ 43 - 0
fw/abcmem.c

@@ -0,0 +1,43 @@
+#include "fw.h"
+#include "io.h"
+#include "abcio.h"
+#include "sys.h"
+
+/* Configure ABC memory map */
+struct abc_mem_init {
+    unsigned int addr;
+    uint16_t len;
+    uint8_t flags;
+    const char *data;		/* May not be const, but... */
+};
+#define RD (ABCMEMMAP_RD >> 24)
+#define WR (ABCMEMMAP_WR >> 24)
+
+extern const char rom_ufddos80[];
+
+static char __dram_bss abc80_extmem[16 << 10];
+
+static const struct abc_mem_init mem_init[] = {
+    { 0x5800,  2 << 10, RD, rom_ufddos80 },
+    { 0x8000, 16 << 10, RD|WR, abc80_extmem },
+    { -1U, 0, 0, NULL }
+};
+
+void abc_init_memmap(void)
+{
+
+    volatile uint32_t *pg = &ABCMEMMAP_PAGE(0);
+    const struct abc_mem_init *next = &mem_init[0];
+
+    for (unsigned int addr = 0; addr < 0x10000; addr += 512) {
+	if (addr >= next->addr + next->len)
+	    next++;
+
+	if (addr < next->addr) {
+	    *pg++ = 0;
+	} else {
+	    *pg++ = ((size_t)(next->data + (addr - next->addr))
+		     & SDRAM_MASK) | (next->flags << 24);
+	}
+    }
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 5192 - 5192
fw/boot.mif


+ 0 - 2
fw/diskcache.c

@@ -221,8 +221,6 @@ int disk_init(void)
     con_printf("sdcard: %u/%u clusters free, clusters = %u bytes\n",
 	       freeclust, fs->n_fatent - 2, fs->csize << 9);
 
-    abcdisk_init();
-
     return 0;
 }
 

+ 1 - 17
fw/main.c

@@ -14,22 +14,6 @@ IRQHANDLER(sysclock)
     set_led(count >> 3); /* 4 Hz */
 }
 
-/* Configure ABC memory map */
-static void init_abc_memmap(void)
-{
-    volatile uint32_t *pg = &ABCMEMMAP_PAGE(0);
-
-    for (unsigned int addr = 0; addr < 0x10000; addr += 512) {
-	if (addr >= 0x5800 && addr < 0x6000) {
-	    *pg++ = ABCMEMMAP_RD | addr;
-	} else if (addr >= 0x8000 && addr < 0xc000) {
-	    *pg++ = ABCMEMMAP_RD | ABCMEMMAP_WR | addr;
-	} else {
-	    *pg++ = addr;	/* Disabled */
-	}
-    }
-}
-
 static no_return killed(const char *how, size_t pc)
 {
     con_printf("ERROR: %s at 0x%08x\n", how, pc);
@@ -63,8 +47,8 @@ static void init(void)
     con_set_baudrate(115200);
     con_puts(hello);
 
+    abc_init_memmap();
     abc_init();
-    init_abc_memmap();
 
     timer_irq_count = 0;
     timer_irq_start = rdtime();

+ 12 - 4
fw/max80.ld

@@ -14,6 +14,7 @@ MEMORY
 {
 	SRAM	: org = SRAM_ADDR,  len = SRAM_SIZE
 	DRAM	: org = SDRAM_ADDR, len = SDRAM_SIZE
+	DRAM2   : org = SDRAM_ADDR+SDRAM_SIZE, len = SDRAM_SIZE
 }
 
 SECTIONS
@@ -202,10 +203,17 @@ SECTIONS
 	__dram_init_end = .;
 	__dram_init_len = __dram_init_end - __dram_init_start;
 
-	/* Test program image */
-	.dram.test : ALIGN(4) {
-		KEEP(*(.dram.test*))
-	} >DRAM
+	/* Keeps ld from getting confused */
+	. = . + SDRAM_SIZE;
+
+	/* Test program image - overlays */
+	.dram.test __dram_init_end + SDRAM_SIZE :
+		   AT(SRAM_SIZE + __dram_init_len) ALIGN(4) {
+		   KEEP(*(.dram.test*))
+	} >DRAM2
+
+	/* bss can overlay the test program image */
+	. = __dram_init_end;
 
 	__dram_bss_start = .;
 	.dram.bss (NOLOAD) : ALIGN(8) {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.