-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.defines
200 lines (167 loc) · 6.05 KB
/
Makefile.defines
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#*******************************************************************************
# Ledger SDK
# (c) 2024 Ledger
#
# 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.
#*******************************************************************************
ifeq ($(__MAKEFILE_DEFINES__),)
__MAKEFILE_DEFINES__ := 1
include $(BOLOS_SDK)/Makefile.target
API_LEVEL := 0
# APPNAME exposed to the app as a CFLAG because it might contain spaces
CFLAGS += -DAPPNAME=\"$(APPNAME)\"
# API_LEVEL exposed to the app as an integer
DEFINES += API_LEVEL=$(API_LEVEL)
# Define list of other items to be exposed to the app as strings
# TARGET_ID is not in this list: it is already defined in bolos_target.h.
APP_METADATA_LIST := TARGET TARGET_NAME APPVERSION SDK_NAME SDK_VERSION SDK_HASH
DEFINES += $(foreach item,$(APP_METADATA_LIST), $(item)=\"$($(item))\")
### platform definitions
DEFINES += gcc __IO=volatile
# no assert by default
DEFINES += NDEBUG
# default is not to display make commands
log = $(if $(strip $(VERBOSE)),$1,@$1) # kept for retrocompat
L = $(if $(strip $(VERBOSE)),,@)
ifeq ($(CC),)
CC = clang
endif
SYSROOT = $(shell $(GCCPATH)arm-none-eabi-gcc -print-sysroot)
ifeq ($(SYSROOT),)
CFLAGS += -I/usr/include
else
CFLAGS += --sysroot="$(SYSROOT)"
endif
CFLAGS += -fomit-frame-pointer -momit-leaf-frame-pointer
CFLAGS += -fno-common -mlittle-endian
CFLAGS += -std=gnu99
CFLAGS += -Wall -Wextra
CFLAGS += -Wno-main
CFLAGS += -Werror=int-to-pointer-cast
# Additional Clang warnings
CFLAGS += -Wno-error=int-conversion -Wimplicit-fallthrough
CFLAGS += -Wvla -Wundef -Wshadow -Wformat=2 -Wformat-security -Wwrite-strings
ENABLE_SDK_WERROR ?= 0
ifneq ($(ENABLE_SDK_WERROR),0)
CFLAGS += -Werror
endif
CFLAGS += -fdata-sections -ffunction-sections -funsigned-char -fshort-enums
CFLAGS += -mno-unaligned-access
CFLAGS += -fropi
CFLAGS += -fno-jump-tables # avoid jump tables for switch to avoid problems with invalid PIC access
CFLAGS += -nostdlib -nodefaultlibs
LDFLAGS += -fomit-frame-pointer
LDFLAGS += -Wall
LDFLAGS += -fno-common -ffunction-sections -fdata-sections -fwhole-program
LDFLAGS += -mno-unaligned-access
LDFLAGS += -Wl,--gc-sections -Wl,-Map,$(DBG_DIR)/app.map
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOS))
CFLAGS += --target=armv6m-none-eabi -mthumb
CFLAGS += -mcpu=cortex-m0plus -mthumb -mtune=cortex-m0plus
AFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -nostartfiles --specs=nano.specs
endif
ifeq ($(TARGET_NAME),TARGET_NANOX)
CFLAGS += -frwpi
LDFLAGS += -momit-leaf-frame-pointer
CFLAGS += --target=armv6m-none-eabi -mthumb
LDFLAGS += --target=armv6m-none-eabi -mthumb
LDFLAGS += -mtune=cortex-m0plus -mlittle-endian -mcpu=cortex-m0plus
LDFLAGS += -nostdlib -nodefaultlibs #-nostartfiles
LDFLAGS += -mno-movt
LDFLAGS += -L$(BOLOS_SDK)/arch/st33/lib/
AFLAGS += -mcpu=cortex-m0plus -mthumb
endif
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX TARGET_NANOS2))
CFLAGS += -mno-movt -frwpi --target=armv8m-none-eabi -mcpu=cortex-m35p+nodsp -mthumb -msoft-float -mtune=cortex-m35p+nodsp
LDFLAGS += -momit-leaf-frame-pointer
LDFLAGS += --target=armv8m-none-eabi
LDFLAGS += -mcpu=cortex-m35p+nodsp -mlittle-endian
LDFLAGS += -nostdlib -nodefaultlibs #-nostartfiles
LDFLAGS += -mno-movt
LDFLAGS += -L$(BOLOS_SDK)/arch/st33k1/lib/
AFLAGS += -mcpu=cortex-m35p+nodsp -mthumb
endif
ifeq ($(TARGET_NAME),TARGET_STAX)
# For Stax NBGL must be used
USE_NBGL = 1
DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_24PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_24PX
DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_32PX
DEFINES += HAVE_INAPP_BLE_PAIRING
DEFINES += HAVE_NBGL
DEFINES += HAVE_PIEZO_SOUND
DEFINES += HAVE_SE_TOUCH
DEFINES += HAVE_SE_EINK_DISPLAY
DEFINES += NBGL_PAGE
DEFINES += NBGL_USE_CASE
DEFINES += SCREEN_SIZE_WALLET
endif # TARGET_STAX
ifeq ($(TARGET_NAME),TARGET_FLEX)
# For Flex NBGL must be used
USE_NBGL = 1
DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_28PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_28PX
DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_36PX
DEFINES += HAVE_INAPP_BLE_PAIRING
DEFINES += HAVE_NBGL
DEFINES += HAVE_PIEZO_SOUND
DEFINES += HAVE_SE_TOUCH
DEFINES += HAVE_SE_EINK_DISPLAY
# DEFINES += HAVE_HW_TOUCH_SWIPE
DEFINES += NBGL_PAGE
DEFINES += NBGL_USE_CASE
DEFINES += SCREEN_SIZE_WALLET
DEFINES += HAVE_FAST_HOLD_TO_APPROVE
endif # TARGET_FLEX
# For other devices, by default NBGL is not used
USE_NBGL ?= 0
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
DEFINES += BAGL_HEIGHT=64
DEFINES += BAGL_WIDTH=128
DEFINES += HAVE_BAGL_ELLIPSIS
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
DEFINES += SCREEN_SIZE_NANO
ifeq ($(USE_NBGL),0)
DEFINES += HAVE_BAGL
DEFINES += HAVE_UX_FLOW
else
DEFINES += HAVE_NBGL
DEFINES += NBGL_STEP
DEFINES += NBGL_USE_CASE
endif # USE_NBGL
endif # TARGET_NANOX / TARGET_NANOS2
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += BAGL_HEIGHT=32
DEFINES += BAGL_WIDTH=128
DEFINES += SCREEN_SIZE_NANO
DEFINES += HAVE_BAGL
endif # TARGET_NANOS
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
# Screen is directly connected to the SE
DEFINES += HAVE_SE_SCREEN
# Button is directly connected to the SE
DEFINES += HAVE_SE_BUTTON
# MCU serial is stored on board of the SE
DEFINES += HAVE_MCU_SERIAL_STORAGE
DEFINES += HAVE_FONTS
DEFINES += HAVE_INAPP_BLE_PAIRING
DEFINES += HAVE_BATTERY
endif
DEFINES += HAVE_LEDGER_PKI
# include builtin CX libs options
-include $(BOLOS_SDK)/Makefile.conf.cx
endif