Просмотр исходного кода

fw: move sdram downloader test data to assembly

Put the sdram downloader test data in an assembly file instead of
Perl. This slots much better into the new infrastructure (dram.hex)
but also appears to be 10-100x faster.
H. Peter Anvin 3 лет назад
Родитель
Сommit
0855fd5684
10 измененных файлов с 5684 добавлено и 5675 удалено
  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. 4 9
      fw/Makefile
  6. 5650 5650
      fw/boot.mif
  7. 5 2
      fw/hello.c
  8. 11 3
      fw/max80.ld
  9. 14 0
      fw/testdata.S
  10. 0 11
      fw/testdata.pl

BIN
fpga/output_files/max80.jbc


BIN
fpga/output_files/max80.jic


BIN
fpga/output_files/max80.pof


BIN
fpga/output_files/max80.sof


+ 4 - 9
fw/Makefile

@@ -38,7 +38,7 @@ boot_stride := 1
 
 max80.elf: head.o die.o dummy.o irqtable.o irqasm.o sbrk.o hello.o \
 	  console.o sdcard.o rtc.o memset.o \
-	  abcdrive.o fatfs.a
+	  abcdrive.o testdata.o fatfs.a
 
 FATFS_C = $(wildcard fatfs/source/*.c)
 FATFS_O = $(FATFS_C:.c=.o)
@@ -63,6 +63,9 @@ boot.bin: max80.elf
 dram.bin: max80.elf
 	$(OBJCOPY) -O binary -j '.dram*' $< $@
 
+dram.hex: max80.elf
+	$(OBJCOPY) -O ihex -j '.dram*' $< $@
+
 %.elf: $(LDSCRIPT)
 	$(CC) $(LDFLAGS) -o $@ $(filter-out $(LDSCRIPT),$^)
 
@@ -93,14 +96,6 @@ iodevs.h: ../iodevs.conf ../tools/iodevs.pl
 irqtable.c: ../iodevs.conf ../tools/iodevs.pl
 	$(PERL) ../tools/iodevs.pl c $< $@
 
-testdata.bin: testdata.pl
-	$(PERL) $< > $@
-
-dram.hex: testdata.bin dram.bin
-	cat $^ > $@.bin
-	$(OBJCOPY) -I binary -O ihex $@.bin $@
-	rm -f $@.bin
-
 clean:
 	rm -f *.o *.i *.s *.elf *.bin .*.d *.ild $(genhdrs) $(gensrcs)
 

Разница между файлами не показана из-за своего большого размера
+ 5650 - 5650
fw/boot.mif


+ 5 - 2
fw/hello.c

@@ -91,10 +91,13 @@ static void test_sdram(void)
 #endif
 }
 
+#define TESTDATA_WORDS (128*1024)
+extern uint32_t testdata[TESTDATA_WORDS];
+
 static void test_download(void)
 {
-    volatile uint32_t *p = (uint32_t *)SDRAM_ADDR;
-    const unsigned int words = 128*1024;
+    const unsigned int words = TESTDATA_WORDS;
+    volatile uint32_t *p = testdata;
     unsigned int ok = words;
     uint32_t val = 0x00001111;
     unsigned int ratelimit = ERROR_RATELIMIT;

+ 11 - 3
fw/max80.ld

@@ -145,11 +145,19 @@ SECTIONS
 
 	/* Sections in SDRAM */
 
-	.dram.data (NOLOAD) : {
-		. = . + 512*1024; /* testdata hack */
+	.dram.text : ALIGN(4) {
+		*(.dram.text*)
 	} >DRAM
 
-	.dram.bss (NOLOAD) : {
+	.dram.rodata : ALIGN(4) {
+		*(.dram.rodata*)
+	} >DRAM
+
+	.dram.data : ALIGN(4) {
+		*(.dram.data*)
+	} >DRAM
+
+	.dram.bss (NOLOAD) : ALIGN(4) {
 		*(.dram.bss*)
 	} >DRAM
 }

+ 14 - 0
fw/testdata.S

@@ -0,0 +1,14 @@
+	.section ".dram.rodata","a"
+	.globl testdata
+testdata:
+	x = 0x00001111
+	y = 0
+
+	.rept 0x20000
+	.long x
+	x = ((x * 0x89abcdef) + ((x * 0x89abcdef) >> 32) + (y * 0x76543210)) & 0xffffffff
+	y = y + 1
+	.endr
+
+	.type testdata,@object
+	.size testdata,. - testdata

+ 0 - 11
fw/testdata.pl

@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-
-use bigint;
-use strict;
-
-my $x = 0x00001111;
-for (my $i = 0; $i < 128*1024; $i++) {
-    print pack("V", $x);
-    $x = (($x * 0x89abcdef) + (($x * 0x89abcdef) >> 32) + ($i * 0x76543210))
-	& 0xffffffff;
-}

Некоторые файлы не были показаны из-за большого количества измененных файлов