mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
loader: remove unused imports
This commit is contained in:
parent
d4a85c7efa
commit
e7eb9ece2b
5 changed files with 203 additions and 210 deletions
380
loader/link.x
380
loader/link.x
|
|
@ -1,190 +1,190 @@
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH : ORIGIN = 0x20501000, LENGTH = 188k
|
FLASH : ORIGIN = 0x20501000, LENGTH = 188k
|
||||||
FONTS : ORIGIN = 0x20530000, LENGTH = 4352k
|
FONTS : ORIGIN = 0x20530000, LENGTH = 4352k
|
||||||
RAM : ORIGIN = 0x40000000, LENGTH = 16M
|
RAM : ORIGIN = 0x40000000, LENGTH = 16M
|
||||||
MEMLCD : ORIGIN = 0xB0000000, LENGTH = 32k
|
MEMLCD : ORIGIN = 0xB0000000, LENGTH = 32k
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Fonts go from 0x2053_0000 to 0x2097_0000
|
Fonts go from 0x2053_0000 to 0x2097_0000
|
||||||
*/
|
*/
|
||||||
|
|
||||||
REGION_ALIAS("REGION_TEXT", FLASH);
|
REGION_ALIAS("REGION_TEXT", FLASH);
|
||||||
REGION_ALIAS("REGION_RODATA", FLASH);
|
REGION_ALIAS("REGION_RODATA", FLASH);
|
||||||
REGION_ALIAS("REGION_DATA", RAM);
|
REGION_ALIAS("REGION_DATA", RAM);
|
||||||
REGION_ALIAS("REGION_BSS", RAM);
|
REGION_ALIAS("REGION_BSS", RAM);
|
||||||
REGION_ALIAS("REGION_STACK", RAM);
|
REGION_ALIAS("REGION_STACK", RAM);
|
||||||
REGION_ALIAS("REGION_HEAP", RAM);
|
REGION_ALIAS("REGION_HEAP", RAM);
|
||||||
|
|
||||||
_lcdfb = ORIGIN(MEMLCD);
|
_lcdfb = ORIGIN(MEMLCD);
|
||||||
/* Size of the main kernel stack */
|
/* Size of the main kernel stack */
|
||||||
_stack_size = 16K;
|
_stack_size = 16K;
|
||||||
_eheap = ORIGIN(RAM) + LENGTH(RAM);
|
_eheap = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
|
|
||||||
PROVIDE(_stext = ORIGIN(REGION_TEXT));
|
PROVIDE(_stext = ORIGIN(REGION_TEXT));
|
||||||
PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
|
PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
|
||||||
PROVIDE(_max_hart_id = 0);
|
PROVIDE(_max_hart_id = 0);
|
||||||
PROVIDE(_hart_stack_size = 2K);
|
PROVIDE(_hart_stack_size = 2K);
|
||||||
PROVIDE(_heap_size = 0);
|
PROVIDE(_heap_size = 0);
|
||||||
|
|
||||||
PROVIDE(trap_handler = default_trap_handler);
|
PROVIDE(trap_handler = default_trap_handler);
|
||||||
|
|
||||||
/* # Pre-initialization function */
|
/* # Pre-initialization function */
|
||||||
/* If the user overrides this using the `#[pre_init]` attribute or by creating a `__pre_init` function,
|
/* If the user overrides this using the `#[pre_init]` attribute or by creating a `__pre_init` function,
|
||||||
then the function this points to will be called before the RAM is initialized. */
|
then the function this points to will be called before the RAM is initialized. */
|
||||||
PROVIDE(__pre_init = default_pre_init);
|
PROVIDE(__pre_init = default_pre_init);
|
||||||
|
|
||||||
/* # Multi-processing hook function
|
/* # Multi-processing hook function
|
||||||
fn _mp_hook() -> bool;
|
fn _mp_hook() -> bool;
|
||||||
|
|
||||||
This function is called from all the harts and must return true only for one hart,
|
This function is called from all the harts and must return true only for one hart,
|
||||||
which will perform memory initialization. For other harts it must return false
|
which will perform memory initialization. For other harts it must return false
|
||||||
and implement wake-up in platform-dependent way (e.g. after waiting for a user interrupt).
|
and implement wake-up in platform-dependent way (e.g. after waiting for a user interrupt).
|
||||||
*/
|
*/
|
||||||
PROVIDE(_mp_hook = default_mp_hook);
|
PROVIDE(_mp_hook = default_mp_hook);
|
||||||
|
|
||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.text.dummy (NOLOAD) :
|
.text.dummy (NOLOAD) :
|
||||||
{
|
{
|
||||||
/* This section is intended to make _stext address work */
|
/* This section is intended to make _stext address work */
|
||||||
. = ABSOLUTE(_stext);
|
. = ABSOLUTE(_stext);
|
||||||
} > REGION_TEXT
|
} > REGION_TEXT
|
||||||
|
|
||||||
.text _stext :
|
.text _stext :
|
||||||
{
|
{
|
||||||
/* Put reset handler first in .text section so it ends up as the entry */
|
/* Put reset handler first in .text section so it ends up as the entry */
|
||||||
/* point of the program. */
|
/* point of the program. */
|
||||||
KEEP(*(.text.init));
|
KEEP(*(.text.init));
|
||||||
KEEP(*(.init));
|
KEEP(*(.init));
|
||||||
KEEP(*(.init.rust));
|
KEEP(*(.init.rust));
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
KEEP(*(.trap));
|
KEEP(*(.trap));
|
||||||
KEEP(*(.trap.rust));
|
KEEP(*(.trap.rust));
|
||||||
|
|
||||||
*(.text .text.*);
|
*(.text .text.*);
|
||||||
} > REGION_TEXT
|
} > REGION_TEXT
|
||||||
|
|
||||||
.rodata : ALIGN(4)
|
.rodata : ALIGN(4)
|
||||||
{
|
{
|
||||||
*(.rodata .rodata.*);
|
*(.rodata .rodata.*);
|
||||||
|
|
||||||
/* 4-byte align the end (VMA) of this section.
|
/* 4-byte align the end (VMA) of this section.
|
||||||
This is required by LLD to ensure the LMA of the following .data
|
This is required by LLD to ensure the LMA of the following .data
|
||||||
section will have the correct alignment. */
|
section will have the correct alignment. */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_etext = .;
|
_etext = .;
|
||||||
} > REGION_RODATA
|
} > REGION_RODATA
|
||||||
|
|
||||||
.data : ALIGN(4)
|
.data : ALIGN(4)
|
||||||
{
|
{
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
_sdata = .;
|
_sdata = .;
|
||||||
/* Must be called __global_pointer$ for linker relaxations to work. */
|
/* Must be called __global_pointer$ for linker relaxations to work. */
|
||||||
PROVIDE(__global_pointer$ = . + 0x800);
|
PROVIDE(__global_pointer$ = . + 0x800);
|
||||||
*(.sdata .sdata.* .sdata2 .sdata2.*);
|
*(.sdata .sdata.* .sdata2 .sdata2.*);
|
||||||
*(.data .data.*);
|
*(.data .data.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_edata = .;
|
_edata = .;
|
||||||
} > REGION_DATA AT > REGION_RODATA
|
} > REGION_DATA AT > REGION_RODATA
|
||||||
|
|
||||||
.fonts : ALIGN(65536)
|
.fonts : ALIGN(65536)
|
||||||
{
|
{
|
||||||
KEEP(*(.fontdata));
|
KEEP(*(.fontdata));
|
||||||
} > FONTS
|
} > FONTS
|
||||||
|
|
||||||
.bss (NOLOAD) :
|
.bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
_sbss = .;
|
_sbss = .;
|
||||||
*(.sbss .sbss.* .bss .bss.*);
|
*(.sbss .sbss.* .bss .bss.*);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} > REGION_BSS
|
} > REGION_BSS
|
||||||
|
|
||||||
/* fictitious region that represents the memory available for the stack */
|
/* fictitious region that represents the memory available for the stack */
|
||||||
.stack (NOLOAD) :
|
.stack (NOLOAD) :
|
||||||
{
|
{
|
||||||
_sstack = .;
|
_sstack = .;
|
||||||
. += _stack_size;
|
. += _stack_size;
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
_estack = .;
|
_estack = .;
|
||||||
} > REGION_STACK
|
} > REGION_STACK
|
||||||
|
|
||||||
/* fictitious region that represents the memory available for the heap */
|
/* fictitious region that represents the memory available for the heap */
|
||||||
.heap (NOLOAD) :
|
.heap (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_sheap = .;
|
_sheap = .;
|
||||||
/* _eheap is defined elsewhere and is the remainder of RAM */
|
/* _eheap is defined elsewhere and is the remainder of RAM */
|
||||||
} > REGION_HEAP
|
} > REGION_HEAP
|
||||||
|
|
||||||
/* fake output .got section */
|
/* fake output .got section */
|
||||||
/* Dynamic relocations are unsupported. This section is only used to detect
|
/* Dynamic relocations are unsupported. This section is only used to detect
|
||||||
relocatable code in the input files and raise an error if relocatable code
|
relocatable code in the input files and raise an error if relocatable code
|
||||||
is found */
|
is found */
|
||||||
.got (INFO) :
|
.got (INFO) :
|
||||||
{
|
{
|
||||||
KEEP(*(.got .got.*));
|
KEEP(*(.got .got.*));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard .eh_frame, we are not doing unwind on panic so it is not needed */
|
/* Discard .eh_frame, we are not doing unwind on panic so it is not needed */
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
{
|
{
|
||||||
*(.eh_frame);
|
*(.eh_frame);
|
||||||
*(.eh_frame_hdr);
|
*(.eh_frame_hdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not exceed this mark in the error messages above | */
|
/* Do not exceed this mark in the error messages above | */
|
||||||
ASSERT(ORIGIN(REGION_TEXT) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_TEXT) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_TEXT must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_TEXT must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(ORIGIN(REGION_RODATA) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_RODATA) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_RODATA must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_RODATA must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(ORIGIN(REGION_DATA) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_DATA) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_DATA must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_DATA must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(ORIGIN(REGION_HEAP) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_HEAP) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_HEAP must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_HEAP must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(ORIGIN(REGION_TEXT) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_TEXT) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_TEXT must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_TEXT must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(ORIGIN(REGION_STACK) % 4 == 0, "
|
ASSERT(ORIGIN(REGION_STACK) % 4 == 0, "
|
||||||
ERROR(riscv-rt): the start of the REGION_STACK must be 4-byte aligned");
|
ERROR(riscv-rt): the start of the REGION_STACK must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_stext % 4 == 0, "
|
ASSERT(_stext % 4 == 0, "
|
||||||
ERROR(riscv-rt): `_stext` must be 4-byte aligned");
|
ERROR(riscv-rt): `_stext` must be 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_sdata % 4 == 0 && _edata % 4 == 0, "
|
ASSERT(_sdata % 4 == 0 && _edata % 4 == 0, "
|
||||||
BUG(riscv-rt): .data is not 4-byte aligned");
|
BUG(riscv-rt): .data is not 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_sidata % 4 == 0, "
|
ASSERT(_sidata % 4 == 0, "
|
||||||
BUG(riscv-rt): the LMA of .data is not 4-byte aligned");
|
BUG(riscv-rt): the LMA of .data is not 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_sbss % 4 == 0 && _ebss % 4 == 0, "
|
ASSERT(_sbss % 4 == 0 && _ebss % 4 == 0, "
|
||||||
BUG(riscv-rt): .bss is not 4-byte aligned");
|
BUG(riscv-rt): .bss is not 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_sheap % 4 == 0, "
|
ASSERT(_sheap % 4 == 0, "
|
||||||
BUG(riscv-rt): start of .heap is not 4-byte aligned");
|
BUG(riscv-rt): start of .heap is not 4-byte aligned");
|
||||||
|
|
||||||
ASSERT(_stext + SIZEOF(.text) < ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT), "
|
ASSERT(_stext + SIZEOF(.text) < ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT), "
|
||||||
ERROR(riscv-rt): The .text section must be placed inside the REGION_TEXT region.
|
ERROR(riscv-rt): The .text section must be placed inside the REGION_TEXT region.
|
||||||
Set _stext to an address smaller than 'ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT)'");
|
Set _stext to an address smaller than 'ORIGIN(REGION_TEXT) + LENGTH(REGION_TEXT)'");
|
||||||
|
|
||||||
ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
|
ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
|
||||||
ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
|
ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
|
||||||
Consider changing `_max_hart_id` or `_hart_stack_size`.");
|
Consider changing `_max_hart_id` or `_hart_stack_size`.");
|
||||||
|
|
||||||
ASSERT(SIZEOF(.got) == 0, "
|
ASSERT(SIZEOF(.got) == 0, "
|
||||||
.got section detected in the input files. Dynamic relocations are not
|
.got section detected in the input files. Dynamic relocations are not
|
||||||
supported. If you are linking to C code compiled using the `gcc` crate
|
supported. If you are linking to C code compiled using the `gcc` crate
|
||||||
then modify your build script to compile the C code _without_ the
|
then modify your build script to compile the C code _without_ the
|
||||||
-fPIC flag. See the documentation of the `gcc::Config.fpic` method for
|
-fPIC flag. See the documentation of the `gcc::Config.fpic` method for
|
||||||
details.");
|
details.");
|
||||||
|
|
||||||
/* Do not exceed this mark in the error messages above | */
|
/* Do not exceed this mark in the error messages above | */
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use core::{mem, slice};
|
use core::{mem, slice};
|
||||||
|
|
||||||
#[cfg(feature = "atsama5d27")]
|
#[cfg(feature = "atsama5d27")]
|
||||||
pub use armv7::{
|
use armv7::{
|
||||||
PhysicalAddress, VirtualAddress,
|
VirtualAddress,
|
||||||
structures::paging::{
|
structures::paging::{
|
||||||
InMemoryRegister, PageTable as L2PageTable, PageTableDescriptor, PageTableMemory,
|
InMemoryRegister, PageTableDescriptor,
|
||||||
PageTableType, Readable, TranslationTable, TranslationTableDescriptor, TranslationTableMemory,
|
Readable, TranslationTableDescriptor, TranslationTableMemory,
|
||||||
TranslationTableType, Writeable, PAGE_TABLE_FLAGS, PAGE_TABLE_SIZE, SMALL_PAGE_FLAGS,
|
TranslationTableType, SMALL_PAGE_FLAGS,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::num::NonZeroUsize;
|
use core::num::NonZeroUsize;
|
||||||
|
|
||||||
pub use armv7::structures::paging::{
|
use armv7::structures::paging::{
|
||||||
PageTable as L2PageTable, TranslationTable, TranslationTableDescriptor,
|
PageTable as L2PageTable, TranslationTable, TranslationTableDescriptor,
|
||||||
TranslationTableType, PageTableDescriptor, PAGE_TABLE_SIZE, PageTableType,
|
TranslationTableType, PageTableDescriptor, PageTableType,
|
||||||
TranslationTableMemory, PageTableMemory,
|
TranslationTableMemory, PageTableMemory,
|
||||||
PAGE_TABLE_FLAGS, SMALL_PAGE_FLAGS,
|
PAGE_TABLE_FLAGS, SMALL_PAGE_FLAGS,
|
||||||
};
|
};
|
||||||
pub use armv7::{PhysicalAddress, VirtualAddress};
|
use armv7::{PhysicalAddress, VirtualAddress};
|
||||||
use crate::consts::{
|
use crate::consts::{
|
||||||
FLG_R, FLG_U, FLG_VALID, FLG_W, FLG_X, GUARD_MEMORY_BYTES, KERNEL_ARGUMENT_OFFSET,
|
FLG_R, FLG_U, FLG_VALID, FLG_W, FLG_X, GUARD_MEMORY_BYTES, KERNEL_ARGUMENT_OFFSET,
|
||||||
LOADER_CODE_ADDRESS, PAGE_TABLE_OFFSET, KERNEL_STACK_PAGE_COUNT,
|
LOADER_CODE_ADDRESS, PAGE_TABLE_OFFSET, KERNEL_STACK_PAGE_COUNT,
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,12 @@
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
use atsama5d27::uart::{Uart as UartHw, Uart1};
|
use atsama5d27::uart::{Uart as UartHw, Uart1};
|
||||||
pub use armv7::structures::paging::{
|
use armv7::structures::paging::{
|
||||||
PageTable as L2PageTable, TranslationTable, TranslationTableDescriptor,
|
PageTable as L2PageTable, TranslationTable,
|
||||||
TranslationTableType, PageTableDescriptor, PAGE_TABLE_SIZE, PageTableType,
|
TranslationTableType, PageTableType,
|
||||||
TranslationTableMemory, PageTableMemory,
|
TranslationTableMemory, PageTableMemory,
|
||||||
PAGE_TABLE_FLAGS, SMALL_PAGE_FLAGS,
|
|
||||||
};
|
};
|
||||||
pub use armv7::{PhysicalAddress, VirtualAddress};
|
use armv7::PhysicalAddress;
|
||||||
|
|
||||||
type UartType = UartHw<Uart1>;
|
type UartType = UartHw<Uart1>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,7 @@ use crate::{
|
||||||
println, BootConfig, ProgramDescription,
|
println, BootConfig, ProgramDescription,
|
||||||
XousPid, PAGE_SIZE, STACK_PAGE_COUNT, VDBG,
|
XousPid, PAGE_SIZE, STACK_PAGE_COUNT, VDBG,
|
||||||
};
|
};
|
||||||
pub use armv7::structures::paging::{
|
use armv7::structures::paging::TranslationTableMemory;
|
||||||
PageTable as L2PageTable, TranslationTable, TranslationTableDescriptor,
|
|
||||||
TranslationTableType, PageTableDescriptor, PAGE_TABLE_SIZE, PageTableType,
|
|
||||||
TranslationTableMemory, PageTableMemory,
|
|
||||||
PAGE_TABLE_FLAGS, SMALL_PAGE_FLAGS,
|
|
||||||
};
|
|
||||||
pub use armv7::{PhysicalAddress, VirtualAddress};
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue