forked from M-Labs/artiq
runtime: make memory map saner.
This commit is contained in:
parent
b4bbf44a0a
commit
b52ecda1d5
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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 = .;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,9 @@ 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 :
|
||||||
|
@ -67,15 +60,25 @@ SECTIONS
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
. = ALIGN(8);
|
} > runtime
|
||||||
|
|
||||||
|
.stack :
|
||||||
|
{
|
||||||
|
. = ALIGN(0x1000);
|
||||||
|
_estack = .;
|
||||||
|
. += 0x4000;
|
||||||
|
_fstack = . - 4;
|
||||||
|
} > runtime
|
||||||
|
|
||||||
|
.heap :
|
||||||
|
{
|
||||||
|
_fheap = .;
|
||||||
|
. = ORIGIN(runtime) + LENGTH(runtime) - 0x1000;
|
||||||
|
_eheap = .;
|
||||||
} > runtime
|
} > runtime
|
||||||
|
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
{
|
{
|
||||||
*(.eh_frame)
|
*(.eh_frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
_fheap = .;
|
|
||||||
. += 0x1800000;
|
|
||||||
_eheap = .;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue