use fpu_enable from zc706

This commit is contained in:
Sebastien Bourdeauducq 2020-07-06 00:18:28 +08:00
parent de8da59e56
commit 3bd4643009
5 changed files with 14 additions and 35 deletions

View File

@ -15,7 +15,7 @@ let
version = "0.1.0"; version = "0.1.0";
src = ./src; src = ./src;
cargoSha256 = "0p7n0kng0l3cgvfb6lss2pnljawh2gy7j1kvd9k072zyaqqjm58l"; cargoSha256 = "04f45x75vb2ccn8h5pclng913747jx3qqv5d7fip5dhqw90nb8gn";
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.gnumake pkgs.gnumake

14
src/Cargo.lock generated
View File

@ -37,9 +37,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.54" version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -200,7 +200,7 @@ dependencies = [
[[package]] [[package]]
name = "libasync" name = "libasync"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#6195ad40c334a847cd01cd4adadf6b8f8d730908" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#90e33f688ab8de54173caca1e8d9a7357def5df8"
dependencies = [ dependencies = [
"embedded-hal", "embedded-hal",
"libcortex_a9", "libcortex_a9",
@ -212,7 +212,7 @@ dependencies = [
[[package]] [[package]]
name = "libboard_zynq" name = "libboard_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#6195ad40c334a847cd01cd4adadf6b8f8d730908" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#90e33f688ab8de54173caca1e8d9a7357def5df8"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"embedded-hal", "embedded-hal",
@ -236,7 +236,7 @@ dependencies = [
[[package]] [[package]]
name = "libcortex_a9" name = "libcortex_a9"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#6195ad40c334a847cd01cd4adadf6b8f8d730908" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#90e33f688ab8de54173caca1e8d9a7357def5df8"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"libregister", "libregister",
@ -245,7 +245,7 @@ dependencies = [
[[package]] [[package]]
name = "libregister" name = "libregister"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#6195ad40c334a847cd01cd4adadf6b8f8d730908" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#90e33f688ab8de54173caca1e8d9a7357def5df8"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"vcell", "vcell",
@ -255,7 +255,7 @@ dependencies = [
[[package]] [[package]]
name = "libsupport_zynq" name = "libsupport_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#6195ad40c334a847cd01cd4adadf6b8f8d730908" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#90e33f688ab8de54173caca1e8d9a7357def5df8"
dependencies = [ dependencies = [
"compiler_builtins", "compiler_builtins",
"libboard_zynq", "libboard_zynq",

View File

@ -3,7 +3,7 @@ use log::{debug, info, error};
use alloc::{vec::Vec, sync::Arc}; use alloc::{vec::Vec, sync::Arc};
use cslice::CSlice; use cslice::CSlice;
use libcortex_a9::{cache::dcci_slice, mutex::Mutex, sync_channel::{self, sync_channel}}; use libcortex_a9::{enable_fpu, cache::dcci_slice, mutex::Mutex, sync_channel::{self, sync_channel}};
use libsupport_zynq::boot::Core1; use libsupport_zynq::boot::Core1;
use dyld; use dyld;
@ -288,17 +288,7 @@ fn resolve(required: &[u8]) -> Option<u32> {
pub fn main_core1() { pub fn main_core1() {
debug!("Core1 started"); debug!("Core1 started");
unsafe { enable_fpu();
llvm_asm!("
mrc p15, 0, r1, c1, c0, 2
orr r1, r1, (0b1111<<20)
mcr p15, 0, r1, c1, c0, 2
vmrs r1, fpexc
orr r1, r1, (1<<30)
vmsr fpexc, r1
":::"r1");
}
debug!("FPU enabled on Core1"); debug!("FPU enabled on Core1");
let mut core1_tx = None; let mut core1_tx = None;

View File

@ -1,7 +1,6 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![recursion_limit="1024"] // for futures_util::select! #![recursion_limit="1024"] // for futures_util::select!
#![feature(llvm_asm)]
#![feature(alloc_error_handler)] #![feature(alloc_error_handler)]
#![feature(panic_info_message)] #![feature(panic_info_message)]

View File

@ -1,14 +1,13 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(llvm_asm)]
extern crate log; extern crate log;
use core::mem; use core::mem;
use log::{info, error}; use log::{debug, info, error};
use cstr_core::CStr; use cstr_core::CStr;
use libcortex_a9::cache::dcci_slice; use libcortex_a9::{enable_fpu, cache::dcci_slice};
use libboard_zynq::{ use libboard_zynq::{
self as zynq, clocks::Clocks, clocks::source::{ClockSource, ArmPll, IoPll}, self as zynq, clocks::Clocks, clocks::source::{ClockSource, ArmPll, IoPll},
logger, logger,
@ -37,18 +36,9 @@ pub fn main_core0() {
log::set_max_level(log::LevelFilter::Debug); log::set_max_level(log::LevelFilter::Debug);
info!("Simple Zynq Loader starting..."); info!("Simple Zynq Loader starting...");
unsafe { enable_fpu();
llvm_asm!(" debug!("FPU enabled on Core0");
mrc p15, 0, r1, c1, c0, 2
orr r1, r1, (0b1111<<20)
mcr p15, 0, r1, c1, c0, 2
vmrs r1, fpexc
orr r1, r1, (1<<30)
vmsr fpexc, r1
":::"r1");
}
info!("FPU enabled on Core0");
const CPU_FREQ: u32 = 800_000_000; const CPU_FREQ: u32 = 800_000_000;
ArmPll::setup(2 * CPU_FREQ); ArmPll::setup(2 * CPU_FREQ);