mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-11 16:00:57 +00:00
build: introduce T1 memory file
This commit is contained in:
parent
0499e983fe
commit
398f1557d6
@ -86,6 +86,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -109,7 +110,7 @@ env.Replace(
|
||||
'vendor/micropython/lib/cmsis/inc',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
|
@ -107,6 +107,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -131,7 +132,7 @@ env.Replace(
|
||||
'vendor/micropython/lib/cmsis/inc',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
|
@ -300,6 +300,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -311,7 +312,7 @@ env.Replace(
|
||||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-T embed/firmware/memory.ld -Wl,--gc-sections -Wl,-Map=build/firmware/firmware.map -Wl,--warn-common',
|
||||
LINKFLAGS='-T embed/firmware/memory_${TREZOR_MODEL}.ld -Wl,--gc-sections -Wl,-Map=build/firmware/firmware.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'.',
|
||||
'embed/firmware',
|
||||
@ -324,7 +325,7 @@ env.Replace(
|
||||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
('STM32_HAL_H', '"<stm32f4xx.h>"'),
|
||||
|
@ -76,6 +76,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -98,7 +99,7 @@ env.Replace(
|
||||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
|
@ -76,6 +76,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -98,7 +99,7 @@ env.Replace(
|
||||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
|
@ -249,6 +249,7 @@ env.Replace(
|
||||
OBJCOPY='objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'),
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
@ -266,7 +267,7 @@ env.Replace(
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_EMULATOR',
|
||||
('TREZOR_MODEL', 'T'),
|
||||
('TREZOR_MODEL', '$TREZOR_MODEL'),
|
||||
'MICROPY_USE_READLINE',
|
||||
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
|
66
embed/firmware/memory_1.ld
Normal file
66
embed/firmware/memory_1.ld
Normal file
@ -0,0 +1,66 @@
|
||||
/* TREZORv1 firmware linker script */
|
||||
|
||||
ENTRY(reset_handler)
|
||||
|
||||
MEMORY {
|
||||
FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 768K
|
||||
SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
main_stack_base = ORIGIN(SRAM) + LENGTH(SRAM); /* 8-byte aligned full descending stack */
|
||||
_estack = main_stack_base;
|
||||
|
||||
/* used by the startup code to populate variables used by the C code */
|
||||
data_lma = LOADADDR(.data);
|
||||
data_vma = ADDR(.data);
|
||||
data_size = SIZEOF(.data);
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
ccmram_start = 0;
|
||||
ccmram_end = 0;
|
||||
|
||||
/* used by the startup code to wipe memory */
|
||||
sram_start = ORIGIN(SRAM);
|
||||
sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
|
||||
_ram_start = sram_start;
|
||||
_ram_end = sram_end;
|
||||
|
||||
_codelen = LENGTH(FLASH) - SIZEOF(.header);
|
||||
_flash_start = ORIGIN(FLASH);
|
||||
_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
_heap_start = ADDR(.heap);
|
||||
_heap_end = ADDR(.heap) + SIZEOF(.heap);
|
||||
|
||||
SECTIONS {
|
||||
.header : ALIGN(4) {
|
||||
KEEP(*(.header));
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.flash : ALIGN(512) {
|
||||
KEEP(*(.vector_table));
|
||||
. = ALIGN(4);
|
||||
*(.text*);
|
||||
. = ALIGN(4);
|
||||
*(.rodata*);
|
||||
. = ALIGN(512);
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.data : ALIGN(4) {
|
||||
*(.data*);
|
||||
. = ALIGN(512);
|
||||
} >SRAM AT>FLASH
|
||||
|
||||
.bss : ALIGN(4) {
|
||||
*(.bss*);
|
||||
. = ALIGN(4);
|
||||
} >SRAM
|
||||
|
||||
.heap : ALIGN(4) {
|
||||
. = 37K; /* this acts as a build time assertion that at least this much memory is available for heap use */
|
||||
. = ABSOLUTE(sram_end - 16K); /* this explicitly sets the end of the heap effectively giving the stack at most 16K */
|
||||
} >SRAM
|
||||
|
||||
.stack : ALIGN(8) {
|
||||
. = 4K; /* this acts as a build time assertion that at least this much memory is available for stack use */
|
||||
} >SRAM
|
||||
}
|
Loading…
Reference in New Issue
Block a user