@@ -1009,25 +1009,26 @@ def find_esp32_ports(chip):
1009
1009
1010
1010
1011
1011
def update_mpthreadport ():
1012
- data = read_file ('esp32' , MPTHREADPORT_PATH )
1013
-
1014
- if '_CORE_ID' not in data :
1015
- data = data .replace ('MP_TASK_COREID' , '_CORE_ID' )
1016
-
1017
- new_data = [
1018
- '#if MICROPY_PY_THREAD' ,
1019
- '' ,
1020
- '#if (MP_USE_DUAL_CORE && !CONFIG_FREERTOS_UNICORE)' ,
1021
- ' #define _CORE_ID tskNO_AFFINITY' ,
1022
- '#else' ,
1023
- ' #define _CORE_ID MP_TASK_COREID' ,
1024
- '#endif' ,
1025
- ''
1026
- ]
1027
-
1028
- data = data .replace ('#if MICROPY_PY_THREAD' , '\n ' .join (new_data ), 1 )
1029
-
1030
- write_file (MPTHREADPORT_PATH , data )
1012
+ # data = read_file('esp32', MPTHREADPORT_PATH)
1013
+ #
1014
+ # if '_CORE_ID' not in data:
1015
+ # data = data.replace('MP_TASK_COREID', '_CORE_ID')
1016
+ #
1017
+ # new_data = [
1018
+ # '#if MICROPY_PY_THREAD',
1019
+ # '',
1020
+ # '#if (MP_USE_DUAL_CORE && !CONFIG_FREERTOS_UNICORE)',
1021
+ # ' #define _CORE_ID tskNO_AFFINITY',
1022
+ # '#else',
1023
+ # ' #define _CORE_ID MP_TASK_COREID',
1024
+ # '#endif',
1025
+ # ''
1026
+ # ]
1027
+ #
1028
+ # data = data.replace('#if MICROPY_PY_THREAD', '\n'.join(new_data), 1)
1029
+ #
1030
+ # write_file(MPTHREADPORT_PATH, data)
1031
+ pass
1031
1032
1032
1033
1033
1034
def update_panic_handler ():
@@ -1067,17 +1068,20 @@ def update_mpconfigport():
1067
1068
data = read_file ('esp32' , MPCONFIGPORT_PATH )
1068
1069
1069
1070
if custom_board_path is None :
1071
+
1072
+ # doesn't work
1070
1073
repl_data = [
1071
- '#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES' ,
1072
- '#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)' ,
1073
- '#endif' ,
1074
- '' ,
1074
+ # '#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES',
1075
+ # '#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)',
1076
+ # '#endif',
1077
+ # '',
1075
1078
'#ifdef MICROPY_HW_UART_REPL_BAUD' ,
1076
1079
'#undef MICROPY_HW_UART_REPL_BAUD' ,
1077
1080
'#endif' ,
1078
1081
f'#define MICROPY_HW_UART_REPL_BAUD ({ uart_repl_bitrate } )'
1079
1082
]
1080
1083
1084
+ # doesn't work
1081
1085
if enable_uart_repl is not None :
1082
1086
repl_data .extend ([
1083
1087
'#ifdef MICROPY_HW_ENABLE_UART_REPL' ,
@@ -1086,21 +1090,26 @@ def update_mpconfigport():
1086
1090
f'#define MICROPY_HW_ENABLE_UART_REPL ({ int (enable_uart_repl .lower () == "y" )} )'
1087
1091
])
1088
1092
1093
+ # doesn't work
1089
1094
if enable_cdc_repl is not None :
1090
1095
repl_data .extend ([
1091
1096
'#ifdef MICROPY_HW_ENABLE_USBDEV' ,
1092
1097
'#undef MICROPY_HW_ENABLE_USBDEV' ,
1093
1098
'#endif' ,
1094
1099
f'#define MICROPY_HW_ENABLE_USBDEV ({ int (enable_cdc_repl .lower () == "y" )} )'
1100
+ '' ,
1101
+ '#ifdef MICROPY_HW_USB_CDC' ,
1102
+ '#undef MICROPY_HW_USB_CDC' ,
1103
+ '#endif' ,
1104
+ '#define MICROPY_HW_USB_CDC (MICROPY_HW_ENABLE_USBDEV)'
1095
1105
])
1096
1106
1097
1107
if enable_jtag_repl is not None :
1098
1108
repl_data .extend ([
1099
1109
'#ifdef MICROPY_HW_ESP_USB_SERIAL_JTAG' ,
1100
1110
'#undef MICROPY_HW_ESP_USB_SERIAL_JTAG' ,
1101
1111
'#endif' ,
1102
- f'#define MICROPY_HW_ESP_USB_SERIAL_JTAG ({ int (enable_jtag_repl .lower () == "y" )} )' ,
1103
- '#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)'
1112
+ f'#define MICROPY_HW_ESP_USB_SERIAL_JTAG ({ int (enable_jtag_repl .lower () == "y" )} )'
1104
1113
])
1105
1114
1106
1115
repl_data .extend ([
@@ -1115,16 +1124,14 @@ def update_mpconfigport():
1115
1124
)
1116
1125
1117
1126
pattern = (
1118
- '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM && '
1119
- 'CONFIG_SPIRAM_CACHE_WORKAROUND)\n '
1127
+ '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM && CONFIG_SPIRAM_CACHE_WORKAROUND)\n '
1120
1128
'#define MICROPY_WRAP_MP_BINARY_OP(f) IRAM_ATTR f\n '
1121
1129
'#endif'
1122
1130
)
1123
1131
1124
1132
if pattern in data :
1125
1133
pattern = (
1126
- '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM '
1127
- '&& CONFIG_SPIRAM_CACHE_WORKAROUND)\n '
1134
+ '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM && CONFIG_SPIRAM_CACHE_WORKAROUND)\n '
1128
1135
)
1129
1136
data = data .replace (
1130
1137
'#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f\n ' ,
@@ -1146,93 +1153,95 @@ def update_mpconfigport():
1146
1153
'IRAM_ATTR f\n '
1147
1154
)
1148
1155
1149
- has_dual_core = 'MP_USE_DUAL_CORE' in data
1150
-
1151
- data = data .split ('\n ' )
1152
-
1153
- for i , line in enumerate (data ):
1154
- if has_dual_core and line .startswith ('#define MP_USE_DUAL_CORE' ):
1155
- data [i ] = (
1156
- '#define MP_USE_DUAL_CORE '
1157
- f'({ int (dual_core_threads )} )'
1158
- )
1159
- continue
1160
-
1161
- if line .startswith ('#define MICROPY_PY_THREAD_GIL' ):
1162
- data [i ] = (
1163
- f'#define MICROPY_PY_THREAD_GIL '
1164
- f'({ int (not dual_core_threads )} )'
1165
- )
1166
- if not has_dual_core :
1167
- data [i ] += (
1168
- '\n #define MP_USE_DUAL_CORE '
1169
- f'({ int (dual_core_threads )} )'
1170
- )
1171
- continue
1172
-
1173
- if line .startswith ('#define MICROPY_TASK_STACK_SIZE' ):
1174
- data [i ] = (
1175
- f'#define MICROPY_TASK_STACK_SIZE ({ task_stack_size } )'
1176
- )
1177
- continue
1156
+ # has_dual_core = 'MP_USE_DUAL_CORE' in data
1157
+ #
1158
+ # data = data.split('\n')
1159
+ #
1160
+ # for i, line in enumerate(data):
1161
+ # if has_dual_core and line.startswith('#define MP_USE_DUAL_CORE'):
1162
+ # data[i] = (
1163
+ # '#define MP_USE_DUAL_CORE '
1164
+ # f'({int(dual_core_threads)})'
1165
+ # )
1166
+ # continue
1167
+ #
1168
+ # if line.startswith('#define MICROPY_PY_THREAD_GIL'):
1169
+ # data[i] = (
1170
+ # f'#define MICROPY_PY_THREAD_GIL '
1171
+ # f'({int(not dual_core_threads)})'
1172
+ # )
1173
+ # if not has_dual_core:
1174
+ # data[i] += (
1175
+ # '\n#define MP_USE_DUAL_CORE '
1176
+ # f'({int(dual_core_threads)})'
1177
+ # )
1178
+ # continue
1179
+ #
1180
+ # if line.startswith('#define MICROPY_TASK_STACK_SIZE'):
1181
+ # data[i] = (
1182
+ # f'#define MICROPY_TASK_STACK_SIZE ({task_stack_size})'
1183
+ # )
1184
+ # continue
1178
1185
1179
1186
data = '\n ' .join (data )
1180
1187
1181
1188
write_file (MPCONFIGPORT_PATH , data )
1182
1189
1183
1190
1184
1191
def update_main ():
1185
- data = read_file ('esp32' , MAIN_PATH )
1186
-
1187
- rep_data = [
1188
- '#if SOC_LCD_I80_SUPPORTED' ,
1189
- '#include "../../../../ext_mod/lcd_bus/esp32_include/i80_bus.h"' ,
1190
- '#endif' ,
1191
- '' ,
1192
- '#if SOC_LCD_RGB_SUPPORTED' ,
1193
- '#include "../../../../ext_mod/lcd_bus/esp32_include/rgb_bus.h"' ,
1194
- '#endif' ,
1195
- '' ,
1196
- '#include "../../../../ext_mod/lcd_bus/esp32_include/spi_bus.h"' ,
1197
- '#include "../../../../ext_mod/lcd_bus/esp32_include/i2c_bus.h"' ,
1198
- '#include "../../../../ext_mod/spi3wire/include/spi3wire.h"' ,
1199
- '#include "../../../../micropy_updates/common/mp_spi_common.h"' ,
1200
- '' ,
1201
- '#if MICROPY_BLUETOOTH_NIMBLE'
1202
- ]
1203
-
1204
- data = data .replace (
1205
- '#if MICROPY_BLUETOOTH_NIMBLE' ,
1206
- '\n ' .join (rep_data ),
1207
- 1
1208
- )
1209
-
1210
- rep_data = [
1211
- 'soft_reset_exit:' ,
1212
- ' ' ,
1213
- '#if SOC_LCD_I80_SUPPORTED' ,
1214
- ' mp_lcd_i80_bus_deinit_all();' ,
1215
- '#endif' ,
1216
- ' ' ,
1217
- '#if SOC_LCD_RGB_SUPPORTED' ,
1218
- ' mp_lcd_rgb_bus_deinit_all();' ,
1219
- '#endif' ,
1220
- ' ' ,
1221
- ' mp_lcd_spi_bus_deinit_all();' ,
1222
- ' ' ,
1223
- ' mp_lcd_i2c_bus_deinit_all();' ,
1224
- ' ' ,
1225
- ' mp_spi3wire_deinit_all();' ,
1226
- ' ' ,
1227
- ' mp_machine_hw_spi_bus_deinit_all();'
1228
- ]
1229
-
1230
- data = data .replace (
1231
- 'soft_reset_exit:' ,
1232
- '\n ' .join (rep_data )
1233
- )
1234
-
1235
- write_file (MAIN_PATH , data )
1192
+ # data = read_file('esp32', MAIN_PATH)
1193
+
1194
+ # rep_data = [
1195
+ # '#if SOC_LCD_I80_SUPPORTED',
1196
+ # '#include "../../../../ext_mod/lcd_bus/esp32_include/i80_bus.h"',
1197
+ # '#endif',
1198
+ # '',
1199
+ # '#if SOC_LCD_RGB_SUPPORTED',
1200
+ # '#include "../../../../ext_mod/lcd_bus/esp32_include/rgb_bus.h"',
1201
+ # '#endif',
1202
+ # '',
1203
+ # '#include "../../../../ext_mod/lcd_bus/esp32_include/spi_bus.h"',
1204
+ # '#include "../../../../ext_mod/lcd_bus/esp32_include/i2c_bus.h"',
1205
+ # '#include "../../../../ext_mod/spi3wire/include/spi3wire.h"',
1206
+ # '#include "../../../../micropy_updates/common/mp_spi_common.h"',
1207
+ # '',
1208
+ # '#if MICROPY_BLUETOOTH_NIMBLE'
1209
+ # ]
1210
+
1211
+ # data = data.replace(
1212
+ # '#if MICROPY_BLUETOOTH_NIMBLE',
1213
+ # '\n'.join(rep_data),
1214
+ # 1
1215
+ # )
1216
+
1217
+ # rep_data = [
1218
+ # 'soft_reset_exit:',
1219
+ # ' ',
1220
+ # '#if SOC_LCD_I80_SUPPORTED',
1221
+ # ' mp_lcd_i80_bus_deinit_all();',
1222
+ # '#endif',
1223
+ # ' ',
1224
+ # '#if SOC_LCD_RGB_SUPPORTED',
1225
+ # ' mp_lcd_rgb_bus_deinit_all();',
1226
+ # '#endif',
1227
+ # ' ',
1228
+ # ' mp_lcd_spi_bus_deinit_all();',
1229
+ # ' ',
1230
+ # ' mp_lcd_i2c_bus_deinit_all();',
1231
+ # ' ',
1232
+ # ' mp_spi3wire_deinit_all();',
1233
+ # ' ',
1234
+ # ' mp_machine_hw_spi_bus_deinit_all();'
1235
+ # ]
1236
+
1237
+ # data = data.replace(
1238
+ # 'soft_reset_exit:',
1239
+ # '\n'.join(rep_data)
1240
+ # )
1241
+
1242
+ # write_file(MAIN_PATH, data)
1243
+
1244
+ pass
1236
1245
1237
1246
1238
1247
def build_sdkconfig (* args ):
@@ -1249,8 +1258,8 @@ def build_sdkconfig(*args):
1249
1258
'CONFIG_ESPTOOLPY_FLASHSIZE_32MB=n' ,
1250
1259
'CONFIG_ESPTOOLPY_FLASHSIZE_64MB=n' ,
1251
1260
'CONFIG_ESPTOOLPY_FLASHSIZE_128MB=n' ,
1252
- 'CONFIG_COMPILER_OPTIMIZATION_SIZE=n' ,
1253
- 'CONFIG_COMPILER_OPTIMIZATION_PERF=n' ,
1261
+ # 'CONFIG_COMPILER_OPTIMIZATION_SIZE=n',
1262
+ # 'CONFIG_COMPILER_OPTIMIZATION_PERF=n',
1254
1263
'CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y'
1255
1264
]
1256
1265
@@ -1315,8 +1324,8 @@ def build_sdkconfig(*args):
1315
1324
1316
1325
if optimize_size :
1317
1326
base_config .append ('CONFIG_COMPILER_OPTIMIZATION_SIZE=y' )
1318
- else :
1319
- base_config .append ('CONFIG_COMPILER_OPTIMIZATION_PERF=y' )
1327
+ # else:
1328
+ # base_config.append('CONFIG_COMPILER_OPTIMIZATION_PERF=y')
1320
1329
1321
1330
if oct_flash :
1322
1331
base_config .append ('CONFIG_ESPTOOLPY_OCT_FLASH=y' )
0 commit comments