Skip to content

Commit

Permalink
<Qemu SiFive-E> Add project and bootloader
Browse files Browse the repository at this point in the history
Issue: #233
  • Loading branch information
akashkollipara committed Feb 19, 2023
1 parent bdc735a commit a36e4e1
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 1 deletion.
20 changes: 20 additions & 0 deletions projects/demo_qemu_sifive_e/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
#
# File Name : build.mk
# Description : This file builds and gathers project properties
# Primary Author : Akash Kollipara [akashkollipara@gmail.com]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

include $(PROJECT_DIR)/../demo.src/build.mk
include $(PROJECT_DIR)/config.mk

DIR := $(PROJECT_DIR)
include mk/obj.mk

aux_target:
make qemu_sifive_e_bl
20 changes: 20 additions & 0 deletions projects/demo_qemu_sifive_e/config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
#
# File Name : config.mk
# Description : This file consists of project config
# Primary Author : Akash Kollipara [akashkollipara@gmail.com]
# Organisation : Cyancore Core-Team
#

COMPILER := gcc
TC_VER := 10.2.0
FAMILY := sifive
PLATFORM := qemu-sifive-e
STDLOG_MEMBUF := 0
BOOTMSGS := 0
EARLYCON_SERIAL := 1
CONSOLE_SERIAL := 1
OBRDLED_ENABLE := 1
TERRAKERN := 0
21 changes: 21 additions & 0 deletions projects/qemu_sifive_e_bl/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2022, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Primary Author : Akash Kollipara [akashkollipara@gmail.com]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

include $(PROJECT_DIR)/config.mk

DIR := $(PROJECT_DIR)
include mk/obj.mk
21 changes: 21 additions & 0 deletions projects/qemu_sifive_e_bl/config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
#
# File Name : config.mk
# Description : This file consists of project config
# Primary Author : Akash Kollipara [akashkollipara@gmail.com]
# Organisation : Cyancore Core-Team
#

COMPILER := gcc
TC_VER := 10.2.0
FAMILY := sifive
PLATFORM := qemu-sifive-e-bl
USE_FLOAT := 0
STDLOG_MEMBUF := 0
BOOTMSGS := 0
EARLYCON_SERIAL := 1
CONSOLE_SERIAL := 0
OBRDLED_ENABLE := 0
TERRAKERN := 0
41 changes: 41 additions & 0 deletions projects/qemu_sifive_e_bl/project.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2022, Cyancore Team
*
* File Name : project.c
* Description : This file consists of project srouces
* Primary Author : Akash Kollipara [akashkollipara@gmail.com]
* Organisation : Cyancore Core-Team
*/

#include <status.h>
#include <syslog.h>
#include <terravisor/bootstrap.h>
#include <arch.h>
#include <driver.h>
#include <interrupt.h>
#include <platform.h>
#include <time.h>

void no_program(void);
void plug()
{
bootstrap();
driver_setup_all();
syslog_stdout_enable();
link_interrupt(int_arch, 2, no_program);
syslog(info, "Bootloader!\n");
syslog(info, "Jumping to XIP...\n");
driver_exit_all();
arch_di();
platform_jump_to_user_code();
return;
}

void no_program()
{
driver_setup_all();
syslog(fail, "No User program found!\n");
plat_panic_handler();
}

10 changes: 9 additions & 1 deletion src/platform/sifive/common_fe310/platform/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,17 @@ static void platform_memory_layout()

void platform_setup()
{
/*
status_t ret = success;
*/

#if PRCI_CLK
status_t ret = success;
driver_setup("sysclk_prci");
ret |= sysclk_reset();
/* This is a temporary change */
if(ret != success)
exit(EXIT_FAILURE);
#endif

driver_setup("earlycon");
Expand All @@ -91,9 +97,11 @@ void platform_setup()
#if PRINT_MEMORY_LAYOUT
platform_memory_layout();
#endif

/* Uncomment this and remove above check if more conditions
* are introduced.
if(ret != success)
exit(EXIT_FAILURE);
*/
return;
}

Expand Down

0 comments on commit a36e4e1

Please sign in to comment.