Skip to content

Commit

Permalink
lib: update libmetal to SHA 23ba779
Browse files Browse the repository at this point in the history
Origin:
	https://github.com/OpenAMP/libmetal

commit:
	23ba779

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>
  • Loading branch information
carlocaione committed Jun 30, 2022
1 parent 850a3c3 commit 2f586b4
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 168 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -27,7 +27,7 @@ URL:
https://github.com/OpenAMP/libmetal

commit:
2371f615bb0f7968e7bd2483301a9ab9d957bec9
23ba77941cf38a916d7a9fe5137a8bd2ee1e6122

Maintained-by:
External
Expand Down
5 changes: 4 additions & 1 deletion libmetal/cmake/options.cmake
Expand Up @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions libmetal/cmake/platforms/cross-generic-gcc.cmake
Expand Up @@ -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
11 changes: 2 additions & 9 deletions libmetal/cmake/syscheck.cmake
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion libmetal/lib/system/linux/irq.c
Expand Up @@ -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");
Expand Down
4 changes: 1 addition & 3 deletions libmetal/lib/system/zephyr/CMakeLists.txt
Expand Up @@ -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
2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/alloc.h
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions libmetal/lib/system/zephyr/arm/CMakeLists.txt

This file was deleted.

22 changes: 0 additions & 22 deletions libmetal/lib/system/zephyr/arm/sys.c

This file was deleted.

27 changes: 0 additions & 27 deletions libmetal/lib/system/zephyr/arm/sys.h

This file was deleted.

2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/assert.h
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/cache.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/log.c
Expand Up @@ -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: ",
Expand Down
2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/mutex.h
Expand Up @@ -17,7 +17,7 @@
#define __METAL_ZEPHYR_MUTEX__H__

#include <metal/atomic.h>
#include <kernel.h>
#include <zephyr/kernel.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 0 additions & 2 deletions libmetal/lib/system/zephyr/riscv/CMakeLists.txt

This file was deleted.

27 changes: 0 additions & 27 deletions libmetal/lib/system/zephyr/riscv/sys.h

This file was deleted.

2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/sleep.h
Expand Up @@ -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" {
Expand Down
@@ -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();
}
2 changes: 0 additions & 2 deletions libmetal/lib/system/zephyr/sys.h
Expand Up @@ -18,8 +18,6 @@

#include <stdlib.h>

#include "./@PROJECT_MACHINE@/sys.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion libmetal/lib/system/zephyr/time.c
Expand Up @@ -10,7 +10,7 @@
*/

#include <metal/time.h>
#include <kernel.h>
#include <zephyr/kernel.h>

unsigned long long metal_get_timestamp(void)
{
Expand Down
2 changes: 0 additions & 2 deletions libmetal/lib/system/zephyr/xtensa/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions libmetal/lib/system/zephyr/xtensa/sys.c

This file was deleted.

28 changes: 0 additions & 28 deletions libmetal/lib/system/zephyr/xtensa/sys.h

This file was deleted.

0 comments on commit 2f586b4

Please sign in to comment.