Compile each stdlib module independently and return (name, object) pairs. No source concatenation: each HLL file becomes its own object.
(mode: TargetMode)
| 436 | } |
| 437 | |
| 438 | print!("{}", live.uart_log); |
| 439 | match live.state { |
| 440 | MachineState::Exited(code) => { |
| 441 | eprintln!("fsc: kernel exited with code {code}"); |
| 442 | Ok(ExitCode::from((code & 0xFF) as u8)) |
| 443 | } |
| 444 | MachineState::Faulted(msg) => Err(CliError::Assemble(format!("kernel faulted: {msg}"))), |
| 445 | MachineState::Stopped | MachineState::Paused => Ok(ExitCode::SUCCESS), |
| 446 | MachineState::Running => Err(CliError::Timeout(max_steps)), |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | fn config_for_cli_input(input: &str, mode: TargetMode) -> Result<(NativeFs, RunConfig), CliError> { |
| 451 | let (fs, path) = cli_workspace_for_input(input)?; |
| 452 | let config = if has_extension(input, "build") { |
| 453 | run_config_from_manifest(&fs, path).map_err(CliError::Io)? |
| 454 | } else { |
| 455 | let kind = match mode { |
| 456 | TargetMode::Hosted => RunKind::Hosted, |
| 457 | TargetMode::Freestanding => RunKind::Freestanding, |
| 458 | TargetMode::Kernel => RunKind::KernelBoot, |
| 459 | }; |
| 460 | let mut config = RunConfig::hosted(source_stem(input, "program"), VPath::root()); |
| 461 | config.kind = kind; |