mirror of https://github.com/ARMmbed/mbed-os.git
Add RTW8195AM support for mbed client with ARMCC
Move ticker related code to SRAM due to time drift sensitivepull/4665/head
parent
56a98e11d1
commit
e16c2d2833
Binary file not shown.
|
@ -18,29 +18,50 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ER_IRAM +0 FIXED {
|
ER_IRAM +0 FIXED {
|
||||||
*rtl8195a_crypto.o(.text*, .rodata*)
|
*rtl8195a_crypto.o (+RO)
|
||||||
*mbedtls*.o(.text*, .rodata*)
|
* (i.mbedtls*)
|
||||||
libc.a: (.text*, .rodata*)
|
*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 {
|
RW_IRAM1 +0 UNINIT FIXED {
|
||||||
*rtl8195a_crypto.o(.data*)
|
*rtl8195a_crypto.o(+RW)
|
||||||
*mbedtls*.o(.data*)
|
;*mbedtls*.o(+RW)
|
||||||
libc.a: (.data*)
|
*libc.a (+RW)
|
||||||
*(.sdram.data*)
|
*(.sdram.data*)
|
||||||
|
*lib_peripheral_mbed_arm.ar (+RW)
|
||||||
}
|
}
|
||||||
|
|
||||||
RW_IRAM2 +0 UNINIT FIXED {
|
RW_IRAM2 +0 UNINIT FIXED {
|
||||||
*rtl8195a_crypto.o(.bss*, COMMON)
|
*rtl8195a_crypto.o(+ZI, COMMON)
|
||||||
*mbedtls*.o(.bss*, COMMON)
|
;*mbedtls*.o(+ZI, COMMON)
|
||||||
libc.a: (.bss*, COMMON)
|
*libc.a (+ZI, COMMON)
|
||||||
*(.bss.thread_stack_main)
|
*(.bss.thread_stack_main)
|
||||||
|
*lib_peripheral_mbed_arm.ar (+ZI, COMMON)
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
|
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 0x200000 {
|
LR_DRAM 0x30000000 0x200000 {
|
||||||
|
|
||||||
ER_DRAM +0 FIXED {
|
ER_DRAM +0 FIXED {
|
||||||
|
|
|
@ -125,9 +125,9 @@ void __TRAP_HardFaultHandler_Patch(uint32_t addr)
|
||||||
* Otherwise it will keep hitting MemMange Fault on the same assembly code.
|
* Otherwise it will keep hitting MemMange Fault on the same assembly code.
|
||||||
*
|
*
|
||||||
* To step to next command, we need parse the assembly code to check if
|
* To step to next command, we need parse the assembly code to check if
|
||||||
* it is 16-bit or 32-bit command.
|
* it is 16-bit or 32-bit command.
|
||||||
* Ref: ARM Architecture Reference Manual (ARMv7-A and ARMv7-R edition),
|
* Ref: ARM Architecture Reference Manual (ARMv7-A and ARMv7-R edition),
|
||||||
* Chapter A6 - Thumb Instruction Set Encoding
|
* Chapter A6 - Thumb Instruction Set Encoding
|
||||||
*
|
*
|
||||||
* However, the fault assembly code (Ex. LDR or ADR) is not actually executed,
|
* However, the fault assembly code (Ex. LDR or ADR) is not actually executed,
|
||||||
* So the register value is un-predictable.
|
* So the register value is un-predictable.
|
||||||
|
@ -202,6 +202,9 @@ void PLAT_Start(void)
|
||||||
#else
|
#else
|
||||||
TRAP_OverrideTable(0x1FFFFFFC);
|
TRAP_OverrideTable(0x1FFFFFFC);
|
||||||
#endif
|
#endif
|
||||||
|
extern HAL_TIMER_OP_EXT HalTimerOpExt;
|
||||||
|
__rtl_memset_v1_00((void *)&HalTimerOpExt, 0, sizeof(HalTimerOpExt));
|
||||||
|
__rtl_memset_v1_00((void *)&HalTimerOp, 0, sizeof(HalTimerOp));
|
||||||
|
|
||||||
HalTimerOpInit_Patch(&HalTimerOp);
|
HalTimerOpInit_Patch(&HalTimerOp);
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#define _RTL8195A_TIMER_H_
|
#define _RTL8195A_TIMER_H_
|
||||||
|
|
||||||
|
|
||||||
#define TIMER_TICK_US 31
|
#define TIMER_TICK_US 32
|
||||||
|
|
||||||
#define TIMER_LOAD_COUNT_OFF 0x00
|
#define TIMER_LOAD_COUNT_OFF 0x00
|
||||||
#define TIMER_CURRENT_VAL_OFF 0x04
|
#define TIMER_CURRENT_VAL_OFF 0x04
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
#if !defined(CONFIG_PLATFORM_8711B)
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
|
#define CONFIG_USE_TCM_HEAP 0 /* USE TCM HEAP */
|
||||||
#endif
|
#endif
|
||||||
#define CONFIG_RECV_TASKLET_THREAD
|
#define CONFIG_RECV_TASKLET_THREAD
|
||||||
#define CONFIG_XMIT_TASKLET_THREAD
|
#define CONFIG_XMIT_TASKLET_THREAD
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_8195A)
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
#ifndef CONFIG_USE_TCM_HEAP
|
#ifndef CONFIG_USE_TCM_HEAP
|
||||||
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
|
#define CONFIG_USE_TCM_HEAP 0 /* USE TCM HEAP */
|
||||||
#endif
|
#endif
|
||||||
#define USE_MUTEX_FOR_SPINLOCK 1
|
#define USE_MUTEX_FOR_SPINLOCK 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,21 +77,22 @@ uint32_t us_ticker_read()
|
||||||
void us_ticker_set_interrupt(timestamp_t timestamp)
|
void us_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
uint32_t cur_time_us;
|
uint32_t cur_time_us;
|
||||||
uint32_t time_def;
|
uint32_t time_dif;
|
||||||
|
|
||||||
|
|
||||||
|
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
|
||||||
cur_time_us = us_ticker_read();
|
cur_time_us = us_ticker_read();
|
||||||
if ((uint32_t)timestamp >= cur_time_us) {
|
if ((uint32_t)timestamp > cur_time_us) {
|
||||||
time_def = (uint32_t)timestamp - cur_time_us;
|
time_dif = (uint32_t)timestamp - cur_time_us;
|
||||||
} else {
|
} else {
|
||||||
time_def = 0xffffffff - cur_time_us + (uint32_t)timestamp;
|
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, 0xffffffff);
|
||||||
|
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
|
||||||
|
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
||||||
|
NVIC_SetPendingIRQ(TIMER2_7_IRQ);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_def < TIMER_TICK_US) {
|
TimerAdapter.TimerLoadValueUs = time_dif;
|
||||||
time_def = TIMER_TICK_US; // at least 1 tick
|
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_dif / TIMER_TICK_US);
|
||||||
}
|
|
||||||
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
|
|
||||||
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_def);
|
|
||||||
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
|
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
|
||||||
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue