@@ -137,6 +137,8 @@ def generate_hal_config_file():
137
137
138
138
139
139
def build_custom_lib (lib_path , lib_manifest = None ):
140
+ if not os .path .isdir (lib_path ):
141
+ return
140
142
if board .get ("build.stm32cube.disable_embedded_libs" , "no" ) == "yes" :
141
143
return
142
144
if lib_path :
@@ -255,8 +257,9 @@ def build_usb_libs(usb_libs_root):
255
257
256
258
bsp_dir = os .path .join (FRAMEWORK_DIR , "Drivers" , "BSP" )
257
259
components_dir = os .path .join (bsp_dir , "Components" )
258
- for component in os .listdir (components_dir ):
259
- build_custom_lib (os .path .join (components_dir , component ))
260
+ if os .path .isdir (components_dir ):
261
+ for component in os .listdir (components_dir ):
262
+ build_custom_lib (os .path .join (components_dir , component ))
260
263
261
264
if os .path .isdir (os .path .join (bsp_dir , "Adafruit_Shield" )):
262
265
build_custom_lib (os .path .join (bsp_dir , "Adafruit_Shield" ))
@@ -266,19 +269,25 @@ def build_usb_libs(usb_libs_root):
266
269
#
267
270
268
271
utils_dir = os .path .join (FRAMEWORK_DIR , "Utilities" )
269
- for util in os .listdir (utils_dir ):
270
- util_dir = os .path .join (utils_dir , util )
271
- # Some of utilities is not meant to be built
272
- if not any (f .endswith ((".c" , ".h" )) for f in os .listdir (util_dir )):
273
- continue
274
- build_custom_lib (
275
- os .path .join (utils_dir , util ),
276
- {
277
- "name" : "Util-%s" % util ,
278
- "dependencies" : [{"name" : "FrameworkVariantBSP" }],
279
- "build" : {"flags" : ["-I $PROJECT_SRC_DIR" , "-I $PROJECT_INCLUDE_DIR" ], "libLDFMode" : "deep" },
280
- },
281
- )
272
+ if os .path .isdir (utils_dir ):
273
+ for util in os .listdir (utils_dir ):
274
+ util_dir = os .path .join (utils_dir , util )
275
+ # Some of utilities is not meant to be built
276
+ if not os .path .isdir (util_dir ) or not any (
277
+ f .endswith ((".c" , ".h" )) for f in os .listdir (util_dir )
278
+ ):
279
+ continue
280
+ build_custom_lib (
281
+ os .path .join (utils_dir , util ),
282
+ {
283
+ "name" : "Util-%s" % util ,
284
+ "dependencies" : [{"name" : "FrameworkVariantBSP" }],
285
+ "build" : {
286
+ "flags" : ["-I $PROJECT_SRC_DIR" , "-I $PROJECT_INCLUDE_DIR" ],
287
+ "libLDFMode" : "deep" ,
288
+ },
289
+ },
290
+ )
282
291
283
292
#
284
293
# USB libraries from ST
0 commit comments