Rearrange memory layout
Main RAM block is now in the core 0 4K section, so .data and .bss get
put there for everything. The main 256K chunk is now dedicated to
application RAM.
MEMORY {
BOOT2 (r) : ORIGIN = 0x10000000, LENGTH = 0x100
FLASH (rx) : ORIGIN = 0x10000100, LENGTH = 1024K - 0x100
- RAM (rw) : ORIGIN = 0x20000000, LENGTH = 256K
- SRAM4 (rw) : ORIGIN = 0x20040000, LENGTH = 4K
- SRAM5 (rw) : ORIGIN = 0x20041000, LENGTH = 4K
+ ARAM (rw) : ORIGIN = 0x20000000, LENGTH = 256K
+ RAM (rw) : ORIGIN = 0x20040000, LENGTH = 4K
+ RAM2 (rw) : ORIGIN = 0x20041000, LENGTH = 4K
}
EXTERN(BOOT2_FIRMWARE)
} INSERT BEFORE .text;
SECTIONS {
- .appram : {
+ .appram (NOLOAD) : {
*(.appram);
. = ALIGN(4);
- } > RAM
+ } > ARAM
_appram = ADDR(.appram);
_appram_end = ADDR(.appram) + SIZEOF(.appram);
+} INSERT BEFORE .data;
- .kgram1 : {
- *(.kgram1);
- . = ALIGN(4);
- } > SRAM4 AT >FLASH
- __skgram1 = ADDR(.kgram1);
- __ekgram1 = ADDR(.kgram1) + SIZEOF(.kgram1);
- __lkgram1 = LOADADDR(.kgram1);
-
- .kgram2 : {
- *(.kgram2);
+SECTIONS {
+ .ram2 : {
+ *(.ram2);
. = ALIGN(4);
- } > SRAM5 AT >FLASH
- __skgram2 = ADDR(.kgram2);
- __ekgram2 = ADDR(.kgram2) + SIZEOF(.kgram2);
- __lkgram2 = LOADADDR(.kgram1);
+ } > RAM2 AT >FLASH
+ __sram2 = ADDR(.ram2);
+ __eram2 = ADDR(.ram2) + SIZEOF(.ram2);
+ __lram2 = LOADADDR(.ram2);
} INSERT AFTER .bss;
\ No newline at end of file
use crate::{capabilities::CapType, peripherals::with_usb, task::with_task_manager};
-#[link_section = ".kgram1"]
static CONSOLE: Mutex<RefCell<Console>> = Mutex::new(RefCell::new(Console::new()));
#[derive(Debug)]
use task::{init_tasks, with_task_manager};
use peripherals::init_peripherals;
-use r0;
-
-extern "C" {
- static mut __skgram1: u32;
- static mut __ekgram1: u32;
- static mut __lkgram1: u32;
-}
#[entry]
fn main() -> ! {
- unsafe {
- r0::init_data(&mut __skgram1, &mut __ekgram1, &mut __lkgram1);
- }
-
init_peripherals();
init_console();
init_tasks();
use crate::console::{write, ConsoleError};
-#[link_section = ".kgram1"]
static mut ALREADY_PANICKING: bool = false;
fn print_panic(info: &PanicInfo) -> Result<(), ConsoleError> {
const EXTERNAL_XTAL_FREQ_HZ: u32 = 12_000_000;
-#[link_section = ".kgram1"]
static PERIPHERALS: Mutex<RefCell<Option<Peripherals>>> = Mutex::new(RefCell::new(None));
type LedPin = gpio::Pin<gpio::bank0::Gpio7, gpio::Output<gpio::PushPull>>;
use usbd_human_interface_device::prelude::*;
use usbd_serial::SerialPort;
-#[link_section = ".kgram1"]
static mut USB_ALLOCATOR: Option<UsbBusAllocator<UsbBus>> = None;
-#[link_section = ".kgram1"]
static USB_MANAGER: Mutex<RefCell<Option<UsbManager>>> = Mutex::new(RefCell::new(None));
pub struct UsbManager<'a> {
use cortex_m_rt::exception;
use critical_section::Mutex;
-#[link_section = ".kgram1"]
static TIMER: Mutex<RefCell<Option<Timer>>> = Mutex::new(RefCell::new(None));
pub type Ticks = u32;