forked from phoenix-rtos/libphoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.targets
85 lines (63 loc) · 2.42 KB
/
Makefile.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Makefile for libphoenix - target specifications
#
# Copyright 2012-2018 Phoenix Systems
############ GENERIC #########
CC = $(CROSS)gcc
AR = $(CROSS)ar
ARFLAGS = -r
LD = $(CROSS)ld
OBJCOPY = $(CROSS)objcopy
OBJDUMP = $(CROSS)objdump
STRIP = $(CROSS)strip
############ IA32 ############
ifneq (, $(findstring ia32, $(TARGET)))
CROSS ?= i386-pc-phoenix-
SUBDIRS = arch/ia32 $(SUBSYSTEMS)
CFLAGS += -O2 -g -Wall -Wstrict-prototypes -nostartfiles -nostdlib\
-m32 -march=i586 -mtune=generic -mno-mmx -mno-sse -fno-pic -fno-pie\
-fomit-frame-pointer -fno-strength-reduce -fno-builtin-malloc
LDFLAGS += -m elf_i386
GCCLIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
endif
############ ARMv7 (Cortex-M3/M7) ############
ifneq (, $(findstring armv7, $(TARGET)))
CROSS ?= arm-phoenix-
SUBDIRS = arch/armv7 $(SUBSYSTEMS)
ifneq (, $(findstring imxrt, $(TARGET)))
#FIXME: -mfpu=fpv5-d16 does not work with current toolchain
CFLAGS += -O2 -Wall -Wstrict-prototypes -g -nostartfiles -nostdlib\
-mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb\
-fomit-frame-pointer -ffreestanding\
-fpic -fpie -msingle-pic-base -mno-pic-data-is-text-relative\
-DNOMMU
else
CFLAGS += -O2 -Wall -Wstrict-prototypes -g -nostartfiles -nostdlib\
-mcpu=cortex-m3 -mthumb \
-fomit-frame-pointer -ffreestanding\
-fpic -fpie -msingle-pic-base -mno-pic-data-is-text-relative\
-DNOMMU
endif
LDFLAGS += -nostdlib -e _start --section-start .text=0 -Tbss=20000000 -z max-page-size=0x10
GCCLIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
endif
############ ARM (Cortex-A5/A7/A9) ############
ifneq (, $(findstring arm-imx, $(TARGET)))
CROSS ?= arm-phoenix-
SUBDIRS = arch/arm-imx $(SUBSYSTEMS)
CFLAGS += -Os -Wall -Wstrict-prototypes -g -nostartfiles -nostdlib\
-mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mthumb\
-fomit-frame-pointer -mno-unaligned-access
LDFLAGS += -nostdlib -z max-page-size=0x1000
GCCLIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
endif
############ RISCV64 ############
ifneq (, $(findstring riscv64, $(TARGET)))
CROSS ?= riscv64-unknown-elf-
SUBDIRS = arch/riscv64 $(SUBSYSTEMS)
CFLAGS += -Wall -Wstrict-prototypes -nostartfiles -nostdlib\
-fomit-frame-pointer -ffreestanding \
-DVERSION=\"$(VERSION)\" -DHAL=\"hal//riscv64//hal.h\" -mcmodel=medany -I/usr/local/include
LDFLAGS += -nostdlib
GCCLIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
endif