Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<CC_OS>Add Test Applications #200

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/github_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: GitHub CI

on:
push:
branches: [ stable, development]
branches: [ stable, development, cc_os_stage]

pull_request:
branches: [ stable, development]
branches: [ stable, development, cc_os_stage]

jobs:
build:
Expand Down Expand Up @@ -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_cc_os_avr
make demo_cc_os_riscv

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- stable
- development
- cc_os_stage
pull_request:
branches:
- stable
- development
- cc_os_stage

jobs:
build:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ out/
tools/
backup/
bkp/
projects/
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
*.elf
*.bin
*.d
Expand Down Expand Up @@ -41,3 +40,7 @@ projects/
*.mod*
*.cmd
*.todo

.vscode/compile_commands.json

.vscode/settings.json
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
"*.{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,
Expand All @@ -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"
}
1 change: 1 addition & 0 deletions mk/path.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TOOLS_ROOT ?= $(abspath $(CC_ROOT))/tools
MISC_TOOLS := $(TOOLS_ROOT)/misc_bins

SRC := $(CC_ROOT)/src
CC_OS_ROOT := $(SRC)/include/visor/terravisor/cc_os
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
OUT_PATH ?= $(CC_ROOT)/out
OUT ?= $(OUT_PATH)/$(PROJECT)

Expand Down
19 changes: 19 additions & 0 deletions projects/demo_cc_os.src/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Primary Author : Pranjal Chdanda [[email protected]]
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
# Organisation : Cyancore Core-Team
#

DEMO_DIR := $(GET_PATH)

OPTIMIZATION := s

EXE_MODE := terravisor

DIR := $(DEMO_DIR)
include mk/obj.mk
51 changes: 51 additions & 0 deletions projects/demo_cc_os.src/project.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
*
* File Name : project.c
* Description : This file consists of project srouces
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/
#include <stdio.h>
#include <driver.h>
#include <terravisor/bootstrap.h>
#include <driver/onboardled.h>
#include <terravisor/cc_os/cc_os.h>

#define TASK_WAIT_TICKS 10

/* Define the Tasks */
CC_TASK_DEF( TASK_A, task_handler, NULL, 10, 100);
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
CC_TASK_DEF( TASK_B, task_handler, NULL, 10, 100);
CC_TASK_DEF( TASK_C, task_handler, NULL, 10, 100);

/* Define Plug */
void plug()
{
bootstrap();
driver_setup_all();

printf("Demo CC OS Program!\n");
cc_os_add_task(&CC_GET_TASK_INST(TASK_A));
cc_os_add_task(&CC_GET_TASK_INST(TASK_B));
cc_os_add_task(&CC_GET_TASK_INST(TASK_C));
cc_os_run();
}

/* Define Play */
void play()
{
/* < ! > Play looping code here*/
return;
}

/* Define the Task Handler */
void task_handler(os_args args _UNUSED)
{
while(CC_OS_TRUE)
{
printf("In Task: %s\n", cc_os_get_curr_task_name());
cc_os_task_wait(TASK_WAIT_TICKS);
}
}
18 changes: 18 additions & 0 deletions projects/demo_cc_os_avr/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Primary Author : Pranjal Chdanda [[email protected]]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

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

DIR := $(PROJECT_DIR)
include mk/obj.mk
17 changes: 17 additions & 0 deletions projects/demo_cc_os_avr/cc_os_config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : cc_os_config.mk
# Description : This file consists of CC_OS kernal configuration
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

CC_OS_USE_DYNAMIC := 1
CC_OS_HEAP_SIZE := 1024
CC_OS_MAX_THREAD := 3
CC_OS_TASK_STACK_LEN := 255
CC_OS_POWER_SAVE_EN := 0

include $(CC_OS_ROOT)/cc_os_config.mk
24 changes: 24 additions & 0 deletions projects/demo_cc_os_avr/config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : config.mk
# Description : This file consists of project config
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

COMPILER := gcc
TC_VER := 5.4.0
FAMILY := mega_avr
PLATFORM := atmega328p
HEAP_SIZE := 256
STACK_SIZE := 256
STDLOG_MEMBUF := 0
BOOTMSGS := 0
EARLYCON_SERIAL := 0
CONSOLE_SERIAL := 0
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
OBRDLED_ENABLE := 1
TERRAKERN := 1

include $(PROJECT_DIR)/cc_os_config.mk
18 changes: 18 additions & 0 deletions projects/demo_cc_os_riscv/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : build.mk
# Description : This file build project sources and specifies
# project properties
# Primary Author : Pranjal Chdanda [[email protected]]
# Organisation : Cyancore Core-Team
#

PROJECT_DIR := $(GET_PATH)

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

DIR := $(PROJECT_DIR)
include mk/obj.mk
17 changes: 17 additions & 0 deletions projects/demo_cc_os_riscv/cc_os_config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : kern_config.mk
# Description : This file consists of CC_OS kernal configuration
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

CC_OS_USE_DYNAMIC := 1
CC_OS_HEAP_SIZE := 1024
CC_OS_MAX_THREAD := 3
CC_OS_TASK_STACK_LEN := 255
CC_OS_POWER_SAVE_EN := 0

include $(CC_OS_ROOT)/cc_os_config.mk
24 changes: 24 additions & 0 deletions projects/demo_cc_os_riscv/config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019-2023, Cyancore Team
#
# File Name : config.mk
# Description : This file consists of project config
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

COMPILER := gcc
TC_VER := 10.2.0
FAMILY := sifive
PLATFORM := fe310g002
HEAP_SIZE := 256
STACK_SIZE := 256
STDLOG_MEMBUF := 0
BOOTMSGS := 0
EARLYCON_SERIAL := 0
CONSOLE_SERIAL := 0
OBRDLED_ENABLE := 1
TERRAKERN := 1

include $(PROJECT_DIR)/cc_os_config.mk
35 changes: 14 additions & 21 deletions src/include/visor/terravisor/cc_os/cc_os_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
* @brief Shall CC_OS use dynamic resource allocation
* @note Possible values : 1/0
*/
#ifndef ccosconfig_CC_OS_USE_DYNAMIC
#define ccosconfig_CC_OS_USE_DYNAMIC 0
#ifndef CC_OS_USE_DYNAMIC
#define CC_OS_USE_DYNAMIC 1
#endif

/**
* @brief Heap size to be allocated to CC_OS
* @note Possible values : Depends on available RAM
*/
#ifndef ccosconfig_CC_OS_HEAP_SIZE
#define ccosconfig_CC_OS_HEAP_SIZE 1024
#ifndef CC_OS_HEAP_SIZE
#define CC_OS_HEAP_SIZE 1024
#endif

/**
Expand All @@ -32,38 +32,31 @@
* User may have to keep it optimised so as to use as low BSS section
* to be used as possible for the application being created.
*/
#ifndef ccosconfig_CC_OS_MAX_THREAD
#define ccosconfig_CC_OS_MAX_THREAD 10
#endif

/**
* @brief Max number of characters allowed to be used for task name
*/
#ifndef ccosconfig_CC_OS_TASK_NAME_LEN
#define ccosconfig_CC_OS_TASK_NAME_LEN 16
#ifndef CC_OS_MAX_THREAD
#define CC_OS_MAX_THREAD 10
#endif

/**
* @brief Task priority of IDLE task
* @note Possible values : 1 -> 255
*/
#ifndef ccosconfig_CC_OS_IDLE_TASK_PRIORITY
#define ccosconfig_CC_OS_IDLE_TASK_PRIORITY 0x01
#ifndef CC_OS_IDLE_TASK_PRIORITY
#define CC_OS_IDLE_TASK_PRIORITY 0x01
#endif

/**
* @brief Stack size used by IDLE task
* @note The stack size is either allocated statically or dynamically as
* per the setting of ccosconfig_CC_OS_USE_DYNAMIC
* per the setting of CC_OS_USE_DYNAMIC
*/
#ifndef ccosconfig_CC_OS_TASK_STACK_LEN
#define ccosconfig_CC_OS_TASK_STACK_LEN 255
#ifndef CC_OS_TASK_STACK_LEN
#define CC_OS_TASK_STACK_LEN 255
#endif

/**
* @brief If the Kernel shall enter poer save mode during IDLE
*
*
*/
#ifndef ccosconfig_CC_OS_POWER_SAVE_EN
#define ccosconfig_CC_OS_POWER_SAVE_EN 0
#ifndef CC_OS_POWER_SAVE_EN
#define CC_OS_POWER_SAVE_EN 0
#endif
21 changes: 21 additions & 0 deletions src/include/visor/terravisor/cc_os/cc_os_config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
#
# File Name : kern_config.mk
# Description : This file consists of CC_OS kernal configuration
# Primary Author : Akash Kollipara [[email protected]]
pranjalchanda08 marked this conversation as resolved.
Show resolved Hide resolved
# Organisation : Cyancore Core-Team
#

CC_OS_USE_DYNAMIC ?= 0
CC_OS_HEAP_SIZE ?= 1024
CC_OS_MAX_THREAD ?= 2
CC_OS_TASK_STACK_LEN ?= 255
CC_OS_POWER_SAVE_EN ?= 0

$(eval $(call add_define,CC_OS_USE_DYNAMIC))
$(eval $(call add_define,CC_OS_HEAP_SIZE))
$(eval $(call add_define,CC_OS_MAX_THREAD))
$(eval $(call add_define,CC_OS_TASK_STACK_LEN))
$(eval $(call add_define,CC_OS_POWER_SAVE_EN))
1 change: 1 addition & 0 deletions src/include/visor/terravisor/cc_os/cc_os_sem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static sem_t _Name##_sem = { \
}; \
static sem_t * _Name##_sem_inst = &_Name##_sem
#else
#define CC_SEM_DEF(_Name) \
static sem_t * _Name##_sem_inst = CC_OS_NULL_PTR
#endif
/*****************************************************
Expand Down
Loading