mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-23 23:19:20 +02:00
Get AP examples working on Mac OS too.
This commit is contained in:
parent
fc36e40eef
commit
fa56c70dcb
@ -12,6 +12,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
UNAME := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
TARGET = aarch64-linux-gnu
|
||||||
|
else
|
||||||
|
TARGET = aarch64-none-elf
|
||||||
|
endif
|
||||||
|
OBJCOPY = $(TARGET)-objcopy
|
||||||
|
|
||||||
.PHONY: build qemu qemu_logger qemu_minimal qemu_psci
|
.PHONY: build qemu qemu_logger qemu_minimal qemu_psci
|
||||||
|
|
||||||
all: minimal.bin improved.bin logger.bin
|
all: minimal.bin improved.bin logger.bin
|
||||||
@ -20,13 +28,13 @@ build:
|
|||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
improved.bin: build
|
improved.bin: build
|
||||||
aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/improved $@
|
$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/improved $@
|
||||||
logger.bin: build
|
logger.bin: build
|
||||||
aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/logger $@
|
$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/logger $@
|
||||||
minimal.bin: build
|
minimal.bin: build
|
||||||
aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/minimal $@
|
$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/minimal $@
|
||||||
psci.bin: build
|
psci.bin: build
|
||||||
aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/psci $@
|
$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/psci $@
|
||||||
|
|
||||||
qemu: improved.bin
|
qemu: improved.bin
|
||||||
qemu-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s
|
qemu-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s
|
||||||
|
@ -16,7 +16,11 @@ use cc::Build;
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
|
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
||||||
|
|
||||||
Build::new()
|
Build::new()
|
||||||
.file("entry.S")
|
.file("entry.S")
|
||||||
.file("exceptions.S")
|
.file("exceptions.S")
|
||||||
|
@ -12,6 +12,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
UNAME := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
TARGET = aarch64-linux-gnu
|
||||||
|
else
|
||||||
|
TARGET = aarch64-none-elf
|
||||||
|
endif
|
||||||
|
OBJCOPY = $(TARGET)-objcopy
|
||||||
|
|
||||||
.PHONY: build qemu_minimal qemu qemu_logger
|
.PHONY: build qemu_minimal qemu qemu_logger
|
||||||
|
|
||||||
all: rtc.bin
|
all: rtc.bin
|
||||||
@ -20,7 +28,7 @@ build:
|
|||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
rtc.bin: build
|
rtc.bin: build
|
||||||
aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/rtc $@
|
$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/rtc $@
|
||||||
|
|
||||||
qemu: rtc.bin
|
qemu: rtc.bin
|
||||||
qemu-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s
|
qemu-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s
|
||||||
|
@ -16,7 +16,11 @@ use cc::Build;
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
|
env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
||||||
|
|
||||||
Build::new()
|
Build::new()
|
||||||
.file("entry.S")
|
.file("entry.S")
|
||||||
.file("exceptions.S")
|
.file("exceptions.S")
|
||||||
|
@ -39,6 +39,7 @@ On MacOS:
|
|||||||
```bash
|
```bash
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
brew install gdb picocom qemu
|
brew install gdb picocom qemu
|
||||||
|
brew install --cask gcc-aarch64-embedded
|
||||||
rustup update
|
rustup update
|
||||||
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
rustup target add aarch64-unknown-none thumbv7em-none-eabihf
|
||||||
cargo install cargo-binutils cargo-embed
|
cargo install cargo-binutils cargo-embed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user