mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5044 from Archcady/Profile_debug
Realtek_RTL8195AM fix for debug profilepull/5151/head
commit
003dd7c47f
|
@ -84,5 +84,10 @@
|
||||||
"help": "Thread stack size for PPP",
|
"help": "Thread stack size for PPP",
|
||||||
"value": 768
|
"value": 768
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"target_overrides": {
|
||||||
|
"REALTEK_RTL8195AM": {
|
||||||
|
"tcpip-thread-stacksize": 1600
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "osdep_service.h"
|
#include "osdep_service.h"
|
||||||
|
|
||||||
typedef struct _wifi_scan_hdl {
|
typedef struct _wifi_scan_hdl {
|
||||||
void *scan_sema;
|
_sema scan_sema;
|
||||||
nsapi_size_t ap_num;
|
nsapi_size_t ap_num;
|
||||||
nsapi_size_t scan_num;
|
nsapi_size_t scan_num;
|
||||||
WiFiAccessPoint *ap_details;
|
WiFiAccessPoint *ap_details;
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,31 @@
|
||||||
|
;
|
||||||
|
; Copyright (c) 2017 Realtek Semiconductor Corp.
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
|
||||||
|
PRESERVE8
|
||||||
|
THUMB
|
||||||
|
|
||||||
|
AREA |i.PLAT_Start|, CODE, READONLY
|
||||||
|
|
||||||
|
PLAT_Start PROC
|
||||||
|
|
||||||
|
EXPORT PLAT_Start
|
||||||
|
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||||
|
IMPORT PLAT_Init
|
||||||
|
LDR SP, =|Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||||
|
LDR R0, =PLAT_Init
|
||||||
|
BX R0
|
||||||
|
ENDP
|
||||||
|
ALIGN
|
||||||
|
END
|
Binary file not shown.
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
.thumb
|
||||||
|
|
||||||
|
.global __StackTop
|
||||||
|
.global PLAT_Init
|
||||||
|
|
||||||
|
/* entry point of application image */
|
||||||
|
.section .text.PLAT_Start
|
||||||
|
.weak PLAT_Start
|
||||||
|
.type PLAT_Start, %function
|
||||||
|
PLAT_Start:
|
||||||
|
ldr sp, =__StackTop
|
||||||
|
ldr r0, =PLAT_Init
|
||||||
|
bx r0
|
||||||
|
.size PLAT_Start, .-PLAT_Start
|
||||||
|
.end
|
Binary file not shown.
|
@ -0,0 +1,31 @@
|
||||||
|
;
|
||||||
|
; Copyright (c) 2017 Realtek Semiconductor Corp.
|
||||||
|
;
|
||||||
|
; 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.
|
||||||
|
|
||||||
|
MODULE ?cstartup
|
||||||
|
|
||||||
|
SECTION .text:CODE:NOROOT:REORDER(2)
|
||||||
|
EXTERN CSTACK$$Limit
|
||||||
|
EXTERN PLAT_Init
|
||||||
|
|
||||||
|
; Default image 2 entry
|
||||||
|
THUMB
|
||||||
|
PUBWEAK PLAT_Start
|
||||||
|
|
||||||
|
PLAT_Start
|
||||||
|
LDR SP, =CSTACK$$Limit
|
||||||
|
LDR R0, =PLAT_Init
|
||||||
|
BX R0
|
||||||
|
|
||||||
|
END
|
|
@ -29,7 +29,6 @@
|
||||||
#if defined(__CC_ARM) || \
|
#if defined(__CC_ARM) || \
|
||||||
(defined (__ARMCC_VERSION) && __ARMCC_VERSION >= 6010050)
|
(defined (__ARMCC_VERSION) && __ARMCC_VERSION >= 6010050)
|
||||||
|
|
||||||
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit;
|
|
||||||
extern uint8_t Image$$RW_IRAM2$$ZI$$Base[];
|
extern uint8_t Image$$RW_IRAM2$$ZI$$Base[];
|
||||||
extern uint8_t Image$$RW_IRAM2$$ZI$$Limit[];
|
extern uint8_t Image$$RW_IRAM2$$ZI$$Limit[];
|
||||||
extern uint8_t Image$$TCM_OVERLAY$$ZI$$Base[];
|
extern uint8_t Image$$TCM_OVERLAY$$ZI$$Base[];
|
||||||
|
@ -42,13 +41,11 @@ extern uint8_t Image$$RW_DRAM2$$ZI$$Limit[];
|
||||||
#define __bss_dtcm_end__ Image$$TCM_OVERLAY$$ZI$$Limit
|
#define __bss_dtcm_end__ Image$$TCM_OVERLAY$$ZI$$Limit
|
||||||
#define __bss_dram_start__ Image$$RW_DRAM2$$ZI$$Base
|
#define __bss_dram_start__ Image$$RW_DRAM2$$ZI$$Base
|
||||||
#define __bss_dram_end__ Image$$RW_DRAM2$$ZI$$Limit
|
#define __bss_dram_end__ Image$$RW_DRAM2$$ZI$$Limit
|
||||||
#define __stackp Image$$ARM_LIB_STACK$$ZI$$Limit
|
|
||||||
|
|
||||||
#elif defined (__ICCARM__)
|
#elif defined (__ICCARM__)
|
||||||
|
|
||||||
#pragma section=".ram.bss"
|
#pragma section=".ram.bss"
|
||||||
|
|
||||||
extern uint32_t CSTACK$$Limit;
|
|
||||||
uint8_t *__bss_start__;
|
uint8_t *__bss_start__;
|
||||||
uint8_t *__bss_end__;
|
uint8_t *__bss_end__;
|
||||||
|
|
||||||
|
@ -57,12 +54,9 @@ void __iar_data_init_app(void)
|
||||||
__bss_start__ = (uint8_t *)__section_begin(".ram.bss");
|
__bss_start__ = (uint8_t *)__section_begin(".ram.bss");
|
||||||
__bss_end__ = (uint8_t *)__section_end(".ram.bss");
|
__bss_end__ = (uint8_t *)__section_end(".ram.bss");
|
||||||
}
|
}
|
||||||
#define __stackp CSTACK$$Limit
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern uint32_t __StackTop;
|
|
||||||
extern uint32_t __StackLimit;
|
|
||||||
extern uint8_t __bss_sram_start__[];
|
extern uint8_t __bss_sram_start__[];
|
||||||
extern uint8_t __bss_sram_end__[];
|
extern uint8_t __bss_sram_end__[];
|
||||||
extern uint8_t __bss_dtcm_start__[];
|
extern uint8_t __bss_dtcm_start__[];
|
||||||
|
@ -70,7 +64,6 @@ extern uint8_t __bss_dtcm_end__[];
|
||||||
extern uint8_t __bss_dram_start__[];
|
extern uint8_t __bss_dram_start__[];
|
||||||
extern uint8_t __bss_dram_end__[];
|
extern uint8_t __bss_dram_end__[];
|
||||||
|
|
||||||
#define __stackp __StackTop
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern VECTOR_Func NewVectorTable[];
|
extern VECTOR_Func NewVectorTable[];
|
||||||
|
@ -175,16 +168,19 @@ void TRAP_HardFaultHandler_Patch(void)
|
||||||
|
|
||||||
extern _LONG_CALL_ void * __rtl_memset_v1_00(void * m , int c , size_t n);
|
extern _LONG_CALL_ void * __rtl_memset_v1_00(void * m , int c , size_t n);
|
||||||
// Image2 Entry Function
|
// Image2 Entry Function
|
||||||
void PLAT_Start(void)
|
void PLAT_Init(void)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
|
|
||||||
#if defined (__ICCARM__)
|
// Overwrite vector table
|
||||||
__iar_data_init_app();
|
NewVectorTable[2] = (VECTOR_Func) TRAP_NMIHandler;
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
NewVectorTable[3] = (VECTOR_Func) TRAP_HardFaultHandler_Patch;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clear RAM BSS
|
// Clear RAM BSS
|
||||||
#if defined (__ICCARM__)
|
#if defined (__ICCARM__)
|
||||||
|
__iar_data_init_app();
|
||||||
__rtl_memset_v1_00((void *)__bss_start__, 0, __bss_end__ - __bss_start__);
|
__rtl_memset_v1_00((void *)__bss_start__, 0, __bss_end__ - __bss_start__);
|
||||||
#else
|
#else
|
||||||
__rtl_memset_v1_00((void *)__bss_sram_start__, 0, __bss_sram_end__ - __bss_sram_start__);
|
__rtl_memset_v1_00((void *)__bss_sram_start__, 0, __bss_sram_end__ - __bss_sram_start__);
|
||||||
|
@ -192,14 +188,6 @@ void PLAT_Start(void)
|
||||||
__rtl_memset_v1_00((void *)__bss_dram_start__, 0, __bss_dram_end__ - __bss_dram_start__);
|
__rtl_memset_v1_00((void *)__bss_dram_start__, 0, __bss_dram_end__ - __bss_dram_start__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set MSP
|
|
||||||
__set_MSP((uint32_t)&__stackp - 0x100);
|
|
||||||
// Overwrite vector table
|
|
||||||
NewVectorTable[2] = (VECTOR_Func) TRAP_NMIHandler;
|
|
||||||
#if defined ( __ICCARM__ )
|
|
||||||
NewVectorTable[3] = (VECTOR_Func) TRAP_HardFaultHandler_Patch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern HAL_TIMER_OP_EXT HalTimerOpExt;
|
extern HAL_TIMER_OP_EXT HalTimerOpExt;
|
||||||
__rtl_memset_v1_00((void *)&HalTimerOpExt, 0, sizeof(HalTimerOpExt));
|
__rtl_memset_v1_00((void *)&HalTimerOpExt, 0, sizeof(HalTimerOpExt));
|
||||||
__rtl_memset_v1_00((void *)&HalTimerOp, 0, sizeof(HalTimerOp));
|
__rtl_memset_v1_00((void *)&HalTimerOp, 0, sizeof(HalTimerOp));
|
||||||
|
|
|
@ -548,7 +548,7 @@ _func_exit_;
|
||||||
|
|
||||||
static u32 _rtx2_get_current_time(void)
|
static u32 _rtx2_get_current_time(void)
|
||||||
{
|
{
|
||||||
return osKernelGetTickCount();
|
return osKernelGetSysTimerCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 _rtx2_systime_to_ms(u32 systime)
|
static u32 _rtx2_systime_to_ms(u32 systime)
|
||||||
|
|
|
@ -23,23 +23,32 @@
|
||||||
#define SYS_TIM_ID 1 // the G-Timer ID for System
|
#define SYS_TIM_ID 1 // the G-Timer ID for System
|
||||||
#define APP_TIM_ID 6 // the G-Timer ID for Application
|
#define APP_TIM_ID 6 // the G-Timer ID for Application
|
||||||
|
|
||||||
|
#define TICK_TO_US(x) (uint64_t)(((x)/2) * 61 + ((x)%2) * TIMER_TICK_US)
|
||||||
|
|
||||||
static int us_ticker_inited = 0;
|
static int us_ticker_inited = 0;
|
||||||
static TIMER_ADAPTER TimerAdapter;
|
static TIMER_ADAPTER TimerAdapter;
|
||||||
|
|
||||||
extern HAL_TIMER_OP HalTimerOp;
|
extern HAL_TIMER_OP HalTimerOp;
|
||||||
extern HAL_TIMER_OP_EXT HalTimerOpExt;
|
extern HAL_TIMER_OP_EXT HalTimerOpExt;
|
||||||
|
|
||||||
VOID _us_ticker_irq_handler(IN VOID *Data)
|
VOID _us_ticker_irq_handler(void *Data)
|
||||||
{
|
{
|
||||||
us_ticker_irq_handler();
|
us_ticker_irq_handler();
|
||||||
|
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void us_ticker_init(void)
|
void us_ticker_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (us_ticker_inited) return;
|
if (us_ticker_inited){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
us_ticker_inited = 1;
|
us_ticker_inited = 1;
|
||||||
|
|
||||||
|
HalTimerOp.HalTimerDis(SYS_TIM_ID);
|
||||||
|
HalTimerOpExt.HalTimerReLoad(SYS_TIM_ID, 0xFFFFFFFFUL);
|
||||||
|
HalTimerOp.HalTimerEn(SYS_TIM_ID);
|
||||||
|
|
||||||
// Initial a G-Timer
|
// Initial a G-Timer
|
||||||
TimerAdapter.IrqDis = 0; // Enable Irq @ initial
|
TimerAdapter.IrqDis = 0; // Enable Irq @ initial
|
||||||
|
@ -52,50 +61,45 @@ void us_ticker_init(void)
|
||||||
TimerAdapter.TimerLoadValueUs = 0xFFFFFFFF;
|
TimerAdapter.TimerLoadValueUs = 0xFFFFFFFF;
|
||||||
TimerAdapter.TimerMode = USER_DEFINED;
|
TimerAdapter.TimerMode = USER_DEFINED;
|
||||||
|
|
||||||
HalTimerOp.HalTimerInit((VOID*) &TimerAdapter);
|
HalTimerOp.HalTimerInit((void *) &TimerAdapter);
|
||||||
|
|
||||||
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID);
|
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t us_ticker_read()
|
uint32_t us_ticker_read(void)
|
||||||
{
|
{
|
||||||
uint32_t tick_cnt;
|
uint32_t tick_cnt;
|
||||||
uint32_t ticks_125ms;
|
uint64_t tick_us;
|
||||||
uint32_t ticks_remain;
|
|
||||||
uint64_t us_tick;
|
if (!us_ticker_inited) {
|
||||||
|
us_ticker_init();
|
||||||
|
}
|
||||||
|
|
||||||
tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID);
|
tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID);
|
||||||
tick_cnt = 0xffffffff - tick_cnt; // it's a down counter
|
tick_us = TICK_TO_US(0xFFFFFFFFUL - tick_cnt);
|
||||||
ticks_125ms = tick_cnt/(GTIMER_CLK_HZ/8); //use 125ms as a intermediate unit;
|
|
||||||
ticks_remain = tick_cnt - (ticks_125ms*(GTIMER_CLK_HZ/8)); //calculate the remainder
|
|
||||||
us_tick = ticks_125ms * 125000; //change unit to us, 125ms is 125000 us
|
|
||||||
us_tick += (ticks_remain * 1000000)/GTIMER_CLK_HZ; //also use us as unit
|
|
||||||
|
|
||||||
return ((uint32_t)us_tick); //return ticker value in micro-seconds (us)
|
return ((uint32_t)tick_us); //return ticker value in micro-seconds (us)
|
||||||
}
|
}
|
||||||
|
|
||||||
void us_ticker_set_interrupt(timestamp_t timestamp)
|
void us_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
uint32_t cur_time_us;
|
uint32_t time_cur;
|
||||||
uint32_t time_dif;
|
uint32_t time_cnt;
|
||||||
|
|
||||||
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
|
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
|
||||||
cur_time_us = us_ticker_read();
|
time_cur = us_ticker_read();
|
||||||
if ((uint32_t)timestamp > cur_time_us) {
|
if (timestamp > time_cur + TIMER_TICK_US) {
|
||||||
time_dif = (uint32_t)timestamp - cur_time_us;
|
time_cnt = timestamp - time_cur;
|
||||||
} else {
|
} else {
|
||||||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, 0xffffffff);
|
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, 0xffffffff);
|
||||||
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
|
|
||||||
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
||||||
NVIC_SetPendingIRQ(TIMER2_7_IRQ);
|
us_ticker_fire_interrupt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimerAdapter.TimerLoadValueUs = time_dif;
|
TimerAdapter.TimerLoadValueUs = time_cnt / TIMER_TICK_US;
|
||||||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_dif / TIMER_TICK_US);
|
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, TimerAdapter.TimerLoadValueUs);
|
||||||
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
|
|
||||||
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void us_ticker_fire_interrupt(void)
|
void us_ticker_fire_interrupt(void)
|
||||||
|
|
Loading…
Reference in New Issue