Skip to content

Commit 12155ca

Browse files
authored
Merge pull request #25 from jannic-dev-forks/fix_glitches
Store vga code and font data in RAM, as flash is too slow
2 parents b804868 + ec2653a commit 12155ca

5 files changed

Lines changed: 8 additions & 2 deletions

File tree

memory.x

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ MEMORY {
2525
/*
2626
* This is the bottom of the four striped banks of SRAM in the RP2040.
2727
*/
28-
RAM_OS : ORIGIN = 0x20000000, LENGTH = 0x3C000
28+
RAM_OS : ORIGIN = 0x20000000, LENGTH = 0x3A000
2929
/*
3030
* This is the top of the four striped banks of SRAM in the RP2040.
3131
*/
32-
RAM : ORIGIN = 0x2003C000, LENGTH = 16K
32+
RAM : ORIGIN = 0x2003A000, LENGTH = 24K
3333
/*
3434
* This is the fifth bank, a 4KB block. We use this for Core 0 Stack.
3535
*/

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ extern "C" fn time_ticks_per_second() -> common::Ticks {
17761776
/// Called when DMA raises IRQ0; i.e. when a DMA transfer to the pixel FIFO or
17771777
/// the timing FIFO has completed.
17781778
#[interrupt]
1779+
#[link_section = ".data"]
17791780
fn DMA_IRQ_0() {
17801781
unsafe {
17811782
vga::irq();

src/vga/font16.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub static FONT: super::Font = super::Font {
3636
};
3737

3838
/// Our font data - arranged as 256 glyphs of 1 byte/row x 16 row/glyph.
39+
#[link_section = ".data"]
3940
static DATA: [u8; 256 * 16] = [
4041
// Char::Null
4142
0b0000_0000,

src/vga/font8.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub static FONT: super::Font = super::Font {
3838
};
3939

4040
/// Our font data - arranged as 256 glyphs of 1 byte/row x 8 row/glyph.
41+
#[link_section = ".data"]
4142
static DATA: [u8; 256 * 8] = [
4243
// Char::Null
4344
0b0000_0000,

src/vga/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ pub fn get_num_scan_lines() -> u16 {
693693
/// # Safety
694694
///
695695
/// Only run this function on Core 1.
696+
#[link_section = ".data"]
696697
unsafe extern "C" fn core1_main() -> u32 {
697698
CORE1_START_FLAG.store(true, Ordering::Relaxed);
698699

@@ -721,6 +722,7 @@ unsafe extern "C" fn core1_main() -> u32 {
721722
/// # Safety
722723
///
723724
/// Only call this from the DMA IRQ handler.
725+
#[link_section = ".data"]
724726
pub unsafe fn irq() {
725727
let dma: &mut super::pac::DMA = match DMA_PERIPH.as_mut() {
726728
Some(dma) => dma,
@@ -813,6 +815,7 @@ impl RenderEngine {
813815
}
814816
}
815817

818+
#[link_section = ".data"]
816819
pub fn poll(&mut self) {
817820
if DMA_READY.load(Ordering::Relaxed) {
818821
DMA_READY.store(false, Ordering::Relaxed);

0 commit comments

Comments
 (0)