Skip to content

Commit

Permalink
rtl8721csm/ai_tfmicro: add build config with cxx support
Browse files Browse the repository at this point in the history
This build configuration will be updated for Tensor Flow Micro code build.
  • Loading branch information
vibhor-m authored and Taejun-Kwon committed Mar 23, 2023
1 parent abecdfb commit 75ed512
Show file tree
Hide file tree
Showing 2 changed files with 1,652 additions and 0 deletions.
231 changes: 231 additions & 0 deletions build/configs/rtl8721csm/ai_tfmicro/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
###########################################################################
#
# Copyright 2023 Samsung Electronics All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
#
###########################################################################
############################################################################
#
# Copyright (C) 2020 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################

include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
ARCH_FAMILY = $(patsubst "%",%,$(CONFIG_ARCH_FAMILY))
include ${TOPDIR}/arch/$(CONFIG_ARCH)/src/$(ARCH_FAMILY)/Toolchain.defs

ifeq ($(CONFIG_AMEBAD_TRUSTZONE),y)
LDSCRIPT = rlx8721d_img2_ns.ld
else
LDSCRIPT = rlx8721d_img2_is.ld
endif

ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/../framework/include}" -isystem "${shell cygpath -w $(TOPDIR)/../external/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/../external/include}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/../build/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/../framework/include -isystem $(TOPDIR)/../external/include
ARCHINCLUDES += -isystem $(TOPDIR)/net/lwip/src/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/../external/include
ARCHXXINCLUDES += -isystem $(TOPDIR)/net/lwip/src/include
ARCHXXINCLUDES += -isystem $(TOPDIR)/../external/include/libcxx
ARCHXXINCLUDES += -isystem $(TOPDIR)/../framework/include
ARCHSCRIPT = -T$(TOPDIR)/../build/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif

CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AS = $(CROSSDEV)as
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
LD_ROM = $(CROSSDEV)ld
CC_SIZE = $(CROSSDEV)size
FROMELF = $(CROSSDEV)objcopy
STRIP = $(CROSSDEV)strip
NM = $(ARCROSSDEV)nm

GDB = arm-none-eabi-gdb
GDBR = arm-none-eabi-gdb
READELF = arm-none-eabi-readelf

REMOVE = -rm -f
REMOVEDIR = rm -rf
MKDIR = mkdir
MAKE = make
CD = cd
COPY = cp
MOVE = mv

PREPENDTOOL = $(COMPILATION_FILE_FOLDER)/prepend_header.sh
CODE_ANALYZE_PYTHON=$(COMPILATION_FILE_FOLDER)/code_analyze.py

ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ARCHCCMINOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f2}

ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif

ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif

ifeq ($(CONFIG_FRAME_POINTER),y)
ARCHOPTIMIZATION += -fomit-frame-pointer -mapcs -mno-sched-prolog
endif

ARCHCFLAGS = -fno-builtin -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -fno-common
ARCHCXXFLAGS = -fno-builtin -fno-common -fno-exceptions -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -fno-rtti $(ARCHCPUFLAGS)
ifeq ($(QUICKBUILD),y)
ARCHWARNINGS = -Wall -Werror -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
ARCHWARNINGSXX = -Wall -Werror -Wshadow -Wundef
else
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-implicit-function-declaration -Wno-unused-function -Wno-unused-but-set-variable
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
# only version 4.9 supports color diagnostics
ifeq "$(ARCHMAJOR)" "4"
ifeq "$(ARCHMINOR)" "9"
ARCHWARNINGS += -fdiagnostics-color=auto
ARCHWARNINGSCC += -fdiagnostics-color=auto
endif
endif

endif
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -ffunction-sections -fdata-sections
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXFLAGS += -std=c++11 -DCLOCK_MONOTONIC -D__TINYARA__
CXXFLAGS += -fno-exceptions -fcheck-new -fno-rtti
#CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -ffunction-sections -fdata-sections -D__GLIBCXX__
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__

##########################################################################################################################################
CFLAGS += -march=armv8-m.main+dsp
CFLAGS += -mthumb
CFLAGS += -mcmse
#CFLAGS += -mfloat-abi=hard
#CFLAGS += -mfpu=fpv5-sp-d16


#CFLAGS += -g
#CFLAGS += -gdwarf-3
#CFLAGS += -nodefaultlibs
#CFLAGS += -O2
#CFLAGS += -D__FPU_PRESENT

#CFLAGS += -fstack-usage
#CFLAGS += -fdata-sections
#CFLAGS += -nostartfiles
#CFLAGS += -nostdlib
#CFLAGS += -Wpointer-arith
#CFLAGS += -Wno-write-strings
#CFLAGS += -Wno-maybe-uninitialized
#CFLAGS += --save-temps
#CFLAGS += -c
#CFLAGS += -MMD

#CFLAGS += -Wextra

#CFLAGS += $(IFLAGS)
CFLAGS += -DCONFIG_PLATFORM_8721D
CFLAGS += -DCONFIG_USE_MBEDTLS_ROM_ALG
CFLAGS += -DDM_ODM_SUPPORT_TYPE=32
CFLAGS += -DSTD_PRINTF
CFLAGS += -DCONFIG_PLATFORM_TIZENRT_OS=1
CFLAGS += -DARM_CORE_CM4

#LDFLAGS += --wrap=printf

##########################################################################################################################################

ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT = .axf

ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

LDFLAGS += --gc-sections
LDFLAGS += --defsym=CONFIG_IDLETHREAD_STACKSIZE=$(CONFIG_IDLETHREAD_STACKSIZE)

HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =

define MAKE_BOARD_SPECIFIC_BIN
$(TOPDIR)/../build/configs/rtl8721csm/rtl8721csm_make_bin.sh
endef

SECURE_HEADER_SIZE=32

define MAKE_SAMSUNG_HEADER
$(TOPDIR)/../os/tools/mksamsungheader.py kernel ${SECURE_HEADER_SIZE}
endef

define MAKE_BOOTPARAM
$(TOPDIR)/../os/tools/mkbootparam.py
endef

define DOWNLOAD
$(TOPDIR)/../build/configs/common_download.sh $(1) $(2) $(3) $(4) $(5) $(6)
endef
Loading

0 comments on commit 75ed512

Please sign in to comment.