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

Add POSIX support #90

Merged
merged 31 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5dd0b3b
Revert "Merge branch 'development' into cc-kernel-dev"
akashkollipara Jan 12, 2022
0e4ca3e
Revert "Merge branch 'development' into cc-kernel-dev"
akashkollipara Jan 13, 2022
f3f0e1a
<POSIX> Add POSIX prototype as defined by libc.
pranjalchanda08 Jan 4, 2022
8f35a59
<RISC-V> Add support for arch, initial commit
akashkollipara Dec 25, 2021
7a953c6
<RISC-V> Added exception handler
akashkollipara Dec 27, 2021
00e3dd7
<Build & CI> Updates to support riscv
akashkollipara Dec 27, 2021
8e87cb5
<AVR> Removed unused functions
akashkollipara Dec 27, 2021
bc2cd46
<RISC-V> Added exception handler support
akashkollipara Dec 28, 2021
c054b5c
<RV32IMAC> Add arch suppot
akashkollipara Dec 28, 2021
f6cb618
<RISC-V> Updated interrupts and CLINT architecture
akashkollipara Dec 29, 2021
de04cb5
<RISC-V> Adding additional element to context frame
akashkollipara Dec 29, 2021
951f962
<RV32-A> Adding spinlock
akashkollipara Dec 29, 2021
9903687
<Hifive 1B> Added platform boot and driver init
akashkollipara Dec 30, 2021
08bdb7a
<FE310> Hardcoding reset syndrome to 1
akashkollipara Dec 30, 2021
262b639
<Terravisor> fixed machine call bug
akashkollipara Dec 30, 2021
ee720fa
<FE310> fixed platform name
akashkollipara Dec 30, 2021
38e924d
<RISC-V> Add prints in panic handlers
akashkollipara Dec 30, 2021
5297343
<Remote Copy> Added remote copy to build engine
akashkollipara Dec 30, 2021
fefd3c5
<Make> Updated build with remote copy feature
akashkollipara Dec 31, 2021
9e2b8a8
Updated help
akashkollipara Dec 31, 2021
9864ec2
<POSIX> scall add, Bugfix mcall (callback NULL check)
pranjalchanda08 Jan 5, 2022
2310ea8
<POSIX> build.mk bugfix
pranjalchanda08 Jan 5, 2022
7378ad9
<POSIX> Add scall_id into scall_id_t
pranjalchanda08 Jan 5, 2022
7085e39
<POSIX> MQueue implementation Initial commit
pranjalchanda08 Jan 7, 2022
2b93bc7
<POSIX> Add placeholders for undefined functions.
pranjalchanda08 Jan 9, 2022
0dbc8de
<POSIX> Add support for posix sem
pranjalchanda08 Jan 9, 2022
304cebf
<POSIX> Build Success: posix_time.c, posix_semaphore.c, posix_utils.c…
pranjalchanda08 Jan 12, 2022
e4457e0
<POSIX> Linting issue fixed
pranjalchanda08 Jan 12, 2022
c6693fe
<POSIX> Linting issue fixed
pranjalchanda08 Jan 12, 2022
6f8bc37
<SONARCLOUD> Local integration and Test complete
pranjalchanda08 Jan 13, 2022
6ea7566
<SONARCLOUD> README.md update
pranjalchanda08 Jan 13, 2022
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
74 changes: 0 additions & 74 deletions .github/workflows/github_ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ For details about the framework, follow the README.md in each folder.

Host system requirements:
* Linux Machine (WSL/Dedicated machine)
* make utility and cppcheck installed; run
* make utility and cppcheck installed; run
```sh
$ sudo apt install build-essential cppcheck -y
```
Expand Down
10 changes: 10 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sonar.organization=cyancore
sonar.projectKey=VisorFolks_cyancore
sonar.sources=src
sonar.cfamily.build-wrapper-output=toolchain/bw-output
sonar.verbose=false
sonar.host.url=https://sonarcloud.io
sonar.verbose=true
sonar.cfamily.threads=8
sonar.cfamily.cache.enabled=true
sonar.cfamily.cache.path=toolchain/bw-output/cfamily_cache
35 changes: 33 additions & 2 deletions src/include/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,65 @@

typedef enum status
{
success = 0x0000,
success = 0x0000,
/* Generic error */
error_generic = -0x0001,
error_func_inval = -0x0002,
error_func_inval_arg = -0x0003,
error_overflow = -0x0004,
/* Driver related error */
error_driver = -0x0100,
error_driver_init_done = -0x0101,
error_driver_init_failed = -0x0102,
error_driver_busy = -0x0103,
error_driver_data = -0x0104,
/* Device related error */
error_device = -0x0200,
error_device_id_inval = -0x0201,
error_device_inval = -0x0202,
error_device_busy = -0x0203,
/* Machine Call related error */
error_mcall = -0x0300,
error_mcall_code_inval = -0x0301,
/* hcall related error */
error_hcall = -0x0400,
/* Syscall related error */
error_scall = -0x0500,
error_scall_code_inval = -0x0501,
/* Memory related error */
error_memory = -0x0600,
error_memory_low = -0x0601,
/* File related error */
error_file = -0x0700,
error_file_desc = -0x0701,
error_file_exist = -0x0702,
error_file_not_found = -0x0703,
error_file_no_space = -0x0704,
error_file_long_name = -0x0705,
/* String related error */
error_string = -0x0800,
/* Math related error */
error_math = -0x0900,
error_math_inval_arg = -0x0901,
error_math_large_val = -0x0902,
/* Access related error */
error_access = -0x0a00,
/* System related error */
error_system = -0x0b00,
error_system_irq_link_fail = -0x0b01,
error_system_irq_unlink_fail = -0x0b02,
error_network = -0x0c00,
/* Network related error */
error_net = -0x0c00,
error_net_con_timeout = -0x0c001,
/* User space related error */
error_user = -0x0d00,
/* IO related error */
error_io = -0x0e00,
/* OS related error */
error_os = -0x0f00,
error_os_task_overfow = -0x0f01,
error_os_deadlock = -0x0f02,
/* Mesg related error */
error_mesg = -0x1000,
error_mesg_long = -0x1001,
} status_t;
95 changes: 95 additions & 0 deletions src/include/supervisor_call.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : supervisor_call.h
* Description : This file consists of supervisor call IDs and prototypes
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once
#define _SUPER_CALL_H_

#include <stdint.h>
#include <status.h>

// Supervisor call IDs
typedef enum scall_id
{
scall_id_generic = 0x0000,
scall_id_is_irq,
/* pthread related */
scall_id_pthread_attr_destroy = 0x1000,
scall_id_pthread_attr_getdetachstate,
scall_id_pthread_attr_getschedparam,
scall_id_pthread_attr_getstacksize,
scall_id_pthread_attr_init,
scall_id_pthread_attr_setdetachstate,
scall_id_pthread_attr_setschedparam,
scall_id_pthread_attr_setschedpolicy,
scall_id_pthread_attr_setstacksize,
scall_id_pthread_barrier_destroy,
scall_id_pthread_barrier_init,
scall_id_pthread_barrier_wait,
scall_id_pthread_create,
scall_id_pthread_cond_broadcast,
scall_id_pthread_cond_destroy,
scall_id_pthread_cond_init,
scall_id_pthread_cond_signal,
scall_id_pthread_cond_timedwait,
scall_id_pthread_equal,
scall_id_pthread_exit,
scall_id_pthread_getschedparam,
scall_id_pthread_join,
scall_id_pthread_mutex_destroy,
scall_id_pthread_mutex_init,
scall_id_pthread_mutex_timedlock,
scall_id_pthread_mutex_unlock,
scall_id_pthread_mutexattr_destroy,
scall_id_pthread_mutexattr_gettype,
scall_id_pthread_mutexattr_init,
scall_id_pthread_mutexattr_settype,
scall_id_pthread_self,
scall_id_pthread_setschedparam,
scall_id_pthread_delay_ticks,
/* mqueue related */
scall_id_mq_close,
scall_id_mq_setattr,
scall_id_mq_getattr,
scall_id_mq_open,
scall_id_mq_receive,
scall_id_mq_send,
scall_id_mq_unlink,
/* semaphore related */
scall_id_sem_init,
scall_id_sem_destroy,
scall_id_sem_getvalue,
scall_id_sem_post,
scall_id_sem_wait,
/* scheduler related */
scall_id_sched_get_max_priority,
scall_id_sched_get_min_priority,
scall_id_sched_yield,

} scall_id_t;

typedef struct sret
{
uintptr_t p;
size_t size;
status_t status;
} sret_t;

typedef struct scall
{
scall_id_t id;
sret_t (*callback)(unsigned int a0, unsigned int a1, unsigned int a2);
} scall_t;

#define INCLUDE_SCALL(_name, _id , _callback) \
const scall_t _name _SECTION(".scall") = \
{ \
.id = _id, \
.callback = _callback \
}
16 changes: 16 additions & 0 deletions src/include/visor/supervisor/workers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : worker.h
* Description : This file consists of supervisor-workers
* and related prototypes
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#include <supervisor_call.h>

void super_call(scall_id_t id, unsigned int a0, unsigned int a1, unsigned int a2, sret_t *ret);
1 change: 1 addition & 0 deletions src/lib/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LIB_DIR := $(GET_PATH)
# Mandatory libraries
include $(LIB_DIR)/libresource/build.mk
include $(LIB_DIR)/libc/build.mk
include $(LIB_DIR)/libposix/build.mk
#==================================================

include $(LIB_DIR)/libnmath/build.mk
2 changes: 1 addition & 1 deletion src/lib/libc/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int vprintf(const char *fmt, va_list args)
break;
case 'c':
str = va_arg(args, char *);
ret += console_putc((int)str);
ret += console_putc((int)str[0]);
break;
case 's':
str = va_arg(args, char *);
Expand Down
22 changes: 22 additions & 0 deletions src/lib/libposix/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
#
# File Name : build.mk
# Descrption : This script accumulates sources and builds
# library
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

POSIX_PATH := $(GET_PATH)
LIB_OBJS :=

LIB := libposix.a
LIB_INCLUDE += $(POSIX_PATH)/include/
DEP_LIBS_ARG += -lposix

include $(POSIX_PATH)/src/build.mk

DIR := $(POSIX_PATH)
include mk/lib.mk
47 changes: 47 additions & 0 deletions src/lib/libposix/include/cc_posix_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : cc_posix_config.h
* Description : POSIX user config
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#ifndef posixconfigTICK_RATE_HZ
#define posixconfigTICK_RATE_HZ (1000)
#endif

/*******************
* MQUEUE configs
*******************/

/**
* @brief MQUEUE max name length in bytes
*/
#ifndef posixconfigMQ_NAME_LEN_MAX
#define posixconfigMQ_NAME_LEN_MAX (16)
#endif

/**
* @brief MQUEUE max munber of queues allowed
*/
#ifndef posixconfigMQ_MAX_QUEUE
#define posixconfigMQ_MAX_QUEUE (5)
#endif

/**
* @brief MQUEUE Maximum number of messages in an mq at one time
*/
#ifndef posixconfigMQ_MAX_MESSAGES
#define posixconfigMQ_MAX_MESSAGES (10)
#endif

/**
* @brief MQUEUE Maximum size (in bytes) of each message
*/
#ifndef posixconfigMQ_MAX_SIZE
#define posixconfigMQ_MAX_SIZE (128)
#endif
Loading