Skip to content

Commit 003dd7c

Browse files
authored
Merge pull request #5044 from Archcady/Profile_debug
Realtek_RTL8195AM fix for debug profile
2 parents 02a10e5 + f7bc126 commit 003dd7c

File tree

11 files changed

+137
-46
lines changed

11 files changed

+137
-46
lines changed

features/FEATURE_LWIP/lwip-interface/mbed_lib.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,10 @@
8484
"help": "Thread stack size for PPP",
8585
"value": 768
8686
}
87+
},
88+
"target_overrides": {
89+
"REALTEK_RTL8195AM": {
90+
"tcpip-thread-stacksize": 1600
91+
}
8792
}
8893
}

targets/TARGET_Realtek/TARGET_AMEBA/RTWInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "osdep_service.h"
2929

3030
typedef struct _wifi_scan_hdl {
31-
void *scan_sema;
31+
_sema scan_sema;
3232
nsapi_size_t ap_num;
3333
nsapi_size_t scan_num;
3434
WiFiAccessPoint *ap_details;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
;
2+
; Copyright (c) 2017 Realtek Semiconductor Corp.
3+
;
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+
PRESERVE8
17+
THUMB
18+
19+
AREA |i.PLAT_Start|, CODE, READONLY
20+
21+
PLAT_Start PROC
22+
23+
EXPORT PLAT_Start
24+
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
25+
IMPORT PLAT_Init
26+
LDR SP, =|Image$$ARM_LIB_STACK$$ZI$$Limit|
27+
LDR R0, =PLAT_Init
28+
BX R0
29+
ENDP
30+
ALIGN
31+
END
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2017 Realtek Semiconductor Corp.
3+
*
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+
.syntax unified
18+
.thumb
19+
20+
.global __StackTop
21+
.global PLAT_Init
22+
23+
/* entry point of application image */
24+
.section .text.PLAT_Start
25+
.weak PLAT_Start
26+
.type PLAT_Start, %function
27+
PLAT_Start:
28+
ldr sp, =__StackTop
29+
ldr r0, =PLAT_Init
30+
bx r0
31+
.size PLAT_Start, .-PLAT_Start
32+
.end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
;
2+
; Copyright (c) 2017 Realtek Semiconductor Corp.
3+
;
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+
MODULE ?cstartup
17+
18+
SECTION .text:CODE:NOROOT:REORDER(2)
19+
EXTERN CSTACK$$Limit
20+
EXTERN PLAT_Init
21+
22+
; Default image 2 entry
23+
THUMB
24+
PUBWEAK PLAT_Start
25+
26+
PLAT_Start
27+
LDR SP, =CSTACK$$Limit
28+
LDR R0, =PLAT_Init
29+
BX R0
30+
31+
END

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/rtl8195a_init.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#if defined(__CC_ARM) || \
3030
(defined (__ARMCC_VERSION) && __ARMCC_VERSION >= 6010050)
3131

32-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit;
3332
extern uint8_t Image$$RW_IRAM2$$ZI$$Base[];
3433
extern uint8_t Image$$RW_IRAM2$$ZI$$Limit[];
3534
extern uint8_t Image$$TCM_OVERLAY$$ZI$$Base[];
@@ -42,13 +41,11 @@ extern uint8_t Image$$RW_DRAM2$$ZI$$Limit[];
4241
#define __bss_dtcm_end__ Image$$TCM_OVERLAY$$ZI$$Limit
4342
#define __bss_dram_start__ Image$$RW_DRAM2$$ZI$$Base
4443
#define __bss_dram_end__ Image$$RW_DRAM2$$ZI$$Limit
45-
#define __stackp Image$$ARM_LIB_STACK$$ZI$$Limit
4644

4745
#elif defined (__ICCARM__)
4846

4947
#pragma section=".ram.bss"
5048

51-
extern uint32_t CSTACK$$Limit;
5249
uint8_t *__bss_start__;
5350
uint8_t *__bss_end__;
5451

@@ -57,20 +54,16 @@ void __iar_data_init_app(void)
5754
__bss_start__ = (uint8_t *)__section_begin(".ram.bss");
5855
__bss_end__ = (uint8_t *)__section_end(".ram.bss");
5956
}
60-
#define __stackp CSTACK$$Limit
6157

6258
#else
6359

64-
extern uint32_t __StackTop;
65-
extern uint32_t __StackLimit;
6660
extern uint8_t __bss_sram_start__[];
6761
extern uint8_t __bss_sram_end__[];
6862
extern uint8_t __bss_dtcm_start__[];
6963
extern uint8_t __bss_dtcm_end__[];
7064
extern uint8_t __bss_dram_start__[];
7165
extern uint8_t __bss_dram_end__[];
7266

73-
#define __stackp __StackTop
7467
#endif
7568

7669
extern VECTOR_Func NewVectorTable[];
@@ -175,31 +168,26 @@ void TRAP_HardFaultHandler_Patch(void)
175168

176169
extern _LONG_CALL_ void * __rtl_memset_v1_00(void * m , int c , size_t n);
177170
// Image2 Entry Function
178-
void PLAT_Start(void)
171+
void PLAT_Init(void)
179172
{
180173
uint32_t val;
181174

182-
#if defined (__ICCARM__)
183-
__iar_data_init_app();
175+
// Overwrite vector table
176+
NewVectorTable[2] = (VECTOR_Func) TRAP_NMIHandler;
177+
#if defined ( __ICCARM__ )
178+
NewVectorTable[3] = (VECTOR_Func) TRAP_HardFaultHandler_Patch;
184179
#endif
185180

186181
// Clear RAM BSS
187182
#if defined (__ICCARM__)
183+
__iar_data_init_app();
188184
__rtl_memset_v1_00((void *)__bss_start__, 0, __bss_end__ - __bss_start__);
189185
#else
190186
__rtl_memset_v1_00((void *)__bss_sram_start__, 0, __bss_sram_end__ - __bss_sram_start__);
191187
__rtl_memset_v1_00((void *)__bss_dtcm_start__, 0, __bss_dtcm_end__ - __bss_dtcm_start__);
192188
__rtl_memset_v1_00((void *)__bss_dram_start__, 0, __bss_dram_end__ - __bss_dram_start__);
193189
#endif
194190

195-
// Set MSP
196-
__set_MSP((uint32_t)&__stackp - 0x100);
197-
// Overwrite vector table
198-
NewVectorTable[2] = (VECTOR_Func) TRAP_NMIHandler;
199-
#if defined ( __ICCARM__ )
200-
NewVectorTable[3] = (VECTOR_Func) TRAP_HardFaultHandler_Patch;
201-
#endif
202-
203191
extern HAL_TIMER_OP_EXT HalTimerOpExt;
204192
__rtl_memset_v1_00((void *)&HalTimerOpExt, 0, sizeof(HalTimerOpExt));
205193
__rtl_memset_v1_00((void *)&HalTimerOp, 0, sizeof(HalTimerOp));

targets/TARGET_Realtek/TARGET_AMEBA/sdk/os/rtx2/rtx2_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ _func_exit_;
548548

549549
static u32 _rtx2_get_current_time(void)
550550
{
551-
return osKernelGetTickCount();
551+
return osKernelGetSysTimerCount();
552552
}
553553

554554
static u32 _rtx2_systime_to_ms(u32 systime)

0 commit comments

Comments
 (0)