From: Sebastien Bourdeauducq Date: Sat, 1 Jun 2013 15:20:40 +0000 (+0200) Subject: New simplified flash layout + build flashable images for SoC and videomixer X-Git-Tag: 24jan2021_ls180~2908 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45cfdf41fcd4c1635676a4073ef7ff65eced386f;p=litex.git New simplified flash layout + build flashable images for SoC and videomixer --- diff --git a/.gitignore b/.gitignore index 1462cfdf..4ad51605 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,9 @@ build/* *.o *.d *.a -*.bin *.elf +*.bin +*.fbi tools/bin2hex tools/flterm tools/mkmmimg diff --git a/Makefile b/Makefile index 78d1840c..0e60158a 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,21 @@ RM ?= rm -f -all: build/top.bit build/top.fpg +all: build/soc.bit build/soc.fpg -build/top.bit build/top.bin: +build/soc.bit build/soc.bin: ./build.py -build/top.fpg: build/top.bin +build/soc.fpg: build/soc.bin $(MAKE) -C tools tools/byteswap $< $@ -load: build/top.bit +load: build/soc.bit jtag -n load.jtag +flash: build/soc.fpg + m1nor-ng build/soc.fpg + clean: $(RM) -r build/* -.PHONY: all load clean +.PHONY: all load clean flash diff --git a/build.py b/build.py index b345a5c9..dc9edce8 100755 --- a/build.py +++ b/build.py @@ -69,7 +69,7 @@ TIMESPEC "TSdviclk1" = PERIOD "GRPdviclk1" 26.7 ns HIGH 50%; "jtag_tap_spartan6.v", "lm32_itlb.v", "lm32_dtlb.v") platform.add_sources(os.path.join("verilog", "lm32"), "lm32_config.v") - platform.build_cmdline(soc) + platform.build_cmdline(soc, build_name="soc") csr_header = cif.get_csr_header(soc.csr_base, soc.csrbankarray, soc.interrupt_map) write_to_file("software/include/hw/csr.h", csr_header) diff --git a/load.jtag b/load.jtag index 1bea8ee1..c20825fb 100644 --- a/load.jtag +++ b/load.jtag @@ -1,3 +1,3 @@ cable milkymist detect -pld load build/top.bit +pld load build/soc.bit diff --git a/software/bios/Makefile b/software/bios/Makefile index 16f2503f..973fb3ab 100644 --- a/software/bios/Makefile +++ b/software/bios/Makefile @@ -39,7 +39,7 @@ libs: $(MAKE) -C $(M2DIR)/software/libnet flash: bios.bin - m1nor bios.bin + m1nor-ng bios.bin clean: $(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin .*~ *~ diff --git a/software/bios/boot.c b/software/bios/boot.c index 365bbb50..9d9b3363 100644 --- a/software/bios/boot.c +++ b/software/bios/boot.c @@ -196,12 +196,13 @@ static int tftp_get_v(unsigned int ip, const char *filename, char *buffer) return r; } +static const unsigned char macadr[6] = {0x10, 0xe2, 0xd5, 0x00, 0x00, 0x00}; + void netboot(void) { int size; unsigned int cmdline_adr, initrdstart_adr, initrdend_adr; unsigned int ip; - unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS; printf("Booting from network...\n"); printf("Local IP : %d.%d.%d.%d\n", LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4); @@ -244,11 +245,11 @@ void flashboot(void) unsigned int got_crc; printf("Booting from flash...\n"); - flashbase = (unsigned int *)FLASH_OFFSET_REGULAR_APP; + flashbase = (unsigned int *)FLASH_OFFSET_APP; length = *flashbase++; crc = *flashbase++; if((length < 32) || (length > 4*1024*1024)) { - printf("Error: Invalid flash boot image length\n"); + printf("Error: Invalid flash boot image length 0x%08x\n", length); return; } diff --git a/software/bios/linker.ld b/software/bios/linker.ld index 955d9e0b..b21c1e36 100644 --- a/software/bios/linker.ld +++ b/software/bios/linker.ld @@ -4,7 +4,7 @@ ENTRY(_start) __DYNAMIC = 0; MEMORY { - rom : ORIGIN = 0x00860000, LENGTH = 0x20000 /* 128K */ + rom : ORIGIN = 0x00180000, LENGTH = 0x20000 /* 128K */ sram : ORIGIN = 0x10000000, LENGTH = 0x01000 /* 4K */ } diff --git a/software/bios/main.c b/software/bios/main.c index 4d326f43..618217e7 100644 --- a/software/bios/main.c +++ b/software/bios/main.c @@ -390,7 +390,7 @@ static void crcbios(void) * We also use the address of _edata to know the length * of our code. */ - offset_bios = FLASH_OFFSET_REGULAR_BIOS; + offset_bios = FLASH_OFFSET_BIOS; expected_crc = _edata; length = (unsigned int)&_edata - offset_bios; actual_crc = crc32((unsigned char *)offset_bios, length); @@ -402,13 +402,6 @@ static void crcbios(void) } } -static void print_mac(void) -{ - unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS; - - printf("MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n", macadr[0], macadr[1], macadr[2], macadr[3], macadr[4], macadr[5]); -} - static const char banner[] = "\nMILKYMIST(tm) v"VERSION" BIOS http://www.milkymist.org\n" "(c) Copyright 2007-2013 Sebastien Bourdeauducq\n" @@ -506,7 +499,6 @@ int main(int i, char **c) crcbios(); id_print(); ethreset(); - print_mac(); ddr_ok = ddrinit(); if(ddr_ok) boot_sequence(); diff --git a/software/include/hw/mem.h b/software/include/hw/mem.h index b36082a5..5df28894 100644 --- a/software/include/hw/mem.h +++ b/software/include/hw/mem.h @@ -1,19 +1,9 @@ #ifndef __HW_MEM_H #define __HW_MEM_H -#define FLASH_OFFSET_STANDBY_BITSTREAM 0x00000000 /* 640k */ - -#define FLASH_OFFSET_RESCUE_BITSTREAM 0x000A0000 /* 1536k */ -#define FLASH_OFFSET_RESCUE_BIOS 0x00220000 /* 128k */ -#define FLASH_OFFSET_RESCUE_APP 0x00240000 /* 4736k */ - -#define FLASH_OFFSET_REGULAR_BITSTREAM 0x006E0000 /* 1536k */ -#define FLASH_OFFSET_REGULAR_BIOS 0x00860000 /* 128k */ -#define FLASH_OFFSET_REGULAR_APP 0x00880000 /* 4736k */ - -#define FLASH_OFFSET_FILESYSTEM 0x00D20000 /* 19328k (remaining space) */ - -#define FLASH_OFFSET_MAC_ADDRESS 0x002200E0 /* within rescue BIOS */ +#define FLASH_OFFSET_BITSTREAM 0x00000000 /* 1536k */ +#define FLASH_OFFSET_BIOS 0x00180000 /* 128k */ +#define FLASH_OFFSET_APP 0x001A0000 /* remaining space */ #define SDRAM_BASE 0x40000000 diff --git a/software/videomixer/Makefile b/software/videomixer/Makefile index 41b1fcfa..fa3ae233 100644 --- a/software/videomixer/Makefile +++ b/software/videomixer/Makefile @@ -3,7 +3,7 @@ include $(M2DIR)/software/common.mak OBJECTS=crt0.o isr.o time.o dvisampler0.o dvisampler1.o main.o -all: videomixer.bin +all: videomixer.bin videomixer.fbi # pull in dependency info for *existing* .o files -include $(OBJECTS:.o=.d) @@ -12,6 +12,9 @@ all: videomixer.bin $(OBJCOPY) -O binary $< $@ chmod -x $@ +%.fbi: %.bin + $(M2DIR)/tools/mkmmimg $< write $@ + videomixer.elf: linker.ld $(OBJECTS) libs %.elf: @@ -62,8 +65,12 @@ load: videomixer.bin $(MAKE) -C $(M2DIR)/tools $(M2DIR)/tools/flterm --port /dev/ttyUSB0 --kernel videomixer.bin +flash: videomixer.fbi + m1nor-ng videomixer.fbi + clean: - $(RM) $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin .*~ *~ + $(RM) $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin videomixer.fbi + $(RM) .*~ *~ $(RM) dvisampler0.h dvisampler0.c dvisampler1.h dvisampler1.c .PHONY: all main.o clean libs load diff --git a/verilog/lm32/lm32_config.v b/verilog/lm32/lm32_config.v index 45f95ec2..df2a0a7e 100644 --- a/verilog/lm32/lm32_config.v +++ b/verilog/lm32/lm32_config.v @@ -7,7 +7,7 @@ // // Base address for exception vectors -`define CFG_EBA_RESET 32'h00860000 +`define CFG_EBA_RESET 32'h00180000 // Base address for the debug exception vectors. If the DC_RE flag is // set or the at_debug signal is asserted (see CFG_ALTERNATE_EBA) this