Skip to content

Commit 9a1ffdd

Browse files
authored
Merge pull request #11330 from tung7970/fix-ameba
RTL8195AM - resuscitate AMEBA GCC/ARMCC support
2 parents a924c02 + 16e52f2 commit 9a1ffdd

File tree

9 files changed

+20
-164
lines changed

9 files changed

+20
-164
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_GCC_ARM/rtl8195a.ld

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ SECTIONS
107107
} > SRAM2
108108
__etext = .;
109109

110-
__data_start__ = .;
111-
112110
.data.sram1 :
113111
{
114-
. = ALIGN(8);
112+
. = ALIGN(4);
113+
__data_start__ = .;
115114
__sram_data_start__ = .;
116115
*rtl8195a_crypto*.o (.data*)
117116
*mbedtls*.o (.data*)
117+
__data_end__ = .;
118118
__sram_data_end__ = .;
119119
} > SRAM1
120120

121121
.data.sram2 :
122122
{
123-
__sdram_data_start__ = .;
123+
__dram_data_start__ = .;
124124
*(vtable)
125125
*(.data*)
126126
*(.sdram.data*)
@@ -145,12 +145,8 @@ SECTIONS
145145
KEEP(*(.fini_array))
146146
PROVIDE (__fini_array_end = .);
147147

148-
. = ALIGN(8);
149-
150-
__sdram_data_end__ = .;
151-
/* All data end */
148+
__dram_data_end__ = .;
152149
} > SRAM2
153-
__data_end__ = .;
154150
__image2_end__ = .;
155151

156152
.ARM.extab :
@@ -167,24 +163,24 @@ SECTIONS
167163

168164
.bss.sram1 (NOLOAD) :
169165
{
166+
__bss_start__ = .;
170167
__bss_sram_start__ = .;
171168
*rtl8195a_crypto*.o (.bss* COMMON)
172169
*mbedtls*.o (.bss* COMMON)
173170
*(.bss.thread_stack_main)
174171
*lib_peripheral_mbed_gcc.a: (.bss* COMMON)
175172
*mbed_boot*.o (.bss* COMMON)
176173
__bss_sram_end__ = .;
174+
__bss_end__ = .;
177175
} > SRAM1
178176

179177
.bss.sram2 (NOLOAD) :
180178
{
181-
__bss_start__ = .;
182179
__bss_dram_start__ = .;
183180
*(.bss*)
184181
*(COMMON)
185182
*(.bdsram.data*)
186183
__bss_dram_end__ = .;
187-
__bss_end__ = .;
188184
} > SRAM2
189185

190186
.bf_data :
@@ -199,7 +195,7 @@ SECTIONS
199195
__end__ = .;
200196
end = __end__;
201197
*(.heap*)
202-
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
198+
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
203199
__HeapLimit = .;
204200
} > SRAM1
205201

@@ -219,7 +215,7 @@ SECTIONS
219215
{
220216
__StackLimit = .;
221217
*(.stack)
222-
. += StackSize - (. - __StackLimit);
218+
. += StackSize - (. - __StackLimit);
223219
} > SRAM1
224220

225221
/* Set stack top to end of RAM, and stack limit move down by
@@ -228,6 +224,9 @@ SECTIONS
228224
__StackLimit = __StackTop - StackSize;
229225
PROVIDE(__stack = __StackTop);
230226

227+
/* Check if reserved stack size is too small */
228+
ASSERT(StackSize >= SIZEOF(.stack_dummy), "reserved stack size is too small")
229+
231230
/* Check if data + heap + stack exceeds RAM limit */
232231
ASSERT(__StackLimit >= __HeapLimit, "region RAM exceeds ram limit")
233232
}

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/i2c_api.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,6 @@
2828

2929
#ifdef CONFIG_MBED_ENABLED
3030
#include "PeripheralPins.h"
31-
#else
32-
static const PinMap PinMap_I2C_SDA[] = {
33-
{PD_4, RTL_PIN_PERI(I2C0, 0, S0), RTL_PIN_FUNC(I2C0, S0)},
34-
{PH_1, RTL_PIN_PERI(I2C0, 0, S1), RTL_PIN_FUNC(I2C0, S1)},
35-
{PC_8, RTL_PIN_PERI(I2C0, 0, S2), RTL_PIN_FUNC(I2C0, S2)},
36-
{PE_7, RTL_PIN_PERI(I2C0, 0, S3), RTL_PIN_FUNC(I2C0, S3)},
37-
38-
{PC_4, RTL_PIN_PERI(I2C1, 1, S0), RTL_PIN_FUNC(I2C1, S0)},
39-
{PH_3, RTL_PIN_PERI(I2C1, 1, S1), RTL_PIN_FUNC(I2C1, S1)},
40-
{PD_7, RTL_PIN_PERI(I2C1, 1, S2), RTL_PIN_FUNC(I2C1, S2)},
41-
42-
{PB_7, RTL_PIN_PERI(I2C2, 2, S0), RTL_PIN_FUNC(I2C2, S0)},
43-
{PE_1, RTL_PIN_PERI(I2C2, 2, S1), RTL_PIN_FUNC(I2C2, S1)},
44-
{PC_7, RTL_PIN_PERI(I2C2, 2, S2), RTL_PIN_FUNC(I2C2, S2)},
45-
46-
{PB_3, RTL_PIN_PERI(I2C3, 3, S0), RTL_PIN_FUNC(I2C3, S0)},
47-
{PE_3, RTL_PIN_PERI(I2C3, 3, S1), RTL_PIN_FUNC(I2C3, S1)},
48-
{PE_5, RTL_PIN_PERI(I2C3, 3, S2), RTL_PIN_FUNC(I2C3, S2)},
49-
{PD_9, RTL_PIN_PERI(I2C3, 3, S3), RTL_PIN_FUNC(I2C3, S3)},
50-
51-
{NC, NC, 0}
52-
};
53-
54-
static const PinMap PinMap_I2C_SCL[] = {
55-
{PD_5, RTL_PIN_PERI(I2C0, 0, S0), RTL_PIN_FUNC(I2C0, S0)},
56-
{PH_0, RTL_PIN_PERI(I2C0, 0, S1), RTL_PIN_FUNC(I2C0, S1)},
57-
{PC_9, RTL_PIN_PERI(I2C0, 0, S2), RTL_PIN_FUNC(I2C0, S2)},
58-
{PE_6, RTL_PIN_PERI(I2C0, 0, S3), RTL_PIN_FUNC(I2C0, S3)},
59-
60-
{PC_5, RTL_PIN_PERI(I2C1, 1, S0), RTL_PIN_FUNC(I2C1, S0)},
61-
{PH_2, RTL_PIN_PERI(I2C1, 1, S1), RTL_PIN_FUNC(I2C1, S1)},
62-
{PD_6, RTL_PIN_PERI(I2C1, 1, S2), RTL_PIN_FUNC(I2C1, S2)},
63-
64-
{PB_6, RTL_PIN_PERI(I2C2, 2, S0), RTL_PIN_FUNC(I2C2, S0)},
65-
{PE_0, RTL_PIN_PERI(I2C2, 2, S1), RTL_PIN_FUNC(I2C2, S1)},
66-
{PC_6, RTL_PIN_PERI(I2C2, 2, S2), RTL_PIN_FUNC(I2C2, S2)},
67-
68-
{PB_2, RTL_PIN_PERI(I2C3, 3, S0), RTL_PIN_FUNC(I2C3, S0)},
69-
{PE_2, RTL_PIN_PERI(I2C3, 3, S1), RTL_PIN_FUNC(I2C3, S1)},
70-
{PE_4, RTL_PIN_PERI(I2C3, 3, S2), RTL_PIN_FUNC(I2C3, S2)},
71-
{PD_8, RTL_PIN_PERI(I2C3, 3, S3), RTL_PIN_FUNC(I2C3, S3)},
72-
73-
{NC, NC, 0}
74-
};
7531
#endif
7632

7733
static int address_save_int[4];

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/pwmout_api.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,6 @@
2929

3030
#ifdef CONFIG_MBED_ENABLED
3131
#include "PeripheralPins.h"
32-
#else
33-
static const PinMap PinMap_PWM[] = {
34-
{PB_4, RTL_PIN_PERI(PWM0, 0, S0), RTL_PIN_FUNC(PWM0, S0)},
35-
{PB_5, RTL_PIN_PERI(PWM1, 1, S0), RTL_PIN_FUNC(PWM1, S0)},
36-
{PB_6, RTL_PIN_PERI(PWM2, 2, S0), RTL_PIN_FUNC(PWM2, S0)},
37-
{PB_7, RTL_PIN_PERI(PWM3, 3, S0), RTL_PIN_FUNC(PWM3, S0)},
38-
39-
{PC_0, RTL_PIN_PERI(PWM0, 0, S1), RTL_PIN_FUNC(PWM0, S1)},
40-
{PC_1, RTL_PIN_PERI(PWM1, 1, S1), RTL_PIN_FUNC(PWM1, S1)},
41-
{PC_2, RTL_PIN_PERI(PWM2, 2, S1), RTL_PIN_FUNC(PWM2, S1)},
42-
{PC_3, RTL_PIN_PERI(PWM3, 3, S1), RTL_PIN_FUNC(PWM3, S1)},
43-
44-
{PD_3, RTL_PIN_PERI(PWM0, 0, S2), RTL_PIN_FUNC(PWM0, S2)},
45-
{PD_4, RTL_PIN_PERI(PWM1, 1, S2), RTL_PIN_FUNC(PWM1, S2)},
46-
{PD_5, RTL_PIN_PERI(PWM2, 2, S2), RTL_PIN_FUNC(PWM2, S2)},
47-
{PD_6, RTL_PIN_PERI(PWM3, 3, S2), RTL_PIN_FUNC(PWM3, S2)},
48-
49-
{PE_0, RTL_PIN_PERI(PWM0, 0, S3), RTL_PIN_FUNC(PWM0, S3)},
50-
{PE_1, RTL_PIN_PERI(PWM1, 1, S3), RTL_PIN_FUNC(PWM1, S3)},
51-
{PE_2, RTL_PIN_PERI(PWM2, 2, S3), RTL_PIN_FUNC(PWM2, S3)},
52-
{PE_3, RTL_PIN_PERI(PWM3, 3, S3), RTL_PIN_FUNC(PWM3, S3)},
53-
54-
{NC, NC, 0}
55-
};
5632
#endif
5733

5834
void pwmout_init(pwmout_t* obj, PinName pin)

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/serial_api.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,6 @@
2929

3030
#ifdef CONFIG_MBED_ENABLED
3131
#include "PeripheralPins.h"
32-
#else
33-
static const PinMap PinMap_UART_TX[] = {
34-
{PC_3, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
35-
{PE_0, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
36-
{PA_7, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)},
37-
{PD_3, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)},
38-
{PE_4, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)},
39-
{PB_5, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)},
40-
{PA_4, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
41-
{PC_9, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)},
42-
{PD_7, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)},
43-
{PB_0, RTL_PIN_PERI(LOG_UART, 3, S0), RTL_PIN_FUNC(LOG_UART, S0)},
44-
{NC, NC, 0}
45-
};
46-
47-
static const PinMap PinMap_UART_RX[] = {
48-
{PC_0, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
49-
{PE_3, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
50-
{PA_6, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)},
51-
{PD_0, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)},
52-
{PE_7, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)},
53-
{PB_4, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)},
54-
{PA_0, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
55-
{PC_6, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)},
56-
{PD_4, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)},
57-
{PB_1, RTL_PIN_PERI(LOG_UART, 3, S0), RTL_PIN_FUNC(LOG_UART, S0)},
58-
{NC, NC, 0}
59-
};
6032
#endif
6133

6234
#define UART_NUM (3)

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/spi_api.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -43,55 +43,6 @@ extern const DW_SSI_DEFAULT_SETTING SpiDefaultSetting;
4343

4444
#ifdef CONFIG_MBED_ENABLED
4545
#include "PeripheralPins.h"
46-
#else
47-
static const PinMap PinMap_SSI_MOSI[] = {
48-
{PE_2, RTL_PIN_PERI(SPI0, 0, S0), RTL_PIN_FUNC(SPI0, S0)},
49-
{PC_2, RTL_PIN_PERI(SPI0, 0, S1), RTL_PIN_FUNC(SPI0, S1)},
50-
{PA_1, RTL_PIN_PERI(SPI1, 1, S0), RTL_PIN_FUNC(SPI1, S0)},
51-
{PB_6, RTL_PIN_PERI(SPI1, 1, S1), RTL_PIN_FUNC(SPI1, S1)},
52-
{PD_6, RTL_PIN_PERI(SPI1, 1, S2), RTL_PIN_FUNC(SPI1, S2)},
53-
{PG_2, RTL_PIN_PERI(SPI2, 2, S0), RTL_PIN_FUNC(SPI2, S0)},
54-
{PE_6, RTL_PIN_PERI(SPI2, 2, S1), RTL_PIN_FUNC(SPI2, S1)},
55-
{PD_2, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
56-
{NC, NC, 0}
57-
};
58-
59-
static const PinMap PinMap_SSI_MISO[] = {
60-
{PE_3, RTL_PIN_PERI(SPI0, 0, S0), RTL_PIN_FUNC(SPI0, S0)},
61-
{PC_3, RTL_PIN_PERI(SPI0, 0, S1), RTL_PIN_FUNC(SPI0, S1)},
62-
{PA_0, RTL_PIN_PERI(SPI1, 1, S0), RTL_PIN_FUNC(SPI1, S0)},
63-
{PB_7, RTL_PIN_PERI(SPI1, 1, S1), RTL_PIN_FUNC(SPI1, S1)},
64-
{PD_7, RTL_PIN_PERI(SPI1, 1, S2), RTL_PIN_FUNC(SPI1, S2)},
65-
{PG_3, RTL_PIN_PERI(SPI2, 2, S0), RTL_PIN_FUNC(SPI2, S0)},
66-
{PE_7, RTL_PIN_PERI(SPI2, 2, S1), RTL_PIN_FUNC(SPI2, S1)},
67-
{PD_3, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
68-
{NC, NC, 0}
69-
};
70-
71-
// For testing only
72-
static const PinMap PinMap_SSI_SCLK[] = {
73-
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
74-
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
75-
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
76-
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
77-
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
78-
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
79-
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
80-
81-
{NC, NC, 0}
82-
};
83-
84-
// For testing only
85-
static const PinMap PinMap_SSI_SSEL[] = {
86-
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
87-
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
88-
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
89-
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
90-
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
91-
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
92-
93-
{NC, NC, 0}
94-
};
9546
#endif
9647

9748
void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)

targets/TARGET_Realtek/TARGET_AMEBA/sdk/os/cmsis_rtos/cmsis_rtos_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ _WEAK void xPortSysTickHandler(void)
12121212
printf("%s: Should not come over here!\r\n", __func__);
12131213
}
12141214

1215-
_WEAK u8 __ram_start_table_start__[];
1215+
_WEAK u8 *__ram_start_table_start__;
12161216

12171217
_WEAK void rtw_odm_acquirespinlock(void * adapter, int type)
12181218
{

targets/TARGET_Realtek/TARGET_AMEBA/sdk/os/os_dep/osdep_service.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,11 @@ void add_mem_usage(_list *pmem_table, void *ptr, int size, int *used_num, int fl
208208
return;
209209
}
210210
else{
211-
if(flag == MEM_MONITOR_FLAG_WPAS)
211+
if(flag == MEM_MONITOR_FLAG_WPAS) {
212212
DBG_INFO("Alloc memory at %p with size of %d", ptr, size);
213-
else
213+
} else {
214214
DBG_INFO("Alloc memory at %p with size of %d", ptr, size);
215+
}
215216
}
216217
#if CONFIG_MEM_MONITOR & MEM_MONITOR_LEAK
217218
mem_entry = (struct mem_entry *) _rtw_malloc(sizeof(struct mem_entry));

targets/TARGET_Realtek/TARGET_AMEBA/sdk/os/os_dep/tcm_heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void tcm_heap_dump(void)
6767
chunk;
6868
prev = chunk, chunk = chunk->next)
6969
{
70-
printf(" prev %x, chunk %x, size %d \n\r", prev, chunk, chunk->size);
70+
printf(" prev %p, chunk %p, size %d \n\r", prev, chunk, chunk->size);
7171
}
7272
printf("--------------\n\r");
7373
}

targets/targets.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7879,13 +7879,14 @@
78797879
"SERIAL",
78807880
"SPI",
78817881
"TRNG",
7882-
"FLASH"
7882+
"FLASH",
7883+
"USTICKER"
78837884
],
78847885
"public": false,
78857886
"supported_toolchains": ["GCC_ARM", "ARM"],
78867887
"post_binary_hook": {
78877888
"function": "RTL8195ACode.binary_hook",
7888-
"toolchains": ["ARM_STD", "GCC_ARM", "IAR"]
7889+
"toolchains": ["ARM_STD", "GCC_ARM"]
78897890
},
78907891
"release_versions": [],
78917892
"overrides": {

0 commit comments

Comments
 (0)