Skip to content

RTL8195AM - resuscitate AMEBA GCC/ARMCC support #11330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,20 @@ SECTIONS
} > SRAM2
__etext = .;

__data_start__ = .;

.data.sram1 :
{
. = ALIGN(8);
. = ALIGN(4);
__data_start__ = .;
__sram_data_start__ = .;
*rtl8195a_crypto*.o (.data*)
*mbedtls*.o (.data*)
__data_end__ = .;
__sram_data_end__ = .;
} > SRAM1

.data.sram2 :
{
__sdram_data_start__ = .;
__dram_data_start__ = .;
*(vtable)
*(.data*)
*(.sdram.data*)
Expand All @@ -145,12 +145,8 @@ SECTIONS
KEEP(*(.fini_array))
PROVIDE (__fini_array_end = .);

. = ALIGN(8);

__sdram_data_end__ = .;
/* All data end */
__dram_data_end__ = .;
} > SRAM2
__data_end__ = .;
__image2_end__ = .;

.ARM.extab :
Expand All @@ -167,24 +163,24 @@ SECTIONS

.bss.sram1 (NOLOAD) :
{
__bss_start__ = .;
__bss_sram_start__ = .;
*rtl8195a_crypto*.o (.bss* COMMON)
*mbedtls*.o (.bss* COMMON)
*(.bss.thread_stack_main)
*lib_peripheral_mbed_gcc.a: (.bss* COMMON)
*mbed_boot*.o (.bss* COMMON)
__bss_sram_end__ = .;
__bss_end__ = .;
} > SRAM1

.bss.sram2 (NOLOAD) :
{
__bss_start__ = .;
__bss_dram_start__ = .;
*(.bss*)
*(COMMON)
*(.bdsram.data*)
__bss_dram_end__ = .;
__bss_end__ = .;
} > SRAM2

.bf_data :
Expand All @@ -199,7 +195,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
__HeapLimit = .;
} > SRAM1

Expand All @@ -219,7 +215,7 @@ SECTIONS
{
__StackLimit = .;
*(.stack)
. += StackSize - (. - __StackLimit);
. += StackSize - (. - __StackLimit);
} > SRAM1

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

/* Check if reserved stack size is too small */
ASSERT(StackSize >= SIZEOF(.stack_dummy), "reserved stack size is too small")

/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM exceeds ram limit")
}
44 changes: 0 additions & 44 deletions targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,6 @@

#ifdef CONFIG_MBED_ENABLED
#include "PeripheralPins.h"
#else
static const PinMap PinMap_I2C_SDA[] = {
{PD_4, RTL_PIN_PERI(I2C0, 0, S0), RTL_PIN_FUNC(I2C0, S0)},
{PH_1, RTL_PIN_PERI(I2C0, 0, S1), RTL_PIN_FUNC(I2C0, S1)},
{PC_8, RTL_PIN_PERI(I2C0, 0, S2), RTL_PIN_FUNC(I2C0, S2)},
{PE_7, RTL_PIN_PERI(I2C0, 0, S3), RTL_PIN_FUNC(I2C0, S3)},

{PC_4, RTL_PIN_PERI(I2C1, 1, S0), RTL_PIN_FUNC(I2C1, S0)},
{PH_3, RTL_PIN_PERI(I2C1, 1, S1), RTL_PIN_FUNC(I2C1, S1)},
{PD_7, RTL_PIN_PERI(I2C1, 1, S2), RTL_PIN_FUNC(I2C1, S2)},

{PB_7, RTL_PIN_PERI(I2C2, 2, S0), RTL_PIN_FUNC(I2C2, S0)},
{PE_1, RTL_PIN_PERI(I2C2, 2, S1), RTL_PIN_FUNC(I2C2, S1)},
{PC_7, RTL_PIN_PERI(I2C2, 2, S2), RTL_PIN_FUNC(I2C2, S2)},

{PB_3, RTL_PIN_PERI(I2C3, 3, S0), RTL_PIN_FUNC(I2C3, S0)},
{PE_3, RTL_PIN_PERI(I2C3, 3, S1), RTL_PIN_FUNC(I2C3, S1)},
{PE_5, RTL_PIN_PERI(I2C3, 3, S2), RTL_PIN_FUNC(I2C3, S2)},
{PD_9, RTL_PIN_PERI(I2C3, 3, S3), RTL_PIN_FUNC(I2C3, S3)},

{NC, NC, 0}
};

static const PinMap PinMap_I2C_SCL[] = {
{PD_5, RTL_PIN_PERI(I2C0, 0, S0), RTL_PIN_FUNC(I2C0, S0)},
{PH_0, RTL_PIN_PERI(I2C0, 0, S1), RTL_PIN_FUNC(I2C0, S1)},
{PC_9, RTL_PIN_PERI(I2C0, 0, S2), RTL_PIN_FUNC(I2C0, S2)},
{PE_6, RTL_PIN_PERI(I2C0, 0, S3), RTL_PIN_FUNC(I2C0, S3)},

{PC_5, RTL_PIN_PERI(I2C1, 1, S0), RTL_PIN_FUNC(I2C1, S0)},
{PH_2, RTL_PIN_PERI(I2C1, 1, S1), RTL_PIN_FUNC(I2C1, S1)},
{PD_6, RTL_PIN_PERI(I2C1, 1, S2), RTL_PIN_FUNC(I2C1, S2)},

{PB_6, RTL_PIN_PERI(I2C2, 2, S0), RTL_PIN_FUNC(I2C2, S0)},
{PE_0, RTL_PIN_PERI(I2C2, 2, S1), RTL_PIN_FUNC(I2C2, S1)},
{PC_6, RTL_PIN_PERI(I2C2, 2, S2), RTL_PIN_FUNC(I2C2, S2)},

{PB_2, RTL_PIN_PERI(I2C3, 3, S0), RTL_PIN_FUNC(I2C3, S0)},
{PE_2, RTL_PIN_PERI(I2C3, 3, S1), RTL_PIN_FUNC(I2C3, S1)},
{PE_4, RTL_PIN_PERI(I2C3, 3, S2), RTL_PIN_FUNC(I2C3, S2)},
{PD_8, RTL_PIN_PERI(I2C3, 3, S3), RTL_PIN_FUNC(I2C3, S3)},

{NC, NC, 0}
};
#endif

static int address_save_int[4];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@

#ifdef CONFIG_MBED_ENABLED
#include "PeripheralPins.h"
#else
static const PinMap PinMap_PWM[] = {
{PB_4, RTL_PIN_PERI(PWM0, 0, S0), RTL_PIN_FUNC(PWM0, S0)},
{PB_5, RTL_PIN_PERI(PWM1, 1, S0), RTL_PIN_FUNC(PWM1, S0)},
{PB_6, RTL_PIN_PERI(PWM2, 2, S0), RTL_PIN_FUNC(PWM2, S0)},
{PB_7, RTL_PIN_PERI(PWM3, 3, S0), RTL_PIN_FUNC(PWM3, S0)},

{PC_0, RTL_PIN_PERI(PWM0, 0, S1), RTL_PIN_FUNC(PWM0, S1)},
{PC_1, RTL_PIN_PERI(PWM1, 1, S1), RTL_PIN_FUNC(PWM1, S1)},
{PC_2, RTL_PIN_PERI(PWM2, 2, S1), RTL_PIN_FUNC(PWM2, S1)},
{PC_3, RTL_PIN_PERI(PWM3, 3, S1), RTL_PIN_FUNC(PWM3, S1)},

{PD_3, RTL_PIN_PERI(PWM0, 0, S2), RTL_PIN_FUNC(PWM0, S2)},
{PD_4, RTL_PIN_PERI(PWM1, 1, S2), RTL_PIN_FUNC(PWM1, S2)},
{PD_5, RTL_PIN_PERI(PWM2, 2, S2), RTL_PIN_FUNC(PWM2, S2)},
{PD_6, RTL_PIN_PERI(PWM3, 3, S2), RTL_PIN_FUNC(PWM3, S2)},

{PE_0, RTL_PIN_PERI(PWM0, 0, S3), RTL_PIN_FUNC(PWM0, S3)},
{PE_1, RTL_PIN_PERI(PWM1, 1, S3), RTL_PIN_FUNC(PWM1, S3)},
{PE_2, RTL_PIN_PERI(PWM2, 2, S3), RTL_PIN_FUNC(PWM2, S3)},
{PE_3, RTL_PIN_PERI(PWM3, 3, S3), RTL_PIN_FUNC(PWM3, S3)},

{NC, NC, 0}
};
#endif

void pwmout_init(pwmout_t* obj, PinName pin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,6 @@

#ifdef CONFIG_MBED_ENABLED
#include "PeripheralPins.h"
#else
static const PinMap PinMap_UART_TX[] = {
{PC_3, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
{PE_0, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
{PA_7, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)},
{PD_3, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)},
{PE_4, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)},
{PB_5, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)},
{PA_4, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
{PC_9, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)},
{PD_7, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)},
{PB_0, RTL_PIN_PERI(LOG_UART, 3, S0), RTL_PIN_FUNC(LOG_UART, S0)},
{NC, NC, 0}
};

static const PinMap PinMap_UART_RX[] = {
{PC_0, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
{PE_3, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
{PA_6, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)},
{PD_0, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)},
{PE_7, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)},
{PB_4, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)},
{PA_0, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
{PC_6, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)},
{PD_4, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)},
{PB_1, RTL_PIN_PERI(LOG_UART, 3, S0), RTL_PIN_FUNC(LOG_UART, S0)},
{NC, NC, 0}
};
#endif

#define UART_NUM (3)
Expand Down
49 changes: 0 additions & 49 deletions targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/spi_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,55 +43,6 @@ extern const DW_SSI_DEFAULT_SETTING SpiDefaultSetting;

#ifdef CONFIG_MBED_ENABLED
#include "PeripheralPins.h"
#else
static const PinMap PinMap_SSI_MOSI[] = {
{PE_2, RTL_PIN_PERI(SPI0, 0, S0), RTL_PIN_FUNC(SPI0, S0)},
{PC_2, RTL_PIN_PERI(SPI0, 0, S1), RTL_PIN_FUNC(SPI0, S1)},
{PA_1, RTL_PIN_PERI(SPI1, 1, S0), RTL_PIN_FUNC(SPI1, S0)},
{PB_6, RTL_PIN_PERI(SPI1, 1, S1), RTL_PIN_FUNC(SPI1, S1)},
{PD_6, RTL_PIN_PERI(SPI1, 1, S2), RTL_PIN_FUNC(SPI1, S2)},
{PG_2, RTL_PIN_PERI(SPI2, 2, S0), RTL_PIN_FUNC(SPI2, S0)},
{PE_6, RTL_PIN_PERI(SPI2, 2, S1), RTL_PIN_FUNC(SPI2, S1)},
{PD_2, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
{NC, NC, 0}
};

static const PinMap PinMap_SSI_MISO[] = {
{PE_3, RTL_PIN_PERI(SPI0, 0, S0), RTL_PIN_FUNC(SPI0, S0)},
{PC_3, RTL_PIN_PERI(SPI0, 0, S1), RTL_PIN_FUNC(SPI0, S1)},
{PA_0, RTL_PIN_PERI(SPI1, 1, S0), RTL_PIN_FUNC(SPI1, S0)},
{PB_7, RTL_PIN_PERI(SPI1, 1, S1), RTL_PIN_FUNC(SPI1, S1)},
{PD_7, RTL_PIN_PERI(SPI1, 1, S2), RTL_PIN_FUNC(SPI1, S2)},
{PG_3, RTL_PIN_PERI(SPI2, 2, S0), RTL_PIN_FUNC(SPI2, S0)},
{PE_7, RTL_PIN_PERI(SPI2, 2, S1), RTL_PIN_FUNC(SPI2, S1)},
{PD_3, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
{NC, NC, 0}
};

// For testing only
static const PinMap PinMap_SSI_SCLK[] = {
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},

{NC, NC, 0}
};

// For testing only
static const PinMap PinMap_SSI_SSEL[] = {
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},

{NC, NC, 0}
};
#endif

void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ _WEAK void xPortSysTickHandler(void)
printf("%s: Should not come over here!\r\n", __func__);
}

_WEAK u8 __ram_start_table_start__[];
_WEAK u8 *__ram_start_table_start__;

_WEAK void rtw_odm_acquirespinlock(void * adapter, int type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,11 @@ void add_mem_usage(_list *pmem_table, void *ptr, int size, int *used_num, int fl
return;
}
else{
if(flag == MEM_MONITOR_FLAG_WPAS)
if(flag == MEM_MONITOR_FLAG_WPAS) {
DBG_INFO("Alloc memory at %p with size of %d", ptr, size);
else
} else {
DBG_INFO("Alloc memory at %p with size of %d", ptr, size);
}
}
#if CONFIG_MEM_MONITOR & MEM_MONITOR_LEAK
mem_entry = (struct mem_entry *) _rtw_malloc(sizeof(struct mem_entry));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void tcm_heap_dump(void)
chunk;
prev = chunk, chunk = chunk->next)
{
printf(" prev %x, chunk %x, size %d \n\r", prev, chunk, chunk->size);
printf(" prev %p, chunk %p, size %d \n\r", prev, chunk, chunk->size);
}
printf("--------------\n\r");
}
Expand Down
5 changes: 3 additions & 2 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7826,13 +7826,14 @@
"SERIAL",
"SPI",
"TRNG",
"FLASH"
"FLASH",
"USTICKER"
],
"public": false,
"supported_toolchains": ["GCC_ARM", "ARM"],
"post_binary_hook": {
"function": "RTL8195ACode.binary_hook",
"toolchains": ["ARM_STD", "GCC_ARM", "IAR"]
"toolchains": ["ARM_STD", "GCC_ARM"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IAR should be also enabled to have "5" in the versions below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit "disable IAR" without having a reason is not sufficient - please add more details there.

Copy link
Contributor Author

@tung7970 tung7970 Aug 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is to bring back basic RTL8195AM support, at least for GCC and ARMCC. IAR will have to be disabled until its HAL library is upgraded to IAR8.

See issue #11232

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, therefore 5 version should be still disabled (not being added in this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove that patch, and add details to disable IAR patch. But, users will have to manually add 5 to the release version to enable RTL8195AM support.

},
"release_versions": [],
"overrides": {
Expand Down