Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Update dependencies polarfire-soc/platform 2021.11
Browse files Browse the repository at this point in the history
  • Loading branch information
cgarlati committed Feb 2, 2022
1 parent aaa2b14 commit e1270a4
Show file tree
Hide file tree
Showing 15 changed files with 574 additions and 476 deletions.
14 changes: 14 additions & 0 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.361158373" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/multizone-sdk-pfsc}/" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.323820810" incrementalBuildTarget="all" keepEnvironmentInBuildfile="true" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.262651274" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.35641094" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/icicle-kit-es}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/icicle-kit-es/platform_config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/pfsc-platform}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/pfsc-platform/platform_config_reference}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/multizone}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1939954707" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.254994017" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"/>
Expand Down Expand Up @@ -66,6 +73,13 @@
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.149539586" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/multizone-sdk-pfsc}/" id="cdt.managedbuild.builder.gnu.cross.329880829" keepEnvironmentInBuildfile="true" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.315548965" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.804731966" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/icicle-kit-es}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/icicle-kit-es/platform_config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/pfsc-platform}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/pfsc-platform/platform_config_reference}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/multizone-sdk-pfsc/ext/multizone}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1116648218" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1637123622" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"/>
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
*.lst
*.map
*.siz
ext/icicle-kit-es/soc_config/
ext/icicle-kit-es/fpga_design_config/
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "ext/icicle-ref-design"]
path = ext/icicle-ref-design
url = https://github.com/polarfire-soc/icicle-kit-reference-design.git
[submodule "ext/pfsc-platform"]
path = ext/pfsc-platform
url = https://github.com/polarfire-soc/platform.git
[submodule "ext/icicle-ref-design"]
path = ext/icicle-ref-design
url = https://github.com/polarfire-soc/icicle-kit-reference-design.git
5 changes: 5 additions & 0 deletions .settings/org.eclipse.cdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
doxygen/doxygen_new_line_after_brief=true
doxygen/doxygen_use_brief_tag=false
doxygen/doxygen_use_javadoc_tags=true
doxygen/doxygen_use_pre_tag=false
doxygen/doxygen_use_structural_commands=false
eclipse.preferences.version=1
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1359029007.668057433/BOARD/delimiter=\:
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1359029007.668057433/BOARD/operation=append
Expand Down
25 changes: 15 additions & 10 deletions apps/hart0/bsp/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

TARGET = boot.elf

EXT_DIR := ../../../../ext
PLATFORM_DIR := $(EXT_DIR)/bare-metal-lib/src/platform
EXT_DIR := $(abspath ../../../../ext)
PLATFORM_DIR := $(EXT_DIR)/pfsc-platform
ICICLE_KIT_ES_DIR := $(EXT_DIR)/icicle-kit-es
SOC_CONF_DIR := $(EXT_DIR)/icicle-kit-es/soc_config
SOC_CONF_GEN_DIR := $(EXT_DIR)/bare-metal-lib/src/platform/soc_config_generator
SOC_CONF_DIR := $(EXT_DIR)/icicle-kit-es/fpga_design_config
SOC_CONF_GEN_DIR := $(EXT_DIR)/pfsc-platform/soc_config_generator
SOC_CONF_XML_DIR := $(EXT_DIR)/icicle-ref-design/XML
MULTIZONE_DIR := $(EXT_DIR)/multizone

Expand All @@ -25,6 +25,7 @@ C_SRCS += ../../../hart3/u54_3.c
C_SRCS += ../../../hart4/u54_4.c

ASM_SRCS+= $(PLATFORM_DIR)/mpfs_hal/startup_gcc/mss_entry.S
ASM_SRCS+= $(PLATFORM_DIR)/mpfs_hal/startup_gcc/mss_utils.S
#ASM_SRCS+= $(PLATFORM_DIR)/mpfs_hal/startup_gcc/mss_mutex.S
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/startup_gcc/system_startup.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/startup_gcc/newlib_stubs.c
Expand All @@ -35,8 +36,9 @@ C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_irq_handler_stubs.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_l2_cache.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_mpu.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_mtrap.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_peripherals.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_plic.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_pmp.c
#C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_pmp.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/mss_util.c
#C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_cfm.c
#C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_ddr.c
Expand All @@ -45,15 +47,16 @@ C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_io.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_nwc_init.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_pll.c
C_SRCS += $(PLATFORM_DIR)/mpfs_hal/common/nwc/mss_sgmii.c
C_SRCS += $(PLATFORM_DIR)/drivers/mss_mmuart/mss_uart.c
C_SRCS += $(PLATFORM_DIR)/drivers/mss/mss_mmuart/mss_uart.c

CFLAGS += -march=rv64gc -mabi=lp64d # g = imafd
CFLAGS += -mcmodel=medany -msmall-data-limit=8
CFLAGS += -mstrict-align -mno-save-restore
CFLAGS += -fmessage-length=0 -fsigned-char
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Og -g # MCHP Bug: anything but -O0 => GDB msg "The riscv_frame_cache's start_addr is ..."
CFLAGS += -Wextra -DNDEBUG
CFLAGS += -Wall -Wextra -DNDEBUG -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function
CFLAGS += -DNDEBUG
CFLAGS += -std=gnu11 -Wstrict-prototypes -Wbad-function-cast

LDFLAGS += -T $(LINKER_SCRIPT)
Expand Down Expand Up @@ -91,10 +94,12 @@ $(ASM_OBJS): %.o: %.S $(HEADERS) $(SOC_CONF_DIR)
$(C_OBJS): %.o: %.c $(HEADERS) $(SOC_CONF_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

.SILENT: $(SOC_CONF_DIR)
$(SOC_CONF_DIR):
@python3 $(SOC_CONF_GEN_DIR)/mpfs_configuration_generator.py \
$(SOC_CONF_XML_DIR)/ICICLE_MSS_cfg.xml \
$(ICICLE_KIT_ES_DIR)
# MCHP Bug - mpfs_configuration_generator.py v2021.11: xml file name ignored unless in current folder
echo "mpfs_configuration_generator.py ICICLE_MSS_cfg.xml"
cd $(SOC_CONF_XML_DIR); \
python3 $(SOC_CONF_GEN_DIR)/mpfs_configuration_generator.py ICICLE_MSS_cfg.xml $(ICICLE_KIT_ES_DIR) > /dev/null

.PHONY: clean
clean:
Expand Down
7 changes: 7 additions & 0 deletions apps/hart0/e51.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "mpfs_hal/mss_hal.h"

/* Overrides weak symbol in ext/pfsc-platform/mpfs_hal/startup_gcc/system_startup.c */
void e51(void) {

/* Enable UARTs */
Expand Down Expand Up @@ -37,3 +38,9 @@ void e51(void) {
asm("csrr t0, mscratch; csrw mtvec, t0; ecall");

}

/* Overrides weak symbol in ext/pfsc-platform/mpfs_hal/startup_gcc/system_startup.c */
uint8_t init_pmp(uint8_t hart_id) {
//pmp_configure(hart_id);
return (0U);
}
18 changes: 9 additions & 9 deletions apps/hart1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#include <stdlib.h> // strtoul()

#include "mpfs_hal/mss_hal.h"
#include "drivers/mss_mmuart/mss_uart.h"
#include "drivers/mss/mss_mmuart/mss_uart.h"
#include "mss_multizone.h"

#define mss_printf(format, args...) { \
snprintf(mss_uart_tx_buf, sizeof mss_uart_tx_buf, format, ## args); \
MSS_UART_polled_tx_string (uart, mss_uart_tx_buf); \
MSS_UART_polled_tx_string (uart, (uint8_t *)mss_uart_tx_buf); \
}

typedef enum {zone1=1, zone2, zone3, zone4} Zone;
Expand All @@ -33,25 +33,25 @@ void handle_m_trap_h1(uintptr_t * regs, uintptr_t mcause, uintptr_t mepc){
switch(mcause){

case CAUSE_LOAD_ACCESS :
mss_printf("Load access fault : 0x%08x 0x%08x 0x%08x \n\r", mcause, mepc, mtval);
mss_printf("Load access fault : 0x%08x 0x%08x 0x%08x \n\r", (unsigned)mcause, (unsigned)mepc, (unsigned)mtval);
write_csr(mepc, mepc + (((*(char *)mepc) & 0b11) == 0b11 ? 4 : 2)); // skip faulty instruction
return;

case CAUSE_STORE_ACCESS :
mss_printf("Store access fault : 0x%08x 0x%08x 0x%08x \n\r", mcause, mepc, mtval);
mss_printf("Store access fault : 0x%08x 0x%08x 0x%08x \n\r", (unsigned)mcause, (unsigned)mepc, (unsigned)mtval);
write_csr(mepc, mepc + (((*(char *)mepc) & 0b11) == 0b11 ? 4 : 2)); // skip faulty instruction
return;

case CAUSE_FETCH_ACCESS :
mss_printf("Instr access fault : 0x%08x 0x%08x 0x%08x \n\r", mcause, mepc, mtval);
mss_printf("Instr access fault : 0x%08x 0x%08x 0x%08x \n\r", (unsigned)mcause, (unsigned)mepc, (unsigned)mtval);
break;

default : mss_printf("Exception : 0x%08x 0x%08x 0x%08x \n\r", mcause, mepc, mtval);
default : mss_printf("Exception : 0x%08x 0x%08x 0x%08x \n\r", (unsigned)mcause, (unsigned)mepc, (unsigned)mtval);

}

mss_printf("Press any key to continue \n\r");
char c='\0'; while( MSS_UART_get_rx(uart, &c, 1) == 0 ){;}
char c='\0'; while( MSS_UART_get_rx(uart, (uint8_t *)&c, 1) == 0 ){;}
inputline[0]='\0';
asm ("la t0, main; csrw mepc, t0" : : : "t0"); // TBD: asm("j _start");

Expand Down Expand Up @@ -145,7 +145,7 @@ void print_pmp(void){

}

mss_printf("0x%02x%08x 0x%02x%08x %s %s \n\r", (uint8_t)(start>>32), start, (uint8_t)(end>>32), end, rwx, type);
mss_printf("0x%02x%08x 0x%02x%08x %s %s \n\r", (unsigned)(start>>32), (unsigned)start, (unsigned)(end>>32), (unsigned)end, rwx, type);

}

Expand Down Expand Up @@ -385,7 +385,7 @@ int main (void) {
while(1){

// UART RX event handler
if (MSS_UART_get_rx(uart, &c, 1) && readline(c)){
if (MSS_UART_get_rx(uart, (uint8_t *)&c, 1) && readline(c)){
cmd_handler();
mss_printf("\n\rH1 > ");
inputline[0]='\0';
Expand Down
2 changes: 1 addition & 1 deletion apps/hart1/u54_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>

#include "mpfs_hal/mss_hal.h"
#include "drivers/mss_mmuart/mss_uart.h"
#include "drivers/mss/mss_mmuart/mss_uart.h"

void u54_1(void) {

Expand Down
4 changes: 2 additions & 2 deletions apps/hart2/u54_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>

#include "mpfs_hal/mss_hal.h"
#include "drivers/mss_mmuart/mss_uart.h"
#include "drivers/mss/mss_mmuart/mss_uart.h"

void u54_2(void) {

Expand All @@ -27,7 +27,7 @@ void u54_2(void) {

MSS_UART_init(uart, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);

MSS_UART_polled_tx_string (uart, "H2> ");
MSS_UART_polled_tx_string (uart, (uint8_t *)"H2> ");

while (1) {

Expand Down
4 changes: 2 additions & 2 deletions apps/hart3/u54_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>

#include "mpfs_hal/mss_hal.h"
#include "drivers/mss_mmuart/mss_uart.h"
#include "drivers/mss/mss_mmuart/mss_uart.h"

void u54_3(void) {

Expand All @@ -27,7 +27,7 @@ void u54_3(void) {

MSS_UART_init(uart, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);

MSS_UART_polled_tx_string (uart, "H3> ");
MSS_UART_polled_tx_string (uart, (uint8_t *)"H3> ");

while (1) {

Expand Down
4 changes: 2 additions & 2 deletions apps/hart4/u54_4.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>

#include "mpfs_hal/mss_hal.h"
#include "drivers/mss_mmuart/mss_uart.h"
#include "drivers/mss/mss_mmuart/mss_uart.h"

void u54_4(void) {

Expand All @@ -27,7 +27,7 @@ void u54_4(void) {

MSS_UART_init(uart, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT);

MSS_UART_polled_tx_string (uart, "H4> ");
MSS_UART_polled_tx_string (uart, (uint8_t *)"H4> ");

while (1) {

Expand Down
Loading

0 comments on commit e1270a4

Please sign in to comment.