Add RTW8195AM support for mbed client with ARMCC

Move ticker related code to SRAM due to time drift sensitive
pull/4665/head
Yuguo Zou 2017-08-17 19:35:37 +08:00
parent 56a98e11d1
commit e16c2d2833
7 changed files with 49 additions and 24 deletions

View File

@ -18,29 +18,50 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
}
ER_IRAM +0 FIXED {
*rtl8195a_crypto.o(.text*, .rodata*)
*mbedtls*.o(.text*, .rodata*)
libc.a: (.text*, .rodata*)
*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 {
*rtl8195a_crypto.o(.data*)
*mbedtls*.o(.data*)
libc.a: (.data*)
*rtl8195a_crypto.o(+RW)
;*mbedtls*.o(+RW)
*libc.a (+RW)
*(.sdram.data*)
*lib_peripheral_mbed_arm.ar (+RW)
}
RW_IRAM2 +0 UNINIT FIXED {
*rtl8195a_crypto.o(.bss*, COMMON)
*mbedtls*.o(.bss*, COMMON)
libc.a: (.bss*, COMMON)
*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 0x200000 {
ER_DRAM +0 FIXED {

View File

@ -125,9 +125,9 @@ void __TRAP_HardFaultHandler_Patch(uint32_t addr)
* 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
* 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),
* 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,
* So the register value is un-predictable.
@ -202,6 +202,9 @@ void PLAT_Start(void)
#else
TRAP_OverrideTable(0x1FFFFFFC);
#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);
SystemCoreClockUpdate();

View File

@ -15,7 +15,7 @@
#define _RTL8195A_TIMER_H_
#define TIMER_TICK_US 31
#define TIMER_TICK_US 32
#define TIMER_LOAD_COUNT_OFF 0x00
#define TIMER_CURRENT_VAL_OFF 0x04

View File

@ -107,7 +107,7 @@
#if defined(CONFIG_PLATFORM_AMEBA_X)
#if !defined(CONFIG_PLATFORM_8711B)
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
#define CONFIG_USE_TCM_HEAP 0 /* USE TCM HEAP */
#endif
#define CONFIG_RECV_TASKLET_THREAD
#define CONFIG_XMIT_TASKLET_THREAD

View File

@ -32,7 +32,7 @@ extern "C" {
#if defined(CONFIG_PLATFORM_8195A)
#ifndef CONFIG_USE_TCM_HEAP
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
#define CONFIG_USE_TCM_HEAP 0 /* USE TCM HEAP */
#endif
#define USE_MUTEX_FOR_SPINLOCK 1
#endif

View File

@ -77,21 +77,22 @@ uint32_t us_ticker_read()
void us_ticker_set_interrupt(timestamp_t timestamp)
{
uint32_t cur_time_us;
uint32_t time_def;
uint32_t time_dif;
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
cur_time_us = us_ticker_read();
if ((uint32_t)timestamp >= cur_time_us) {
time_def = (uint32_t)timestamp - cur_time_us;
if ((uint32_t)timestamp > cur_time_us) {
time_dif = (uint32_t)timestamp - cur_time_us;
} 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) {
time_def = TIMER_TICK_US; // at least 1 tick
}
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_def);
TimerAdapter.TimerLoadValueUs = time_dif;
HalTimerOpExt.HalTimerReLoad((u32)TimerAdapter.TimerId, time_dif / TIMER_TICK_US);
HalTimerOpExt.HalTimerIrqEn((u32)TimerAdapter.TimerId);
HalTimerOp.HalTimerEn((u32)TimerAdapter.TimerId);