Merge pull request #2098 from RT-Thread/bsp_k210

[bsp][k210] Add get_free_heap_size function.
This commit is contained in:
Bernard Xiong 2018-12-23 15:24:03 +08:00 committed by GitHub
commit 6db31e30c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 71 additions and 4 deletions

View File

@ -93,7 +93,7 @@ CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
CONFIG_FINSH_THREAD_PRIORITY=20
CONFIG_FINSH_THREAD_STACK_SIZE=4096
CONFIG_FINSH_THREAD_STACK_SIZE=16384
CONFIG_FINSH_CMD_SIZE=80
# CONFIG_FINSH_USING_AUTH is not set
CONFIG_FINSH_USING_MSH=y
@ -325,6 +325,40 @@ CONFIG_PKG_KENDRYTE_SDK_VER="v0.5.2"
# CONFIG_PKG_USING_ZLIB is not set
# CONFIG_PKG_USING_DSTR is not set
# CONFIG_PKG_USING_TINYFRAME is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO_V001 is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO_LATEST_VERSION is not set
# CONFIG_KENDRYTE_DEMO_NONE is not set
# CONFIG_KENDRYTE_DEMO_AES_128_TEST is not set
# CONFIG_KENDRYTE_DEMO_AES_192_TEST is not set
# CONFIG_KENDRYTE_DEMO_AES_256_TEST is not set
# CONFIG_KENDRYTE_DEMO_AI_DEMO_SIM is not set
# CONFIG_KENDRYTE_DEMO_DVP_OV is not set
# CONFIG_KENDRYTE_DEMO_FACE_DETECT is not set
# CONFIG_KENDRYTE_DEMO_FFT_TEST is not set
# CONFIG_KENDRYTE_DEMO_FLASH_W25QXX is not set
# CONFIG_KENDRYTE_DEMO_FLASH_W25QXX_DMA_TEST is not set
# CONFIG_KENDRYTE_DEMO_FLASH_W25QXX_TEST is not set
# CONFIG_KENDRYTE_DEMO_GPIOHS_LED is not set
# CONFIG_KENDRYTE_DEMO_GPIO_LED is not set
# CONFIG_KENDRYTE_DEMO_HELLO_WORLD is not set
# CONFIG_KENDRYTE_DEMO_I2C_SLAVE is not set
# CONFIG_KENDRYTE_DEMO_KPU is not set
# CONFIG_KENDRYTE_DEMO_LCD is not set
# CONFIG_KENDRYTE_DEMO_MIC_PLAY is not set
# CONFIG_KENDRYTE_DEMO_PLAY_PCM is not set
# CONFIG_KENDRYTE_DEMO_PWM is not set
# CONFIG_KENDRYTE_DEMO_RTC is not set
# CONFIG_KENDRYTE_DEMO_RTC_SD3068 is not set
# CONFIG_KENDRYTE_DEMO_SD_CARD is not set
# CONFIG_KENDRYTE_DEMO_SERVO is not set
# CONFIG_KENDRYTE_DEMO_SHA256_TEST is not set
# CONFIG_KENDRYTE_DEMO_TIMER is not set
# CONFIG_KENDRYTE_DEMO_UART is not set
# CONFIG_KENDRYTE_DEMO_UART_DMA is not set
# CONFIG_KENDRYTE_DEMO_UART_DMA_IRQ is not set
# CONFIG_KENDRYTE_DEMO_UART_INTERRUPT is not set
# CONFIG_KENDRYTE_DEMO_WATCHDOG is not set
#
# samples: kernel and components samples

View File

@ -64,6 +64,10 @@ Kendryte中文含义为勘智而勘智取自勘物探智。这颗芯片主要
![terminal](images/k210.png)
如果是K210-test_v0.2开发板,可以用如下命令来打开串口:
python -m serial.tools.miniterm --rts 0 --dtr 0 COM9 115200
## 4. 驱动支持情况及计划
| 驱动 | 支持情况 | 备注 |

View File

@ -5,6 +5,7 @@ from building import *
cwd = GetCurrentDir()
src = Split('''
board.c
heap.c
drv_uart.c
''')
CPPPATH = [cwd]

11
bsp/k210/driver/heap.c Normal file
View File

@ -0,0 +1,11 @@
#include <rtthread.h>
#include <stdlib.h>
size_t get_free_heap_size(void)
{
rt_uint32_t total, used, max;
rt_memory_info(&total, &used, &max);
return total - used;
}

View File

@ -64,7 +64,7 @@
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_THREAD_STACK_SIZE 16384
#define FINSH_CMD_SIZE 80
#define FINSH_USING_MSH
#define FINSH_USING_MSH_DEFAULT

View File

@ -50,7 +50,7 @@ if PLATFORM == 'gcc':
CFLAGS += ' -O0 -ggdb'
AFLAGS += ' -ggdb'
else:
CFLAGS += ' -O2'
CFLAGS += ' -O2 -Os'
CXXFLAGS = CFLAGS

View File

@ -114,6 +114,13 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
return old_handler;
}
RT_WEAK
void plic_irq_handle(plic_irq_t irq)
{
rt_kprintf("UN-handled interrupt %d occurred!!!\n", irq);
return ;
}
uintptr_t handle_irq_m_ext(uintptr_t cause, uintptr_t epc)
{
/*
@ -142,7 +149,12 @@ uintptr_t handle_irq_m_ext(uintptr_t cause, uintptr_t epc)
/* Disable software interrupt and timer interrupt */
clear_csr(mie, MIP_MTIP | MIP_MSIP);
if (irq_desc[core_id][int_num].handler)
if (irq_desc[core_id][int_num].handler == (rt_isr_handler_t)rt_hw_interrupt_handle)
{
/* default handler, route to kendryte bsp plic driver */
plic_irq_handle(int_num);
}
else if (irq_desc[core_id][int_num].handler)
{
irq_desc[core_id][int_num].handler(int_num, irq_desc[core_id][int_num].param);
}

View File

@ -16,6 +16,11 @@
_start:
j 1f
.word 0xdeadbeef
.align 3
.global g_wake_up
g_wake_up:
.dword 1
.dword 0
1:
csrw mideleg, 0
csrw medeleg, 0