New simplified flash layout + build flashable images for SoC and videomixer

This commit is contained in:
Sebastien Bourdeauducq 2013-06-01 17:20:40 +02:00
parent cbd621ef2c
commit 45cfdf41fc
11 changed files with 32 additions and 38 deletions

3
.gitignore vendored
View File

@ -3,8 +3,9 @@ build/*
*.o
*.d
*.a
*.bin
*.elf
*.bin
*.fbi
tools/bin2hex
tools/flterm
tools/mkmmimg

View File

@ -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

View File

@ -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)

View File

@ -1,3 +1,3 @@
cable milkymist
detect
pld load build/top.bit
pld load build/soc.bit

View File

@ -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 .*~ *~

View File

@ -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;
}

View File

@ -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 */
}

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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