Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 7 commits
  • 7 files changed
  • 0 comments
  • 1 contributor
1  .gitignore
... ...
@@ -1,6 +1,7 @@
1 1
 __pycache__
2 2
 build/*
3 3
 *.o
  4
+*.ts
4 5
 *.d
5 6
 *.a
6 7
 *.bin
15  README
@@ -7,7 +7,7 @@ introducing two key innovations:
7 7
  * Increased system memory performance thanks to a new architecture
8 8
    (ASMI) containing a transaction-reordering and superscalar controller.
9 9
 
10  
-The Milkymist-NG SoC supports the Milkymist One board. Obtain yours from:
  10
+The Milkymist-NG SoC supports the Milkymist One board. Obtain yours at:
11 11
   http://milkymist.org
12 12
 
13 13
 Note that the -NG version is still experimental work in progress. For the
@@ -31,15 +31,12 @@ production version of Milkymist SoC, visit:
31 31
   make
32 32
   make install
33 33
 
34  
-3. Build compiler-rt.
35  
-  git clone git://github.com/milkymist/compiler-rt-lm32.git
36  
-  cd compiler-rt-lm32
37  
-  make lm32
  34
+3. Obtain compiler-rt and set the CRTDIR environment variable to the root of 
  35
+   its source tree.
  36
+  svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
  37
+  export CRTDIR=/path_to/compiler-rt
38 38
 
39  
-4. Set the CRTDIR environment variable to where libcompiler_rt.a is.
40  
-  export CRTDIR=/path_to/compiler-rt-lm32/lm32/lm32
41  
-
42  
-5. Build and flash the BIOS (part of this source distribution).
  39
+4. Build and flash the BIOS (part of this source distribution).
43 40
   cd software/bios
44 41
   make
45 42
   make flash
10  software/bios/Makefile
@@ -20,20 +20,24 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
20 20
 %.elf:
21 21
 	$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
22 22
 		-L$(M2DIR)/software/libbase \
23  
-		-L$(CRTDIR) \
24  
-		-lbase -lcompiler_rt
  23
+		-L$(M2DIR)/software/libcompiler-rt \
  24
+		-lbase -lcompiler-rt
25 25
 	chmod -x $@
26 26
 
27 27
 %.o: %.c
28 28
 	$(compile-dep)
29 29
 
  30
+%.o: %.S
  31
+	$(assemble)
  32
+
30 33
 libs:
  34
+	make -C $(M2DIR)/software/libcompiler-rt
31 35
 	make -C $(M2DIR)/software/libbase
32 36
 
33 37
 flash: bios.bin
34 38
 	m1nor bios.bin
35 39
 
36 40
 clean:
37  
-	rm -f $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~
  41
+	rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~
38 42
 
39 43
 .PHONY: clean libs flash
39  software/common.mak
... ...
@@ -1,48 +1,57 @@
1 1
 TARGET_PREFIX=lm32-elf
2  
-CLANG=clang -ccc-host-triple $(TARGET_PREFIX)
  2
+CLANG=clang -target lm32
3 3
 
4 4
 CC_normal := $(CLANG)
  5
+AS_normal := $(TARGET_PREFIX)-as
5 6
 AR_normal := $(TARGET_PREFIX)-ar
6 7
 LD_normal := $(TARGET_PREFIX)-ld
7 8
 OBJCOPY_normal := $(TARGET_PREFIX)-objcopy
8 9
 RANLIB_normal := $(TARGET_PREFIX)-ranlib
9 10
 
10 11
 CC_quiet = @echo " CC " $@ && $(CLANG)
  12
+AS_quiet = @echo " AS " $@ && $(TARGET_PREFIX)-as
11 13
 AR_quiet = @echo " AR " $@ && $(TARGET_PREFIX)-ar
12 14
 LD_quiet = @echo " LD " $@ && $(TARGET_PREFIX)-ld
13 15
 OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(TARGET_PREFIX)-objcopy
14 16
 RANLIB_quiet = @echo " RANLIB  " $@ && $(TARGET_PREFIX)-ranlib
15 17
 
16 18
 ifeq ($(V),1)
17  
-    CC = $(CC_normal)
18  
-    AR = $(AR_normal)
19  
-    LD = $(LD_normal)
20  
-    OBJCOPY = $(OBJCOPY_normal)
21  
-    RANLIB = $(RANLIB_normal)
  19
+	CC = $(CC_normal)
  20
+	AS = $(AS_normal)
  21
+	AR = $(AR_normal)
  22
+	LD = $(LD_normal)
  23
+	OBJCOPY = $(OBJCOPY_normal)
  24
+	RANLIB = $(RANLIB_normal)
22 25
 else
23  
-    CC = $(CC_quiet)
24  
-    AR = $(AR_quiet)
25  
-    LD = $(LD_quiet)
26  
-    OBJCOPY = $(OBJCOPY_quiet)
27  
-    RANLIB = $(RANLIB_quiet)
  26
+	CC = $(CC_quiet)
  27
+	AS = $(AS_quiet)
  28
+	AR = $(AR_quiet)
  29
+	LD = $(LD_quiet)
  30
+	OBJCOPY = $(OBJCOPY_quiet)
  31
+	RANLIB = $(RANLIB_quiet)
28 32
 endif
29 33
 
30 34
 # Toolchain options
31 35
 #
32 36
 INCLUDES = -I$(M2DIR)/software/include/base -I$(M2DIR)/software/include -I$(M2DIR)/common
33  
-CFLAGS = -O9 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
34  
-	 -Wmissing-prototypes -fsigned-char -nostdinc $(INCLUDES)
  37
+CFLAGS = -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
  38
+	 -Wmissing-prototypes -nostdinc $(INCLUDES)
35 39
 LDFLAGS = -nostdlib -nodefaultlibs
36 40
 
37 41
 # compile and generate dependencies, based on
38 42
 # http://scottmcpeak.com/autodepend/autodepend.html
39 43
 
40  
-define compile-dep =
41  
-$(CC) -c $(CFLAGS) $< -o $*.o
  44
+define compile-dep
  45
+$(CC) -c $(CFLAGS) $< -o $*.ts -S
42 46
 @$(CC_normal) -MM $(CFLAGS) $< > $*.d
43 47
 @mv -f $*.d $*.d.tmp
44 48
 @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
45 49
 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
46 50
 	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
47 51
 @rm -f $*.d.tmp
  52
+@$(AS_normal) -o $*.o $*.ts
  53
+endef
  54
+
  55
+define assemble
  56
+$(AS) -o $*.o $<
48 57
 endef
20  software/include/base/stdint.h
@@ -3,5 +3,23 @@
3 3
 
4 4
 typedef unsigned int uintptr_t;
5 5
 
6  
-#endif /* __STDINT_H */
  6
+typedef unsigned long long uint64_t;
  7
+typedef unsigned int uint32_t;
  8
+typedef unsigned short uint16_t;
  9
+typedef unsigned char uint8_t;
  10
+
  11
+typedef long long int64_t;
  12
+typedef int int32_t;
  13
+typedef short int16_t;
  14
+typedef char int8_t;
  15
+
  16
+#define __int_c_join(a, b) a ## b
  17
+#define __int_c(v, suffix) __int_c_join(v, suffix)
  18
+#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
7 19
 
  20
+#define INT64_C(v) __int_c(v, LL)
  21
+#define UINT64_C(v) __uint_c(v, LL)
  22
+#define INT32_C(v) v
  23
+#define UINT32_C(v) v##U
  24
+
  25
+#endif /* __STDINT_H */
5  software/libbase/Makefile
@@ -15,7 +15,10 @@ libbase.a: $(OBJECTS)
15 15
 %.o: %.c
16 16
 	$(compile-dep)
17 17
 
  18
+%.o: %.S
  19
+	$(assemble)
  20
+
18 21
 .PHONY: clean
19 22
 
20 23
 clean:
21  
-	rm -f $(OBJECTS) $(OBJECTS:.o=.d) libbase.a .*~ *~
  24
+	rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~
24  software/libcompiler-rt/Makefile
... ...
@@ -0,0 +1,24 @@
  1
+M2DIR=../..
  2
+include $(M2DIR)/software/common.mak
  3
+
  4
+CFLAGS+=-D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -Wno-missing-prototypes
  5
+
  6
+OBJECTS=divsi3.o modsi3.o comparedf2.o negsf2.o negdf2.o addsf3.o subsf3.o mulsf3.o divsf3.o lshrdi3.o muldi3.o divdi3.o ashldi3.o ashrdi3.o udivmoddi4.o \
  7
+  floatsisf.o floatunsisf.o fixsfsi.o fixunssfsi.o adddf3.o subdf3.o muldf3.o divdf3.o floatsidf.o floatunsidf.o floatdidf.o fixdfsi.o fixunsdfsi.o
  8
+
  9
+all: libcompiler-rt.a
  10
+
  11
+# pull in dependency info for *existing* .o files
  12
+-include $(OBJECTS:.o=.d)
  13
+
  14
+libcompiler-rt.a: $(OBJECTS)
  15
+	$(AR) clr libcompiler-rt.a $(OBJECTS)
  16
+	$(RANLIB) libcompiler-rt.a
  17
+
  18
+%.o: $(CRTDIR)/lib/%.c
  19
+	$(compile-dep)
  20
+
  21
+.PHONY: clean
  22
+
  23
+clean:
  24
+	rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler-rt.a .*~ *~

No commit comments for this range

Something went wrong with that request. Please try again.