mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 00:08:10 +00:00
build(core/rust): use correct architecture for T1
TT is Cortex-M4 is Armv7E-M while T1 is Cortex-M3 is Armv7-M: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/armv6-m-vs-armv7-m---unpacking-the-microcontrollers
This commit is contained in:
parent
6fd4739c5c
commit
20fe8552ca
@ -400,7 +400,7 @@ elif TREZOR_MODEL == '1':
|
|||||||
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
CPU_CCFLAGS = '-mthumb -mtune=cortex-m3 -mcpu=cortex-m3 -mfloat-abi=soft '
|
||||||
CPU_MODEL = 'STM32F405xx'
|
CPU_MODEL = 'STM32F405xx'
|
||||||
LD_VARIANT = '' if EVERYTHING else '_min'
|
LD_VARIANT = '' if EVERYTHING else '_min'
|
||||||
RUST_TARGET = 'thumbv7em-none-eabi'
|
RUST_TARGET = 'thumbv7m-none-eabi'
|
||||||
else:
|
else:
|
||||||
raise ValueError('Unknown Trezor model')
|
raise ValueError('Unknown Trezor model')
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ fn main() {
|
|||||||
/// Generates Rust module that exports QSTR constants used in firmware.
|
/// Generates Rust module that exports QSTR constants used in firmware.
|
||||||
fn generate_qstr_bindings() {
|
fn generate_qstr_bindings() {
|
||||||
let out_path = env::var("OUT_DIR").unwrap();
|
let out_path = env::var("OUT_DIR").unwrap();
|
||||||
let target = env::var("TARGET").unwrap();
|
|
||||||
|
|
||||||
// Tell cargo to invalidate the built crate whenever the header changes.
|
// Tell cargo to invalidate the built crate whenever the header changes.
|
||||||
println!("cargo:rerun-if-changed=qstr.h");
|
println!("cargo:rerun-if-changed=qstr.h");
|
||||||
@ -20,7 +19,7 @@ fn generate_qstr_bindings() {
|
|||||||
// Pass in correct include paths.
|
// Pass in correct include paths.
|
||||||
.clang_args(&[
|
.clang_args(&[
|
||||||
"-I",
|
"-I",
|
||||||
if target.starts_with("thumbv7em-none-eabi") {
|
if is_firmware() {
|
||||||
"../../build/firmware"
|
"../../build/firmware"
|
||||||
} else {
|
} else {
|
||||||
"../../build/unix"
|
"../../build/unix"
|
||||||
@ -41,7 +40,6 @@ fn generate_qstr_bindings() {
|
|||||||
|
|
||||||
fn generate_micropython_bindings() {
|
fn generate_micropython_bindings() {
|
||||||
let out_path = env::var("OUT_DIR").unwrap();
|
let out_path = env::var("OUT_DIR").unwrap();
|
||||||
let target = env::var("TARGET").unwrap();
|
|
||||||
|
|
||||||
// Tell cargo to invalidate the built crate whenever the header changes.
|
// Tell cargo to invalidate the built crate whenever the header changes.
|
||||||
println!("cargo:rerun-if-changed=micropython.h");
|
println!("cargo:rerun-if-changed=micropython.h");
|
||||||
@ -107,7 +105,7 @@ fn generate_micropython_bindings() {
|
|||||||
bindings = bindings.no_copy("_mp_map_t");
|
bindings = bindings.no_copy("_mp_map_t");
|
||||||
|
|
||||||
// Pass in correct include paths and defines.
|
// Pass in correct include paths and defines.
|
||||||
if target.starts_with("thumbv7em-none-eabi") {
|
if is_firmware() {
|
||||||
bindings = bindings.clang_args(&[
|
bindings = bindings.clang_args(&[
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-I../firmware",
|
"-I../firmware",
|
||||||
@ -164,3 +162,8 @@ fn generate_micropython_bindings() {
|
|||||||
.write_to_file(PathBuf::from(out_path).join("micropython.rs"))
|
.write_to_file(PathBuf::from(out_path).join("micropython.rs"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_firmware() -> bool {
|
||||||
|
let target = env::var("TARGET").unwrap();
|
||||||
|
target.starts_with("thumbv7")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user