Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 51f4f920a24d
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 080dbaa206ef
Choose a head ref
  • 7 commits
  • 7 files changed
  • 1 contributor

Commits on Jan 10, 2013

  1. software/include/base/stdint.h: more definitions

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    b0503aa View commit details
  2. software/common.mak: use -target instead of deprecated -ccc-host-triple

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    e4144f2 View commit details
  3. software/common.mak: remove -fsigned-char from CFLAGS

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    c490917 View commit details
  4. software: run the assembler ourselves to prevent future time wastage …

    …due to breakage of our custom Clang toolchain
    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    c5c2919 View commit details
  5. software/include/base/stdint.h: add INT32_C

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    d576893 View commit details
  6. software: compile compiler-rt ourselves

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    7adee98 View commit details
  7. software: hide and delete .ts files

    Sebastien Bourdeauducq committed Jan 10, 2013
    Copy the full SHA
    080dbaa View commit details
Showing with 85 additions and 29 deletions.
  1. +1 −0 .gitignore
  2. +6 −9 README
  3. +7 −3 software/bios/Makefile
  4. +24 −15 software/common.mak
  5. +19 −1 software/include/base/stdint.h
  6. +4 −1 software/libbase/Makefile
  7. +24 −0 software/libcompiler-rt/Makefile
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__pycache__
build/*
*.o
*.ts
*.d
*.a
*.bin
15 changes: 6 additions & 9 deletions README
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ introducing two key innovations:
* Increased system memory performance thanks to a new architecture
(ASMI) containing a transaction-reordering and superscalar controller.

The Milkymist-NG SoC supports the Milkymist One board. Obtain yours from:
The Milkymist-NG SoC supports the Milkymist One board. Obtain yours at:
http://milkymist.org

Note that the -NG version is still experimental work in progress. For the
@@ -31,15 +31,12 @@ production version of Milkymist SoC, visit:
make
make install

3. Build compiler-rt.
git clone git://github.com/milkymist/compiler-rt-lm32.git
cd compiler-rt-lm32
make lm32
3. Obtain compiler-rt and set the CRTDIR environment variable to the root of
its source tree.
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
export CRTDIR=/path_to/compiler-rt

4. Set the CRTDIR environment variable to where libcompiler_rt.a is.
export CRTDIR=/path_to/compiler-rt-lm32/lm32/lm32

5. Build and flash the BIOS (part of this source distribution).
4. Build and flash the BIOS (part of this source distribution).
cd software/bios
make
make flash
10 changes: 7 additions & 3 deletions software/bios/Makefile
Original file line number Diff line number Diff line change
@@ -20,20 +20,24 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
%.elf:
$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
-L$(M2DIR)/software/libbase \
-L$(CRTDIR) \
-lbase -lcompiler_rt
-L$(M2DIR)/software/libcompiler-rt \
-lbase -lcompiler-rt
chmod -x $@

%.o: %.c
$(compile-dep)

%.o: %.S
$(assemble)

libs:
make -C $(M2DIR)/software/libcompiler-rt
make -C $(M2DIR)/software/libbase

flash: bios.bin
m1nor bios.bin

clean:
rm -f $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~
rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~

.PHONY: clean libs flash
39 changes: 24 additions & 15 deletions software/common.mak
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
TARGET_PREFIX=lm32-elf
CLANG=clang -ccc-host-triple $(TARGET_PREFIX)
CLANG=clang -target lm32

CC_normal := $(CLANG)
AS_normal := $(TARGET_PREFIX)-as
AR_normal := $(TARGET_PREFIX)-ar
LD_normal := $(TARGET_PREFIX)-ld
OBJCOPY_normal := $(TARGET_PREFIX)-objcopy
RANLIB_normal := $(TARGET_PREFIX)-ranlib

CC_quiet = @echo " CC " $@ && $(CLANG)
AS_quiet = @echo " AS " $@ && $(TARGET_PREFIX)-as
AR_quiet = @echo " AR " $@ && $(TARGET_PREFIX)-ar
LD_quiet = @echo " LD " $@ && $(TARGET_PREFIX)-ld
OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(TARGET_PREFIX)-objcopy
RANLIB_quiet = @echo " RANLIB " $@ && $(TARGET_PREFIX)-ranlib

ifeq ($(V),1)
CC = $(CC_normal)
AR = $(AR_normal)
LD = $(LD_normal)
OBJCOPY = $(OBJCOPY_normal)
RANLIB = $(RANLIB_normal)
CC = $(CC_normal)
AS = $(AS_normal)
AR = $(AR_normal)
LD = $(LD_normal)
OBJCOPY = $(OBJCOPY_normal)
RANLIB = $(RANLIB_normal)
else
CC = $(CC_quiet)
AR = $(AR_quiet)
LD = $(LD_quiet)
OBJCOPY = $(OBJCOPY_quiet)
RANLIB = $(RANLIB_quiet)
CC = $(CC_quiet)
AS = $(AS_quiet)
AR = $(AR_quiet)
LD = $(LD_quiet)
OBJCOPY = $(OBJCOPY_quiet)
RANLIB = $(RANLIB_quiet)
endif

# Toolchain options
#
INCLUDES = -I$(M2DIR)/software/include/base -I$(M2DIR)/software/include -I$(M2DIR)/common
CFLAGS = -O9 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
-Wmissing-prototypes -fsigned-char -nostdinc $(INCLUDES)
CFLAGS = -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
-Wmissing-prototypes -nostdinc $(INCLUDES)
LDFLAGS = -nostdlib -nodefaultlibs

# compile and generate dependencies, based on
# http://scottmcpeak.com/autodepend/autodepend.html

define compile-dep =
$(CC) -c $(CFLAGS) $< -o $*.o
define compile-dep
$(CC) -c $(CFLAGS) $< -o $*.ts -S
@$(CC_normal) -MM $(CFLAGS) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
@$(AS_normal) -o $*.o $*.ts
endef

define assemble
$(AS) -o $*.o $<
endef
20 changes: 19 additions & 1 deletion software/include/base/stdint.h
Original file line number Diff line number Diff line change
@@ -3,5 +3,23 @@

typedef unsigned int uintptr_t;

#endif /* __STDINT_H */
typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;

typedef long long int64_t;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;

#define __int_c_join(a, b) a ## b
#define __int_c(v, suffix) __int_c_join(v, suffix)
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)

#define INT64_C(v) __int_c(v, LL)
#define UINT64_C(v) __uint_c(v, LL)
#define INT32_C(v) v
#define UINT32_C(v) v##U

#endif /* __STDINT_H */
5 changes: 4 additions & 1 deletion software/libbase/Makefile
Original file line number Diff line number Diff line change
@@ -15,7 +15,10 @@ libbase.a: $(OBJECTS)
%.o: %.c
$(compile-dep)

%.o: %.S
$(assemble)

.PHONY: clean

clean:
rm -f $(OBJECTS) $(OBJECTS:.o=.d) libbase.a .*~ *~
rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~
24 changes: 24 additions & 0 deletions software/libcompiler-rt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
M2DIR=../..
include $(M2DIR)/software/common.mak

CFLAGS+=-D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -Wno-missing-prototypes

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

all: libcompiler-rt.a

# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)

libcompiler-rt.a: $(OBJECTS)
$(AR) clr libcompiler-rt.a $(OBJECTS)
$(RANLIB) libcompiler-rt.a

%.o: $(CRTDIR)/lib/%.c
$(compile-dep)

.PHONY: clean

clean:
rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler-rt.a .*~ *~