@@ -112,6 +112,7 @@ struct Device<'a> {
112
112
pub cflags : Vec < & ' a str > ,
113
113
pub glyphs_folders : Vec < PathBuf > ,
114
114
pub arm_libs : String ,
115
+ pub linker_script : & ' a str ,
115
116
}
116
117
117
118
impl std:: fmt:: Display for DeviceName {
@@ -207,6 +208,7 @@ impl SDKBuilder<'_> {
207
208
cflags : Vec :: from ( CFLAGS_NANOS ) ,
208
209
glyphs_folders : Vec :: new ( ) ,
209
210
arm_libs : Default :: default ( ) ,
211
+ linker_script : "nanos_layout.ld" ,
210
212
} ,
211
213
"nanosplus" => Device {
212
214
name : DeviceName :: NanoSPlus ,
@@ -228,6 +230,7 @@ impl SDKBuilder<'_> {
228
230
cflags : Vec :: from ( CFLAGS_NANOSPLUS ) ,
229
231
glyphs_folders : Vec :: new ( ) ,
230
232
arm_libs : Default :: default ( ) ,
233
+ linker_script : "nanosplus_layout.ld" ,
231
234
} ,
232
235
"nanox" => Device {
233
236
name : DeviceName :: NanoX ,
@@ -249,6 +252,7 @@ impl SDKBuilder<'_> {
249
252
cflags : Vec :: from ( CFLAGS_NANOX ) ,
250
253
glyphs_folders : Vec :: new ( ) ,
251
254
arm_libs : Default :: default ( ) ,
255
+ linker_script : "nanox_layout.ld" ,
252
256
} ,
253
257
"stax" => Device {
254
258
name : DeviceName :: Stax ,
@@ -258,6 +262,7 @@ impl SDKBuilder<'_> {
258
262
cflags : Vec :: from ( CFLAGS_STAX ) ,
259
263
glyphs_folders : Vec :: new ( ) ,
260
264
arm_libs : Default :: default ( ) ,
265
+ linker_script : "stax_layout.ld" ,
261
266
} ,
262
267
"flex" => Device {
263
268
name : DeviceName :: Flex ,
@@ -267,6 +272,7 @@ impl SDKBuilder<'_> {
267
272
cflags : Vec :: from ( CFLAGS_FLEX ) ,
268
273
glyphs_folders : Vec :: new ( ) ,
269
274
arm_libs : Default :: default ( ) ,
275
+ linker_script : "flex_layout.ld" ,
270
276
} ,
271
277
_ => {
272
278
return Err ( SDKBuildError :: UnsupportedDevice ) ;
@@ -613,14 +619,11 @@ impl SDKBuilder<'_> {
613
619
// extend the library search path
614
620
println ! ( "cargo:rustc-link-search={}" , out_dir. display( ) ) ;
615
621
// copy
616
- let linkerscript = match self . device . name {
617
- DeviceName :: NanoS => "nanos_layout.ld" ,
618
- DeviceName :: NanoX => "nanox_layout.ld" ,
619
- DeviceName :: NanoSPlus => "nanosplus_layout.ld" ,
620
- DeviceName :: Stax => "stax_flex_layout.ld" ,
621
- DeviceName :: Flex => "stax_flex_layout.ld" ,
622
- } ;
623
- std:: fs:: copy ( linkerscript, out_dir. join ( linkerscript) ) . unwrap ( ) ;
622
+ std:: fs:: copy (
623
+ self . device . linker_script ,
624
+ out_dir. join ( self . device . linker_script ) ,
625
+ )
626
+ . unwrap ( ) ;
624
627
std:: fs:: copy ( "link.ld" , out_dir. join ( "link.ld" ) ) . unwrap ( ) ;
625
628
Ok ( ( ) )
626
629
}
0 commit comments