Skip to content

Commit

Permalink
Merge pull request #4665 from Archcady/enable_sdram
Browse files Browse the repository at this point in the history
Enable sdram usage of REALTEK_RTL8195AM
  • Loading branch information
theotherjimmy committed Sep 6, 2017
2 parents 5bcd97a + 67f1ee5 commit 7457bbb
Show file tree
Hide file tree
Showing 19 changed files with 1,137 additions and 597 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,51 +1,78 @@
; *************************************************************
; *** Scatter-Loading Description File for RTL8195A ***
; *************************************************************
LR_ROM 0x00000000 0x00030000{
_ROM_CODE 0x00000000 0x00030000 {
;*.o (RESET, +First)
;*(InRoot$$Sections)
}
}
; Realtek Semiconductor Corp.
;
; RTL8195A ARMCC Scatter File
;
; MEMORY
; {
; SROM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00007000
; SRAM (rwx) : ORIGIN = 0x10007000, LENGTH = 0x00070000 - 0x00007000
; TCM (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
; DRAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
; }

LR_RAM 0x10006000 0x6FFFF {
;LR_RAM 0x10000000 0x6FFFF {
;ROM_BSS 0x10000000 0x0005FFF{
;rtl_console.o(.mon.ram.bss*)
;}

.image2.table 0x10006000 FIXED {
rtl8195a_init.o(.image2.ram.data*)
rtl8195a_init.o(.image2.validate.rodata*)
}

.text +0 FIXED{
rtl8195a_init.o(.infra.ram.start)
;*.o(.mon.ram.text*)
;*.o(.hal.flash.text*)
;*.o(.hal.sdrc.text*)
;*.o(.hal.gpio.text*)
;*.o(.text*)
;*.o(.rodata*)
.ANY (+RO)
LR_IRAM 0x10007000 (0x70000 - 0x7000) {

IMAGE2_TABLE 0x10007000 FIXED {
*rtl8195a_init.o(.image2.ram.data*, +FIRST)
*rtl8195a_init.o(.image2.validate.rodata*)
}

.data +0 FIXED{
.ANY (+RW)
ER_IRAM +0 FIXED {
*rtl8195a_crypto.o (+RO)
* (i.mbedtls*)
*libc.a (+RO)

*rtx_*.o (+RO)
*Ticker.o (+RO)
*Timeout.o (+RO)
*rtx_timer.o (+RO)
*TimerEvent.o (+RO)
*mbed_ticker_api.o (+RO)
*mbed_critical.o (+RO)
*us_ticker.o (+RO)

*lib_peripheral_mbed_arm.ar (+RO)
}

RW_IRAM1 +0 UNINIT FIXED {
.ANY (+ZI)
*rtl8195a_crypto.o(+RW)
;*mbedtls*.o(+RW)
*libc.a (+RW)
*(.sdram.data*)
*lib_peripheral_mbed_arm.ar (+RW)
}

TCM_OVERLAY 0x1FFF0000 0x10000{
lwip_mem.o(.bss*)
lwip_memp.o(.bss*)
*.o(.tcm.heap*)
RW_IRAM2 +0 UNINIT FIXED {
*rtl8195a_crypto.o(+ZI, COMMON)
;*mbedtls*.o(+ZI, COMMON)
*libc.a (+ZI, COMMON)
*(.bss.thread_stack_main)
*lib_peripheral_mbed_arm.ar (+ZI, COMMON)
}

ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
}
}

LR_TCM 0x1FFF0000 0x10000 {
TCM_OVERLAY 0x1FFF0000 0x10000 {
*lwip_mem.o(.bss*)
*lwip_memp.o(.bss*)
*.o(.tcm.heap*)
}
}

LR_DRAM 0x30000000 0x1FFFFF{
_DRAM_CODE 0x30000000 0x1FFFFF{
}
}
LR_DRAM 0x30000000 0x200000 {

ER_DRAM +0 FIXED {
.ANY (+RO)
}

RW_DRAM1 +0 UNINIT FIXED {
.ANY (+RW)
}

RW_DRAM2 +0 UNINIT FIXED {
.ANY (+ZI)
}
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
/******************************************************************************
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
/* mbed Microcontroller Library - stackheap
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
* mbed Microcontroller Library - stackheap
* Setup a fixed single stack/heap memory model,
* between the top of the RW/ZI region and the stackpointer
******************************************************************************/

* Setup a fixed single stack/heap memory model,
* between the top of the RW/ZI region and the stackpointer
*/
#ifdef __cplusplus
extern "C" {
#endif
#endif

#include <rt_misc.h>
#include <stdint.h>

extern char Image$$RW_IRAM1$$ZI$$Limit[];
extern char Image$$RW_IRAM2$$ZI$$Limit[];

extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM2$$ZI$$Limit;
uint32_t sp_limit = __current_sp();

zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned

//push down stack pointer to recycle some of the stack space that are not use in future
__asm volatile
(
"MRS IP, MSP \n"
"ADD IP, #64 \n"
"BIC IP, IP, #7 \n"
"MSR MSP, IP \n"
);
struct __initial_stackheap r;
r.heap_base = zi_limit;
r.heap_limit = sp_limit;
Expand All @@ -49,4 +27,4 @@ extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_

#ifdef __cplusplus
}
#endif
#endif
Binary file not shown.
Loading

0 comments on commit 7457bbb

Please sign in to comment.