diff --git a/.github/workflows/m68k.yml b/.github/workflows/m68k.yml index b0866bafb8e..1923704360f 100644 --- a/.github/workflows/m68k.yml +++ b/.github/workflows/m68k.yml @@ -12,8 +12,6 @@ permissions: env: # Enable backtraces for easier debugging RUST_BACKTRACE: 1 - # TODO: remove when confish.sh is removed. - OVERWRITE_TARGET_TRIPLE: m68k-unknown-linux-gnu jobs: build: @@ -109,4 +107,13 @@ jobs: - name: Run tests run: | # TODO: remove --features master when it is back to the default. - ./y.sh test --release --features master --clean --build-sysroot ${{ matrix.commands }} + ./y.sh test --target-triple m68k-unknown-linux-gnu --release --features master --clean --build-sysroot ${{ matrix.commands }} + + - name: Run Hello World! + run: | + # TODO: remove --features master when it is back to the default. + ./y.sh build --target-triple m68k-unknown-linux-gnu --features master + + cd projects/hello_world + ../../y.sh cargo run --target m68k-unknown-linux-gnu > hello_world_stdout + test $(cat hello_world_stdout) == "Hello, world!" || exit 1 diff --git a/Readme.md b/Readme.md index 39ff41acf84..09e817ba9d9 100644 --- a/Readme.md +++ b/Readme.md @@ -324,13 +324,13 @@ generate it in [gimple.md](./doc/gimple.md). * Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case. * Set the path to the cross-compiling libgccjit in `gcc_path`. * Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu`. - * Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`. + * Build your project by specifying the target: `../y.sh cargo build --target m68k-unknown-linux-gnu`. If the target is not yet supported by the Rust compiler, create a [target specification file](https://docs.rust-embedded.org/embedonomicon/custom-target.html) (note that the `arch` specified in this file must be supported by the rust compiler). Then, you can use it the following way: * Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json` - * Build your project by specifying the target specification file: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`. + * Build your project by specifying the target specification file: `../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`. If you get the following error: diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 1824bdd292f..0b792d974dc 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -117,9 +117,13 @@ impl ConfigInfo { }; if self.target_triple.is_empty() { - if let Some(overwrite) = env.get("OVERWRITE_TARGET_TRIPLE") { - self.target_triple = overwrite.clone(); - } + // TODO: set target triple. + // TODO: why do we even need to set target_triple? + // It seems to only be needed for the linker (we could add an environment variable to + // remove this need) and the sysroot (perhaps we could find another way to find it). + // TODO TODO: seems like we would still need OVERWRITE_TARGET_TRIPLE when using a + // json spec file. + // ====> maybe not since we specify both --target and --target-triple. } if self.target_triple.is_empty() { self.target_triple = self.host_triple.clone(); diff --git a/projects/hello_world/Cargo.toml b/projects/hello_world/Cargo.toml new file mode 100644 index 00000000000..624cb0691ce --- /dev/null +++ b/projects/hello_world/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "hello_world" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/projects/hello_world/src/main.rs b/projects/hello_world/src/main.rs new file mode 100644 index 00000000000..e7a11a969c0 --- /dev/null +++ b/projects/hello_world/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}