|
13 | 13 | write_file, |
14 | 14 | copy_micropy_updates, |
15 | 15 | revert_files, |
16 | | - scrub_build_folder |
| 16 | + scrub_build_folder, |
| 17 | + MICROPY_LVGL_VER |
17 | 18 | ) |
18 | 19 |
|
19 | | -IDF_VER = '5.2.0' |
| 20 | +IDF_VER = '5.4.0' |
20 | 21 |
|
21 | 22 |
|
22 | 23 | def get_partition_file_name(otp): |
@@ -477,7 +478,6 @@ def esp32_s3_args(extra_args): |
477 | 478 | dest='oct_flash', |
478 | 479 | action='store_true' |
479 | 480 | ) |
480 | | - |
481 | 481 | esp_argParser.add_argument( |
482 | 482 | '--enable_fb_test', |
483 | 483 | dest='optimum_fb_size', |
@@ -997,50 +997,13 @@ def find_esp32_ports(chip): |
997 | 997 |
|
998 | 998 | SDKCONFIG_PATH = f'build/sdkconfig.board' |
999 | 999 |
|
1000 | | -MPTHREADPORT_PATH = 'lib/micropython/ports/esp32/mpthreadport.c' |
1001 | 1000 | MPCONFIGPORT_PATH = 'lib/micropython/ports/esp32/mpconfigport.h' |
1002 | | -PANICHANDLER_PATH = 'lib/micropython/ports/esp32/panichandler.c' |
1003 | 1001 | MPHALPORT_PATH = 'lib/micropython/ports/esp32/mphalport.c' |
1004 | | -MAIN_PATH = 'lib/micropython/ports/esp32/main.c' |
1005 | | - |
1006 | 1002 |
|
1007 | 1003 | if not os.path.exists('micropy_updates/originals/esp32'): |
1008 | 1004 | os.makedirs('micropy_updates/originals/esp32') |
1009 | 1005 |
|
1010 | 1006 |
|
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) |
1031 | | - |
1032 | | - |
1033 | | -def update_panic_handler(): |
1034 | | - data = read_file('esp32', PANICHANDLER_PATH) |
1035 | | - |
1036 | | - if '"MPY version : "' in data: |
1037 | | - beg, end = data.split('"MPY version : "', 1) |
1038 | | - end = end.split('"\\r\\n"', 1)[1] |
1039 | | - data = f'{beg}"LVGL MicroPython \\r\\n"{end}' |
1040 | | - |
1041 | | - write_file(PANICHANDLER_PATH, data) |
1042 | | - |
1043 | | - |
1044 | 1007 | def update_mpconfigboard(): |
1045 | 1008 | if custom_board_path is not None: |
1046 | 1009 | return |
@@ -1068,10 +1031,6 @@ def update_mpconfigport(): |
1068 | 1031 |
|
1069 | 1032 | if custom_board_path is None: |
1070 | 1033 | repl_data = [ |
1071 | | - '#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES', |
1072 | | - '#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)', |
1073 | | - '#endif', |
1074 | | - '', |
1075 | 1034 | '#ifdef MICROPY_HW_UART_REPL_BAUD', |
1076 | 1035 | '#undef MICROPY_HW_UART_REPL_BAUD', |
1077 | 1036 | '#endif', |
@@ -1114,127 +1073,40 @@ def update_mpconfigport(): |
1114 | 1073 | 1 |
1115 | 1074 | ) |
1116 | 1075 |
|
1117 | | - pattern = ( |
1118 | | - '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM && ' |
1119 | | - 'CONFIG_SPIRAM_CACHE_WORKAROUND)\n' |
1120 | | - '#define MICROPY_WRAP_MP_BINARY_OP(f) IRAM_ATTR f\n' |
1121 | | - '#endif' |
| 1076 | + data = data.replace( |
| 1077 | + f'#define MP_USE_DUAL_CORE (1)', |
| 1078 | + f'#define MP_USE_DUAL_CORE ({int(dual_core_threads)})' |
1122 | 1079 | ) |
1123 | 1080 |
|
1124 | | - if pattern in data: |
1125 | | - pattern = ( |
1126 | | - '#if !(CONFIG_IDF_TARGET_ESP32 && CONFIG_SPIRAM ' |
1127 | | - '&& CONFIG_SPIRAM_CACHE_WORKAROUND)\n' |
1128 | | - ) |
1129 | | - data = data.replace( |
1130 | | - '#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f\n', |
1131 | | - '' |
1132 | | - ) |
1133 | | - data = data.replace( |
1134 | | - '#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) ' |
1135 | | - 'IRAM_ATTR f\n', |
1136 | | - '' |
1137 | | - ) |
1138 | | - data = data.replace( |
1139 | | - pattern, |
1140 | | - pattern + '#define MICROPY_WRAP_MP_SCHED_EXCEPTION(f) IRAM_ATTR f\n' |
1141 | | - ) |
| 1081 | + data = data.replace( |
| 1082 | + f'#define MP_USE_DUAL_CORE (0)', |
| 1083 | + f'#define MP_USE_DUAL_CORE ({int(dual_core_threads)})' |
| 1084 | + ) |
1142 | 1085 |
|
1143 | | - data = data.replace( |
1144 | | - pattern, |
1145 | | - pattern + '#define MICROPY_WRAP_MP_SCHED_KEYBOARD_INTERRUPT(f) ' |
1146 | | - 'IRAM_ATTR f\n' |
1147 | | - ) |
| 1086 | + data = data.replace( |
| 1087 | + '#define MICROPY_PY_THREAD_GIL (1)', |
| 1088 | + f'#define MICROPY_PY_THREAD_GIL ({int(not dual_core_threads)})' |
| 1089 | + ) |
1148 | 1090 |
|
1149 | | - has_dual_core = 'MP_USE_DUAL_CORE' in data |
| 1091 | + data = data.replace( |
| 1092 | + '#define MICROPY_PY_THREAD_GIL (0)', |
| 1093 | + f'#define MICROPY_PY_THREAD_GIL ({int(not dual_core_threads)})' |
| 1094 | + ) |
1150 | 1095 |
|
1151 | | - data = data.split('\n') |
| 1096 | + data = data.splitlines(keepends=False) |
1152 | 1097 |
|
1153 | 1098 | 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 | 1099 | if line.startswith('#define MICROPY_TASK_STACK_SIZE'): |
1174 | 1100 | data[i] = ( |
1175 | 1101 | f'#define MICROPY_TASK_STACK_SIZE ({task_stack_size})' |
1176 | 1102 | ) |
1177 | | - continue |
| 1103 | + break |
1178 | 1104 |
|
1179 | 1105 | data = '\n'.join(data) |
1180 | 1106 |
|
1181 | 1107 | write_file(MPCONFIGPORT_PATH, data) |
1182 | 1108 |
|
1183 | 1109 |
|
1184 | | -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) |
1236 | | - |
1237 | | - |
1238 | 1110 | def build_sdkconfig(*args): |
1239 | 1111 | if custom_board_path is not None: |
1240 | 1112 | return |
@@ -1367,14 +1239,10 @@ def compile(*args): # NOQA |
1367 | 1239 | partition = Partition(p_size) |
1368 | 1240 | partition.save() |
1369 | 1241 |
|
1370 | | - update_main() |
1371 | | - update_mpthreadport() |
1372 | | - update_panic_handler() |
| 1242 | + copy_micropy_updates('esp32') |
1373 | 1243 | update_mpconfigboard() |
1374 | 1244 | update_mpconfigport() |
1375 | 1245 |
|
1376 | | - copy_micropy_updates('esp32') |
1377 | | - |
1378 | 1246 | try: |
1379 | 1247 | cmd_ = compile_cmd[:] |
1380 | 1248 | cmd_.extend(list(args)) |
|
0 commit comments