Spresense SDK 환경에서 LVM libc++ 표준 라이브러리 사용 방법
방법은 LLVM libc++ for NuttX에 쓴 방법을 참고하였다.(혹은 그 자체)
설치하다.
설치 방법은
<Your spresense/nuttx directory>
에서 Spresense SDK 환경의nutx 디렉터리를 지정하여 실행install.sh
합니다.$ git clone https://github.com/baggio63446333/libcxx
$ cd libcxx
$ ./install.sh <Your spresense/nuttx directory>
설치라고는 하지만 원본 파일이나 헤더 파일을nutx 이하의 디렉터리로 복사합니다..gitignore
파일에 의해 비구성 관리 객체로 설정되므로 git status
명령을 실행해도 표시되지 않습니다.파일을 마운트 해제(삭제)할 때
uninstall.sh
합니다.$ cd libcxx
$ ./uninstall.sh <Your spresense/nuttx directory>
프로비저닝
LVM C++Library를 활성화하려면 다음과 같이 Configuuration을 설정합니다.
열기
menuconfig
.$ cd spresense/sdk
$ ./tools/config.py default -m
Build Setup -> Customize Header Files ->
에서 선택math.h
.Library Routines ->
에서 Standard Math library
사이를 선택합니다.Build LLVM libcxx
의 설정이 완료되면 설정은 menuconfig
파일로 저장됩니다.$ ./tools/mkdefconfig.py feature/libcxx
파일 내용은 다음과 같습니다.$ cat configs/feature/libcxx/defconfig
-ARCH_MATH_H=y
-CLOCK_MONOTONIC=y
+LIBCXX=y
+LIBCXX_EXCEPTION=n
+LIBM=y
Makefile을 수정하여 컴파일 옵션을 변경합니다.$ diff --git a/sdk/tools/scripts/Make.defs b/sdk/tools/scripts/Make.defs
index 4eb5ddaab5..9f54a50af3 100644
--- a/sdk/tools/scripts/Make.defs
+++ b/sdk/tools/scripts/Make.defs
@@ -49,7 +49,10 @@ ifeq ($(WINTOOL),y)
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(SDKDIR)/include}"
- ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" -isystem "${shell cygpath -w $(SDKDIR)/include}
+ ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" -isystem "${shell cygpath -w $(SDKDIR)/include}"
+ifeq ($(CONFIG_LIBCXX),y)
+ ARCHXXINCLUDES += -isystem "${shell cygpath -w $(TOPDIR)/include/libcxx}"
+endif
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
HOSTEXEEXT = .exe
else
@@ -57,6 +60,9 @@ else
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(SDKDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(SDKDIR)/include
+ifeq ($(CONFIG_LIBCXX),y)
+ ARCHXXINCLUDES += -isystem $(TOPDIR)/include/libcxx
+endif
ARCHSCRIPT = -T$(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
HOSTEXEEXT =
endif
@@ -86,10 +92,10 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCFLAGS = -fno-builtin -mabi=aapcs -ffunction-sections -fdata-sections
-ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti -std=c++98
+ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti -std=c++11
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
-ARCHDEFINES =
+ARCHDEFINES = -D__NuttX__
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
구축
configs/feature/libcxx/defconfig
의 매개변수에 tools/config.py
를 추가하면 LVM C+++Library가 적용됩니다.$ cd spresense/sdk
$ ./tools/config.py feature/libcxx <その他のconfig...>
$ make
Reference
이 문제에 관하여(Spresense SDK 환경에서 LVM libc++ 표준 라이브러리 사용 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/baggio/items/2b1f5709efa9e49bcced텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)