@@ -66,15 +66,21 @@ def get_original_version(version):
66
66
platform .get_package_version ("toolchain-xtensa32" ))
67
67
68
68
69
+ def is_set (parameter , configuration ):
70
+ if int (configuration .get (parameter , 0 )):
71
+ return True
72
+ return False
73
+
74
+
69
75
def is_ulp_enabled (sdk_params ):
70
76
ulp_memory = int (sdk_params .get ("CONFIG_ULP_COPROC_RESERVE_MEM" , 0 ))
71
- ulp_enabled = int ( sdk_params . get ( "CONFIG_ULP_COPROC_ENABLED" , 0 ) )
72
- return ulp_memory > 0 and ulp_enabled != 0
77
+ ulp_enabled = is_set ( "CONFIG_ULP_COPROC_ENABLED" , sdk_params )
78
+ return ulp_memory > 0 and ulp_enabled
73
79
74
80
75
81
def is_arduino_enabled (sdk_params ):
76
- arduino_enabled = int ( sdk_params . get ( "CONFIG_ENABLE_ARDUINO_DEPENDS" , 0 ) )
77
- return arduino_enabled > 0
82
+ arduino_enabled = is_set ( "CONFIG_ENABLE_ARDUINO_DEPENDS" , sdk_params )
83
+ return arduino_enabled
78
84
79
85
80
86
def parse_mk (path ):
@@ -174,12 +180,6 @@ def get_sdk_configuration(config_path):
174
180
return config
175
181
176
182
177
- def is_set (parameter , configuration ):
178
- if int (configuration .get (parameter , 0 )):
179
- return True
180
- return False
181
-
182
-
183
183
def find_valid_config_file ():
184
184
search_path = join (
185
185
platform .get_dir (), "examples" , "*" , "src" , "sdkconfig.h" )
@@ -208,7 +208,7 @@ def build_lwip_lib(sdk_params):
208
208
]
209
209
210
210
# PPP support can be enabled in sdkconfig.h
211
- if int ( sdk_params . get ( "CONFIG_PPP_SUPPORT" , 0 ) ):
211
+ if is_set ( "CONFIG_PPP_SUPPORT" , sdk_params ):
212
212
src_dirs .extend (
213
213
["lwip/src/netif/ppp" , "lwip/src/netif/ppp/polarssl" ])
214
214
@@ -302,9 +302,9 @@ def build_wpa_supplicant_lib():
302
302
join (FRAMEWORK_DIR , "components" , "wpa_supplicant" ), config )
303
303
304
304
305
- def build_heap_lib (params ):
305
+ def build_heap_lib (sdk_params ):
306
306
src_filter = "+<*> -<test*>"
307
- if int ( sdk_params . get ( "CONFIG_HEAP_POISONING_DISABLED" , 0 )) != 0 :
307
+ if is_set ( "CONFIG_HEAP_POISONING_DISABLED" , sdk_params ) :
308
308
src_filter += " -<multi_heap_poisoning.c>"
309
309
310
310
return build_component (
@@ -427,15 +427,13 @@ def configure_exceptions(sdk_params):
427
427
# directly in sdkconfig.h
428
428
cppdefines = env .Flatten (env .get ("CPPDEFINES" , []))
429
429
pio_exceptions = "PIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS" in cppdefines
430
- config_exceptions = int ( sdk_params . get ( "CONFIG_CXX_EXCEPTIONS" , 0 )) != 0
430
+ config_exceptions = is_set ( "CONFIG_CXX_EXCEPTIONS" , sdk_params )
431
431
432
432
if pio_exceptions or config_exceptions :
433
433
# remove unnecessary flag defined in main.py that disables exceptions
434
434
try :
435
- index = env ['CXXFLAGS' ].index ("-fno-exceptions" )
436
- if index > 0 :
437
- env ['CXXFLAGS' ].remove ("-fno-exceptions" )
438
- except IndexError :
435
+ env ['CXXFLAGS' ].remove ("-fno-exceptions" )
436
+ except ValueError :
439
437
pass
440
438
441
439
env .Append (CXXFLAGS = ["-fexceptions" ])
0 commit comments