From: Florent Kermarrec Date: Tue, 10 Nov 2015 11:22:08 +0000 (+0100) Subject: soc/software: remove memtest (should be re-written) X-Git-Tag: 24jan2021_ls180~2091 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4afe4a07e4d3732c2f695cfce9e4a385fc1653d3;p=litex.git soc/software: remove memtest (should be re-written) --- diff --git a/litex/soc/software/memtest/Makefile b/litex/soc/software/memtest/Makefile deleted file mode 100644 index c7b5254a..00000000 --- a/litex/soc/software/memtest/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -MSCDIR=../.. -include $(MSCDIR)/software/common.mak - -OBJECTS=isr.o main.o - -all: memtest.bin - -%.bin: %.elf - $(OBJCOPY) -O binary $< $@ - chmod -x $@ - -memtest.elf: $(OBJECTS) libs - -%.elf: - $(LD) $(LDFLAGS) \ - -T $(MSCDIR)/software/libbase/linker-sdram.ld \ - -N -o $@ \ - $(MSCDIR)/software/libbase/crt0-$(CPU).o \ - $(OBJECTS) \ - -L$(MSCDIR)/software/libbase \ - -L$(MSCDIR)/software/libcompiler-rt \ - -lbase -lcompiler-rt - chmod -x $@ - -main.o: main.c - $(compile) - -%.o: %.c - $(compile) - -%.o: %.S - $(assemble) - -libs: - $(MAKE) -C $(MSCDIR)/software/libcompiler-rt - $(MAKE) -C $(MSCDIR)/software/libbase - -load: memtest.bin - $(MAKE) -C $(MSCDIR)/tools - $(MSCDIR)/tools/flterm --port /dev/ttyUSB0 --kernel memtest.bin - - -clean: - $(RM) $(OBJECTS) memtest.elf memtest.bin - $(RM) .*~ *~ - -.PHONY: all main.o clean libs load diff --git a/litex/soc/software/memtest/isr.c b/litex/soc/software/memtest/isr.c deleted file mode 100644 index c49d31d8..00000000 --- a/litex/soc/software/memtest/isr.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -void isr(void); -void isr(void) -{ - unsigned int irqs; - - irqs = irq_pending() & irq_getmask(); - - if(irqs & (1 << UART_INTERRUPT)) - uart_isr(); -} diff --git a/litex/soc/software/memtest/main.c b/litex/soc/software/memtest/main.c deleted file mode 100644 index c8858024..00000000 --- a/litex/soc/software/memtest/main.c +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static unsigned int log2(unsigned int v) -{ - unsigned int r; - r = 0; - while(v>>=1) r++; - return r; -} - -static void membw_service(void) -{ - static int last_event; - unsigned long long int nr, nw; - unsigned long long int f; - unsigned int rdb, wrb; - unsigned int dw; - - if(elapsed(&last_event, identifier_frequency_read())) { - sdram_controller_bandwidth_update_write(1); - nr = sdram_controller_bandwidth_nreads_read(); - nw = sdram_controller_bandwidth_nwrites_read(); - f = identifier_frequency_read(); - dw = sdram_controller_bandwidth_data_width_read(); - rdb = (nr*f >> (24 - log2(dw)))/1000000ULL; - wrb = (nw*f >> (24 - log2(dw)))/1000000ULL; - printf("read:%5dMbps write:%5dMbps all:%5dMbps\n", rdb, wrb, rdb + wrb); - } -} - -//#define DEBUG - -static void memtest_service(void) -{ - static unsigned int test_buffer[(MAIN_RAM_SIZE/2)/4] __attribute__((aligned(16))); - static unsigned char reading; - static unsigned int err, total_err; -#ifdef DEBUG - int i; -#endif - - if(reading) { - if(!memtest_w_busy_read()) { -#ifdef DEBUG - flush_l2_cache(); - flush_cpu_dcache(); - printf("starting read\n"); - for(i=0;i<64;i++) { - printf("%08x", test_buffer[i]); - if((i % 4) == 3) - printf("\n"); - } -#endif - memtest_r_reset_write(1); - memtest_r_base_write((unsigned int)test_buffer); - memtest_r_length_write(sizeof(test_buffer)); - memtest_r_shoot_write(1); - reading = 0; - } - } else { - if(!memtest_r_busy_read()) { - err = memtest_r_error_count_read(); - total_err += err; - printf("err=%d\t\ttotal=%d\n", err, total_err); - memtest_w_reset_write(1); - memtest_w_base_write((unsigned int)test_buffer); - memtest_w_length_write(sizeof(test_buffer)); - memtest_w_shoot_write(1); - reading = 1; - } - } -} - -int main(void) -{ - irq_setmask(0); - irq_setie(1); - uart_init(); - - puts("Memory testing software built "__DATE__" "__TIME__"\n"); - - if((memtest_w_magic_read() != 0x361f) || (memtest_r_magic_read() != 0x361f)) { - printf("Memory test cores not detected\n"); - while(1); - } - - time_init(); - - flush_l2_cache(); - while(1) { - memtest_service(); - membw_service(); - } - - return 0; -}