libmetal.defs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ############################################################################
  2. # openamp/libmetal.defs
  3. #
  4. # Licensed to the Apache Software Foundation (ASF) under one or more
  5. # contributor license agreements. See the NOTICE file distributed with
  6. # this work for additional information regarding copyright ownership. The
  7. # ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance with the
  9. # License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. # License for the specific language governing permissions and limitations
  17. # under the License.
  18. #
  19. ############################################################################
  20. ifeq ($(CONFIG_OPENAMP),y)
  21. ifeq ($(CONFIG_ARCH), sim)
  22. LIBMETAL_ARCH = x86_64
  23. else ifeq ($(CONFIG_ARCH), risc-v)
  24. LIBMETAL_ARCH = riscv
  25. else
  26. LIBMETAL_ARCH = $(CONFIG_ARCH)
  27. endif
  28. CSRCS += libmetal/lib/system/nuttx/condition.c
  29. CSRCS += libmetal/lib/system/nuttx/device.c
  30. CSRCS += libmetal/lib/system/nuttx/init.c
  31. CSRCS += libmetal/lib/system/nuttx/io.c
  32. CSRCS += libmetal/lib/system/nuttx/irq.c
  33. CSRCS += libmetal/lib/system/nuttx/shmem.c
  34. CSRCS += libmetal/lib/system/nuttx/time.c
  35. CSRCS += libmetal/lib/device.c
  36. CSRCS += libmetal/lib/dma.c
  37. CSRCS += libmetal/lib/init.c
  38. CSRCS += libmetal/lib/io.c
  39. CSRCS += libmetal/lib/irq.c
  40. CSRCS += libmetal/lib/log.c
  41. CSRCS += libmetal/lib/shmem.c
  42. CSRCS += libmetal/lib/version.c
  43. CFLAGS += -DMETAL_INTERNAL
  44. LIBMETAL_HDRS_SEDEXP := \
  45. "s/@PROJECT_VERSION_MAJOR@/0/g; \
  46. s/@PROJECT_VERSION_MINOR@/1/g; \
  47. s/@PROJECT_VERSION_PATCH@/0/g; \
  48. s/@PROJECT_VERSION@/0.1.0/g; \
  49. s/@PROJECT_SYSTEM@/nuttx/g; \
  50. s/@PROJECT_PROCESSOR@/$(LIBMETAL_ARCH)/g; \
  51. s/@PROJECT_MACHINE@/$(CONFIG_ARCH_CHIP)/g; \
  52. s/@PROJECT_SYSTEM_UPPER@/nuttx/g; \
  53. s/@PROJECT_PROCESSOR_UPPER@/$(LIBMETAL_ARCH)/g; \
  54. s/@PROJECT_MACHINE_UPPER@/$(CONFIG_ARCH_CHIP)/g; \
  55. s/cmakedefine/undef/g"
  56. libmetal.zip:
  57. $(Q) curl -L https://github.com/OpenAMP/libmetal/archive/v$(VERSION).zip -o libmetal.zip
  58. $(Q) unzip -o libmetal.zip
  59. $(Q) mv libmetal-$(VERSION) libmetal
  60. .libmetal_headers: libmetal.zip
  61. $(eval headers := $(wildcard libmetal/lib/compiler/gcc/*.h))
  62. $(eval headers += $(wildcard libmetal/lib/processor/$(LIBMETAL_ARCH)/*.h))
  63. $(eval headers += $(wildcard libmetal/lib/system/nuttx/*.h))
  64. $(eval headers += $(wildcard libmetal/lib/*.h))
  65. $(foreach header,$(headers), \
  66. $(eval hobj := $(patsubst libmetal$(DELIM)lib$(DELIM)%,$(TOPDIR)$(DELIM)include$(DELIM)metal$(DELIM)%,$(header))) \
  67. $(shell if [ ! -d $(dir $(hobj)) ];then mkdir -p $(dir $(hobj)); fi) \
  68. $(shell sed $(LIBMETAL_HDRS_SEDEXP) $(header) > $(hobj)) \
  69. )
  70. touch $@
  71. dirlinks:: .libmetal_headers
  72. distclean::
  73. $(call DELDIR, $(TOPDIR)$(DELIM)include$(DELIM)metal)
  74. $(call DELDIR, libmetal)
  75. $(call DELFILE, libmetal.zip)
  76. $(call DELFILE, .libmetal_headers)
  77. endif