You've already forked comprehensive-rust
							
							
				mirror of
				https://github.com/google/comprehensive-rust.git
				synced 2025-10-31 08:37:45 +02:00 
			
		
		
		
	Get AP examples working on Mac OS too.
This commit is contained in:
		| @@ -12,6 +12,14 @@ | ||||
| # See the License for the specific language governing permissions and | ||||
| # 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 | ||||
|  | ||||
| all: minimal.bin improved.bin logger.bin | ||||
| @@ -20,13 +28,13 @@ build: | ||||
| 	cargo 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 | ||||
| 	aarch64-linux-gnu-objcopy -O binary target/aarch64-unknown-none/debug/logger $@ | ||||
| 	$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/logger $@ | ||||
| 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 | ||||
| 	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-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s | ||||
|   | ||||
| @@ -16,7 +16,11 @@ use cc::Build; | ||||
| use std::env; | ||||
|  | ||||
| fn main() { | ||||
|     #[cfg(target_os = "linux")] | ||||
|     env::set_var("CROSS_COMPILE", "aarch64-linux-gnu"); | ||||
|     #[cfg(not(target_os = "linux"))] | ||||
|     env::set_var("CROSS_COMPILE", "aarch64-none-elf"); | ||||
|  | ||||
|     Build::new() | ||||
|         .file("entry.S") | ||||
|         .file("exceptions.S") | ||||
|   | ||||
| @@ -12,6 +12,14 @@ | ||||
| # See the License for the specific language governing permissions and | ||||
| # 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 | ||||
|  | ||||
| all: rtc.bin | ||||
| @@ -20,7 +28,7 @@ build: | ||||
| 	cargo 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-system-aarch64 -machine virt -cpu max -serial mon:stdio -display none -kernel $< -s | ||||
|   | ||||
| @@ -16,7 +16,11 @@ use cc::Build; | ||||
| use std::env; | ||||
|  | ||||
| fn main() { | ||||
|     #[cfg(target_os = "linux")] | ||||
|     env::set_var("CROSS_COMPILE", "aarch64-linux-gnu"); | ||||
|     #[cfg(not(target_os = "linux"))] | ||||
|     env::set_var("CROSS_COMPILE", "aarch64-none-elf"); | ||||
|  | ||||
|     Build::new() | ||||
|         .file("entry.S") | ||||
|         .file("exceptions.S") | ||||
|   | ||||
| @@ -39,6 +39,7 @@ On MacOS: | ||||
| ```bash | ||||
| xcode-select --install | ||||
| brew install gdb picocom qemu | ||||
| brew install --cask gcc-aarch64-embedded | ||||
| rustup update | ||||
| rustup target add aarch64-unknown-none thumbv7em-none-eabihf | ||||
| cargo install cargo-binutils cargo-embed | ||||
|   | ||||
		Reference in New Issue
	
	Block a user