lib: update libmetal to SHA 23ba77941cf3

Origin:
	https://github.com/OpenAMP/libmetal

commit:
	23ba77941cf38a916d7a9fe5137a8bd2ee1e6122

Status:
	merge libmetal new version after removing useless dirs to bring
	in important fixes and support for ARM64

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2022-06-28 10:25:32 +02:00 committed by Carlo Caione
parent 850a3c3fd5
commit 2f586b4f12
23 changed files with 27 additions and 168 deletions

2
README
View File

@ -27,7 +27,7 @@ URL:
https://github.com/OpenAMP/libmetal
commit:
2371f615bb0f7968e7bd2483301a9ab9d957bec9
23ba77941cf38a916d7a9fe5137a8bd2ee1e6122
Maintained-by:
External

View File

@ -46,7 +46,10 @@ if (NOT DEFINED PROJECT_SYSTEM)
endif (NOT DEFINED PROJECT_SYSTEM)
string (TOLOWER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR)
string (TOUPPER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR_UPPER)
if("${PROJECT_PROCESSOR}" STREQUAL "arm64")
set (PROJECT_PROCESSOR "aarch64")
endif()
string (TOUPPER ${PROJECT_PROCESSOR} PROJECT_PROCESSOR_UPPER)
string (TOLOWER ${MACHINE} PROJECT_MACHINE)
string (TOUPPER ${MACHINE} PROJECT_MACHINE_UPPER)

View File

@ -3,8 +3,10 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "")
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER CACHE STRING "")
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER CACHE STRING "")
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER ("${CROSS_PREFIX}gcc" GNU)
CMAKE_FORCE_CXX_COMPILER ("${CROSS_PREFIX}g++" GNU)
set (CMAKE_C_COMPILER "${CROSS_PREFIX}gcc")
set (CMAKE_CXX_COMPILER "${CROSS_PREFIX}g++")
# _exit is in the BSP rather than in libgcc, leaving this out
# causes errors in try_compile on ARM generic.
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# vim: expandtab:ts=2:sw=2:smartindent

View File

@ -7,14 +7,7 @@ if (WITH_ZEPHYR)
if (NOT WITH_ZEPHYR_LIB)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
endif()
if (CONFIG_ARM)
set (MACHINE "arm" CACHE STRING "")
endif(CONFIG_ARM)
if (CONFIG_RISCV)
set (MACHINE "riscv" CACHE STRING "")
endif (CONFIG_RISCV)
if (CONFIG_XTENSA)
set (MACHINE "xtensa" CACHE STRING "")
endif (CONFIG_XTENSA)
# map zephyr arch to libmetal machine
set (MACHINE "${CONFIG_ARCH}" CACHE STRING "")
endif (WITH_ZEPHYR)

View File

@ -219,7 +219,7 @@ int metal_linux_irq_init(void)
memset(&irqs, 0, sizeof(irqs));
irq_notify_fd = eventfd(0, 0);
irq_notify_fd = eventfd(0, EFD_CLOEXEC);
if (irq_notify_fd < 0) {
metal_log(METAL_LOG_ERROR,
"Failed to create eventfd for IRQ handling.\n");

View File

@ -17,9 +17,7 @@ collect (PROJECT_LIB_SOURCES irq.c)
collect (PROJECT_LIB_SOURCES log.c)
collect (PROJECT_LIB_SOURCES shmem.c)
collect (PROJECT_LIB_SOURCES time.c)
collect (PROJECT_LIB_SOURCES sys.c)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE})
add_subdirectory(${PROJECT_MACHINE})
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE})
# vim: expandtab:ts=2:sw=2:smartindent

View File

@ -16,7 +16,7 @@
#ifndef __METAL_ZEPHYR_ALLOC__H__
#define __METAL_ZEPHYR_ALLOC__H__
#include <kernel.h>
#include <zephyr/kernel.h>
#include <stdlib.h>
#ifdef __cplusplus

View File

@ -1,5 +0,0 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)
# vim: expandtab:ts=2:sw=2:smartindent

View File

@ -1,22 +0,0 @@
/*
* Copyright (c) 2017, Linaro Limited. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/qemu_cortex_m3/sys.c
* @brief machine specific system primitives implementation.
*/
#include <metal/io.h>
#include <metal/sys.h>
#include <stdint.h>
/**
* @brief poll function until some event happens
*/
void metal_weak metal_generic_default_poll(void)
{
metal_asm __volatile__("wfi");
}

View File

@ -1,27 +0,0 @@
/*
* Copyright (c) 2017, Linaro Limited. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/qemu_cortex_m3/sys.h
* @brief Zephyr QEMU Cortex M3 system primitives for libmetal.
*/
#ifndef __METAL_ZEPHYR_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_ZEPHYR_CORTEXM_SYS__H__
#define __METAL_ZEPHYR_CORTEXM_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_ZEPHYR_CORTEXM_SYS__H__ */

View File

@ -16,7 +16,7 @@
#ifndef __METAL_ZEPHYR_ASSERT__H__
#define __METAL_ZEPHYR_ASSERT__H__
#include <zephyr.h>
#include <zephyr/kernel.h>
/**
* @brief Assertion macro for Zephyr-based applications.

View File

@ -16,7 +16,7 @@
#ifndef __METAL_ZEPHYR_CACHE__H__
#define __METAL_ZEPHYR_CACHE__H__
#include <cache.h>
#include <zephyr/cache.h>
#include <metal/utilities.h>
#ifdef __cplusplus

View File

@ -11,7 +11,7 @@
#include <stdarg.h>
#include <metal/log.h>
#include <zephyr.h>
#include <zephyr/kernel.h>
static const char * const level_strs[] = {
"metal: emergency: ",

View File

@ -17,7 +17,7 @@
#define __METAL_ZEPHYR_MUTEX__H__
#include <metal/atomic.h>
#include <kernel.h>
#include <zephyr/kernel.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,2 +0,0 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@ -1,27 +0,0 @@
/*
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/riscv/sys.h
* @brief Zephyr riscv system primitives for libmetal.
*/
#ifndef __METAL_ZEPHYR_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_ZEPHYR_RISCV_SYS__H__
#define __METAL_ZEPHYR_RISCV_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_ZEPHYR_RISCV_SYS__H__ */

View File

@ -16,7 +16,7 @@
#ifndef __METAL_ZEPHYR_SLEEP__H__
#define __METAL_ZEPHYR_SLEEP__H__
#include <kernel.h>
#include <zephyr/kernel.h>
#ifdef __cplusplus
extern "C" {

View File

@ -1,22 +1,23 @@
/*
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
* Copyright (c) 2022 Qualcomm Innovation Center, Inc.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/riscv/sys.c
* @brief machine specific system primitives implementation.
* @file zephyr/sys.c
* @brief Zephyr system primitives for libmetal.
*/
#include <metal/io.h>
#include <metal/sys.h>
#include <stdint.h>
#include <zephyr/sys/arch_interface.h>
/**
* @brief poll function until some event happens
*/
void metal_weak metal_generic_default_poll(void)
{
metal_asm __volatile__("wfi");
arch_cpu_idle();
}

View File

@ -18,8 +18,6 @@
#include <stdlib.h>
#include "./@PROJECT_MACHINE@/sys.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -10,7 +10,7 @@
*/
#include <metal/time.h>
#include <kernel.h>
#include <zephyr/kernel.h>
unsigned long long metal_get_timestamp(void)
{

View File

@ -1,2 +0,0 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@ -1,23 +0,0 @@
/*
* Copyright 2022 NXP
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/xtensa/sys.c
* @brief machine specific system primitives implementation.
*/
#include <metal/io.h>
#include <metal/sys.h>
#include <stdint.h>
/**
* @brief poll function until some event happens
*/
void metal_weak metal_generic_default_poll(void)
{
metal_asm __volatile__("waiti 0");
}

View File

@ -1,28 +0,0 @@
/*
* Copyright 2022 NXP
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file zephyr/xtensa/sys.h
* @brief Zephyr xtensa system primitives for libmetal.
*/
#ifndef __METAL_ZEPHYR_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_ZEPHYR_XTENSA_SYS__H__
#define __METAL_ZEPHYR_XTENSA_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_ZEPHYR_XTENSA_SYS__H__ */