summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fw/fe310/Makefile10
-rw-r--r--fw/fe310/bsp/default.lds5
-rw-r--r--fw/fe310/common.mk10
-rw-r--r--fw/fe310/crypto/Makefile17
-rw-r--r--fw/fe310/eos/Makefile5
-rw-r--r--fw/fe310/eos/app/Makefile2
-rw-r--r--fw/fe310/eos/eve/Makefile3
-rw-r--r--fw/fe310/eos/eve/screen/Makefile3
-rw-r--r--fw/fe310/eos/eve/widget/Makefile3
-rw-r--r--fw/fe310/eos/i2c/Makefile2
-rw-r--r--fw/fe310/fsfat/Makefile4
-rw-r--r--fw/fe310/test/Makefile5
12 files changed, 22 insertions, 47 deletions
diff --git a/fw/fe310/Makefile b/fw/fe310/Makefile
index 96687c7..be584f5 100644
--- a/fw/fe310/Makefile
+++ b/fw/fe310/Makefile
@@ -1,22 +1,26 @@
include common.mk
+MAKEFLAGS += -I$(fe310_dir)
-CFLAGS += -I./include
+include $(crypto_dir)/crypto_obj.mk
+obj_crypto = $(addprefix $(crypto_dir)/,$(obj_dep))
-subdirs = bsp/drivers bsp/gloss bsp/metal eos eos/i2c eos/eve eos/eve/screen eos/eve/widget eos/app crypto fsfat
+subdirs = bsp/drivers bsp/gloss bsp/metal eos eos/i2c eos/eve eos/eve/screen eos/eve/widget eos/app fsfat
+# $(info INFO $(obj_crypto))
all: libeos.a
%.o: %.c
$(CC) $(CFLAGS) -c $<
libeos.a:
- for i in $(subdirs); do \
+ for i in $(subdirs) $(crypto_dir); do \
(cd $$i && $(MAKE)) || exit; \
done
rm -f $@
for i in $(subdirs); do \
$(AR) rcs $@ $$i/*.o; \
done
+ $(AR) rcs $@ $(obj_crypto)
clean:
for i in $(subdirs); do \
diff --git a/fw/fe310/bsp/default.lds b/fw/fe310/bsp/default.lds
index cabcf01..6be3f46 100644
--- a/fw/fe310/bsp/default.lds
+++ b/fw/fe310/bsp/default.lds
@@ -113,7 +113,7 @@ SECTIONS
*(.sdata .sdata.* .sdata2.*)
*(.gnu.linkonce.s.*)
} >itim AT>flash :itim_init
-/* >ram AT>flash :ram_init */
+/* } >ram AT>flash :ram_init */
PROVIDE( metal_segment_data_source_start = LOADADDR(.data) );
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
@@ -127,12 +127,13 @@ SECTIONS
*(.gnu.linkonce.b.*)
*(COMMON)
} >itim AT>ram :itim
-/* >ram AT>ram :ram */
+/* } >ram AT>ram :ram */
PROVIDE( metal_segment_bss_target_start = ADDR(.bss) );
PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) );
__heap_size = 0x4000 - __stack_size;
+/* __heap_size = 0x1000; */
.heap : {
PROVIDE( metal_segment_heap_target_start = . );
. += __heap_size;
diff --git a/fw/fe310/common.mk b/fw/fe310/common.mk
index ab45367..b6147bd 100644
--- a/fw/fe310/common.mk
+++ b/fw/fe310/common.mk
@@ -1,5 +1,7 @@
-CC = $(RISCV_HOME)/bin/riscv64-unknown-elf-gcc
-AR = $(RISCV_HOME)/bin/riscv64-unknown-elf-ar
-RANLIB = $(RISCV_HOME)/bin/riscv64-unknown-elf-ranlib
+fe310_dir := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+bsp_dir := $(abspath $(fe310_dir)/bsp)
+eos_dir := $(abspath $(fe310_dir)/eos)
+crypto_dir := $(abspath $(fe310_dir)/../../crypto)
-CFLAGS = -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections --specs=nano.specs -O2
+include $(fe310_dir)/platform.mk
+CFLAGS += -I$(eos_dir)
diff --git a/fw/fe310/crypto/Makefile b/fw/fe310/crypto/Makefile
deleted file mode 100644
index 2230d6a..0000000
--- a/fw/fe310/crypto/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-include ../common.mk
-
-CRYPTO_DIR = ../../../crypto
-
-obj = $(CRYPTO_DIR)/aes/aes.o $(CRYPTO_DIR)/blowfish/blowfish.o $(CRYPTO_DIR)/sha/sha1.o
-
-
-%.o: %.c %.h
- $(CC) $(CFLAGS) -c $<
-
-%.o: %.S
- $(CC) $(CFLAGS) -c $<
-
-all: $(obj)
-
-clean:
- rm -f *.o $(obj)
diff --git a/fw/fe310/eos/Makefile b/fw/fe310/eos/Makefile
index 2bf285f..fe5bb5e 100644
--- a/fw/fe310/eos/Makefile
+++ b/fw/fe310/eos/Makefile
@@ -1,8 +1,5 @@
include ../common.mk
-
-CRYPTO_DIR = ../../../crypto
-
-CFLAGS += -I. -I../bsp/include -I../bsp/drivers -I$(CRYPTO_DIR)
+CFLAGS += -I. -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(crypto_dir)
obj = trap_entry.o eos.o msgq.o event.o interrupt.o timer.o pwr.o i2s.o i2c.o uart.o spi.o spi_dev.o lcd.o sdcard.o sdc_crypto.o cam.o net.o wifi.o cell.o sock.o unicode.o
diff --git a/fw/fe310/eos/app/Makefile b/fw/fe310/eos/app/Makefile
index e0eee28..fe0ba21 100644
--- a/fw/fe310/eos/app/Makefile
+++ b/fw/fe310/eos/app/Makefile
@@ -1,7 +1,5 @@
include ../../common.mk
-CFLAGS += -I..
-
obj = app_root.o app_status.o
diff --git a/fw/fe310/eos/eve/Makefile b/fw/fe310/eos/eve/Makefile
index 7a5351f..323a132 100644
--- a/fw/fe310/eos/eve/Makefile
+++ b/fw/fe310/eos/eve/Makefile
@@ -1,6 +1,5 @@
include ../../common.mk
-
-CFLAGS += -I.. -I../../bsp/include
+CFLAGS += -I$(bsp_dir)/include
obj = eve.o eve_eos.o eve_platform.o eve_touch.o eve_phy.o eve_vtrack.o eve_font.o eve_kbd.o eve_text.o clipb.o
diff --git a/fw/fe310/eos/eve/screen/Makefile b/fw/fe310/eos/eve/screen/Makefile
index cc4a81d..9026d43 100644
--- a/fw/fe310/eos/eve/screen/Makefile
+++ b/fw/fe310/eos/eve/screen/Makefile
@@ -1,6 +1,5 @@
include ../../../common.mk
-
-CFLAGS += -I.. -I../..
+CFLAGS += -I..
obj = window.o view.o page.o form.o
diff --git a/fw/fe310/eos/eve/widget/Makefile b/fw/fe310/eos/eve/widget/Makefile
index 95af16d..31349a8 100644
--- a/fw/fe310/eos/eve/widget/Makefile
+++ b/fw/fe310/eos/eve/widget/Makefile
@@ -1,6 +1,5 @@
include ../../../common.mk
-
-CFLAGS += -I.. -I../..
+CFLAGS += -I..
obj = label.o widget.o freew.o spacerw.o pagew.o strw.o textw.o selectw.o
diff --git a/fw/fe310/eos/i2c/Makefile b/fw/fe310/eos/i2c/Makefile
index a210898..97e4f12 100644
--- a/fw/fe310/eos/i2c/Makefile
+++ b/fw/fe310/eos/i2c/Makefile
@@ -1,7 +1,5 @@
include ../../common.mk
-CFLAGS += -I..
-
obj = bq25895.o ov2640.o
diff --git a/fw/fe310/fsfat/Makefile b/fw/fe310/fsfat/Makefile
index a20a5be..b5df05e 100644
--- a/fw/fe310/fsfat/Makefile
+++ b/fw/fe310/fsfat/Makefile
@@ -1,7 +1,5 @@
include ../common.mk
-
-CFLAGS += -I. -I..
-
+CFLAGS += -I..
obj = diskio.o ff.o
diff --git a/fw/fe310/test/Makefile b/fw/fe310/test/Makefile
index af18dc5..5f7f86f 100644
--- a/fw/fe310/test/Makefile
+++ b/fw/fe310/test/Makefile
@@ -1,8 +1,5 @@
include ../common.mk
-
-CRYPTO_DIR = ../../../crypto
-
-CFLAGS += -I.. -I../eos -I../bsp/include -I../bsp/drivers -I$(CRYPTO_DIR)
+CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(crypto_dir)
LDFLAGS = $(CFLAGS) -L.. -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc -leos -Wl,--end-group -T../bsp/default.lds
DEPS = main.o status.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o audio.o test.o