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):
def __init__(self, platform,
exec_address=0x42000000,
exec_address=0x40400000,
main_mem_origin=0x40000000,
l2_size=8192):
self._reset = CSRStorage(reset=1)

View File

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

View File

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

View File

@ -3,18 +3,16 @@ ENTRY(_start)
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.
* First 128K of kernel memory are for support code.
*/
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,
* before the runtime stack. Leave 1M for runtime stack.
*/
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 1024*1024 - 4);
/* Kernel stack is at the end of main RAM. */
PROVIDE(_fstack = ORIGIN(main_ram) + LENGTH(main_ram) - 4);
/* Force ld to make the ELF header as loadable. */
PHDRS
@ -73,7 +71,5 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
_ebss = .;
. = ALIGN(8);
_heapstart = .;
}
}

View File

@ -7,16 +7,9 @@ INCLUDE generated/regions.ld
* ld does not allow this expression here.
*/
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
{
.text :
@ -67,15 +60,25 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
_ebss = .;
. = ALIGN(8);
} > runtime
.stack :
{
. = ALIGN(0x1000);
_estack = .;
. += 0x4000;
_fstack = . - 4;
} > runtime
.heap :
{
_fheap = .;
. = ORIGIN(runtime) + LENGTH(runtime) - 0x1000;
_eheap = .;
} > runtime
/DISCARD/ :
{
*(.eh_frame)
}
_fheap = .;
. += 0x1800000;
_eheap = .;
}