diff --git a/.github/workflows/github_ci.yml b/.github/workflows/github_ci.yml index 7b5c758a..832cbfc2 100644 --- a/.github/workflows/github_ci.yml +++ b/.github/workflows/github_ci.yml @@ -2,10 +2,10 @@ name: GitHub CI on: push: - branches: [ stable, development] + branches: [ stable, development, helios_stage] pull_request: - branches: [ stable, development] + branches: [ stable, development, helios_stage] jobs: build: @@ -44,17 +44,13 @@ jobs: languages: ${{ matrix.language }} debug: true - - name: Linting - run: | - make demo_avr check - make demo_avr_cpp check - make demo_riscv check - - name: Build run: | make demo_avr make demo_avr_cpp make demo_riscv + make demo_helios_avr + make demo_helios_riscv - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index bc2a1ed7..a5066287 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -5,10 +5,12 @@ on: branches: - stable - development + - helios_stage pull_request: branches: - stable - development + - helios_stage jobs: build: diff --git a/.gitignore b/.gitignore index 82f9ae17..07daea91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,44 @@ -.scannerwork -sonar-cfamily-reproducer.zip -temp -out/ -tools/ -backup/ -bkp/ -projects/ -*.elf -*.bin -*.d -*.o -*.ko -*.obj -*.dll -*.so -*.so.* -*.dylib -*.lib -*.la -*.lo -*.a -*.ilk -*.map -*.dis -*.new -*.bkp -*.backup -*.b -*.dev -*.old -*.temp -*.tmp -*.sw* -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex -*.mod* -*.cmd -*.todo +.scannerwork +.vscode/ +sonar-cfamily-reproducer.zip +temp +out/ +tools/ +backup/ +bkp/ +projects/ +*.elf +*.bin +*.d +*.o +*.ko +*.obj +*.dll +*.so +*.so.* +*.dylib +*.lib +*.la +*.lo +*.a +*.ilk +*.map +*.dis +*.new +*.bkp +*.backup +*.b +*.dev +*.old +*.temp +*.tmp +*.sw* +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex +*.mod* +*.cmd +*.todo diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index e1140042..f4353993 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -8,7 +8,8 @@ "intelliSenseMode": "${default}", "compilerPath": "/usr/bin/gcc", "cStandard": "gnu17", - "cppStandard": "gnu++14" + "cppStandard": "gnu++14", + "compileCommands": "${workspaceFolder}/.vscode/compile_commands.json" } ], "version": 4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 9adbd8ac..4fef0018 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -35,8 +35,50 @@ "text": "b plug" }, ], - - + }, + { + "name": "FE310 Debug (JLink)", + "type": "cppdbg", + "request": "launch", + "miDebuggerServerAddress": ":2331", + "program": "${workspaceFolder}/out/${input:project}/${input:project}.elf", + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "MIMode": "gdb", + "svdPath": "", + "externalConsole": false, + "showDisplayString": true, + "variables": { + "elfPath": "${workspaceFolder}/out/${input:project}/${input:project}.elf" + }, + "miDebuggerPath": "${workspaceFolder}/tools/risc-v-toolchain/bin/riscv64-unknown-elf-gdb", + "miDebuggerArgs": "${elfPath}", + "setupCommands": + [ + { + "text": "b init" + }, + { + "text": "b plug" + }, + ], + "postRemoteConnectCommands": [ + { + "text": "file ${elfPath}" + }, + { + "text": "monitor halt" + }, + { + "text": "load" + }, + { + "text": "monitor reset" + }, + { + "text": "monitor go" + } + ] } ], "inputs": [ @@ -48,6 +90,7 @@ "demo_avr", "demo_avr_cpp", "demo_riscv", + "demo_helios_riscv" ], "default": "demo_avr" }, diff --git a/.vscode/settings.json b/.vscode/settings.json index b46e6ca1..afd7a788 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -39,7 +39,9 @@ "*.sx": "c", "*.{c,c.dev.c.temp,c.tmp,c.old,h,h.dev,h.old,h.temp,h.tmp)": "C", "*.{cpp,cpp.dev,cpp.temp,cpp.tmp,cpp.old}": "C++", - "*.{S,S.old,S.dev.S.temp,S.tmp,s.old,s.temp,s.tmp,s.dev,asm,asm.old,asm.dev.asm.temp,asm.tmp,inc,inc.old,inc.temp,inc.tmp,ld,ld.old,ld.temp,ld.tmp,ld.sx,ld.sx.old,ld.sx.temp,ld.sx.tmp,lst}": "coffeescript" + "*.{S,S.old,S.dev.S.temp,S.tmp,s.old,s.temp,s.tmp,s.dev,asm,asm.old,asm.dev.asm.temp,asm.tmp,inc,inc.old,inc.temp,inc.tmp,ld,ld.old,ld.temp,ld.tmp,ld.sx,ld.sx.old,ld.sx.temp,ld.sx.tmp,lst}": "coffeescript", + "cc_os_sched.h": "c", + "cc_os.h": "c" }, "files.autoSave": "afterDelay", "files.autoSaveDelay": 100, @@ -57,5 +59,6 @@ "workbench.settings.openDefaultKeybindings": true, "C_Cpp.autocompleteAddParentheses": true, "git.alwaysSignOff": true, - "files.autoGuessEncoding": true + "files.autoGuessEncoding": true, + "sonarlint.pathToCompileCommands": "${workspaceFolder}/.vscode/compile_commands.json" } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30135475..05131b42 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ # Contributing Guidlines -- Use tabs, width=8, commit of **code** with spaces and whitespaces will be rejected. +- Use tabs, width=8, commit of **code** with spaces and trailing whitespaces will be rejected. - Use Spaces, width=4, for **documentation** that is ".md" - Use the coding format that is set in the current repo as of 3-jul-2021. - We recommend going through Cyancore sources by taking help of README in each folder before you start with project. It is our duty to ensure the code is simple and understandable. diff --git a/makefile b/Makefile similarity index 100% rename from makefile rename to Makefile diff --git a/README.md b/README.md index fbabdac7..037c29d6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@
An unified software platform for embedded system projects ...
- From India with Pride!

+ From Bharat with Pride!

diff --git a/mk/help.mk b/mk/help.mk index 553ffbe3..4d26033f 100644 --- a/mk/help.mk +++ b/mk/help.mk @@ -1,6 +1,6 @@ # # CYANCORE LICENSE -# Copyrights (C) 2019, Cyancore Team +# Copyrights (C) 2023, Cyancore Team # # File Name : help.mk # Description : This file prints cyancore build help @@ -8,7 +8,66 @@ # Organisation : Cyancore Core-Team # -.PHONY: help +T_ALLOWLIST += help + +HELP :="\ +==================< Cyancore Make Help >==================\n\ +Usage: make [|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 V=1 \# Builds demo_avr with verbose\n\ +$$ make list \# Displays all the available projects\n\ +$$ make get_all_tc \# Fetches all toolchains\n\ +\n\ +----------\n\ +Variables:\n\ +----------\n\ +V=(*0/1) Verbose build logs.\n\ +If 1, the build will spew all the build logs.\n\ +\n\ +PP=(*0/1) PreProcess stage enable.\n\ +If 1, the build engine shall generate/save preprocessed\n\ +file which can be used for debugging.\n\ +\n\ +DEBUG=(*0/1/2/3/5) Enable build with debug code.\n\ +This Flag is used to enable debug routines to log info\n\ +while program executes. Visit libsyslog directory for\n\ +more info.\n\ +\n\ +* - marks default value\n\ +For more variablea that can be passed,\n\ +please visit [DOCS REPO]\n\ +\n\ +--------\n\ +Targets:\n\ +--------\n\ +project_name: Name of the project.\n\ +The build engine will automatically create dynamic target\n\ +using project name. Any following target which will\n\ +depend on project name will be marked with \`~\`.\n\ +\n\ +~ default: The default target of make, this need not be\n\ +passed. This uses multi threaded build.\n\ +~ cyancore: This performs 1 thread 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\ +list: Displays all the projects available for build.\n\ +get_all_tc: Fetches all Toolchains.\n\ +get_avr_tc: Fetches AVR Toolchain.\n\ +get_arm_tc: Fetches ARM Toolchain.\n\ +get_riscv_tc: Fetches RISC-V Toolchain.\n\ +qemu_test: Performs build and runs a demo on qemu.\n\ +\n\ +For more targets/info, please visit [DOCS REPO].\n\ +\n\ +----------------------------------------------------------\n\ +DOCS REPO: https://github.com/VisorFolks/cc_docs\n\ +----------------------------------------------------------\ +" help: - less mk/usage_help.txt + echo -e $(HELP) diff --git a/mk/project.mk b/mk/project.mk index 24243b98..57599030 100644 --- a/mk/project.mk +++ b/mk/project.mk @@ -13,13 +13,12 @@ #------------< Project Search >-------------# #*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*# -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 +T_ALLOWLIST += list clean all_projects PROJECT_LIST := $(shell ls projects/ -I *.template -I *.src) .PHONY: aux_target @@ -59,7 +58,6 @@ ifeq ($(CMD),) CMD := default endif -.PHONY: $(PROJECT) $(PROJECT): $(CMD) endif diff --git a/mk/qemu.mk b/mk/qemu.mk index e65ce18e..ac776340 100644 --- a/mk/qemu.mk +++ b/mk/qemu.mk @@ -1,6 +1,6 @@ # # CYANCORE LICENSE -# Copyrights (C) 2019, Cyancore Team +# Copyrights (C) 2023, Cyancore Team # # File Name : qemu.mk # Description : This file helps fetch and build qemu @@ -8,7 +8,7 @@ # Organisation : Cyancore Core-Team # -T_ALLOWLIST += get_qemu clean_qemu +T_ALLOWLIST += get_qemu clean_qemu qemu_test QEMU_CHECKOUT := v7.2.0 QEMU_PATH := $(TOOLS_ROOT)/qemu @@ -43,3 +43,15 @@ clean_qemu: @echo "< ! > Removing cc-qemu installation ..." rm -rf $(QEMU_OUT_PATH) $(QEMU_PATH) @echo "< / > Done!" + +qemu_test: +ifeq ($(realpath $(QEMU_OUT_PATH)/bin/qemu-system-riscv32),) + $(info < x > QEMU is not installed...) + $(info < ! > Please run `make get_qemu`) + $(error < x > Stopping demo simulation!) +endif + make demo_qemu_sifive_e + @echo + @echo "Press Ctrl+A - X to exit!" + @echo + $(QEMU_OUT_PATH)/bin/qemu-system-riscv32 -machine sifive_e -device loader,file=out/qemu_sifive_e_bl/qemu_sifive_e_bl.elf -kernel out/demo_qemu_sifive_e/demo_qemu_sifive_e.elf -nographic diff --git a/mk/slib.mk b/mk/slib.mk index 1973addd..3382b067 100644 --- a/mk/slib.mk +++ b/mk/slib.mk @@ -18,8 +18,6 @@ include mk/lobj.mk SLIB := $(addprefix $(OUT)/,$(SLIB)) HEADER := $(addprefix $(LIB_INCLUDE_PATH)/,$(LIB_HEADER)) -.PHONY: slib - slib: $(SLIB) $(SLIB): $(HEADER) $(LIB_OBJS) diff --git a/mk/tc.mk b/mk/tc.mk index 7abd3e42..9e920770 100644 --- a/mk/tc.mk +++ b/mk/tc.mk @@ -10,10 +10,11 @@ include mk/path.mk -ifeq ($(findstring arm-v7,$(ARCH)),arm) +ifeq ($(findstring arm,$(ARCH)),arm) TC ?= $(TOOLS_ROOT)/arm-toolchain/bin/arm-none-eabi -TI := $(TOOLS_ROOT)/arm-toolchain/arm-none-eabi/include -TL := $(TOOLS_ROOT)/arm-toolchain/arm-none-eabi/lib +TI := $(TOOLS_ROOT)/arm-toolchain/lib/gcc/arm-none-eabi/$(TC_VER)/include-fixed/ +TI += $(TOOLS_ROOT)/arm-toolchain/arm-none-eabi/include/ +TL := $(TOOLS_ROOT)/arm-toolchain/lib/gcc/arm-none-eabi/$(TC_VER)/$(TL_TYPE)/ endif ifeq ($(findstring riscv,$(ARCH)),riscv) diff --git a/mk/tc_get.mk b/mk/tc_get.mk index cdaa630d..7548ef2d 100644 --- a/mk/tc_get.mk +++ b/mk/tc_get.mk @@ -15,9 +15,9 @@ T_ALLOWLIST += get_all_tc get_avr_tc get_arm_tc get_riscv_tc # GIT REPO RECOMMENDED # Provide git repo path for toolchains for better experience ESIZE_REPO := https://github.com/VisorFolks/cc_elf_size.git -AVR_TC_REPO ?= -RISC_V_TC_REPO ?= -ARM_TC_REPO ?= +AVR_TC_REPO ?= https://github.com/VisorFolks/avr-toolchain +RISC_V_TC_REPO ?= https://github.com/VisorFolks/risc-v-toolchain +ARM_TC_REPO ?= https://github.com/VisorFolks/arm-toolchain get_all_tc: --tc_clear get_avr_tc get_arm_tc get_riscv_tc diff --git a/mk/usage_help.txt b/mk/usage_help.txt deleted file mode 100644 index 1f284c9b..00000000 --- a/mk/usage_help.txt +++ /dev/null @@ -1,37 +0,0 @@ -==================< Cyancore Make Help >================== -Usage : make