Skip to content

Commit 03c24b4

Browse files
committed
dont inline as much
1 parent 2773707 commit 03c24b4

File tree

2 files changed

+320
-309
lines changed

2 files changed

+320
-309
lines changed

flc-asm/src/lib.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ macro_rules! never_exit {
5656
}
5757

5858
#[panic_handler]
59+
#[link_section = ".analogsucks"]
5960
fn panic_handler(_: &PanicInfo) -> ! {
6061
never_exit!()
6162
}
@@ -83,8 +84,8 @@ struct FlashController<'gcr, 'icc> {
8384

8485
/// Checks whether the given address range (exclusive) is within flash space, returning `false` if there
8586
/// is an error.
86-
#[inline(always)]
8787
#[must_use]
88+
#[link_section = ".analogsucks"]
8889
const fn check_address_bounds(address_range: core::ops::Range<u32>) -> bool {
8990
FLASH_MEM_BASE <= address_range.start
9091
&& address_range.start < FLASH_MEM_BASE + FLASH_MEM_SIZE
@@ -99,7 +100,7 @@ impl FlashController<'_, '_> {
99100
///
100101
/// # Safety
101102
/// - The FLC must be in its ready state after [`Self::wait_until_ready`]
102-
#[inline(always)]
103+
#[link_section = ".analogsucks"]
103104
unsafe fn unlock_write_protection(&self) {
104105
self.flc.ctrl().modify(|_, w| w.unlock().unlocked());
105106
}
@@ -110,7 +111,7 @@ impl FlashController<'_, '_> {
110111
///
111112
/// # Safety
112113
/// - The FLC must be in its ready state after [`Self::wait_until_ready`]
113-
#[inline(always)]
114+
#[link_section = ".analogsucks"]
114115
unsafe fn lock_write_protection(&self) {
115116
self.flc.ctrl().modify(|_, w| w.unlock().locked());
116117
}
@@ -129,7 +130,7 @@ impl FlashController<'_, '_> {
129130
/// - The passed argument `sys_clk_freq` must be the current system clock's
130131
/// frequency divided by its divider.
131132
/// - The FLC must be in its ready state after [`Self::wait_until_ready`]
132-
#[inline(always)]
133+
#[link_section = ".analogsucks"]
133134
unsafe fn set_clock_divisor(&self, sys_clk_freq: u32) {
134135
if sys_clk_freq % 1_000_000 != 0 {
135136
panic()
@@ -145,15 +146,15 @@ impl FlashController<'_, '_> {
145146
/// Wait, by busy-looping, until the FLC is ready.
146147
///
147148
/// This MUST be called BEFORE any FLC operation EXCEPT clearing interrupts.
148-
#[inline(always)]
149+
#[link_section = ".analogsucks"]
149150
fn wait_until_ready(&self) {
150151
while !self.flc.ctrl().read().pend().bit_is_clear() {}
151152
}
152153

153154
/// Clear any stale errors in the FLC interrupt register.
154155
///
155156
/// This can be called without waiting for the FLC to be ready.
156-
#[inline(always)]
157+
#[link_section = ".analogsucks"]
157158
fn clear_interrupts(&self) {
158159
self.flc.intr().modify(|_, w| w.af().clear_bit());
159160
}
@@ -167,7 +168,7 @@ impl FlashController<'_, '_> {
167168
///
168169
/// # Panics
169170
/// - If `sys_clk_freq` is not a multiple of 1 MHz, this function panics.
170-
#[inline(always)]
171+
#[link_section = ".analogsucks"]
171172
unsafe fn write_guard<F: Fn()>(&self, sys_clk_freq: u32, operation: F) {
172173
// Pre-write
173174
self.wait_until_ready();
@@ -201,7 +202,7 @@ impl FlashController<'_, '_> {
201202
/// Flushes the flash line buffer and arm instruction cache.
202203
///
203204
/// This MUST be called after any write/erase flash controller operations.
204-
#[inline(always)]
205+
#[link_section = ".analogsucks"]
205206
fn flush_icc(&self) {
206207
const PAGE1: u32 = FLASH_MEM_BASE;
207208
const PAGE2: u32 = FLASH_MEM_BASE + FLASH_PAGE_SIZE;
@@ -228,15 +229,15 @@ impl FlashController<'_, '_> {
228229
/// Disables instruction cache.
229230
///
230231
/// This MUST be called before any non-read flash controller operations.
231-
#[inline(always)]
232+
#[link_section = ".analogsucks"]
232233
fn disable_icc0(&self) {
233234
self.icc.ctrl().modify(|_, w| w.en().dis());
234235
}
235236

236237
/// Enables instruction cache.
237238
///
238239
/// This MUST be called after any non-read flash controller operations.
239-
#[inline(always)]
240+
#[link_section = ".analogsucks"]
240241
fn enable_icc0(&self) {
241242
// ensure the cache is invalidated when enabled
242243
self.disable_icc0();
@@ -272,7 +273,7 @@ impl FlashController<'_, '_> {
272273
/// - `sys_clk_freq` must be a multiple of 1 MHz
273274
/// - `address` must point to a word contained in flash space
274275
/// - `address` must be aligned to 128 bits
275-
#[inline(always)]
276+
#[link_section = ".analogsucks"]
276277
unsafe fn write128(&self, address: u32, data: &[u32; 4], sys_clk_freq: u32) {
277278
if !check_address_bounds(address..address + 16) {
278279
panic();
@@ -317,7 +318,7 @@ impl FlashController<'_, '_> {
317318
/// - If `sys_clk_freq` is not a multiple of 1 MHz, this function panics.
318319
/// - This function also panics when the `address` does not point inside of a page
319320
/// contained in flash space.
320-
#[inline(always)]
321+
#[link_section = ".analogsucks"]
321322
unsafe fn page_erase(&self, address: u32, sys_clk_freq: u32) {
322323
#[allow(
323324
clippy::range_plus_one,

0 commit comments

Comments
 (0)