Skip to content

Commit

Permalink
feat: Replaced gcc allocator with FreeRTOS allocator for secure world
Browse files Browse the repository at this point in the history
Signed-off-by: Taras Drozdovskyi <[email protected]>
  • Loading branch information
tdrozdovsky committed Jul 30, 2024
1 parent b7990e0 commit 73d4a1e
Show file tree
Hide file tree
Showing 15 changed files with 667 additions and 70 deletions.
4 changes: 2 additions & 2 deletions arch/cortex-m23/m2351/src/numaker_pfm_m2351/secure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ CFLAGS += -I../../Device/Nuvoton/M2351/Include
CFLAGS += -I$(TOPDIR)/tee_client/public
CFLAGS += -I$(TOPDIR)/tee_client/libteec/include/freertos
CFLAGS += -I$(TOPDIR)/tee/lib/libutee/include

CFLAGS += -I$(TOPDIR)/tee/lib/libutils/ext/include
CFLAGS += -I$(TOPDIR)/tee/lib/libutils/isoc/include
CFLAGS += -I$(TOPDIR)/tee/include
Expand Down Expand Up @@ -67,7 +66,7 @@ OBJS_S = $(AOBJS_S) $(COBJS_S)

LIBPATHS = -L. -L"$(TOPDIR)/lib"

LIBS = -lm -lc -lnosys -lm2351_StdDriver_s -lcrypt_s
LIBS = -lm -lc -lnosys -lm2351_StdDriver_s -lalloc_s -lcrypt_s

$(AOBJS_S): $(OBJDIR)/%$(OBJEXT): %.S
$(Q) mkdir -p $(OBJDIR)/$(dir $<)
Expand All @@ -81,6 +80,7 @@ $(COBJS_S): $(OBJDIR)/%$(OBJEXT): %.c

mtower_s$(EXEEXT): $(OBJS_S)
$(Q) $(MAKE) -C ../../StdDriver/src/ TOPDIR="$(TOPDIR)" WORLD=secure libm2351_StdDriver_s.a
$(Q) $(MAKE) -C $(TOPDIR)/common/ TOPDIR="$(TOPDIR)" WORLD=secure liballoc_s.a
$(Q) $(MAKE) -C $(TOPDIR)/crypto/ TOPDIR="$(TOPDIR)" WORLD=secure libcrypt_s.a
@echo "CC: mTower_s$(EXEEXT)"
$(Q) $(CC) $(CFLAGS) -mcmse -Wl,--section-start=.text=$(CONFIG_START_ADDRESS_BL32) -Tsecure.ld $(OBJS_S) $(LIBPATHS) $(LIBS) -o $(OBJDIR)/bl32.elf
Expand Down
8 changes: 4 additions & 4 deletions arch/riscv32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ comment "FE310 Configuration Options"
source arch/riscv32/fe310/Kconfig
endif

if ARCH_FAMILY_BL808
comment "BL808 Configuration Options"
source arch/riscv32/bl808/Kconfig
endif
# if ARCH_FAMILY_BL808
# comment "BL808 Configuration Options"
# source arch/riscv32/bl808/Kconfig
# endif

52 changes: 52 additions & 0 deletions common/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
############################################################################
# common/Makefile
#
# Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved.
# Author: Taras Drozdovskyi [email protected]
#
# 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.
#
############################################################################

-include $(TOPDIR)/Make.defs
-include $(TOPDIR)/.config

CFLAGS += -I.
CFLAGS += -I$(TOPDIR)/include/mtower

ifeq ($(WORLD), secure)
CFLAGS += -mcmse
endif

SRCS = heap_4.c

ifeq ($(WORLD), secure)
CFLAGS += -DDEBUG_PORT=$(subst ",,$(CONFIG_SECURE_DEBUG_UART))
OBJDIR = $(TOPDIR)/build/secure$(subst $(TOPDIR),,$(shell pwd))
endif

OBJS = $(addprefix $(OBJDIR)/, $(SRCS:.c=.o))

current_dir = $(subst $(TOPDIR),,$(shell pwd))

$(OBJDIR)/%.o : %.c
$(Q) mkdir -p $(OBJDIR)/$(dir $<)
@echo "CC: $<"
$(Q) $(CC) $(CFLAGS) -c -o $@ $^

liballoc_s.a: $(OBJS)
$(Q) $(AR) $(OBJDIR)/$@ $(OBJS)
$(Q) cp $(OBJDIR)/$@ $(TOPDIR)/lib/$@

clean:
rm -f $(OBJS) liballoc_s.a
Loading

0 comments on commit 73d4a1e

Please sign in to comment.