diff --git a/src/satman/Cargo.toml b/src/satman/Cargo.toml index f4fdbd6..bc484f4 100644 --- a/src/satman/Cargo.toml +++ b/src/satman/Cargo.toml @@ -4,15 +4,10 @@ name = "satman" version = "0.0.0" build = "build.rs" -[lib] -name = "satman" -crate-type = ["staticlib"] -path = "main.rs" - [features] target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"] target_kasli_soc = ["libboard_zynq/target_kasli_soc", "libsupport_zynq/target_kasli_soc", "libconfig/target_kasli_soc"] -default = ["target_zc706"] +default = ["target_zc706", ] [build-dependencies] build_zynq = { path = "../libbuild_zynq" } diff --git a/src/satman/Makefile b/src/satman/Makefile deleted file mode 100644 index b96938d..0000000 --- a/src/satman/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../include/generated/variables.mak -include $(MISOC_DIRECTORY)/software/common.mak - -LDFLAGS += -L../libbase - -RUSTFLAGS += -Cpanic=abort - -all:: satman.bin satman.fbi - -.PHONY: $(RUSTOUT)/libsatman.a -$(RUSTOUT)/libsatman.a: - $(cargo) --manifest-path $(SATMAN_DIRECTORY)/Cargo.toml - -satman.elf: $(RUSTOUT)/libsatman.a - $(link) -T $(SATMAN_DIRECTORY)/satman.ld - -%.bin: %.elf - $(objcopy) -O binary - -%.fbi: %.bin - $(mscimg) -f diff --git a/src/satman/build.rs b/src/satman/build.rs index 3385371..04ead8d 100644 --- a/src/satman/build.rs +++ b/src/satman/build.rs @@ -8,14 +8,14 @@ extern crate build_zynq; fn main() { // Put the linker script somewhere the linker can find it let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); - File::create(out.join("satman.ld")) + File::create(out.join("link.x")) .unwrap() - .write_all(include_bytes!("satman.ld")) + .write_all(include_bytes!("link.x")) .unwrap(); println!("cargo:rustc-link-search={}", out.display()); // Only re-run the build script when link.x is changed, // instead of when any part of the source code changes. - println!("cargo:rerun-if-changed=satman.ld"); + println!("cargo:rerun-if-changed=link.x"); build_zynq::cfg(); } diff --git a/src/satman/link.x b/src/satman/link.x new file mode 100644 index 0000000..1f148a8 --- /dev/null +++ b/src/satman/link.x @@ -0,0 +1,86 @@ +ENTRY(Reset); + +MEMORY +{ + SDRAM : ORIGIN = 0x00100000, LENGTH = 0x1FF00000 +} + +SECTIONS +{ + __text_start = .; + .text : + { + KEEP(*(.text.exceptions)); + *(.text.boot); + *(.text .text.*); + } > SDRAM + __text_end = .; + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > SDRAM + __exidx_end = .; + + .ARM.extab : + { + * (.ARM.extab*) + } > SDRAM + + .rodata : ALIGN(4) + { + *(.rodata .rodata.*); + } > SDRAM + + .data : ALIGN(4) + { + *(.data .data.*); + } > SDRAM + + .bss (NOLOAD) : ALIGN(4) + { + __bss_start = .; + *(.bss .bss.*); + . = ALIGN(4); + __bss_end = .; + } > SDRAM + + .heap (NOLOAD) : ALIGN(8) + { + __heap0_start = .; + . += 0x8000000; + __heap0_end = .; + __heap1_start = .; + . += 0x8000000; + __heap1_end = .; + } > SDRAM + + .stack1 (NOLOAD) : ALIGN(8) + { + __stack1_end = .; + . += 0x1000000; + __stack1_start = .; + } > SDRAM + + .stack0 (NOLOAD) : ALIGN(8) + { + __stack0_end = .; + . += 0x20000; + __stack0_start = .; + } > SDRAM + + .irq_stack1 (NOLOAD) : ALIGN(8) + { + __irq_stack1_end = .; + . += 0x100; + __irq_stack1_start = .; + } > SDRAM + + .irq_stack0 (NOLOAD) : ALIGN(8) + { + __irq_stack0_end = .; + . += 0x100; + __irq_stack0_start = .; + } > SDRAM +} diff --git a/src/satman/jdac_common.rs b/src/satman/src/jdac_common.rs similarity index 100% rename from src/satman/jdac_common.rs rename to src/satman/src/jdac_common.rs diff --git a/src/satman/main.rs b/src/satman/src/main.rs similarity index 99% rename from src/satman/main.rs rename to src/satman/src/main.rs index d6c1b9e..9d3dda0 100644 --- a/src/satman/main.rs +++ b/src/satman/src/main.rs @@ -1,7 +1,7 @@ -#![feature(never_type, panic_info_message, const_slice_len, try_from, asm, naked_functions)] -#![feature(alloc_error_handler)] #![no_std] #![no_main] +#![feature(never_type, panic_info_message, asm, naked_functions)] +#![feature(alloc_error_handler)] #[macro_use] extern crate log; diff --git a/src/satman/repeater.rs b/src/satman/src/repeater.rs similarity index 100% rename from src/satman/repeater.rs rename to src/satman/src/repeater.rs