Skip to content

Commit

Permalink
Merge pull request #317 from VisorFolks/development
Browse files Browse the repository at this point in the history
Bumping critical changes into stable
  • Loading branch information
akashkollipara authored Aug 1, 2024
2 parents 044d0b6 + 68c9e20 commit e2804a1
Show file tree
Hide file tree
Showing 115 changed files with 583 additions and 400 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub CI
name: Cyancore Build

on:
push:
Expand Down Expand Up @@ -31,12 +31,10 @@ jobs:

- name: Fetch Dependencies
run: |
sudo apt install cppcheck -y
make get_avr_tc
make get_riscv_tc
make setup_workspace
- name: Init CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
debug: true
Expand All @@ -51,10 +49,13 @@ jobs:
make demo_qemu_sifive_e
make demo_ibex_ss
- name: Build Cache Stats
run: |
make show_ccache_stats
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

- name: Clean Up
run: |
make clean
rm -rf toolchain
make clean_workspace
38 changes: 38 additions & 0 deletions .github/workflows/cyancore_tools_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cyancore Tools Build

on:
pull_request:
branches: [ stable ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
statuses: write

strategy:
fail-fast: true

steps:
- uses: actions/checkout@v4

- name: Configure Git
env:
TOKEN: ${{ secrets.AKASH_VF }}
run: git config --global url."https://${TOKEN}:[email protected]/".insteadOf "https://github.com/"

- name: Fetch Dependencies
run: |
make setup_workspace
- name: Tools Build
run: |
make get_qemu V=1
make get_picotool V=1
- name: Clean Up
run: |
make clean_workspace
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tools/
backup/
bkp/
projects/
.buildcache/
*.elf
*.bin
*.d
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
SHELL := /bin/bash
N_JOBS ?= $(shell grep -c ^processor /proc/cpuinfo)
HOST_ARCH := $(shell lscpu | grep -Po '(?<='Architecture:' )[^"]*')
EN_BUILD_CACHE ?= 1
V ?= 0
PP ?= 0

include mk/help.mk
include mk/path.mk
include mk/ccache.mk
include mk/tc_get.mk
include mk/project.mk

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</body>

> **Version (arch:2 | major:4 | minor:2): 1.4.1**
>
[![GitHub CI](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml/badge.svg)](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml) [![Discord](https://img.shields.io/discord/859140196498014238?style=flat&logo=discord&logoSize=auto&label=VF%20Server)](https://discord.gg/gxUQr77MT2)
[![CC Build](https://github.com/VisorFolks/cyancore/actions/workflows/cyancore_build.yml/badge.svg)](https://github.com/VisorFolks/cyancore/actions/workflows/cyancore_build.yml) [![CC Tools Build](https://github.com/VisorFolks/cyancore/actions/workflows/cyancore_tools_build.yml/badge.svg)](https://github.com/VisorFolks/cyancore/actions/workflows/cyancore_tools_build.yml) [![Discord](https://img.shields.io/discord/859140196498014238?style=flat&logo=discord&logoSize=auto&label=VF%20Server)](https://discord.gg/gxUQr77MT2)

Cyancore is an open source unified software platform for embedded system projects. VisorFolks is motivated to develope a framework which enables a developer/user to write a portable project which can run on any of the target. It is designed to be a goto framework for almost all projects, be it an Embedded applications, IoT, firmware, OS, etc. It provides flexibility, tighter integration of features and abilities by utilizing the hardware and software resources better and boost various KPIs of the final product.

Expand Down
135 changes: 135 additions & 0 deletions mk/ccache.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2024, Cyancore Team
#
# File Name : ccache.mk
# Description : This file provides recipes for build cache
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

#*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*#
#--------------< Build Cache >--------------#
#*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*#

CCACHE_DIR := $(CC_ROOT)/.buildcache

# For Flags read ccache documentation
CCACHE_ABSSTDERR := true
export CCACHE_ABSSTDERR
CCACHE_BASEDIR :=
export CCACHE_BASEDIR
CCACHE_DIR := $(CCACHE_DIR)/cache
export CCACHE_DIR
CCACHE_COMPILER :=
export CCACHE_COMPILER
CCACHE_COMPILERCHECK := mtime
export CCACHE_COMPILERCHECK
CCACHE_COMPILERTYPE := auto
export CCACHE_COMPILERTYPE
export CCACHE_COMPRESS
CCACHE_COMPRESSLEVEL := 0
export CCACHE_COMPRESSLEVEL
CCACHE_EXTENSION :=
export CCACHE_EXTENSION
# export CCACHE_DEBUG
export CCACHE_NODEBUG
CCACHE_DEBUGDIR := $(CCACHE_DIR)/dbg
export CCACHE_DEBUGDIR
CCACHE_DEBUGLEVEL := 2
export CCACHE_DEBUGLEVEL
# export CCACHE_DEPEND
export CCACHE_NODEPEND
export CCACHE_DIRECT
# export CCACHE_NODIRECT
# export CCACHE_DISABLE
export CCACHE_NODISABLE
CCACHE_EXTRAFILES :=
export CCACHE_EXTRAFILES
# export CCACHE_FILECLONE
export CCACHE_NOFILECLONE
# export CCACHE_HARDLINK
export CCACHE_NOHARDLINK
export CCACHE_HASHDIR
# export CCACHE_NOHASHDIR
CCACHE_IGNOREHEADERS :=
export CCACHE_IGNOREHEADERS
CCACHE_IGNOREOPTIONS :=
export CCACHE_IGNOREOPTIONS
# export CCACHE_INODECACHE
export CCACHE_NOINODECACHE
# export CCACHE_COMMENTS
export CCACHE_NOCOMMENTS
CCACHE_LOGFILE := $(CCACHE_DIR)/log
export CCACHE_LOGFILE
CCACHE_MAXFILES := 0
export CCACHE_MAXFILES
CCACHE_MAXSIZE := 1.0 GiB
export CCACHE_MAXSIZE
CCACHE_MSVC_DEP_PREFIX := Note: including file:
export CCACHE_MSVC_DEP_PREFIX
CCACHE_NAMESPACE := cyancore
export CCACHE_NAMESPACE
CCACHE_PATH :=
export CCACHE_PATH
# export CCACHE_PCH_EXTSUM
export CCACHE_NOPCH_EXTSUM
CCACHE_PREFIX :=
export CCACHE_PREFIX
CCACHE_PREFIX_CPP :=
export CCACHE_PREFIX_CPP
# export CCACHE_READONLY
export CCACHE_NOREADONLY
# export CCACHE_READONLY_DIRECT
export CCACHE_NOREADONLY_DIRECT
# export CCACHE_RECACHE
export CCACHE_NORECACHE
# export CCACHE_REMOTE_ONLY
export CCACHE_NOREMOTE_ONLY
CCACHE_REMOTE_STORAGE :=
export CCACHE_REMOTE_STORAGE
# export CCACHE_RESHARE
export CCACHE_NORESHARE
export CCACHE_CPP2
# export CCACHE_NOCPP2
CCACHE_SLOPPINESS :=
export CCACHE_SLOPPINESS
# export CCACHE_NOSTATS
export CCACHE_STATS
export CCACHE_STATSLOG := $(CCACHE_DIR)/stats
export CCACHE_TEMPDIR := $(CCACHE_DIR)/
CCACHE_UMASK :=
export CCACHE_UMASK


ifeq ($(EN_BUILD_CACHE),1)
CCACHE := $(shell which ccache)

T_ALLOWLIST += show_ccache_config show_ccache_stats clean_ccache

show_ccache_stats:
ifneq ($(realpath $(CCACHE_LOGFILE)),)
$(CCACHE) -s -x -v
else
$(info < ! > No log file present, try to perform build and try!)
endif

show_ccache_config: --prepare-cache
$(CCACHE) -p

clean_ccache:
ifneq ($(realpath $(CCACHE_LOGFILE)),)
$(CCACHE) -c -C -z
else
$(info < ! > No log file present, try to perform build and try!)
endif


.PHONY: --prepare-cache
--prepare-cache: $(CCACHE_LOGFILE)

.SECONDEXPANSION:
$(CCACHE_LOGFILE): | $$(@D)/
touch $@
endif

4 changes: 2 additions & 2 deletions mk/elf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ elf: $(ELF)
.SECONDEXPANSION:
$(ELF): $(DEP_LIBS) $(DEP_OBJS) $(LD_SCRIPT) $(LD_SUPPLEMENT) | $$(SIZE)
@echo "Elf: Generating $(@F) ..."
$(LD) -dT $(LD_SCRIPT) $(addprefix -T , $(LD_SUPPLEMENT)) $(LD_FLAGS) \
$(CCACHE) $(LD) -dT $(LD_SCRIPT) $(addprefix -T , $(LD_SUPPLEMENT)) $(LD_FLAGS) \
-Map=$(@:.elf=.map) -o $@ $(filter %.o, $^) $(DEP_LIB_PATH) $(DEP_LIBS_ARG) $(EXLIB_ARGS) -L $(TL) -lgcc
$(OD) -Dx -h --wide $@ > $(@:.elf=.lst)
$(OC) -O binary $@ $(@:.elf=.bin)
Expand All @@ -40,5 +40,5 @@ $(ELF): $(DEP_LIBS) $(DEP_OBJS) $(LD_SCRIPT) $(LD_SUPPLEMENT) | $$(SIZE)
$(OUT)/%.ld: %.ld.sx
mkdir -p $(@D)
@echo "Elf: Preprocessing $(@F) ..."
$(CC) $(CFLAGS) -E -P -o $@ $<
$(CCACHE) $(CC) $(CFLAGS) -E -P -o $@ $<

4 changes: 2 additions & 2 deletions mk/help.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Usage: make [<project_name>|default|...] (V=|PP=|...)\n\
\n\
Examples:\n\
$$ make demo_avr \# Builds project demo_avr\n\
$$ make clean \# Cleans the build out folder \n\
$$ make demo_avr clean \# Cleans demo_avr build\n\
$$ make demo_avr V=1 \# Builds demo_avr with verbose\n\
$$ make list \# Displays all the available projects\n\
$$ make get_all_tc \# Fetches all toolchains\n\
Expand Down Expand Up @@ -54,7 +54,7 @@ passed. This uses multi threaded build.\n\
Use this for debug as it will be slow than default.\n\
~ clean: Cleans the project build artifacts.\n\
~ check: Perform static analysis.\n\
clean: Cleans all the build artifacts.\n\
clean_workspace: Cleans workspace to new checkout state.\n\
list: Displays all the projects available for build.\n\
get_all_tc: Fetches all Toolchains.\n\
get_avr_tc: Fetches AVR Toolchain.\n\
Expand Down
2 changes: 1 addition & 1 deletion mk/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AR_FLAGS ?= rcs

$(LIB): $(LIB_OBJS) | $$(@D)/
@echo "Lib: Generating $(@F) ..."
$(AR) $(AR_FLAGS) $@ $^
$(CCACHE) $(AR) $(AR_FLAGS) $@ $^

LIB_INCLUDE_PATH:=
LIB_OBJS :=
Expand Down
12 changes: 6 additions & 6 deletions mk/lobj.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ DEP_SRCS += $(C_SRCS) $(CPP_SRCS)
$(CPP_OBJS): $(OUT)/%.o: %.cpp | $$(@D)/
@echo "Elf: Compiling $(@F:.o=.cpp) ..."
ifeq ($(PP),1)
$(CCP) $(CPPFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.cpp)
$(CCACHE) $(CCP) $(CPPFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.cpp)
endif
$(CCP) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(CCACHE) $(CCP) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(C_OBJS): $(OUT)/%.o: %.c | $$(@D)/
@echo "Lib: Compiling $(@F:.o=.c) ..."
ifeq ($(PP),1)
$(CC) $(CCFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.c)
$(CCACHE) $(CC) $(CCFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.c)
endif
$(CC) $(CCFLAGS) $(CFLAGS) -c $< -o $@
$(CCACHE) $(CC) $(CCFLAGS) $(CFLAGS) -c $< -o $@

$(S_OBJS): $(OUT)/%.o: %.S | $$(@D)/
@echo "Lib: Assembling $(@F:.o=.S) ..."
$(CC) -E $(CCFLAGS) $(CFLAGS) -c $< -o $(@:.o=.pre.S)
$(AS) $(ASFLAGS) $(@:.o=.pre.S) -o $@
$(CCACHE) $(CC) -E $(CCFLAGS) $(CFLAGS) -c $< -o $(@:.o=.pre.S)
$(CCACHE) $(AS) $(ASFLAGS) $(@:.o=.pre.S) -o $@
ifneq ($(PP),1)
rm $(@:.o=.pre.S)
endif
Expand Down
12 changes: 10 additions & 2 deletions mk/mk_helper.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
# Copyrights (C) 2024, Cyancore Team
#
# File Name : mk_helper.mk
# Description : This file defines make helper utilities
Expand All @@ -25,7 +25,7 @@ define add_cflag
endef

define add_ldflag
LD_FLAGS += $(1)
LD_FLAGS+= $(1)
endef

define check_and_include
Expand All @@ -37,3 +37,11 @@ endef
define get_tc_version
TC_VER := $(firstword $(strip $(shell $(1)-gcc --version | grep -m 1 -Po '\s(\d{1,}\.\d{1,}\.\d{1,})')))
endef

define check_config_and_include
ifeq ($(realpath $(1)),)
$$(info < ! > Invalid $(2) ...)
else
include $(realpath $(1))
endif
endef
12 changes: 6 additions & 6 deletions mk/obj.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ DEP_SRCS += $(C_SRCS) $(CPP_SRCS)
$(CPP_OBJS): $(OUT)/%.o: %.cpp | $$(@D)/
@echo "Elf: Compiling $(@F:.o=.cpp) ..."
ifeq ($(PP),1)
$(CCP) $(CPPFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.cpp)
$(CCACHE) $(CCP) $(CPPFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.cpp)
endif
$(CCP) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(CCACHE) $(CCP) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(C_OBJS): $(OUT)/%.o: %.c | $$(@D)/
@echo "Elf: Compiling $(@F:.o=.c) ..."
ifeq ($(PP),1)
$(CC) $(CCFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.c)
$(CCACHE) $(CC) $(CCFLAGS) $(CFLAGS) -E -p $< -o $(@:.o=.pre.c)
endif
$(CC) $(CCFLAGS) $(CFLAGS) -c $< -o $@
$(CCACHE) $(CC) $(CCFLAGS) $(CFLAGS) -c $< -o $@

$(S_OBJS): $(OUT)/%.o: %.S | $$(@D)/
@echo "Elf: Assembling $(@F:.o=.S) ..."
$(CC) -E $(CCFLAGS) $(CFLAGS) -c $< -o $(@:.o=.pre.S)
$(AS) $(ASFLAGS) $(@:.o=.pre.S) -o $@
$(CCACHE) $(CC) -E $(CCFLAGS) $(CFLAGS) -c $< -o $(@:.o=.pre.S)
$(CCACHE) $(AS) $(ASFLAGS) $(@:.o=.pre.S) -o $@
ifneq ($(PP),1)
rm $(@:.o=.pre.S)
endif
Expand Down
2 changes: 1 addition & 1 deletion mk/path.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ OUT ?= $(OUT_PATH)/$(PROJECT)

GET_PATH = $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))

$(OUT)/%/:
%/:
mkdir -p $@
Loading

0 comments on commit e2804a1

Please sign in to comment.