1
0
Fork 0

experiments: use OCM instead of OCM3 (#54)

This commit is contained in:
pca006132 2020-07-28 11:39:46 +08:00
parent b099c56569
commit c50e72f91e
2 changed files with 23 additions and 22 deletions

View File

@ -32,19 +32,19 @@ SECTIONS
*(.bss .bss.*); *(.bss .bss.*);
. = ALIGN(4); . = ALIGN(4);
__bss_end = .; __bss_end = .;
} > OCM3 } > OCM
.stack1 (NOLOAD) : ALIGN(8) { .stack1 (NOLOAD) : ALIGN(8) {
__stack1_end = .; __stack1_end = .;
. += 0x200; . += 0x200;
__stack1_start = .; __stack1_start = .;
} > OCM3 } > OCM
.stack0 (NOLOAD) : ALIGN(8) { .stack0 (NOLOAD) : ALIGN(8) {
__stack0_end = .; __stack0_end = .;
. = ORIGIN(OCM3) + LENGTH(OCM3) - 8; . = ORIGIN(OCM) + LENGTH(OCM) - 8;
__stack0_start = .; __stack0_start = .;
} > OCM3 } > OCM
/DISCARD/ : /DISCARD/ :
{ {

View File

@ -83,24 +83,25 @@ pub fn main_core0() {
clocks.cpu_1x() clocks.cpu_1x()
); );
let sd = libboard_zynq::sdio::SDIO::sdio0(true); // commented out due to OCM full
// only test SD card if it is inserted // let sd = libboard_zynq::sdio::SDIO::sdio0(true);
if sd.is_card_inserted() { // // only test SD card if it is inserted
let result = SdCard::from_sdio(sd); // if sd.is_card_inserted() {
match &result { // let result = SdCard::from_sdio(sd);
Ok(_) => info!("OK!"), // match &result {
Err(a) => info!("{}", a), // Ok(_) => info!("OK!"),
}; // Err(a) => info!("{}", a),
const SIZE: usize = 512 * 2 + 1; // };
let mut sd_card = result.unwrap(); // const SIZE: usize = 512 * 2 + 1;
if false { // let mut sd_card = result.unwrap();
let buffer: [u8; SIZE] = [5; SIZE]; // if false {
sd_card.write_block(0x0, 2, &buffer).unwrap(); // let buffer: [u8; SIZE] = [5; SIZE];
} // sd_card.write_block(0x0, 2, &buffer).unwrap();
let mut buffer: [u8; SIZE] = [0; SIZE]; // }
sd_card.read_block(0 /*0x1*/, 2, &mut buffer[1..]).unwrap(); // let mut buffer: [u8; SIZE] = [0; SIZE];
info!("buffer = {:?}", &buffer[..]); // sd_card.read_block(0 /*0x1*/, 2, &mut buffer[1..]).unwrap();
} // info!("buffer = {:?}", &buffer[..]);
// }
let mut flash = zynq::flash::Flash::new(200_000_000).linear_addressing_mode(); let mut flash = zynq::flash::Flash::new(200_000_000).linear_addressing_mode();
let flash_ram: &[u8] = unsafe { core::slice::from_raw_parts(flash.ptr(), flash.size()) }; let flash_ram: &[u8] = unsafe { core::slice::from_raw_parts(flash.ptr(), flash.size()) };