mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 16:18:22 +00:00
embed: refactor cpu flags in sconscript files
This commit is contained in:
parent
2a06ff4986
commit
45e10a2e79
@ -86,17 +86,27 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
if env.get('TREZOR_MODEL') == 'T':
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16'
|
||||
CPU_CCFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 '
|
||||
CPU_MODEL = 'STM32F427xx'
|
||||
else:
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m3 -mfloat-abi=soft'
|
||||
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
||||
CPU_MODEL = 'STM32F405xx'
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-nostdlib '
|
||||
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith -fno-common '
|
||||
'-mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard '
|
||||
'-fsingle-precision-constant -fdata-sections -ffunction-sections '
|
||||
'-ffreestanding '
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
+ CPU_CCFLAGS + CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/boardloader/memory.ld -Wl,--gc-sections -Wl,-Map=build/boardloader/boardloader.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
@ -111,11 +121,11 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
CPU_MODEL,
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
ASFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16',
|
||||
ASFLAGS=CPU_ASFLAGS,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
|
||||
#
|
||||
|
@ -107,17 +107,27 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
if env.get('TREZOR_MODEL') == 'T':
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16'
|
||||
CPU_CCFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 '
|
||||
CPU_MODEL = 'STM32F427xx'
|
||||
else:
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m3 -mfloat-abi=soft'
|
||||
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
||||
CPU_MODEL = 'STM32F405xx'
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-nostdlib '
|
||||
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith -fno-common '
|
||||
'-mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard '
|
||||
'-fsingle-precision-constant -fdata-sections -ffunction-sections '
|
||||
'-ffreestanding '
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
+ CPU_CCFLAGS + CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/bootloader/memory.ld -Wl,--gc-sections -Wl,-Map=build/bootloader/bootloader.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
@ -133,12 +143,12 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
CPU_MODEL,
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
'PB_FIELD_16BIT',
|
||||
] + CPPDEFINES_MOD,
|
||||
ASFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16',
|
||||
ASFLAGS=CPU_ASFLAGS,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
|
||||
env.Replace(
|
||||
|
@ -301,17 +301,27 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
if env.get('TREZOR_MODEL') == 'T':
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16'
|
||||
CPU_CCFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 '
|
||||
CPU_MODEL = 'STM32F427xx'
|
||||
else:
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m3 -mfloat-abi=soft'
|
||||
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
||||
CPU_MODEL = 'STM32F405xx'
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-nostdlib '
|
||||
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith -fno-common '
|
||||
'-mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard '
|
||||
'-fsingle-precision-constant -fdata-sections -ffunction-sections '
|
||||
'-ffreestanding '
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
+ CPU_CCFLAGS + CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/firmware/memory_${TREZOR_MODEL}.ld -Wl,--gc-sections -Wl,-Map=build/firmware/firmware.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
@ -327,11 +337,11 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
CPU_MODEL,
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
ASFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16',
|
||||
ASFLAGS=CPU_ASFLAGS,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
|
||||
env.Replace(
|
||||
|
@ -76,17 +76,18 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-nostdlib '
|
||||
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith -fno-common '
|
||||
'-mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard '
|
||||
'-fsingle-precision-constant -fdata-sections -ffunction-sections '
|
||||
'-ffreestanding '
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
+ CPU_CCFLAGS + CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/prodtest/memory.ld -Wl,--gc-sections -Wl,-Map=build/prodtest/prodtest.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
@ -100,10 +101,11 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
CPU_MODEL,
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
ASFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16',
|
||||
ASFLAGS=CPU_ASFLAGS,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
|
||||
env.Replace(
|
||||
|
@ -76,17 +76,27 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
if env.get('TREZOR_MODEL') == 'T':
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16'
|
||||
CPU_CCFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mtune=cortex-m4 '
|
||||
CPU_MODEL = 'STM32F427xx'
|
||||
else:
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m3 -mfloat-abi=soft'
|
||||
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
||||
CPU_MODEL = 'STM32F405xx'
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-nostdlib '
|
||||
'-std=gnu99 -Wall -Werror -Wdouble-promotion -Wpointer-arith -fno-common '
|
||||
'-mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard '
|
||||
'-fsingle-precision-constant -fdata-sections -ffunction-sections '
|
||||
'-ffreestanding '
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
+ CPU_CCFLAGS + CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/reflash/memory.ld -Wl,--gc-sections -Wl,-Map=build/reflash/reflash.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
@ -100,10 +110,11 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
CPU_MODEL,
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
ASFLAGS='-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16',
|
||||
ASFLAGS=CPU_ASFLAGS,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
|
||||
env.Replace(
|
||||
|
@ -247,7 +247,9 @@ env.Replace(
|
||||
OBJCOPY='objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
|
@ -60,7 +60,7 @@
|
||||
#define FLASH_SECTOR_COUNT 24
|
||||
|
||||
// note: FLASH_SR_RDERR is STM32F42xxx and STM32F43xxx specific (STM32F427) (reference RM0090 section 3.7.5)
|
||||
#ifndef FLASH_SR_RDERR
|
||||
#ifndef STM32F427xx
|
||||
#define FLASH_SR_RDERR 0
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user