Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New simplified flash layout + build flashable images for SoC and vide…

…omixer
  • Loading branch information...
commit 45cfdf41fcd4c1635676a4073ef7ff65eced386f 1 parent cbd621e
Sébastien Bourdeauducq authored June 01, 2013
3  .gitignore
@@ -3,8 +3,9 @@ build/*
3 3
 *.o
4 4
 *.d
5 5
 *.a
6  
-*.bin
7 6
 *.elf
  7
+*.bin
  8
+*.fbi
8 9
 tools/bin2hex
9 10
 tools/flterm
10 11
 tools/mkmmimg
13  Makefile
... ...
@@ -1,18 +1,21 @@
1 1
 RM ?= rm -f
2 2
 
3  
-all: build/top.bit build/top.fpg
  3
+all: build/soc.bit build/soc.fpg
4 4
 
5  
-build/top.bit build/top.bin:
  5
+build/soc.bit build/soc.bin:
6 6
 	./build.py
7 7
 
8  
-build/top.fpg: build/top.bin
  8
+build/soc.fpg: build/soc.bin
9 9
 	$(MAKE) -C tools
10 10
 	tools/byteswap $< $@
11 11
 
12  
-load: build/top.bit
  12
+load: build/soc.bit
13 13
 	jtag -n load.jtag
14 14
 
  15
+flash: build/soc.fpg
  16
+	m1nor-ng build/soc.fpg
  17
+
15 18
 clean:
16 19
 	$(RM) -r build/*
17 20
 
18  
-.PHONY: all load clean
  21
+.PHONY: all load clean flash
2  build.py
@@ -69,7 +69,7 @@ def main():
69 69
 		"jtag_tap_spartan6.v", "lm32_itlb.v", "lm32_dtlb.v")
70 70
 	platform.add_sources(os.path.join("verilog", "lm32"), "lm32_config.v")
71 71
 
72  
-	platform.build_cmdline(soc)
  72
+	platform.build_cmdline(soc, build_name="soc")
73 73
 	csr_header = cif.get_csr_header(soc.csr_base, soc.csrbankarray, soc.interrupt_map)
74 74
 	write_to_file("software/include/hw/csr.h", csr_header)
75 75
 
2  load.jtag
... ...
@@ -1,3 +1,3 @@
1 1
 cable milkymist
2 2
 detect
3  
-pld load build/top.bit
  3
+pld load build/soc.bit
2  software/bios/Makefile
@@ -39,7 +39,7 @@ libs:
39 39
 	$(MAKE) -C $(M2DIR)/software/libnet
40 40
 
41 41
 flash: bios.bin
42  
-	m1nor bios.bin
  42
+	m1nor-ng bios.bin
43 43
 
44 44
 clean:
45 45
 	$(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin .*~ *~
7  software/bios/boot.c
@@ -196,12 +196,13 @@ static int tftp_get_v(unsigned int ip, const char *filename, char *buffer)
196 196
 	return r;
197 197
 }
198 198
 
  199
+static const unsigned char macadr[6] = {0x10, 0xe2, 0xd5, 0x00, 0x00, 0x00};
  200
+
199 201
 void netboot(void)
200 202
 {
201 203
 	int size;
202 204
 	unsigned int cmdline_adr, initrdstart_adr, initrdend_adr;
203 205
 	unsigned int ip;
204  
-	unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS;
205 206
 
206 207
 	printf("Booting from network...\n");
207 208
 	printf("Local IP : %d.%d.%d.%d\n", LOCALIP1, LOCALIP2, LOCALIP3, LOCALIP4);
@@ -244,11 +245,11 @@ void flashboot(void)
244 245
 	unsigned int got_crc;
245 246
 
246 247
 	printf("Booting from flash...\n");
247  
-	flashbase = (unsigned int *)FLASH_OFFSET_REGULAR_APP;
  248
+	flashbase = (unsigned int *)FLASH_OFFSET_APP;
248 249
 	length = *flashbase++;
249 250
 	crc = *flashbase++;
250 251
 	if((length < 32) || (length > 4*1024*1024)) {
251  
-		printf("Error: Invalid flash boot image length\n");
  252
+		printf("Error: Invalid flash boot image length 0x%08x\n", length);
252 253
 		return;
253 254
 	}
254 255
 	
2  software/bios/linker.ld
@@ -4,7 +4,7 @@ ENTRY(_start)
4 4
 __DYNAMIC = 0;
5 5
 
6 6
 MEMORY {
7  
-	rom  : ORIGIN = 0x00860000, LENGTH = 0x20000 /* 128K */
  7
+	rom  : ORIGIN = 0x00180000, LENGTH = 0x20000 /* 128K */
8 8
 	sram : ORIGIN = 0x10000000, LENGTH = 0x01000 /* 4K */
9 9
 }
10 10
 
10  software/bios/main.c
@@ -390,7 +390,7 @@ static void crcbios(void)
390 390
 	 * We also use the address of _edata to know the length
391 391
 	 * of our code.
392 392
 	 */
393  
-	offset_bios = FLASH_OFFSET_REGULAR_BIOS;
  393
+	offset_bios = FLASH_OFFSET_BIOS;
394 394
 	expected_crc = _edata;
395 395
 	length = (unsigned int)&_edata - offset_bios;
396 396
 	actual_crc = crc32((unsigned char *)offset_bios, length);
@@ -402,13 +402,6 @@ static void crcbios(void)
402 402
 	}
403 403
 }
404 404
 
405  
-static void print_mac(void)
406  
-{
407  
-	unsigned char *macadr = (unsigned char *)FLASH_OFFSET_MAC_ADDRESS;
408  
-
409  
-	printf("MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n", macadr[0], macadr[1], macadr[2], macadr[3], macadr[4], macadr[5]);
410  
-}
411  
-
412 405
 static const char banner[] =
413 406
 	"\nMILKYMIST(tm) v"VERSION" BIOS   http://www.milkymist.org\n"
414 407
 	"(c) Copyright 2007-2013 Sebastien Bourdeauducq\n"
@@ -506,7 +499,6 @@ int main(int i, char **c)
506 499
 	crcbios();
507 500
 	id_print();
508 501
 	ethreset();
509  
-	print_mac();
510 502
 	ddr_ok = ddrinit();
511 503
 	if(ddr_ok)
512 504
 		boot_sequence();
16  software/include/hw/mem.h
... ...
@@ -1,19 +1,9 @@
1 1
 #ifndef __HW_MEM_H
2 2
 #define __HW_MEM_H
3 3
 
4  
-#define FLASH_OFFSET_STANDBY_BITSTREAM	0x00000000 /* 640k */
5  
-
6  
-#define FLASH_OFFSET_RESCUE_BITSTREAM	0x000A0000 /* 1536k */
7  
-#define FLASH_OFFSET_RESCUE_BIOS	0x00220000 /* 128k */
8  
-#define FLASH_OFFSET_RESCUE_APP		0x00240000 /* 4736k */
9  
-
10  
-#define FLASH_OFFSET_REGULAR_BITSTREAM	0x006E0000 /* 1536k */
11  
-#define FLASH_OFFSET_REGULAR_BIOS	0x00860000 /* 128k */
12  
-#define FLASH_OFFSET_REGULAR_APP	0x00880000 /* 4736k */
13  
-
14  
-#define FLASH_OFFSET_FILESYSTEM		0x00D20000 /* 19328k (remaining space) */
15  
-
16  
-#define FLASH_OFFSET_MAC_ADDRESS	0x002200E0 /* within rescue BIOS */
  4
+#define FLASH_OFFSET_BITSTREAM	0x00000000 /* 1536k */
  5
+#define FLASH_OFFSET_BIOS		0x00180000 /* 128k */
  6
+#define FLASH_OFFSET_APP		0x001A0000 /* remaining space */
17 7
 
18 8
 #define SDRAM_BASE			0x40000000
19 9
 
11  software/videomixer/Makefile
@@ -3,7 +3,7 @@ include $(M2DIR)/software/common.mak
3 3
 
4 4
 OBJECTS=crt0.o isr.o time.o dvisampler0.o dvisampler1.o main.o
5 5
 
6  
-all: videomixer.bin
  6
+all: videomixer.bin videomixer.fbi
7 7
 
8 8
 # pull in dependency info for *existing* .o files
9 9
 -include $(OBJECTS:.o=.d)
@@ -12,6 +12,9 @@ all: videomixer.bin
12 12
 	$(OBJCOPY) -O binary $< $@
13 13
 	chmod -x $@
14 14
 
  15
+%.fbi: %.bin
  16
+	$(M2DIR)/tools/mkmmimg $< write $@
  17
+
15 18
 videomixer.elf: linker.ld $(OBJECTS) libs
16 19
 
17 20
 %.elf:
@@ -62,8 +65,12 @@ load: videomixer.bin
62 65
 	$(MAKE) -C $(M2DIR)/tools
63 66
 	$(M2DIR)/tools/flterm --port /dev/ttyUSB0 --kernel videomixer.bin
64 67
 
  68
+flash: videomixer.fbi
  69
+	m1nor-ng videomixer.fbi
  70
+
65 71
 clean:
66  
-	$(RM) $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin .*~ *~
  72
+	$(RM) $(OBJECTS) $(OBJECTS:.o=.d) videomixer.elf videomixer.bin videomixer.fbi
  73
+	$(RM) .*~ *~
67 74
 	$(RM) dvisampler0.h dvisampler0.c dvisampler1.h dvisampler1.c
68 75
 
69 76
 .PHONY: all main.o clean libs load
2  verilog/lm32/lm32_config.v
@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 // Base address for exception vectors
10  
-`define CFG_EBA_RESET 32'h00860000
  10
+`define CFG_EBA_RESET 32'h00180000
11 11
 
12 12
 // Base address for the debug exception vectors. If the DC_RE flag is
13 13
 // set or the at_debug signal is asserted (see CFG_ALTERNATE_EBA) this

0 notes on commit 45cfdf4

Please sign in to comment.
Something went wrong with that request. Please try again.