Skip to content

Commit

Permalink
Merge pull request #144 from VisorFolks/development
Browse files Browse the repository at this point in the history
Staging stable with project unification and dynamic memory support
  • Loading branch information
akashkollipara authored Aug 9, 2022
2 parents 1479c4b + 06a2edc commit f8014bd
Show file tree
Hide file tree
Showing 61 changed files with 1,641 additions and 187 deletions.
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Cyancore VSCode extension",
"includePath": [
"${workspaceFolder}/**"
"${workspaceFolder}/src/**"
],
"intelliSenseMode": "${default}",
"compilerPath": "",
Expand Down
1 change: 1 addition & 0 deletions mk/path.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

CC_ROOT := .
TOOLS_ROOT ?= $(abspath $(CC_ROOT))/tools
MISC_TOOLS := $(TOOLS_ROOT)/misc_bins

SRC := $(CC_ROOT)/src
OUT_PATH ?= $(CC_ROOT)/out
Expand Down
65 changes: 65 additions & 0 deletions mk/picotool.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2022, Cyancore Team
#
# File Name : picotool.mk
# Description : This is a build script to generate picotool
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

PICO_SDK_GIT := [email protected]:raspberrypi/pico-sdk.git
PICO_TOOL_GIT := [email protected]:raspberrypi/picotool.git
PICO_SDK_PATH := $(TOOLS_ROOT)/pico-sdk/
PICO_TOOL_PATH := $(TOOLS_ROOT)/picotool/
PICO_TOOL := $(MISC_TOOLS)/picotool
PICO_TOOL_BUILD := $(PICO_TOOL_PATH)/build/picotool
ELF2UF2 := $(MISC_TOOLS)/elf2uf2

ifneq ($(V),1)
SILENT_LOGS := > cbuild.log 2> /dev/null
endif

P_TARGETS += elf2uf2
T_ALLOWLIST += get_picotool pt_clean install_pt_dep

get_picotool: $(PICO_TOOL) $(ELF2UF2)

$(PICO_TOOL): $(PICO_TOOL_BUILD)
mkdir -p $(dir $@)
cp $(PICO_TOOL_PATH)/build/picotool $@

$(PICO_TOOL_BUILD): $(PICO_SDK_PATH) $(PICO_TOOL_PATH)
@echo "Building picotool ..."
cd $(PICO_TOOL_PATH) && mkdir -p build && \
cd build && export PICO_SDK_PATH=$(PICO_SDK_PATH) && \
cmake ../ $(SILENT_LOGS) \
&& make $(SILENT_LOGS)

$(ELF2UF2): $(PICO_SDK_PATH)
@echo "Building elf2uf2 ..."
mkdir -p $(MISC_TOOLS)/temp
cd $(MISC_TOOLS)/temp; \
cmake $(PICO_SDK_PATH)/tools/elf2uf2 2>/dev/null >/dev/null; \
make >/dev/null 2>/dev/null
cp $(MISC_TOOLS)/temp/elf2uf2 $@
rm -rf $(MISC_TOOLS)/temp

elf2uf2: $(ELF2UF2) elf
@echo "Generating $(notdir $(ELF:.elf=.uf2)) ..."
$(ELF2UF2) $(ELF) $(ELF:.elf=.uf2)

$(PICO_SDK_PATH):
@echo "Fetching PICO SDK ..."
git clone $(PICO_SDK_GIT) --quiet $@

$(PICO_TOOL_PATH):
@echo "Fetching PICO Tool ..."
git clone $(PICO_TOOL_GIT) --quiet $@

install_pt_dep:
@echo "Installing Dependencies ..."
@sudo apt-get install build-essential pkg-config libusb-1.0-0-dev -y -qq > /dev/null

pt_clean:
rm -rf $(PICO_SDK_PATH) $(PICO_TOOL_PATH) $(PICO_TOOL) $(ELF2UF2)
3 changes: 2 additions & 1 deletion mk/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
include mk/path.mk
include mk/mk_helper.mk
include mk/qemu.mk
include mk/picotool.mk

P_TARGETS += default cyancore check version copy_to_remote clean_remote
T_ALLOWLIST += help list clean all_projects
PROJECT_LIST := $(shell ls projects/ -I *.template)
PROJECT_LIST := $(shell ls projects/ -I *.template -I *.src)

.PHONY: aux_target

Expand Down
19 changes: 19 additions & 0 deletions projects/bl.src/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# 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 [[email protected]]
# Organisation : Cyancore Core-Team
#

BLP_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

DIR := $(BLP_DIR)
include mk/obj.mk
52 changes: 52 additions & 0 deletions projects/bl.src/project.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2022, Cyancore Team
*
* File Name : project.c
* Description : This file consists of project srouces
* Primary Author : Akash Kollipara [[email protected]]
* Organisation : Cyancore Core-Team
*/

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

void no_program(void);
void plug()
{
bootstrap();
driver_setup_all();
link_interrupt(int_arch, 2, no_program);

syslog(info, "Bootloader!\n");
syslog(info, "Waiting for 2secs ...\n");
for(int i = 0; i < 40; i++)
{
onboardled_toggle();
mdelay(50);
}
arch_di();
onboardled_off();
driver_exit_all();
platform_jump_to_user_code();
return;
}

void no_program()
{
driver_setup_all();
syslog(fail, "No User program found!\n");
while(1)
{
onboardled_toggle();
mdelay(1000);
}
}

18 changes: 18 additions & 0 deletions projects/demo.src/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2022, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

DEMO_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

DIR := $(DEMO_DIR)
include mk/obj.mk
46 changes: 46 additions & 0 deletions projects/demo.src/project.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2022, Cyancore Team
*
* File Name : project.c
* Description : This file consists of project srouces
* Primary Author : Akash Kollipara [[email protected]]
* Organisation : Cyancore Core-Team
*/

#include <status.h>
#include <stdio.h>
#include <string.h>
#include <terravisor/bootstrap.h>
#include <driver.h>
#include <driver/onboardled.h>
#include <time.h>

void plug()
{
bootstrap();
driver_setup_all();

printf("Demo Program!\n");
return;
}


void play()
{
static unsigned char i = 0;
char progress[] = "-\\|/";
uint64_t time;
char c = progress[(i++) % strlen(progress)];
get_timestamp(&time);
time /= 1000U;

printf("[%012llu] Running Blinky ... [%c]", time, c);

onboardled_toggle();

mdelay(500);

printf("\r");
return;
}
10 changes: 3 additions & 7 deletions projects/demo_avr/build.mk
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
# Copyrights (C) 2019-2022, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Description : This file build and gathers project properties
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

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

DIR := $(PROJECT_DIR)
Expand Down
1 change: 1 addition & 0 deletions projects/demo_avr/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ BOOTMSGS := 0
EARLYCON_SERIAL := 1
CONSOLE_SERIAL := 1
TERRAKERN := 0
OBRDLED_ENABLE := 1
53 changes: 0 additions & 53 deletions projects/demo_avr/project.c

This file was deleted.

8 changes: 2 additions & 6 deletions projects/demo_riscv/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
# Copyrights (C) 2019, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Description : This file builds and gathers project properties
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

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

DIR := $(PROJECT_DIR)
Expand Down
3 changes: 2 additions & 1 deletion projects/demo_riscv/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#

COMPILER := gcc
TC_VER := 8.2.0
TC_VER := 10.2.0
FAMILY := sifive
PLATFORM := fe310g002
STDLOG_MEMBUF := 0
BOOTMSGS := 0
EARLYCON_SERIAL := 1
CONSOLE_SERIAL := 1
OBRDLED_ENABLE := 1
Loading

0 comments on commit f8014bd

Please sign in to comment.