|
29 | 29 | # io and collections are MP modules that fit this bill |
30 | 30 | MPCONFIG_FLAGS = ["ulab", "nvm", "displayio", "warnings", "alarm"] |
31 | 31 |
|
32 | | -ALLOW_FLAGS = { |
| 32 | +ALLOW_MODULE_FLAGS = { |
33 | 33 | pathlib.Path("main.c"): ["atexit", "board", "bleio", "canio", "collections", "cyw43", "digitalio", "epaperdisplay", "io", "keypad", "memorymonitor", "microcontroller", "socketpool", "usb_hid", "watchdog", "wifi"], |
34 | 34 | "supervisor/shared/usb/usb_desc.c": ["usb_midi", "usb_hid"], |
35 | 35 | "supervisor/shared/micropython.c": ["atexit", "watchdog"] |
36 | 36 | } |
37 | 37 |
|
| 38 | +ALLOW_FEATURE_FLAGS = { |
| 39 | + pathlib.Path("main.c"): ["debug", "bleio_hci", "safemode_py", "status_bar", "os_getenv", "usb_keyboard_workflow", "lto", "translate_object", "ssl_mbedtls", "opt_map_lookup_cache"], |
| 40 | +} |
| 41 | + |
| 42 | +ALLOW_MICROPYTHON_FLAGS = { |
| 43 | + pathlib.Path("main.c"): ["py_async_await"], |
| 44 | +} |
| 45 | + |
38 | 46 | # compile_circuitpython = hancho.Rule( |
39 | 47 | # desc="Compile {source_files} -> {build_files}", |
40 | 48 | # command="{compiler} -MMD -Wall -Werror -Wundef {cpu_flags} {module_flags} {circuitpython_flags} {port_flags} -c {source_files} -o {build_files}", |
@@ -167,7 +175,6 @@ async def board( |
167 | 175 |
|
168 | 176 | supervisor_source = [ |
169 | 177 | "main.c", |
170 | | - "lib/tlsf/tlsf.c", |
171 | 178 | f"ports/{port_id}/supervisor/port.c", |
172 | 179 | "supervisor/stub/misc.c", |
173 | 180 | ] |
@@ -232,14 +239,22 @@ async def board( |
232 | 239 | async with asyncio.TaskGroup() as tg: |
233 | 240 | extra_source_flags = {} |
234 | 241 | for source_file in source_files: |
235 | | - if source_file in ALLOW_FLAGS: |
236 | | - extra_flags = [] |
237 | | - for module_name in ALLOW_FLAGS[source_file]: |
| 242 | + extra_flags = [] |
| 243 | + if source_file in ALLOW_MODULE_FLAGS: |
| 244 | + for module_name in ALLOW_MODULE_FLAGS[source_file]: |
238 | 245 | name_upper = module_name.upper() |
239 | 246 | extra_flags.append(f"-DCIRCUITPY_{name_upper}={1 if kwargs.get(module_name, False) else 0}") |
240 | | - |
241 | | - extra_source_flags[source_file] = extra_flags |
| 247 | + if source_file in ALLOW_FEATURE_FLAGS: |
| 248 | + for module_name in ALLOW_FEATURE_FLAGS[source_file]: |
| 249 | + name_upper = module_name.upper() |
| 250 | + extra_flags.append(f"-DCIRCUITPY_{name_upper}={1 if kwargs.get(module_name, False) else 0}") |
| 251 | + if source_file in ALLOW_MICROPYTHON_FLAGS: |
| 252 | + for module_name in ALLOW_MICROPYTHON_FLAGS[source_file]: |
| 253 | + name_upper = module_name.upper() |
| 254 | + extra_flags.append(f"-DMICROPY_{name_upper}={1 if kwargs.get(module_name, False) else 0}") |
| 255 | + if extra_flags: |
242 | 256 | print(extra_flags) |
| 257 | + extra_source_flags[source_file] = extra_flags |
243 | 258 | tg.create_task( |
244 | 259 | preprocess_and_split_defs(compiler, top / source_file, build_path / board_id, [qstr_flags, *circuitpython_flags, *port_flags, *extra_source_flags.get(source_file, [])]), |
245 | 260 | name=f"Split defs {source_file}", |
|
0 commit comments