Skip to content

Commit 7457bbb

Browse files
Merge pull request #4665 from Archcady/enable_sdram
Enable sdram usage of REALTEK_RTL8195AM
2 parents 5bcd97a + 67f1ee5 commit 7457bbb

File tree

19 files changed

+1137
-597
lines changed

19 files changed

+1137
-597
lines changed
Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,78 @@
1-
; *************************************************************
2-
; *** Scatter-Loading Description File for RTL8195A ***
3-
; *************************************************************
4-
LR_ROM 0x00000000 0x00030000{
5-
_ROM_CODE 0x00000000 0x00030000 {
6-
;*.o (RESET, +First)
7-
;*(InRoot$$Sections)
8-
}
9-
}
1+
; Realtek Semiconductor Corp.
2+
;
3+
; RTL8195A ARMCC Scatter File
4+
;
5+
; MEMORY
6+
; {
7+
; SROM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00007000
8+
; SRAM (rwx) : ORIGIN = 0x10007000, LENGTH = 0x00070000 - 0x00007000
9+
; TCM (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
10+
; DRAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
11+
; }
1012

11-
LR_RAM 0x10006000 0x6FFFF {
12-
;LR_RAM 0x10000000 0x6FFFF {
13-
;ROM_BSS 0x10000000 0x0005FFF{
14-
;rtl_console.o(.mon.ram.bss*)
15-
;}
16-
17-
.image2.table 0x10006000 FIXED {
18-
rtl8195a_init.o(.image2.ram.data*)
19-
rtl8195a_init.o(.image2.validate.rodata*)
20-
}
21-
22-
.text +0 FIXED{
23-
rtl8195a_init.o(.infra.ram.start)
24-
;*.o(.mon.ram.text*)
25-
;*.o(.hal.flash.text*)
26-
;*.o(.hal.sdrc.text*)
27-
;*.o(.hal.gpio.text*)
28-
;*.o(.text*)
29-
;*.o(.rodata*)
30-
.ANY (+RO)
13+
LR_IRAM 0x10007000 (0x70000 - 0x7000) {
14+
15+
IMAGE2_TABLE 0x10007000 FIXED {
16+
*rtl8195a_init.o(.image2.ram.data*, +FIRST)
17+
*rtl8195a_init.o(.image2.validate.rodata*)
3118
}
3219

33-
.data +0 FIXED{
34-
.ANY (+RW)
20+
ER_IRAM +0 FIXED {
21+
*rtl8195a_crypto.o (+RO)
22+
* (i.mbedtls*)
23+
*libc.a (+RO)
24+
25+
*rtx_*.o (+RO)
26+
*Ticker.o (+RO)
27+
*Timeout.o (+RO)
28+
*rtx_timer.o (+RO)
29+
*TimerEvent.o (+RO)
30+
*mbed_ticker_api.o (+RO)
31+
*mbed_critical.o (+RO)
32+
*us_ticker.o (+RO)
33+
34+
*lib_peripheral_mbed_arm.ar (+RO)
3535
}
3636

3737
RW_IRAM1 +0 UNINIT FIXED {
38-
.ANY (+ZI)
38+
*rtl8195a_crypto.o(+RW)
39+
;*mbedtls*.o(+RW)
40+
*libc.a (+RW)
41+
*(.sdram.data*)
42+
*lib_peripheral_mbed_arm.ar (+RW)
3943
}
4044

41-
TCM_OVERLAY 0x1FFF0000 0x10000{
42-
lwip_mem.o(.bss*)
43-
lwip_memp.o(.bss*)
44-
*.o(.tcm.heap*)
45+
RW_IRAM2 +0 UNINIT FIXED {
46+
*rtl8195a_crypto.o(+ZI, COMMON)
47+
;*mbedtls*.o(+ZI, COMMON)
48+
*libc.a (+ZI, COMMON)
49+
*(.bss.thread_stack_main)
50+
*lib_peripheral_mbed_arm.ar (+ZI, COMMON)
4551
}
52+
53+
ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
54+
}
55+
}
56+
57+
LR_TCM 0x1FFF0000 0x10000 {
58+
TCM_OVERLAY 0x1FFF0000 0x10000 {
59+
*lwip_mem.o(.bss*)
60+
*lwip_memp.o(.bss*)
61+
*.o(.tcm.heap*)
62+
}
4663
}
4764

48-
LR_DRAM 0x30000000 0x1FFFFF{
49-
_DRAM_CODE 0x30000000 0x1FFFFF{
50-
}
51-
}
65+
LR_DRAM 0x30000000 0x200000 {
66+
67+
ER_DRAM +0 FIXED {
68+
.ANY (+RO)
69+
}
70+
71+
RW_DRAM1 +0 UNINIT FIXED {
72+
.ANY (+RW)
73+
}
74+
75+
RW_DRAM2 +0 UNINIT FIXED {
76+
.ANY (+ZI)
77+
}
78+
}
Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,24 @@
1-
/******************************************************************************
2-
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
1+
/* mbed Microcontroller Library - stackheap
2+
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*
16-
******************************************************************************
17-
* mbed Microcontroller Library - stackheap
18-
* Setup a fixed single stack/heap memory model,
19-
* between the top of the RW/ZI region and the stackpointer
20-
******************************************************************************/
21-
4+
* Setup a fixed single stack/heap memory model,
5+
* between the top of the RW/ZI region and the stackpointer
6+
*/
227
#ifdef __cplusplus
238
extern "C" {
24-
#endif
9+
#endif
2510

2611
#include <rt_misc.h>
2712
#include <stdint.h>
2813

29-
extern char Image$$RW_IRAM1$$ZI$$Limit[];
14+
extern char Image$$RW_IRAM2$$ZI$$Limit[];
15+
3016
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
31-
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
17+
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM2$$ZI$$Limit;
3218
uint32_t sp_limit = __current_sp();
3319

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

36-
//push down stack pointer to recycle some of the stack space that are not use in future
37-
__asm volatile
38-
(
39-
"MRS IP, MSP \n"
40-
"ADD IP, #64 \n"
41-
"BIC IP, IP, #7 \n"
42-
"MSR MSP, IP \n"
43-
);
4422
struct __initial_stackheap r;
4523
r.heap_base = zi_limit;
4624
r.heap_limit = sp_limit;
@@ -49,4 +27,4 @@ extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_
4927

5028
#ifdef __cplusplus
5129
}
52-
#endif
30+
#endif

0 commit comments

Comments
 (0)