Skip to content

Commit

Permalink
Pre-update 2.1.1 : update bsp folders
Browse files Browse the repository at this point in the history
  • Loading branch information
cgarlati committed Sep 15, 2021
1 parent a91ca47 commit 85cf2e3
Show file tree
Hide file tree
Showing 23 changed files with 164 additions and 85 deletions.
54 changes: 53 additions & 1 deletion .cproject

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bsp/E31/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.PHONY: all
all:
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -x assembler-with-cpp -c -o boot.o boot.S
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T linker.lds -T ../memory.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T ../memory.lds -T linker.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(OBJCOPY) -O ihex -j.boot boot.elf boot.hex
$(OBJDUMP) --source --all-headers --demangle --disassemble --line-numbers --reloc --wide boot.elf > boot.lst

Expand Down
4 changes: 2 additions & 2 deletions bsp/E31/memory.lds
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright(C) 2020 Hex Five Security, Inc. - All Rights Reserved */

flash = 0x40400000;
itim = 0x40400000; /* ITIM 0x0800_0000 16K */
dtim = 0x80000000; /* DTIM 0x8000_0000 64K */
itim = 0x08000000; /* 16K */
dtim = 0x80000000; /* 64K */
Binary file modified bsp/E31/memory.ods
Binary file not shown.
6 changes: 3 additions & 3 deletions bsp/E31/multizone.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Tick = 10 # ms

Zone = 1
#irq = ? # DMA
irq = 19 # DMA (Mockup)
plic = 17 # UART
base = 0x40402800; size = 30K; rwx = rx # FLASH
base = 0x80001800; size = 4K; rwx = rw # RAM
Expand All @@ -20,9 +20,9 @@ Zone = 2

Zone = 3
base = 0x4040C000; size = 8K; rwx = rx # FLASH
base = 0x80003000; size = 2K; rwx = rw # RAM
base = 0x80003000; size = 3K; rwx = rw # RAM
base = 0x20002000; size = 0x100; rwx = rw # GPIO

Zone = 4
base = 0x4040E000; size = 8K; rwx = rx # FLASH
base = 0x80003800; size = 2K; rwx = rw # RAM
base = 0x80003C00; size = 1K; rwx = rw # RAM
11 changes: 7 additions & 4 deletions bsp/E31/newlib/newlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LDFLAGS += --specs=nano.specs
LDFLAGS += --specs=nosys.specs
LDFLAGS += -nostartfiles
LDFLAGS += -Xlinker --gc-sections
LDFLAGS += -Wl,-Map,$(MAP)

ASM_OBJS := $(ASM_SRCS:.S=.o)
C_OBJS := $(C_SRCS:.c=.o)
Expand All @@ -28,17 +29,19 @@ CFLAGS += -mabi=$(RISCV_ABI)
CFLAGS += -mcmodel=medlow
CFLAGS += -msmall-data-limit=8
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -g3 -Os -Wall
CFLAGS += -Wall
CFLAGS += -Os -ggdb

HEX = $(subst .elf,.hex,$(TARGET))
LST = $(subst .elf,.lst,$(TARGET))
CLEAN_OBJS += $(HEX)
CLEAN_OBJS += $(LST)
MAP = $(subst .elf,.map,$(TARGET))
SIZ = $(subst .elf,.siz,$(TARGET))

$(TARGET): $(LINK_OBJS) $(LINK_DEPS)
$(CC) $(CFLAGS) $(INCLUDES) $(LINK_OBJS) -o $@ $(LDFLAGS)
$(OBJCOPY) -O ihex $(TARGET) $(HEX) --gap-fill 0x00
$(OBJDUMP) --all-headers --demangle --disassemble --file-headers --wide -D $(TARGET) > $(LST)
$(SIZE) --format=sysv $(TARGET) > $(SIZ)

$(ASM_OBJS): %.o: %.S $(HEADERS)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
Expand All @@ -48,5 +51,5 @@ $(C_OBJS): %.o: %.c $(HEADERS)

.PHONY: clean
clean:
rm -f $(CLEAN_OBJS)
rm -rf $(TARGET) $(LINK_OBJS) $(HEX) $(LST) $(MAP) $(SIZ)

20 changes: 10 additions & 10 deletions bsp/E31/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@
// ------------------------------------------------------------------------------
#define PLIC_BASE 0x0C000000

#define PLIC_PRI_OFFSET 0x0
#define PLIC_PRI_SHIFT_PER_SOURCE 2
#define PLIC_EN_OFFSET 0x2000
#define PLIC_EN_SHIFT_PER_TARGET 1
#define PLIC_THRES_OFFSET 0x200000
#define PLIC_CLAIM_OFFSET 0x200004
#define PLIC_PRI 0
#define PLIC_EN 0x002000
#define PLIC_IP 0x001000
#define PLIC_THRES 0x200000
#define PLIC_CLAIM 0x200004
#define PLIC_SHIFT_PER_TRG 1
#define PLIC_SHIFT_PER_SRC 2

#define PLIC_UART_RX_SOURCE 17
#define PLIC_SRC_UART 17

// -----------------------------------------------------------------------------
// DMA (single channel mockup)
Expand All @@ -133,8 +134,7 @@
#define DMA_TR_DEST_OFF 0x4C /* +ch*0x14 */
#define DMA_TR_SIZE_OFF 0x50 /* +ch*0x14 */

#define DMA_IRQ 3

#define DMA_IRQ 19 /* Mockup */

// -----------------------------------------------------------------------------
// C Helper functions
Expand All @@ -148,7 +148,7 @@
#define PWM_REG(offset) _REG32(PWM_BASE, offset)
#define UART_REG(offset) _REG32(UART_BASE, offset)
#define PLIC_REG(offset) _REG32(PLIC_BASE, offset)
#define DMA_REG(offset) _REG32(DMA_BASE, offset)
#define DMA_REG(offset) _REG32(DMA_BASE, offset)


#endif /* HEXFIVE_PLATFORM_H */
2 changes: 1 addition & 1 deletion bsp/FE310/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.PHONY: all
all:
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -x assembler-with-cpp -c -o boot.o boot.S
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T linker.lds -T ../memory.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T ../memory.lds -T linker.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(OBJCOPY) -O ihex -j.boot boot.elf boot.hex
$(OBJDUMP) --source --all-headers --demangle --disassemble --line-numbers --reloc --wide boot.elf > boot.lst

Expand Down
4 changes: 2 additions & 2 deletions bsp/FE310/memory.lds
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright(C) 2020 Hex Five Security, Inc. - All Rights Reserved */

flash = 0x20010000;
itim = 0x20010000; /* ITIM 0x0800_0000 8K */
dtim = 0x80000000; /* DTIM 0x8000_0000 16K */
itim = 0x08000000; /* 8K */
dtim = 0x80000000; /* 16K */
Binary file modified bsp/FE310/memory.ods
Binary file not shown.
8 changes: 4 additions & 4 deletions bsp/FE310/multizone.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Tick = 10 # ms

Zone = 1
#irq = ? # DMA
plic = 3 # UART
irq = 19 # DMA (Mockup)
plic = 3 # UART
base = 0x20012800; size = 30K; rwx = rx # FLASH
base = 0x80001800; size = 4K; rwx = rw # RAM
base = 0x10013000; size = 0x100; rwx = rw # UART
Expand All @@ -20,9 +20,9 @@ Zone = 2

Zone = 3
base = 0x2001C000; size = 8K; rwx = rx # FLASH
base = 0x80003000; size = 2K; rwx = rw # RAM
base = 0x80003000; size = 3K; rwx = rw # RAM
base = 0x10012000; size = 0x100; rwx = rw # GPIO

Zone = 4
base = 0x2001E000; size = 8K; rwx = rx # FLASH
base = 0x80003800; size = 2K; rwx = rw # RAM
base = 0x80003C00; size = 1K; rwx = rw # RAM
11 changes: 7 additions & 4 deletions bsp/FE310/newlib/newlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LDFLAGS += --specs=nano.specs
LDFLAGS += --specs=nosys.specs
LDFLAGS += -nostartfiles
LDFLAGS += -Xlinker --gc-sections
LDFLAGS += -Wl,-Map,$(MAP)

ASM_OBJS := $(ASM_SRCS:.S=.o)
C_OBJS := $(C_SRCS:.c=.o)
Expand All @@ -28,17 +29,19 @@ CFLAGS += -mabi=$(RISCV_ABI)
CFLAGS += -mcmodel=medlow
CFLAGS += -msmall-data-limit=8
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -g3 -Os -Wall
CFLAGS += -Wall
CFLAGS += -Os -ggdb

HEX = $(subst .elf,.hex,$(TARGET))
LST = $(subst .elf,.lst,$(TARGET))
CLEAN_OBJS += $(HEX)
CLEAN_OBJS += $(LST)
MAP = $(subst .elf,.map,$(TARGET))
SIZ = $(subst .elf,.siz,$(TARGET))

$(TARGET): $(LINK_OBJS) $(LINK_DEPS)
$(CC) $(CFLAGS) $(INCLUDES) $(LINK_OBJS) -o $@ $(LDFLAGS)
$(OBJCOPY) -O ihex $(TARGET) $(HEX) --gap-fill 0x00
$(OBJDUMP) --all-headers --demangle --disassemble --file-headers --wide -D $(TARGET) > $(LST)
$(SIZE) --format=sysv $(TARGET) > $(SIZ)

$(ASM_OBJS): %.o: %.S $(HEADERS)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
Expand All @@ -48,5 +51,5 @@ $(C_OBJS): %.o: %.c $(HEADERS)

.PHONY: clean
clean:
rm -f $(CLEAN_OBJS)
rm -rf $(TARGET) $(LINK_OBJS) $(HEX) $(LST) $(MAP) $(SIZ)

33 changes: 26 additions & 7 deletions bsp/FE310/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,33 @@
// ------------------------------------------------------------------------------
#define PLIC_BASE 0x0C000000

#define PLIC_PRI_OFFSET 0x0
#define PLIC_PRI_SHIFT_PER_SOURCE 2
#define PLIC_EN_OFFSET 0x2000
#define PLIC_EN_SHIFT_PER_TARGET 1
#define PLIC_THRES_OFFSET 0x200000
#define PLIC_CLAIM_OFFSET 0x200004
#define PLIC_PRI 0
#define PLIC_EN 0x002000
#define PLIC_IP 0x001000
#define PLIC_THRES 0x200000
#define PLIC_CLAIM 0x200004
#define PLIC_SHIFT_PER_TRG 1
#define PLIC_SHIFT_PER_SRC 2

#define PLIC_UART_RX_SOURCE 3
#define PLIC_SRC_UART 3

// -----------------------------------------------------------------------------
// DMA (single channel mockup)
// ------------------------------------------------------------------------------
#define DMA_BASE 0x10040000

#define DMA_VER_OFF 0x00
#define DMA_CFG_OFF 0x10
#define DMA_CTRL_OFF 0x20
#define DMA_CH_STATUS_OFF 0x30 /* TC: 1<<ch+16, AB: 1<<ch+8, ERR: 1<<ch+0 */
#define DMA_CH_ENABLE_OFF 0x34 /* 1<<ch */
#define DMA_CH_ABORT_OFF 0x40 /* 1<<ch */
#define DMA_CH_CTRL_OFF 0x44 /* +ch*0x14 */
#define DMA_TR_SRC_OFF 0x48 /* +ch*0x14 */
#define DMA_TR_DEST_OFF 0x4C /* +ch*0x14 */
#define DMA_TR_SIZE_OFF 0x50 /* +ch*0x14 */

#define DMA_IRQ 19 /* Mockup */

// -----------------------------------------------------------------------------
// C Helper functions
Expand All @@ -130,6 +148,7 @@
#define PWM_REG(offset) _REG32(PWM_BASE, offset)
#define UART_REG(offset) _REG32(UART_BASE, offset)
#define PLIC_REG(offset) _REG32(PLIC_BASE, offset)
#define DMA_REG(offset) _REG32(DMA_BASE, offset)


#endif /* HEXFIVE_PLATFORM_H */
2 changes: 1 addition & 1 deletion bsp/S51/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.PHONY: all
all:
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -x assembler-with-cpp -c -o boot.o boot.S
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T linker.lds -T ../memory.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(CC) -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ffreestanding -Wall -T ../memory.lds -T linker.lds -nostdlib -Xlinker --gc-sections -Wl,-Map,boot.map -o boot.elf ./boot.o
$(OBJCOPY) -O ihex -j.boot boot.elf boot.hex
$(OBJDUMP) --source --all-headers --demangle --disassemble --line-numbers --reloc --wide boot.elf > boot.lst

Expand Down
9 changes: 5 additions & 4 deletions bsp/S51/memory.lds
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* Copyright(C) 2020 Hex Five Security, Inc. - All Rights Reserved */

flash = 0x40400000;
itim = 0x40400000; /* ITIM 0x0800_0000 16K */
dtim = 0x80000800; /* DTIM 0x8000_0000 64K */
itim = 0x08000000; /* 16K */
dtim = 0x80000800; /* 64K */

/* Note:
dtim start value increased +2K to make room for the larger 8K rv64 kernel
while allowing for unchanged dtim/ram offsets in the zones linker sripts
that fit the smaller 6K rv32 kernel and the DTIM 16K size limit imposed by the FE310
*/
that fit the smaller 6K rv32 kernel and the DTIM 16K size limit imposed
by the FE310
*/
Binary file modified bsp/S51/memory.ods
Binary file not shown.
6 changes: 3 additions & 3 deletions bsp/S51/multizone.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Tick = 10 # ms

Zone = 1
#irq = ? # DMA
irq = 19 # DMA (Mockup)
plic = 17 # UART
base = 0x40402800; size = 30K; rwx = rx # FLASH
base = 0x80002000; size = 4K; rwx = rw # RAM
Expand All @@ -20,9 +20,9 @@ Zone = 2

Zone = 3
base = 0x4040C000; size = 8K; rwx = rx # FLASH
base = 0x80003800; size = 2K; rwx = rw # RAM
base = 0x80003800; size = 3K; rwx = rw # RAM
base = 0x20002000; size = 0x100; rwx = rw # GPIO

Zone = 4
base = 0x4040E000; size = 8K; rwx = rx # FLASH
base = 0x80004000; size = 2K; rwx = rw # RAM
base = 0x80004400; size = 1K; rwx = rw # RAM
11 changes: 7 additions & 4 deletions bsp/S51/newlib/newlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LDFLAGS += --specs=nano.specs
LDFLAGS += --specs=nosys.specs
LDFLAGS += -nostartfiles
LDFLAGS += -Xlinker --gc-sections
LDFLAGS += -Wl,-Map,$(MAP)

ASM_OBJS := $(ASM_SRCS:.S=.o)
C_OBJS := $(C_SRCS:.c=.o)
Expand All @@ -28,17 +29,19 @@ CFLAGS += -mabi=$(RISCV_ABI)
CFLAGS += -mcmodel=medany
CFLAGS += -msmall-data-limit=8
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -g3 -Os -Wall
CFLAGS += -Wall
CFLAGS += -Os -ggdb

HEX = $(subst .elf,.hex,$(TARGET))
LST = $(subst .elf,.lst,$(TARGET))
CLEAN_OBJS += $(HEX)
CLEAN_OBJS += $(LST)
MAP = $(subst .elf,.map,$(TARGET))
SIZ = $(subst .elf,.siz,$(TARGET))

$(TARGET): $(LINK_OBJS) $(LINK_DEPS)
$(CC) $(CFLAGS) $(INCLUDES) $(LINK_OBJS) -o $@ $(LDFLAGS)
$(OBJCOPY) -O ihex $(TARGET) $(HEX) --gap-fill 0x00
$(OBJDUMP) --all-headers --demangle --disassemble --file-headers --wide -D $(TARGET) > $(LST)
$(SIZE) --format=sysv $(TARGET) > $(SIZ)

$(ASM_OBJS): %.o: %.S $(HEADERS)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
Expand All @@ -48,5 +51,5 @@ $(C_OBJS): %.o: %.c $(HEADERS)

.PHONY: clean
clean:
rm -f $(CLEAN_OBJS)
rm -rf $(TARGET) $(LINK_OBJS) $(HEX) $(LST) $(MAP) $(SIZ)

20 changes: 10 additions & 10 deletions bsp/S51/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


#define CPU_FREQ 32537487
#define RTC_FREQ 32833
#define RTC_FREQ 32833

// -----------------------------------------------------------------------------
// RTC (CLINT)
Expand Down Expand Up @@ -108,14 +108,15 @@
// ------------------------------------------------------------------------------
#define PLIC_BASE 0x0C000000

#define PLIC_PRI_OFFSET 0x0
#define PLIC_PRI_SHIFT_PER_SOURCE 2
#define PLIC_EN_OFFSET 0x2000
#define PLIC_EN_SHIFT_PER_TARGET 1
#define PLIC_THRES_OFFSET 0x200000
#define PLIC_CLAIM_OFFSET 0x200004
#define PLIC_PRI 0
#define PLIC_EN 0x002000
#define PLIC_IP 0x001000
#define PLIC_THRES 0x200000
#define PLIC_CLAIM 0x200004
#define PLIC_SHIFT_PER_TRG 1
#define PLIC_SHIFT_PER_SRC 2

#define PLIC_UART_RX_SOURCE 17
#define PLIC_SRC_UART 17

// -----------------------------------------------------------------------------
// DMA (single channel mockup)
Expand All @@ -133,8 +134,7 @@
#define DMA_TR_DEST_OFF 0x4C /* +ch*0x14 */
#define DMA_TR_SIZE_OFF 0x50 /* +ch*0x14 */

#define DMA_IRQ 3

#define DMA_IRQ 19 /* Mockup */

// -----------------------------------------------------------------------------
// C Helper functions
Expand Down
Binary file modified bsp/X300/memory.ods
Binary file not shown.
Loading

0 comments on commit 85cf2e3

Please sign in to comment.