forked from M-Labs/artiq
1
0
Fork 0

runtime: make memory map saner.

This commit is contained in:
whitequark 2016-10-06 18:05:38 +00:00
parent b4bbf44a0a
commit b52ecda1d5
5 changed files with 71 additions and 72 deletions

View File

@ -7,7 +7,7 @@ from misoc.integration.soc_core import mem_decoder
class KernelCPU(Module): class KernelCPU(Module):
def __init__(self, platform, def __init__(self, platform,
exec_address=0x42000000, exec_address=0x40400000,
main_mem_origin=0x40000000, main_mem_origin=0x40000000,
l2_size=8192): l2_size=8192):
self._reset = CSRStorage(reset=1) self._reset = CSRStorage(reset=1)

View File

@ -2,7 +2,7 @@ use core::ptr;
use board::csr; use board::csr;
use mailbox; use mailbox;
const KERNELCPU_EXEC_ADDRESS: usize = 0x42000000; const KERNELCPU_EXEC_ADDRESS: usize = 0x40400000;
const KERNELCPU_LAST_ADDRESS: usize = (0x4fffffff - 1024*1024); const KERNELCPU_LAST_ADDRESS: usize = (0x4fffffff - 1024*1024);
const KSUPPORT_HEADER_SIZE: usize = 0x80; const KSUPPORT_HEADER_SIZE: usize = 0x80;

View File

@ -16,8 +16,8 @@
#include "dds.h" #include "dds.h"
#include "i2c.h" #include "i2c.h"
#define KERNELCPU_EXEC_ADDRESS 0x42000000 #define KERNELCPU_EXEC_ADDRESS 0x40400000
#define KERNELCPU_PAYLOAD_ADDRESS 0x42020000 #define KERNELCPU_PAYLOAD_ADDRESS 0x40420000
#define KERNELCPU_LAST_ADDRESS (0x4fffffff - 1024*1024) #define KERNELCPU_LAST_ADDRESS (0x4fffffff - 1024*1024)
#define KSUPPORT_HEADER_SIZE 0x80 #define KSUPPORT_HEADER_SIZE 0x80

View File

@ -3,18 +3,16 @@ ENTRY(_start)
INCLUDE generated/regions.ld INCLUDE generated/regions.ld
/* First 32M of main memory are reserved for runtime /* First 4M of main memory are reserved for runtime
* code/data/heap, then comes kernel memory. * code/data/heap, then comes kernel memory.
* First 128K of kernel memory are for support code. * First 128K of kernel memory are for support code.
*/ */
MEMORY { MEMORY {
ksupport (RWX) : ORIGIN = 0x42000000, LENGTH = 0x20000 ksupport (RWX) : ORIGIN = 0x40400000, LENGTH = 0x20000
} }
/* On AMP systems, kernel stack is at the end of main RAM, /* Kernel stack is at the end of main RAM. */
* before the runtime stack. Leave 1M for runtime stack. PROVIDE(_fstack = ORIGIN(main_ram) + LENGTH(main_ram) - 4);
*/
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 1024*1024 - 4);
/* Force ld to make the ELF header as loadable. */ /* Force ld to make the ELF header as loadable. */
PHDRS PHDRS
@ -73,7 +71,5 @@ SECTIONS
*(COMMON) *(COMMON)
. = ALIGN(4); . = ALIGN(4);
_ebss = .; _ebss = .;
. = ALIGN(8);
_heapstart = .;
} }
} }

View File

@ -7,75 +7,78 @@ INCLUDE generated/regions.ld
* ld does not allow this expression here. * ld does not allow this expression here.
*/ */
MEMORY { MEMORY {
runtime : ORIGIN = 0x40000000, LENGTH = 0x2000000 /* 32M */ runtime (RWX) : ORIGIN = 0x40000000, LENGTH = 0x400000 /* 4M */
} }
/* Kernel memory space start right after the runtime,
* and ends before the runtime stack.
* Runtime stack is always at the end of main_ram.
* This stack is shared with the kernel on UP systems.
*/
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 4);
SECTIONS SECTIONS
{ {
.text : .text :
{ {
_ftext = .; _ftext = .;
*(.text .stub .text.* .gnu.linkonce.t.*) *(.text .stub .text.* .gnu.linkonce.t.*)
_etext = .; _etext = .;
} > runtime } > runtime
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */ /* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
.got : { .got : {
_GLOBAL_OFFSET_TABLE_ = .; _GLOBAL_OFFSET_TABLE_ = .;
*(.got) *(.got)
} > runtime } > runtime
.got.plt : { .got.plt : {
*(.got.plt) *(.got.plt)
} > runtime } > runtime
.rodata : .rodata :
{ {
. = ALIGN(4); . = ALIGN(4);
_frodata = .; _frodata = .;
*(.rodata .rodata.* .gnu.linkonce.r.*) *(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1) *(.rodata1)
_erodata = .; _erodata = .;
} > runtime } > runtime
.data : .data :
{ {
. = ALIGN(4); . = ALIGN(4);
_fdata = .; _fdata = .;
*(.data .data.* .gnu.linkonce.d.*) *(.data .data.* .gnu.linkonce.d.*)
*(.data1) *(.data1)
*(.sdata .sdata.* .gnu.linkonce.s.*) *(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .; _edata = .;
} > runtime } > runtime
.bss : .bss :
{ {
. = ALIGN(4); . = ALIGN(4);
_fbss = .; _fbss = .;
*(.dynsbss) *(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*) *(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon) *(.scommon)
*(.dynbss) *(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*) *(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON) *(COMMON)
. = ALIGN(4); . = ALIGN(4);
_ebss = .; _ebss = .;
. = ALIGN(8); } > runtime
} > runtime
/DISCARD/ : .stack :
{ {
*(.eh_frame) . = ALIGN(0x1000);
} _estack = .;
. += 0x4000;
_fstack = . - 4;
} > runtime
_fheap = .; .heap :
. += 0x1800000; {
_eheap = .; _fheap = .;
. = ORIGIN(runtime) + LENGTH(runtime) - 0x1000;
_eheap = .;
} > runtime
/DISCARD/ :
{
*(.eh_frame)
}
} }