Create a platform-specific dummy object file. Args: as_path (Path): Path to the assembler executable. dummy_obj_path (Path): Path to the dummy object file to be created. platform (str): Target platform.
(as_path: Path, dummy_obj_path: Path, platform: str)
| 246 | |
| 247 | |
| 248 | def _create_platform_object_file(as_path: Path, dummy_obj_path: Path, platform: str): |
| 249 | """ |
| 250 | Create a platform-specific dummy object file. |
| 251 | |
| 252 | Args: |
| 253 | as_path (Path): Path to the assembler executable. |
| 254 | dummy_obj_path (Path): Path to the dummy object file to be created. |
| 255 | platform (str): Target platform. |
| 256 | """ |
| 257 | print(f"Creating {platform} dummy object file...") |
| 258 | |
| 259 | if platform == "esp32": |
| 260 | # ESP32/Xtensa assembly |
| 261 | assembly_code = """ |
| 262 | .section .text |
| 263 | .global _start |
| 264 | .type _start, @function |
| 265 | _start: |
| 266 | nop |
| 267 | j _start |
| 268 | """ |
| 269 | elif platform == "avr": |
| 270 | # AVR assembly |
| 271 | assembly_code = """ |
| 272 | .section .text |
| 273 | .global _start |
| 274 | _start: |
| 275 | nop |
| 276 | rjmp _start |
| 277 | """ |
| 278 | else: |
| 279 | # Generic assembly |
| 280 | assembly_code = """ |
| 281 | .section .text |
| 282 | .global _start |
| 283 | _start: |
| 284 | nop |
| 285 | """ |
| 286 | |
| 287 | asm_file = dummy_obj_path.with_suffix(".s") |
| 288 | asm_file.write_text(assembly_code) |
| 289 | |
| 290 | command = [str(as_path), "-o", str(dummy_obj_path), str(asm_file)] |
| 291 | print(f"Creating {platform} dummy object file: {dummy_obj_path}") |
| 292 | _run_command(command, show_output=True) |
| 293 | |
| 294 | # Clean up assembly file |
| 295 | if asm_file.exists(): |
| 296 | asm_file.unlink() |
| 297 | |
| 298 | |
| 299 | def _create_dummy_elf( |
no test coverage detected