Compare commits

..

No commits in common. "57efbf0cec6d417cc818cdb5a6b21f53ced03755" and "26c8164837fb5ae04320b8d1c7d5a161f11d83d9" have entirely different histories.

4 changed files with 12 additions and 26 deletions

View File

@ -12,7 +12,5 @@ lto = false
[profile.release]
panic = "abort"
debug = true
# Link-Time Optimization:
# turned off for producing unusable debug symbols.
lto = false
lto = true # Link-Time Optimization
opt-level = 'z' # Optimize for size.

View File

@ -8,7 +8,7 @@ macro_rules! def_reg_r {
impl RegisterR for $name {
type R = $type;
#[inline]
#[inline(always)]
fn read(&self) -> Self::R {
let mut value: u32;
unsafe { asm!($asm_instr : "=r" (value) ::: "volatile") }
@ -23,13 +23,12 @@ macro_rules! def_reg_w {
impl RegisterW for $name {
type W = $type;
#[inline]
#[inline(always)]
fn write(&mut self, value: Self::W) {
let value: u32 = value.into();
unsafe { asm!($asm_instr :: "r" (value) :: "volatile") }
}
#[inline]
fn zeroed() -> Self::W {
0u32.into()
}
@ -44,7 +43,6 @@ macro_rules! wrap_reg {
pub inner: u32,
}
impl From<u32> for Read {
#[inline]
fn from(value: u32) -> Self {
Read { inner: value }
}
@ -54,13 +52,11 @@ macro_rules! wrap_reg {
pub inner: u32,
}
impl From<u32> for Write {
#[inline]
fn from(value: u32) -> Self {
Write { inner: value }
}
}
impl Into<u32> for Write {
#[inline]
fn into(self) -> u32 {
self.inner
}
@ -137,7 +133,6 @@ register_bit!(actlr, l1_prefetch_enable, 2);
register_bit!(actlr, fw, 0);
impl RegisterRW for ACTLR {
#[inline]
fn modify<F: FnOnce(Self::R, Self::W) -> Self::W>(&mut self, f: F) {
let r = self.read();
let w = actlr::Write { inner: r.inner };

View File

@ -55,7 +55,6 @@ macro_rules! register_r {
impl libregister::RegisterR for $struct_name {
type R = $mod_name::Read;
#[inline]
fn read(&self) -> Self::R {
let inner = self.inner.read();
$mod_name::Read { inner }
@ -70,12 +69,10 @@ macro_rules! register_w {
impl libregister::RegisterW for $struct_name {
type W = $mod_name::Write;
#[inline]
fn zeroed() -> $mod_name::Write {
$mod_name::Write { inner: 0 }
}
#[inline]
fn write(&mut self, w: Self::W) {
unsafe {
self.inner.write(w.inner);
@ -89,7 +86,6 @@ macro_rules! register_w {
macro_rules! register_rw {
($mod_name: ident, $struct_name: ident) => (
impl libregister::RegisterRW for $struct_name {
#[inline]
fn modify<F: FnOnce(Self::R, Self::W) -> Self::W>(&mut self, f: F) {
unsafe {
self.inner.modify(|inner| {
@ -109,7 +105,6 @@ macro_rules! register_vcell {
impl libregister::RegisterR for $struct_name {
type R = $mod_name::Read;
#[inline]
fn read(&self) -> Self::R {
let inner = self.inner.get();
$mod_name::Read { inner }
@ -118,18 +113,15 @@ macro_rules! register_vcell {
impl libregister::RegisterW for $struct_name {
type W = $mod_name::Write;
#[inline]
fn zeroed() -> $mod_name::Write {
$mod_name::Write { inner: 0 }
}
#[inline]
fn write(&mut self, w: Self::W) {
self.inner.set(w.inner);
}
}
impl libregister::RegisterRW for $struct_name {
#[inline]
fn modify<F: FnOnce(Self::R, Self::W) -> Self::W>(&mut self, f: F) {
let r = self.read();
let w = $mod_name::Write { inner: r.inner };
@ -177,7 +169,6 @@ macro_rules! register_bit {
$(#[$outer])*
impl $mod_name::Read {
#[allow(unused)]
#[inline]
pub fn $name(&self) -> bool {
use bit_field::BitField;
@ -188,7 +179,6 @@ macro_rules! register_bit {
$(#[$outer])*
impl $mod_name::Write {
#[allow(unused)]
#[inline]
pub fn $name(mut self, value: bool) -> Self {
use bit_field::BitField;
@ -205,7 +195,6 @@ macro_rules! register_bits {
($mod_name: ident, $(#[$outer:meta])* $name: ident, $type: ty, $bit_begin: expr, $bit_end: expr) => (
impl $mod_name::Read {
#[allow(unused)]
#[inline]
$(#[$outer])*
pub fn $name(&self) -> $type {
use bit_field::BitField;
@ -218,7 +207,6 @@ macro_rules! register_bits {
$(#[$outer])*
impl $mod_name::Write {
#[allow(unused)]
#[inline]
pub fn $name(mut self, value: $type) -> Self {
use bit_field::BitField;
@ -238,7 +226,6 @@ macro_rules! register_bits_typed {
($mod_name: ident, $(#[$outer:meta])* $name: ident, $bit_type: ty, $type: ty, $bit_begin: expr, $bit_end: expr) => (
impl $mod_name::Read {
#[allow(unused)]
#[inline]
$(#[$outer])*
pub fn $name(&self) -> $type {
use bit_field::BitField;
@ -250,7 +237,6 @@ macro_rules! register_bits_typed {
impl $mod_name::Write {
#[allow(unused)]
#[inline]
$(#[$outer])*
pub fn $name(mut self, value: $type) -> Self {
use bit_field::BitField;
@ -268,7 +254,6 @@ macro_rules! register_at {
($name: ident, $addr: expr, $ctor: ident) => (
impl $name {
#[allow(unused)]
#[inline]
pub fn $ctor() -> &'static mut Self {
let addr = $addr as *mut Self;
unsafe { &mut *addr }

10
link.x
View File

@ -21,9 +21,17 @@ MEMORY
SECTIONS
{
.text :
.exceptions ORIGIN(OCM) :
{
KEEP(*(.text.exceptions));
} > OCM
.__fill (NOLOAD) : {
. = ORIGIN(OCM) + 0x8000;
} > OCM
.text (ORIGIN(OCM) + 0x8000) :
{
*(.text.boot);
*(.text .text.*);
} > OCM