Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript

This commit is contained in:
wgzAIIT
2023-08-24 10:16:43 +08:00
24 changed files with 672 additions and 52 deletions

View File

@@ -14,6 +14,7 @@
#define PMP_H
#include <xs_klist.h>
#include <stddef.h>
#define PMP_MAX_ENTRY_NUMBER 16
#define PMP_ENTRY_RESERVE 6
@@ -40,11 +41,11 @@
struct PmpEntry
{
uint8_t pmpcfg;
uint8 pmpcfg;
#if defined(ARCH_RISCV64)
uint64_t pmpaddr;
uint64 pmpaddr;
#else
uint32_t pmpaddr;
uint32 pmpaddr;
#endif
};
@@ -53,8 +54,8 @@ struct PmpRegionNapot
{
x_ubase start ;
x_ubase end;
uint16_t swap_count;
uint8_t region_type;
uint16 swap_count;
uint8 region_type;
struct PmpEntry entry;
DoubleLinklistType link;
@@ -64,8 +65,8 @@ struct PmpRegionTor
{
x_ubase start ;
x_ubase end;
uint16_t swap_count;
uint8_t region_type;
uint16 swap_count;
uint8 region_type;
struct PmpEntry entry[2];
DoubleLinklistType link;
@@ -73,8 +74,8 @@ struct PmpRegionTor
struct Pmp
{
uint8_t count;
uint8_t reserve;
uint8 count;
uint8 reserve;
struct PmpEntry pmp_entry_reserve[PMP_ENTRY_RESERVE];
DoubleLinklistType tor_list;
@@ -82,7 +83,7 @@ struct Pmp
};
x_err_t PmpAddTorRegion(void *task_pmp, x_ubase start , size_t size , uint8_t flag );
x_err_t PmpAddTorRegion(void *task_pmp, x_ubase start , size_t size , uint8 flag );
x_err_t PmpInitIsolation(void **task_pmp, x_ubase stack_start , size_t stack_size);
void PmpFree(void *task_pmp);
void PmpClear(void);

View File

@@ -14,7 +14,7 @@ endif
export APPLFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl,--gc-sections,-Map=XiZi-edu-riscv64.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds
export CXXFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -Werror
export CXXFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -Werror -std=gnu++11
export CROSS_COMPILE ?=/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin/riscv-none-embed-

View File

@@ -1,7 +1,7 @@
if BSP_USING_HWTIMER
config HWTIMER_BUS_NAME_1
string "hwtimer bus name"
default "hwtim1"
default "timer0"
menuconfig ENABLE_TIM1
bool "enable TIM1"
@@ -10,10 +10,10 @@ if BSP_USING_HWTIMER
if ENABLE_TIM1
config HWTIMER_1_DEVICE_NAME_1
string "TIM1 dev name"
default "hwtim1_dev1"
default "timer0_dev0"
config HWTIMER_DRIVER_NAME_1
string "TIM1 drv name"
default "hwtim1_drv"
default "timer0_drv"
endif
endif

View File

@@ -42,16 +42,10 @@ uint32 HwtimerOpen(void *dev)
{
struct HwtimerHardwareDevice *hwtimer_dev = dev;
ptim2_cb_info = &hwtimer_dev->hwtimer_param.cb_info;
plic_init();
sysctl_enable_irq();
timer_init(TIMER_DEVICE_1);
size_t real_time = timer_set_interval(TIMER_DEVICE_1, TIMER_CHANNEL_1, hwtimer_dev->hwtimer_param.period_millisecond *1000);
KPrintf("timer_set_interval -- real_time : %ld\n", real_time);
timer_irq_register(TIMER_DEVICE_1, TIMER_CHANNEL_1, !hwtimer_dev->hwtimer_param.repeat, 1, timer_callback, NULL);
timer_set_enable(TIMER_DEVICE_1, TIMER_CHANNEL_1, 1);
return EOK;
@@ -73,6 +67,34 @@ static const struct HwtimerDevDone dev_done =
.read = NONE,
};
static uint32 HwTimerDrvConfigure(void *drv, struct BusConfigureInfo *configure_info)
{
NULL_PARAM_CHECK(drv);
NULL_PARAM_CHECK(configure_info);
x_err_t ret = EOK;
void* param;
switch (configure_info->configure_cmd)
{
case OPE_CFG: {
size_t real_time = timer_set_interval(TIMER_DEVICE_1, TIMER_CHANNEL_1, *(x_ticks_t *)configure_info->private_data *1000000);
KPrintf("timer_set_interval -- real_time : %ld\n", real_time);
break;
}
case OPE_INT: {
ptim2_cb_info = (struct HwtimerCallBackInfo *)malloc(sizeof(struct HwtimerCallBackInfo));
ptim2_cb_info->timeout_callback = configure_info->private_data;
timer_irq_register(TIMER_DEVICE_1, TIMER_CHANNEL_1, 0, 1, timer_callback, NULL);
break;
}
default:
break;
}
return ret;
}
/*Init hwtimer bus*/
static int BoardHwtimerBusInit(struct HwtimerBus *hwtimer_bus, struct HwtimerDriver *hwtimer_driver)
{
@@ -86,7 +108,7 @@ static int BoardHwtimerBusInit(struct HwtimerBus *hwtimer_bus, struct HwtimerDri
}
/*Init the hwtimer driver*/
hwtimer_driver->configure = NONE;
hwtimer_driver->configure = &HwTimerDrvConfigure;
ret = HwtimerDriverInit(hwtimer_driver, HWTIMER_DRIVER_NAME_1);
if (EOK != ret) {
KPrintf("board_hwtimer_init HwtimerDriverInit error %d\n", ret);

View File

@@ -111,7 +111,7 @@ uint32_t wdt_init(wdt_device_number_t id, uint64_t time_out_ms, plic_irq_callbac
plic_irq_enable(id ? IRQN_WDT1_INTERRUPT : IRQN_WDT0_INTERRUPT);
plic_irq_register(id ? IRQN_WDT1_INTERRUPT : IRQN_WDT0_INTERRUPT, on_irq, ctx);
wdt_response_mode(id, WDT_CR_RMOD_INTERRUPT);
wdt_response_mode(id, WDT_CR_RMOD_RESET);
uint8_t m_top = wdt_get_top(id, time_out_ms);
wdt_set_timeout(id, m_top);
wdt_enable(id);

View File

@@ -1,4 +1,5 @@
import os
import sys
def mergeBinProccess( files, fileSaveName):
bin = b''
@@ -17,11 +18,11 @@ def mergeBinProccess( files, fileSaveName):
f.write(bin)
if __name__ == '__main__':
file1 = r'./build/XiZi-kd233_kernel.bin'
file1 = r'./build/XiZi-'+sys.argv[1]+'_kernel.bin'
file1_start_addr = 0
file2 = r'./build/XiZi-kd233_app.bin'
file2 = r'./build/XiZi-'+sys.argv[1]+'_app.bin'
file2_start_addr = 1024 * 1024 + 4096
newfile = r'./build/XiZi-kd233.bin'
newfile = r'./build/XiZi-'+sys.argv[1]+'.bin'
file = [ [file1 , file1_start_addr] , [file2 , file2_start_addr] ]
mergeBinProccess(file, newfile)

View File

@@ -64,14 +64,14 @@ static uint32 I2cDeviceRead(void *dev, struct BusBlockReadParam *read_param)
struct I2cHardwareDevice *i2c_dev = (struct I2cHardwareDevice *)dev;
struct I2cDataStandard i2c_msg_write, i2c_msg_read;
i2c_msg_write.addr = i2c_dev->i2c_dev_addr;
i2c_msg_write.flags = I2C_WR;
i2c_msg_write.buf = NONE;
i2c_msg_write.len = 0;
i2c_msg_write.retries = 10;
i2c_msg_write.next = NONE;
// i2c_msg_write.addr = i2c_dev->i2c_dev_addr;
// i2c_msg_write.flags = I2C_WR;
// i2c_msg_write.buf = NONE;
// i2c_msg_write.len = 0;
// i2c_msg_write.retries = 10;
// i2c_msg_write.next = NONE;
i2c_dev->i2c_dev_done->dev_write(i2c_dev, &i2c_msg_write);
// i2c_dev->i2c_dev_done->dev_write(i2c_dev, &i2c_msg_write);
i2c_msg_read.addr = i2c_dev->i2c_dev_addr;
i2c_msg_read.flags = I2C_RD;