@@ -111,6 +111,7 @@ struct Device<'a> {
111
111
pub defines : Vec < ( String , Option < String > ) > ,
112
112
pub cflags : Vec < & ' a str > ,
113
113
pub glyphs_folders : Vec < PathBuf > ,
114
+ pub arm_libs : String ,
114
115
}
115
116
116
117
impl std:: fmt:: Display for DeviceName {
@@ -437,6 +438,7 @@ impl SDKBuilder<'_> {
437
438
defines : header2define ( "csdk_nanos.h" ) ,
438
439
cflags : Vec :: from ( CFLAGS_NANOS ) ,
439
440
glyphs_folders : Vec :: new ( ) ,
441
+ arm_libs : Default :: default ( ) ,
440
442
} ,
441
443
"nanosplus" => Device {
442
444
name : DeviceName :: NanoSPlus ,
@@ -457,6 +459,7 @@ impl SDKBuilder<'_> {
457
459
} ,
458
460
cflags : Vec :: from ( CFLAGS_NANOSPLUS ) ,
459
461
glyphs_folders : Vec :: new ( ) ,
462
+ arm_libs : Default :: default ( ) ,
460
463
} ,
461
464
"nanox" => Device {
462
465
name : DeviceName :: NanoX ,
@@ -477,6 +480,7 @@ impl SDKBuilder<'_> {
477
480
} ,
478
481
cflags : Vec :: from ( CFLAGS_NANOX ) ,
479
482
glyphs_folders : Vec :: new ( ) ,
483
+ arm_libs : Default :: default ( ) ,
480
484
} ,
481
485
"stax" => Device {
482
486
name : DeviceName :: Stax ,
@@ -485,6 +489,7 @@ impl SDKBuilder<'_> {
485
489
defines : header2define ( "csdk_stax.h" ) ,
486
490
cflags : Vec :: from ( CFLAGS_STAX ) ,
487
491
glyphs_folders : Vec :: new ( ) ,
492
+ arm_libs : Default :: default ( ) ,
488
493
} ,
489
494
"flex" => Device {
490
495
name : DeviceName :: Flex ,
@@ -493,6 +498,7 @@ impl SDKBuilder<'_> {
493
498
defines : header2define ( "csdk_flex.h" ) ,
494
499
cflags : Vec :: from ( CFLAGS_FLEX ) ,
495
500
glyphs_folders : Vec :: new ( ) ,
501
+ arm_libs : Default :: default ( ) ,
496
502
} ,
497
503
_ => {
498
504
return Err ( SDKBuildError :: UnsupportedDevice ) ;
@@ -536,6 +542,25 @@ impl SDKBuilder<'_> {
536
542
}
537
543
}
538
544
545
+ // Set ARM pre-compiled libraries path
546
+ self . device . arm_libs = match self . device . name {
547
+ DeviceName :: NanoS => {
548
+ let mut path = self . gcc_toolchain . display ( ) . to_string ( ) ;
549
+ path. push_str ( "/lib" ) ;
550
+ path
551
+ }
552
+ DeviceName :: NanoX => {
553
+ let mut path = self . device . c_sdk . display ( ) . to_string ( ) ;
554
+ path. push_str ( "/arch/st33/lib" ) ;
555
+ path
556
+ }
557
+ DeviceName :: NanoSPlus | DeviceName :: Flex | DeviceName :: Stax => {
558
+ let mut path = self . device . c_sdk . display ( ) . to_string ( ) ;
559
+ path. push_str ( "/arch/st33k1/lib" ) ;
560
+ path
561
+ }
562
+ } ;
563
+
539
564
// export TARGET into env for 'infos.rs'
540
565
println ! ( "cargo:rustc-env=TARGET={}" , self . device. name) ;
541
566
println ! ( "cargo:warning=Device is {:?}" , self . device. name) ;
@@ -664,19 +689,7 @@ impl SDKBuilder<'_> {
664
689
command. compile ( "ledger-secure-sdk" ) ;
665
690
666
691
/* Link with libc, libm and libgcc */
667
- let mut path = self . device . c_sdk . display ( ) . to_string ( ) ;
668
- match self . device . name {
669
- DeviceName :: NanoS => {
670
- path = self . gcc_toolchain . display ( ) . to_string ( ) ;
671
- path. push_str ( "/lib" ) ;
672
- }
673
- DeviceName :: NanoX => {
674
- path. push_str ( "/arch/st33/lib" ) ;
675
- }
676
- DeviceName :: NanoSPlus | DeviceName :: Flex | DeviceName :: Stax => {
677
- path. push_str ( "/arch/st33k1/lib" ) ;
678
- }
679
- } ;
692
+ let path = self . device . arm_libs . clone ( ) ;
680
693
println ! ( "cargo:rustc-link-lib=c" ) ;
681
694
println ! ( "cargo:rustc-link-lib=m" ) ;
682
695
println ! ( "cargo:rustc-link-lib=gcc" ) ;
0 commit comments