Platform: BL_MCU initial support
This commit is contained in:
parent
d75cb3224f
commit
9271990670
25
core/shared/platform/bl-mcu/blmcu_malloc.c
Normal file
25
core/shared/platform/bl-mcu/blmcu_malloc.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "platform_api_vmcore.h"
|
||||||
|
|
||||||
|
void *
|
||||||
|
os_malloc(unsigned size)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
os_realloc(void *ptr, unsigned size)
|
||||||
|
{
|
||||||
|
return realloc(ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
os_free(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
os_dumps_proc_mem_info(char *out, unsigned int size)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
31
core/shared/platform/bl-mcu/blmcu_memmap.c
Normal file
31
core/shared/platform/bl-mcu/blmcu_memmap.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "platform_api_vmcore.h"
|
||||||
|
|
||||||
|
#if defined(BL808)
|
||||||
|
#include "bl808_l1c.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *
|
||||||
|
os_mmap(void *hint, size_t size, int prot, int flags)
|
||||||
|
{
|
||||||
|
return os_malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
os_munmap(void *addr, size_t size)
|
||||||
|
{
|
||||||
|
return os_free(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
os_mprotect(void *addr, size_t size, int prot)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
os_dcache_flush()
|
||||||
|
{
|
||||||
|
#if defined(BL808)
|
||||||
|
L1C_DCache_Clean_Invalid_All();
|
||||||
|
#endif
|
||||||
|
}
|
31
core/shared/platform/bl-mcu/blmcu_platform.c
Normal file
31
core/shared/platform/bl-mcu/blmcu_platform.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "platform_api_vmcore.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
os_thread_sys_init();
|
||||||
|
|
||||||
|
void
|
||||||
|
os_thread_sys_destroy();
|
||||||
|
|
||||||
|
int
|
||||||
|
bh_platform_init()
|
||||||
|
{
|
||||||
|
return os_thread_sys_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bh_platform_destroy()
|
||||||
|
{
|
||||||
|
os_thread_sys_destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 *
|
||||||
|
os_thread_get_stack_boundary(void)
|
||||||
|
{
|
||||||
|
#if (configUSE_TRACE_FACILITY == 1)
|
||||||
|
TaskStatus_t pxTaskStatus;
|
||||||
|
vTaskGetInfo(xTaskGetCurrentTaskHandle(), &pxTaskStatus, pdTRUE, eInvalid);
|
||||||
|
return pxTaskStatus.pxStackBase;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
44
core/shared/platform/bl-mcu/platform_internal.h
Normal file
44
core/shared/platform/bl-mcu/platform_internal.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef _PLATFORM_INTERNAL_H
|
||||||
|
#define _PLATFORM_INTERNAL_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <task.h>
|
||||||
|
#include <semphr.h>
|
||||||
|
|
||||||
|
#ifndef BH_PLATFORM_BL_MCU
|
||||||
|
#define BH_PLATFORM_BL_MCU
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef TaskHandle_t korp_thread;
|
||||||
|
typedef korp_thread korp_tid;
|
||||||
|
typedef struct {
|
||||||
|
bool is_recursive;
|
||||||
|
SemaphoreHandle_t sem;
|
||||||
|
} korp_mutex;
|
||||||
|
|
||||||
|
struct os_thread_wait_node;
|
||||||
|
typedef struct os_thread_wait_node *os_thread_wait_list;
|
||||||
|
typedef struct korp_cond {
|
||||||
|
SemaphoreHandle_t wait_list_lock;
|
||||||
|
os_thread_wait_list thread_wait_list;
|
||||||
|
} korp_cond;
|
||||||
|
|
||||||
|
typedef unsigned int korp_sem;
|
||||||
|
|
||||||
|
#undef signbit
|
||||||
|
|
||||||
|
#define BH_THREAD_DEFAULT_PRIORITY 5
|
||||||
|
|
||||||
|
#define os_printf printf
|
||||||
|
#define os_vprintf vprintf
|
||||||
|
|
||||||
|
#endif
|
13
core/shared/platform/bl-mcu/shared_platform.cmake
Normal file
13
core/shared/platform/bl-mcu/shared_platform.cmake
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
set(PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
|
add_definitions(-DBH_PLATFORM_BL_MCU)
|
||||||
|
|
||||||
|
include_directories(${PLATFORM_SHARED_DIR})
|
||||||
|
include_directories(${PLATFORM_SHARED_DIR}/../include)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/../common/freertos/platform_api_freertos.cmake)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/../common/math/platform_api_math.cmake)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c)
|
||||||
|
|
||||||
|
set(PLATFORM_SHARED_SOURCE ${source_all} ${PLATFORM_COMMON_MATH_SOURCE} ${PLATFORM_COMMON_FREERTOS_SOURCE})
|
Reference in New Issue
Block a user