python3 src/ls2.py versa_ecp5 ./hello_world/hello_world.bin
openocd -f top-openocd.cfg \
-c "transport select jtag; init; svf -quiet top.svf; exit"
+
+# Versa ECP5 ecpprog QSPI
+
+ecpprog -o 0 binary.bin
+
#LONG_TIMER_MULT = 1
#SHORT_TIMER_MULT = 1
+# SPI boot address 0x1000_0000, main SRAM boot would be 0x0000_0000
+# but remember to recompile external_core_top.v with a matching
+# --pc_reset=0xNNNNNNNN
+BOOT_INIT_BASE ?= 0x10000000
+
LIBGRAMDIR = ../libgram
LIBGRAMINC = ../libgram/include
-fdata-sections -ffunction-sections -I../include \
-I $(LIBGRAMINC) \
-DLONG_TIMER_MULT=$(LONG_TIMER_MULT) \
+ -DBOOT_INIT_BASE=$(BOOT_INIT_BASE) \
-DSHORT_TIMER_MULT=$(SHORT_TIMER_MULT)
ASFLAGS = $(CFLAGS)
LDFLAGS = -T powerpc.lds
calibration.o: ../libgram/src/calibration.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-coldboot.elf: coldboot.o head.o ../lib/console.o $(GRAMOBJS)
- $(LD) $(LDFLAGS) -o $@ $^
+powerpc.lds: powerpc.lds.S
+ $(CC) $(CFLAGS) -P -E powerpc.lds.S -o powerpc.lds
+
+coldboot.elf: coldboot.o head.o ../lib/console.o $(GRAMOBJS) powerpc.lds
+ $(LD) $(LDFLAGS) -o $@ coldboot.o head.o ../lib/console.o $(GRAMOBJS)
coldboot.bin: coldboot.elf
$(OBJCOPY) -O binary $^ $@
clean:
- @rm -f *.o coldboot.elf coldboot.bin coldboot.hex coldboot.as
+ @rm -f *.o coldboot.elf coldboot.bin coldboot.hex coldboot.as powerpc.lds
distclean: clean
rm -f *~
//puts("Firmware launched...\n");
puts("fw..");
-#if 1
#if 1
// print out configuration parameters for QSPI
volatile uint32_t *qspi_cfg = (uint32_t*)0xc0003000;
- for (int k=0; k < 2; k++) {
+ for (int k=0; k < 10; k++) {
tmp = readl((unsigned long)&(qspi_cfg[k]));
- //puts("cfg");
- //uart_writeuint32(k);
- //puts(" ");
- //uart_writeuint32(tmp);
- //puts("\n");
+ puts("cfg");
+ uart_writeuint32(k);
+ puts(" ");
+ uart_writeuint32(tmp);
+ puts("\n");
}
-#endif
+
volatile uint32_t *qspi = (uint32_t*)0x10000000;
+ volatile uint8_t *qspi_bytes = (uint8_t*)0x10000000;
// let's not, eh? writel(0xDEAF0123, (unsigned long)&(qspi[0]));
// tmp = readl((unsigned long)&(qspi[0]));
-#if 1
+for (i=0;i<1000;i++) {
+ writel(0xDEAF0123+i, (unsigned long)&(qspi[i]));
+}
+for (i=0;i<1000;i++) {
+ if (i%8 == 0) puts("\r\n");
+ tmp = readl((unsigned long)&(qspi[i]));
+ uart_writeuint32(tmp);
+ puts(" ");
+}
+putchar(10);
+putchar(10);
+for (i=0;i<1000;i++) {
+ if (i%8 == 0) puts("\r\n");
+ tmp = readb((unsigned long)&(qspi_bytes[i]));
+ uart_writeuint32(tmp);
+ puts(" ");
+}
+#if 0
while (1) {
// quick read
tmp = readl((unsigned long)&(qspi[0x1000/4]));
+++ /dev/null
-SECTIONS
-{
- . = 0;
- _start = .;
- .head : {
- KEEP(*(.head))
- }
- . = ALIGN(0x1000);
- .text : { *(.text) *(.text.*) *(.rodata) *(.rodata.*) }
- . = ALIGN(0x10);
- .data : { *(.data) *(.data.*) *(.got) *(.toc) }
- . = ALIGN(0x10);
- __bss_start = .;
- .bss : {
- *(.dynsbss)
- *(.sbss)
- *(.scommon)
- *(.dynbss)
- *(.bss)
- *(.common)
- *(.bss.*)
- }
- . = ALIGN(0x10);
- __bss_end = .;
- . = . + 0x5000;
- __stack_top = .;
-}
--- /dev/null
+SECTIONS
+{
+ . = BOOT_INIT_BASE;
+ _start = .;
+ .head : {
+ KEEP(*(.head))
+ }
+ . = ALIGN(0x1000);
+ .text : { *(.text) *(.text.*) *(.rodata) *(.rodata.*) }
+ . = ALIGN(0x10);
+ .data : { *(.data) *(.data.*) *(.got) *(.toc) }
+ . = ALIGN(0x10);
+ __bss_start = .;
+ .bss : {
+ *(.dynsbss)
+ *(.sbss)
+ *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(.common)
+ *(.bss.*)
+ }
+ . = ALIGN(0x10);
+ __bss_end = .;
+ . = . + 0x5000;
+ __stack_top = .;
+}
Resource("spi_0", 0,
Subsignal("dq", Pins("W2 V2 Y2 W1", dir="io")),
Subsignal("cs_n", Pins("R2", dir="o")),
- Attrs(PULLMODE="NONE", DRIVE="8", SLEWRATE="FAST",
- IO_TYPE="LVCMOS33"))
+ Attrs(PULLMODE="NONE", DRIVE="4", IO_TYPE="LVCMOS33"))
]
platform.add_resources(spi_0_ios)
spi_0_pins = platform.request("spi_0", 0, dir={"dq":"io", "cs_n":"o"},