提交 988fd85f 编写于 作者: A arvinzzz

fix: 支持硬浮点编译

1. 通过本工程的gn编译时,需要在device目录下,单板的关于内核的config.gn中指定-mfloat-abi的等级,并在单板相关代码的编译选项中保持-mfloat-abi一致
2. 通过本工程的Makefile编译时,需要在kernel/liteos_m/targets/下添加单板相关的代码配置,在Makefile中设置-mfloat-abi即可
3. 通过IDE编译本工程时,需要在IDE的汇编文件相关编译选项中加入 -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h,保证浮点等级在汇编文件中生效

close: #I48KJP
Signed-off-by: Narvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ibf9b750b922be2530de349981d55e40b5919933f
上级 07151260
......@@ -29,9 +29,17 @@
import("config.gni")
LITEOS_LOS_CONFIG_H = rebase_path("$LITEOSTOPDIR/kernel/include/los_config.h")
config("los_config") {
cflags = [ "-Werror" ]
asmflags = [
"-DCLZ=CLZ",
"-imacros",
"$LITEOS_LOS_CONFIG_H",
]
include_dirs = [
"//kernel/liteos_m/kernel/include",
"//kernel/liteos_m/kernel/arch/include",
......
......@@ -31,7 +31,6 @@
#include "los_cppsupport.h"
typedef VOID (*InitFunc)(VOID);
INT32 LOS_CppSystemInit(UINTPTR initArrayStart, UINTPTR initArrayEnd)
......@@ -39,12 +38,10 @@ INT32 LOS_CppSystemInit(UINTPTR initArrayStart, UINTPTR initArrayEnd)
UINTPTR *start;
InitFunc initFunc = NULL;
for (start = (UINTPTR *)initArrayStart; start < (UINTPTR *)initArrayEnd; start++){
for (start = (UINTPTR *)initArrayStart; start < (UINTPTR *)initArrayEnd; start++) {
initFunc = (InitFunc)(*start);
initFunc();
}
return 0;
}
......@@ -176,7 +176,7 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(AS) -c $(CFLAGS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(LDSCRIPT)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
......
......@@ -36,9 +36,11 @@ C_INCLUDES += -I. \
-I$(LITEOSTOPDIR)/kernel/arch/include \
-I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc
ASFLAGS += -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h -DCLZ=CLZ
# list of ASM .S program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMS_SOURCES:.S=.o)))
vpath %.S $(sort $(dir $(ASMS_SOURCES)))
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) $< -o $@
$(CC) -c $(CFLAGS) $(ASFLAGS) $< -o $@
......@@ -178,7 +178,7 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(AS) -c $(CFLAGS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(LDSCRIPT)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
......
......@@ -36,9 +36,11 @@ C_INCLUDES += -I. \
-I$(LITEOSTOPDIR)/kernel/arch/include \
-I$(LITEOSTOPDIR)/kernel/arch/risc-v/nuclei/gcc
ASFLAGS += -imacros $(LITEOSTOPDIR)/kernel/include/los_config.h -DCLZ=CLZ
# list of ASM .S program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMS_SOURCES:.S=.o)))
vpath %.S $(sort $(dir $(ASMS_SOURCES)))
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) $< -o $@
$(CC) -c $(CFLAGS) $(ASFLAGS) $< -o $@
......@@ -194,7 +194,7 @@ extern "C" {
* Allow inline sections
*/
#ifndef LITE_OS_SEC_ALW_INLINE
#define LITE_OS_SEC_ALW_INLINE //__attribute__((always_inline))
#define LITE_OS_SEC_ALW_INLINE // __attribute__((always_inline))
#endif
/**
......@@ -210,7 +210,7 @@ extern "C" {
* .Text section (Code section)
*/
#ifndef LITE_OS_SEC_TEXT
#define LITE_OS_SEC_TEXT //__attribute__((section(".sram.text")))
#define LITE_OS_SEC_TEXT // __attribute__((section(".sram.text")))
#endif
/**
......@@ -226,7 +226,7 @@ extern "C" {
* .Text.init section
*/
#ifndef LITE_OS_SEC_TEXT_INIT
#define LITE_OS_SEC_TEXT_INIT //__attribute__((section(".dyn.text")))
#define LITE_OS_SEC_TEXT_INIT // __attribute__((section(".dyn.text")))
#endif
/**
......@@ -234,7 +234,7 @@ extern "C" {
* .Data section
*/
#ifndef LITE_OS_SEC_DATA
#define LITE_OS_SEC_DATA //__attribute__((section(".dyn.data")))
#define LITE_OS_SEC_DATA // __attribute__((section(".dyn.data")))
#endif
/**
......@@ -242,7 +242,7 @@ extern "C" {
* .Data.init section
*/
#ifndef LITE_OS_SEC_DATA_INIT
#define LITE_OS_SEC_DATA_INIT //__attribute__((section(".dyn.data")))
#define LITE_OS_SEC_DATA_INIT // __attribute__((section(".dyn.data")))
#endif
/**
......@@ -250,7 +250,7 @@ extern "C" {
* Not initialized variable section
*/
#ifndef LITE_OS_SEC_BSS
#define LITE_OS_SEC_BSS //__attribute__((section(".sym.bss")))
#define LITE_OS_SEC_BSS // __attribute__((section(".sym.bss")))
#endif
/**
......@@ -270,34 +270,34 @@ extern "C" {
#endif
#ifndef LITE_OS_SEC_TEXT_DATA
#define LITE_OS_SEC_TEXT_DATA //__attribute__((section(".dyn.data")))
#define LITE_OS_SEC_TEXT_BSS //__attribute__((section(".dyn.bss")))
#define LITE_OS_SEC_TEXT_RODATA //__attribute__((section(".dyn.rodata")))
#define LITE_OS_SEC_TEXT_DATA // __attribute__((section(".dyn.data")))
#define LITE_OS_SEC_TEXT_BSS // __attribute__((section(".dyn.bss")))
#define LITE_OS_SEC_TEXT_RODATA // __attribute__((section(".dyn.rodata")))
#endif
#ifndef LITE_OS_SEC_SYMDATA
#define LITE_OS_SEC_SYMDATA //__attribute__((section(".sym.data")))
#define LITE_OS_SEC_SYMDATA // __attribute__((section(".sym.data")))
#endif
#ifndef LITE_OS_SEC_SYMBSS
#define LITE_OS_SEC_SYMBSS //__attribute__((section(".sym.bss")))
#define LITE_OS_SEC_SYMBSS // __attribute__((section(".sym.bss")))
#endif
#ifndef LITE_OS_SEC_KEEP_DATA_DDR
#define LITE_OS_SEC_KEEP_DATA_DDR //__attribute__((section(".keep.data.ddr")))
#define LITE_OS_SEC_KEEP_DATA_DDR // __attribute__((section(".keep.data.ddr")))
#endif
#ifndef LITE_OS_SEC_KEEP_TEXT_DDR
#define LITE_OS_SEC_KEEP_TEXT_DDR //__attribute__((section(".keep.text.ddr")))
#define LITE_OS_SEC_KEEP_TEXT_DDR // __attribute__((section(".keep.text.ddr")))
#endif
#ifndef LITE_OS_SEC_KEEP_DATA_SRAM
#define LITE_OS_SEC_KEEP_DATA_SRAM //__attribute__((section(".keep.data.sram")))
#define LITE_OS_SEC_KEEP_DATA_SRAM // __attribute__((section(".keep.data.sram")))
#endif
#ifndef LITE_OS_SEC_KEEP_TEXT_SRAM
#define LITE_OS_SEC_KEEP_TEXT_SRAM //__attribute__((section(".keep.text.sram")))
#define LITE_OS_SEC_KEEP_TEXT_SRAM // __attribute__((section(".keep.text.sram")))
#endif
#ifndef LITE_OS_SEC_BSS_MINOR
......@@ -378,7 +378,7 @@ typedef signed int INTPTR;
* @ingroup los_base
* Align the tail of the object with the base address addr, with size bytes being the smallest unit of alignment.
*/
#define TRUNCATE(addr, size) ((addr) & ~((size)-1))
#define TRUNCATE(addr, size) ((addr) & ~((size) - 1))
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册