This commit is contained in:
pvvx 2017-12-28 18:44:55 +03:00
parent 8c8b03208e
commit 8e26e8ec8d
24 changed files with 2592 additions and 2483 deletions

View file

@ -415,6 +415,7 @@ void log_service(void *param)
#if CONFIG_INIC_EN #if CONFIG_INIC_EN
inic_cmd_ioctl = 0; inic_cmd_ioctl = 0;
#endif #endif
extern int tcm_heap_freeSpace(void);
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r[MEM] After do cmd, available heap %d+%d\n\r", xPortGetFreeHeapSize(), tcm_heap_freeSpace()); _AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r[MEM] After do cmd, available heap %d+%d\n\r", xPortGetFreeHeapSize(), tcm_heap_freeSpace());
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\r\n\n# "); //"#" is needed for mp tool _AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\r\n\n# "); //"#" is needed for mp tool
#if CONFIG_EXAMPLE_UART_ATCMD #if CONFIG_EXAMPLE_UART_ATCMD
@ -493,5 +494,5 @@ void at_log_init(void)
{ {
log_service_add_table(at_log_items, sizeof(at_log_items)/sizeof(at_log_items[0])); log_service_add_table(at_log_items, sizeof(at_log_items)/sizeof(at_log_items[0]));
} }
log_module_init(at_log_init); //log_module_init(at_log_init);
#endif #endif

View file

@ -634,12 +634,39 @@ int wifi_is_ready_to_transceive(rtw_interface_t interface) {
} }
return RTW_ERROR; return RTW_ERROR;
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
int wifi_set_mac_address(char * mac) { int mactostr(char * s, unsigned char *mac, bool fmt)
char buf[13 + 17 + 1]; {
rtw_memset(buf, 0, sizeof(buf)); char *ptrb = s;
snprintf(buf, 13 + 17, "write_mac %s", mac); unsigned char *ptrm = mac;
int i = 6;
while(i--) {
unsigned char x = ptrm[0] >> 4;
if (x <= 9) ptrb[0] = x + '0';
else ptrb[0] = x - 10 + 'a';
ptrb++;
x = ptrm[0] & 0x0f;
if (x <= 9) ptrb[0] = x + '0';
else ptrb[0] = x - 10 + 'a';
ptrb++;
ptrm++;
if(fmt && i) {
ptrb[0] = ':';
ptrb++;
}
};
*ptrb = '\0';
if (fmt) return 12+5;
return 12;
}
//----------------------------------------------------------------------------//
int wifi_set_mac_address(char * new_mac) {
// char buf[13 + 17 + 1];
char buf[10 + 12 + 1];
memcpy(buf,"write_mac ", 10);
// snprintf(buf, 13 + 17, "write_mac %s", mac);
//BAG NotWork! rtl_sprintf(buf, "write_mac %02x%02x%02x%02x%02x%02x", new_mac[0], new_mac[1], new_mac[2], new_mac[3], new_mac[4], new_mac[5]);
mactostr(&buf[10], new_mac, false);
return wext_private_command(WLAN0_NAME, buf, SHOW_PRIVATE_OUT); return wext_private_command(WLAN0_NAME, buf, SHOW_PRIVATE_OUT);
} }
@ -656,6 +683,7 @@ int wifi_get_mac_address(char * mac) {
return ret; return ret;
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
int wifi_enable_powersave(void) { int wifi_enable_powersave(void) {
return wext_enable_powersave(WLAN0_NAME, 1, 1); return wext_enable_powersave(WLAN0_NAME, 1, 1);

View file

@ -703,6 +703,8 @@ int wifi_disable_packet_filter(unsigned char filter_id);
int wifi_remove_packet_filter(unsigned char filter_id); int wifi_remove_packet_filter(unsigned char filter_id);
#endif #endif
int mactostr(char * s, unsigned char *mac, bool fmt);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -280,8 +280,9 @@ int SC_send_simple_config_ack(u8 round)
#endif #endif
} }
} }
#if LEAVE_ACK_EARLY
leave_ack: leave_ack:
#endif
close(ack_socket); close(ack_socket);
#endif #endif
@ -296,7 +297,6 @@ leave_ack:
static int SC_check_and_show_connection_info(void) static int SC_check_and_show_connection_info(void)
{ {
rtw_wifi_setting_t setting;
int ret = -1; int ret = -1;
#if CONFIG_LWIP_LAYER #if CONFIG_LWIP_LAYER
@ -308,6 +308,7 @@ static int SC_check_and_show_connection_info(void)
#endif #endif
#if CONFIG_EXAMPLE_UART_ATCMD == 0 #if CONFIG_EXAMPLE_UART_ATCMD == 0
rtw_wifi_setting_t setting;
wifi_get_setting(WLAN0_NAME, &setting); wifi_get_setting(WLAN0_NAME, &setting);
wifi_show_setting(WLAN0_NAME, &setting); wifi_show_setting(WLAN0_NAME, &setting);
#endif #endif
@ -614,7 +615,7 @@ int SC_connect_to_candidate_AP (rtw_network_info_t *wifi){
} }
/* call wifi scan to scan */ /* call wifi scan to scan */
if(scan_cnt = (wifi_scan(RTW_SCAN_TYPE_ACTIVE, RTW_BSS_TYPE_ANY, &scan_buf)) < 0){ if((scan_cnt = (wifi_scan(RTW_SCAN_TYPE_ACTIVE, RTW_BSS_TYPE_ANY, &scan_buf))) < 0){
printf("ERROR: wifi scan failed\n"); printf("ERROR: wifi scan failed\n");
ret = RTW_ERROR; ret = RTW_ERROR;
}else{ }else{
@ -704,7 +705,7 @@ enum sc_result SC_connect_to_AP(void)
wifi.key_id, wifi.key_id,
NULL); NULL);
if (ret == RTW_SUCCESS) if (ret == 0)
goto wifi_connect_success; goto wifi_connect_success;
if (retry == max_retry) { if (retry == max_retry) {
@ -718,7 +719,7 @@ enum sc_result SC_connect_to_AP(void)
#if 1 #if 1
/* when optimization fail: if connect with bssid fail because of we have connect to the wrong AP */ /* when optimization fail: if connect with bssid fail because of we have connect to the wrong AP */
ret = SC_connect_to_candidate_AP(&wifi); ret = SC_connect_to_candidate_AP(&wifi);
if (RTW_SUCCESS == ret) { if (ret == 0) {
goto wifi_connect_success; goto wifi_connect_success;
} else { } else {
ret = SC_JOIN_BSS_FAIL; ret = SC_JOIN_BSS_FAIL;
@ -769,15 +770,15 @@ extern void rtk_sc_deinit(void);
void init_simple_config_lib_config(struct simple_config_lib_config* config) void init_simple_config_lib_config(struct simple_config_lib_config* config)
{ {
config->free = rtw_mfree; config->free = (simple_config_free_fn) rtw_mfree;
config->malloc = rtw_malloc; config->malloc = (simple_config_malloc_fn) rtw_malloc;
config->memcmp = memcmp; config->memcmp = memcmp;
config->memcpy = memcpy; config->memcpy = memcpy;
config->memset = memset; config->memset = (simple_config_memset_fn) memset;
config->printf = printf; config->printf = printf;
config->strcpy = strcpy; config->strcpy = strcpy;
config->strlen = strlen; config->strlen = strlen;
config->zmalloc = rtw_zmalloc; config->zmalloc = (simple_config_zmalloc_fn) rtw_zmalloc;
#if CONFIG_LWIP_LAYER #if CONFIG_LWIP_LAYER
config->_ntohl = lwip_ntohl; config->_ntohl = lwip_ntohl;
#else #else

View file

@ -280,14 +280,14 @@ int uartadapter_uart_open(ua_socket_t *ua_socket, ua_uart_set_str *puartpara)
serial_rx_fifo_level(&ua_socket->uart.uart_sobj, FifoLvHalf); serial_rx_fifo_level(&ua_socket->uart.uart_sobj, FifoLvHalf);
//---------------------------- add Flow //---------------------------- add Flow
#define rxflow UA_UART_RTS_PIN // #define rxflow UA_UART_RTS_PIN
#define txflow UA_UART_CTS_PIN // #define txflow UA_UART_CTS_PIN
if(puartpara->FlowControl){ if(puartpara->FlowControl){
pin_mode(txflow, PullDown); // init CTS in low pin_mode(txflow, PullDown); // init CTS in low
serial_set_flow_control(&ua_socket->uart.uart_sobj, FlowControlRTSCTS, rxflow, txflow); serial_set_flow_control(&ua_socket->uart.uart_sobj, FlowControlRTSCTS);//, rxflow, txflow);
} }
else else
serial_set_flow_control(&ua_socket->uart.uart_sobj, FlowControlNone, rxflow, txflow); serial_set_flow_control(&ua_socket->uart.uart_sobj, FlowControlNone);//, rxflow, txflow);
//---------------------------- add Flow //---------------------------- add Flow
/*uart irq handle*/ /*uart irq handle*/

View file

@ -269,10 +269,9 @@ int reset_uart_atcmd_setting(){
return 0; return 0;
} }
#if ATCMD_RX_GPIO_WAKEUP #ifdef UART_AT_RX_WAKE // UART_RX
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1) #if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
#include "gpio_irq_api.h" #include "gpio_irq_api.h"
#define UART_AT_RX_WAKE UART_RX
void gpio_uart_at_rx_irq_callback (uint32_t id, gpio_irq_event event) void gpio_uart_at_rx_irq_callback (uint32_t id, gpio_irq_event event)
{ {
/* PMU_LOGUART_DEVICE is also handled in log service. /* PMU_LOGUART_DEVICE is also handled in log service.
@ -289,7 +288,6 @@ void uart_at_rx_wakeup()
gpio_irq_enable(&gpio_rx_wake); gpio_irq_enable(&gpio_rx_wake);
} }
#endif #endif
#endif
void uart_atcmd_reinit(UART_LOG_CONF* uartconf){ void uart_atcmd_reinit(UART_LOG_CONF* uartconf){
serial_baud(&at_cmd_sobj,uartconf->BaudRate); serial_baud(&at_cmd_sobj,uartconf->BaudRate);
@ -297,14 +295,12 @@ void uart_atcmd_reinit(UART_LOG_CONF* uartconf){
// set flow control, only support RTS and CTS concurrent mode // set flow control, only support RTS and CTS concurrent mode
// rxflow and tx flow is fixed by hardware // rxflow and tx flow is fixed by hardware
#define rxflow UART_RTS
#define txflow UART_CTS
if(uartconf->FlowControl){ if(uartconf->FlowControl){
pin_mode(txflow, PullDown); //init CTS in low pin_mode(txflow, PullDown); //init CTS in low
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS, rxflow, txflow); serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS); // , rxflow, txflow);
} }
else else
serial_set_flow_control(&at_cmd_sobj, FlowControlNone, rxflow, txflow); serial_set_flow_control(&at_cmd_sobj, FlowControlNone); // , rxflow, txflow);
} }
void uart_at_send_string(char *str) void uart_at_send_string(char *str)
@ -532,10 +528,10 @@ void uart_atcmd_main(void)
#define txflow UART_CTS #define txflow UART_CTS
if(uartconf.FlowControl){ if(uartconf.FlowControl){
pin_mode(txflow, PullDown); //init CTS in low pin_mode(txflow, PullDown); //init CTS in low
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS, rxflow, txflow); serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS); //, rxflow, txflow);
} }
else else
serial_set_flow_control(&at_cmd_sobj, FlowControlNone, rxflow, txflow); serial_set_flow_control(&at_cmd_sobj, FlowControlNone); //, rxflow, txflow);
/*uart_at_lock_init();*/ /*uart_at_lock_init();*/
@ -550,7 +546,7 @@ void uart_atcmd_main(void)
serial_irq_handler(&at_cmd_sobj, uart_irq, (uint32_t)&at_cmd_sobj); serial_irq_handler(&at_cmd_sobj, uart_irq, (uint32_t)&at_cmd_sobj);
serial_irq_set(&at_cmd_sobj, RxIrq, 1); serial_irq_set(&at_cmd_sobj, RxIrq, 1);
#if ATCMD_RX_GPIO_WAKEUP #ifdef UART_AT_RX_WAKE
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1) #if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
uart_at_rx_wakeup(); uart_at_rx_wakeup();
#endif #endif

View file

@ -12,20 +12,48 @@
#include "semphr.h" #include "semphr.h"
/*UART Pinmux*/ /*UART Pinmux*/
#define CONFIG_AMEBA1 1 #if defined(RTL8710AF) && defined(RTL8711AM)
#if CONFIG_AMEBA1 #if 1
#define UART_TX PA_4 // RTL8711AM + RTL8710AF + RTL8195AM
#define UART_RX PA_0 #define UART_TX PE_0
#define UART_RTS PA_2 #define UART_RX PE_3
#define UART_CTS PA_1 #define UART_AT_RX_WAKE PE_3
#else #define UART_RTS PE_1
#define UART_TX PA_23 #define UART_CTS PE_2
#define UART_RX PA_18 #elif 0
#define UART_RTS PA_22 // RTL8711AM + RTL8710AF
#define UART_CTS PA_19 #define UART_TX PC_3
#define UART_RX PC_0 // no Interrupt!
//#define UART_AT_RX_WAKE PE_3
#define UART_RTS PC_2
#define UART_CTS PC_1
#elif 0
// RTL8711AM - RAK473
#define UART_TX PA_7
#define UART_RX PA_6 // no Interrupt!
//#define UART_RX_INT PE_3
#define UART_RTS PA_3
#define UART_CTS PA_5
#endif
#elif defined(RTL8710AF)
// RTL8710AF
#define UART_TX PA_4
#define UART_RX PA_0
#define UART_AT_RX_WAKE PA_0
#define UART_RTS PA_2
#define UART_CTS PA_1
#elif defined(RTL8711AM)
// RTL8711AM - RAK473
#define UART_TX PA_7
#define UART_RX PA_6 // no Interrupt!
//#define UART_AT_RX_WAKE PE_3
#define UART_RTS PA_3
#define UART_CTS PA_5
#endif #endif
#define ATCMD_RX_GPIO_WAKEUP 0
#define KEY_NL 0xa // '\n' #define KEY_NL 0xa // '\n'
#define KEY_ENTER 0xd // '\r' #define KEY_ENTER 0xd // '\r'
#define KEY_BS 0x8 #define KEY_BS 0x8

View file

@ -67,7 +67,7 @@ void serial_break_clear(serial_t *obj);
void serial_pinout_tx(PinName tx); void serial_pinout_tx(PinName tx);
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow); void serial_set_flow_control(serial_t *obj, FlowControl type); // , PinName rxflow, PinName txflow);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -47,6 +47,7 @@ int flash_set_extend_addr (flash_t * obj, uint32_t data);
int flash_get_extend_addr (flash_t * obj); int flash_get_extend_addr (flash_t * obj);
unsigned int flash_get_size (flash_t *obj); unsigned int flash_get_size (flash_t *obj);
int flash_otp_read (flash_t *obj, uint32_t address, uint32_t Length, uint8_t * data); int flash_otp_read (flash_t *obj, uint32_t address, uint32_t Length, uint8_t * data);
unsigned int flash_read_id (flash_t *obj);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -589,6 +589,27 @@ unsigned int flash_get_size(flash_t *obj) {
return flashchip_size; return flashchip_size;
} }
unsigned int flash_read_id(flash_t *obj)
{
flash_turnon();
/* Disable SPI_FLASH User Mode */
HAL_SPI_WRITE32(REG_SPIC_SSIENR, 0);
/* Set Ctrlr1; 1 byte data frames */
HAL_SPI_WRITE32(REG_SPIC_CTRLR1, BIT_NDF(3));
/* Send flash RX command and read the data */
SpicRxCmdRefinedRtl8195A(FLASH_CMD_RDID, obj->SpicInitPara);
unsigned int ret = HAL_SPI_READ32(REG_SPIC_DR0);
/* Disable SPI_FLASH User Mode */
HAL_SPI_WRITE32(REG_SPIC_SSIENR, 0);
SpicDisableRtl8195A();
return ret;
}
/* /*
* Read Flash OTP data * Read Flash OTP data
*/ */
@ -604,6 +625,7 @@ int flash_otp_read(flash_t *obj, uint32_t address, uint32_t Length,
switch (flashobj.SpicInitPara.flashtype) { switch (flashobj.SpicInitPara.flashtype) {
case FLASH_MXIC_4IO: case FLASH_MXIC_4IO:
case FLASH_MXIC: // Only 512 bits case FLASH_MXIC: // Only 512 bits
case FLASH_OTHERS:
#if CONFIG_DEBUG_LOG > 4 #if CONFIG_DEBUG_LOG > 4
DBG_SPIF_INFO("MXIC: Only 512 bits!\n"); DBG_SPIF_INFO("MXIC: Only 512 bits!\n");
#endif #endif
@ -629,9 +651,10 @@ int flash_otp_read(flash_t *obj, uint32_t address, uint32_t Length,
ret = 0; ret = 0;
break; break;
default: default:
DBG_8195A("Flash type?"); DBG_8195A("Flash type [%06x]?\n", flash_read_id(&flashobj));
ret = 0; ret = 0;
} }
SpicDisableRtl8195A(); SpicDisableRtl8195A();
return ret; return ret;
} }

View file

@ -438,7 +438,7 @@ void serial_recv_comp_handler(serial_t *obj, void *handler, uint32_t id)
pHalRuartAdapter->RxCompCbPara = (void*)id; pHalRuartAdapter->RxCompCbPara = (void*)id;
} }
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) void serial_set_flow_control(serial_t *obj, FlowControl type) // , PinName rxflow, PinName txflow)
{ {
PHAL_RUART_ADAPTER pHalRuartAdapter; PHAL_RUART_ADAPTER pHalRuartAdapter;

View file

@ -611,7 +611,7 @@ SpicReadIDRtl8195A(
SpicInitPara.flashtype = FLASH_MICRON; SpicInitPara.flashtype = FLASH_MICRON;
else if(SpicInitPara.id[0] == 0xC2) else if(SpicInitPara.id[0] == 0xC2)
SpicInitPara.flashtype = FLASH_MXIC; SpicInitPara.flashtype = FLASH_MXIC;
else if(SpicInitPara.id[0] == 0xEF) else if(SpicInitPara.id[0] == 0xEF || SpicInitPara.id[0] == 0xC8) // + GigaDevice
SpicInitPara.flashtype = FLASH_WINBOND; SpicInitPara.flashtype = FLASH_WINBOND;
else else
SpicInitPara.flashtype = FLASH_OTHERS; SpicInitPara.flashtype = FLASH_OTHERS;

View file

@ -16,6 +16,7 @@
#include "freertos_pmu.h" #include "freertos_pmu.h"
#endif #endif
#include "tcm_heap.h" #include "tcm_heap.h"
//#include "log_service.h"
//MON_RAM_BSS_SECTION UART_LOG_CTL UartLogCtl; //MON_RAM_BSS_SECTION UART_LOG_CTL UartLogCtl;
//MON_RAM_BSS_SECTION UART_LOG_CTL *pUartLogCtl; //MON_RAM_BSS_SECTION UART_LOG_CTL *pUartLogCtl;
@ -274,7 +275,7 @@ extern xSemaphoreHandle log_rx_interrupt_sema;
//====================================================== //======================================================
void console_cmd_exec(PUART_LOG_CTL pUartLogCtlExe) void console_cmd_exec(PUART_LOG_CTL pUartLogCtlExe)
{ {
u8 CmdCnt = 0; // u8 CmdCnt = 0;
u8 argc = 0; u8 argc = 0;
u8 **argv; u8 **argv;
//u32 CmdNum; //u32 CmdNum;
@ -311,6 +312,7 @@ RtlConsolTaskRam(
) )
{ {
#if SUPPORT_LOG_SERVICE #if SUPPORT_LOG_SERVICE
extern void log_service_init(void);
log_service_init(); log_service_init();
#else #else
#ifdef CONFIG_AT_USR #ifdef CONFIG_AT_USR

View file

@ -178,53 +178,66 @@ flash_OTA:
#@taskkill /F /IM $(JLINK_GDBSRV) #@taskkill /F /IM $(JLINK_GDBSRV)
else else
ifeq ($(FLASHER_TYPE),cmsis-dap)
flashburn: FLASHER:=cmsis-dap
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \
-c "rtl8710_flash_write $(RAM1P_IMAGE) 0" \
-c "rtl8710_flash_write $(RAM2P_IMAGE) 0xb000" \
-c "rtl8710_reboot" -c "reset run" -c shutdown
flashimage2p:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \
-c "rtl8710_flash_write $(RAM2P_IMAGE) 0xb000" \
-c "rtl8710_reboot" -c "reset run" -c shutdown
flashwebfs:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \
-c "rtl8710_flash_write $(BIN_DIR)/WEBFiles.bin 0xd0000" \
-c "rtl8710_reboot" -c "reset run" -c shutdown
flashboot: flashboot:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \ @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c "rtl8710_flash_write $(RAM1P_IMAGE) 0" \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \
-c "rtl8710_reboot" -c "reset run" -c shutdown -c 'rtl8710_flash_write $(RAM1P_IMAGE) 0' \
-c 'rtl8710_reboot' -c 'reset run' -c shutdown
flashburn:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \
-c 'rtl8710_flash_write $(RAM1P_IMAGE) 0' \
-c 'rtl8710_flash_write $(RAM2P_IMAGE) 0xb000' \
-c 'rtl8710_reboot' -c 'reset run' -c shutdown
flashimage2p:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \
-c 'rtl8710_flash_write $(RAM2P_IMAGE) 0xb000' \
-c 'rtl8710_reboot' -c 'reset run' -c shutdown
flash_OTA:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \
-c 'rtl8710_flash_write $(RAM2P_IMAGE) 0x80000' \
-c 'rtl8710_reboot' -c 'reset run' -c shutdown
flashespfs: flashespfs:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \ @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c "rtl8710_flash_write $(BIN_DIR)/webpages.espfs 0xd0000" \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \
-c "rtl8710_reboot" -c "reset run" -c shutdown -c 'rtl8710_flash_write $(BIN_DIR)/webpages.espfs 0xd0000' \
-c 'rtl8710_reboot' -c 'reset run' -c shutdown
reset: reset:
# @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed $(FLASHER_SPEED) flasher/RTLreset.JLinkScript @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c "rtl8710_reboot" -c shutdown -c 'mww 0x40000210 0x111157' -c 'rtl8710_reboot' -c shutdown
runram: runram:
# @$(JLINK_PATH)$(JLINK_GDB) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED) @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
# @$(GDB) -x flasher/gdb_run_ram.jlink -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
# @taskkill.exe -F -IM $(JLINK_GDB) -c 'load_image $(RAM1R_IMAGE) 0x10000bc8 bin' \
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \ -c 'load_image $(RAM2_IMAGE) 0x10006000 bin' \
-c "load_image $(RAM1R_IMAGE) 0x10000bc8 bin" \ -c 'mww 0x40000210 0x20111157' -c 'rtl8710_reboot' -c shutdown
-c "load_image $(RAM2_IMAGE) 0x10006000 bin" \
-c "mww 0x40000210 0x20200113" \
-c "reset run" -c shutdown
runsdram:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \
-f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \
-c 'load_image $(RAM1R_IMAGE) 0x10000bc8 bin' \
-c 'load_image $(RAM2_IMAGE) 0x10006000 bin' \
-c 'boot_load_srdam $(RAM3_IMAGE) 0x30000000' \
-c shutdown
endif
endif endif
$(NMAPFILE): $(ELFFILE) $(NMAPFILE): $(ELFFILE)

View file

@ -338,3 +338,18 @@ proc rtl8710_reboot {} {
mww 0xE000ED0C 0x05FA0007 mww 0xE000ED0C 0x05FA0007
} }
proc boot_load_srdam {local_filename loc} {
echo "# Set flag WISDRAM"
mww 0x1FFF0000 0x12345678
mww 0x40000210 0x20011113
resume
echo "# Wait Init SDRAM..."
# sleep 1000
while {[rtl8710_flasher_mrw 0x1FFF0000] == 0x12345678 } { sleep 10 }
halt
echo "# Load SDRAM image..."
load_image $local_filename $loc
resume
# echo "# Go"
mww 0x1FFF0000 1
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -338,3 +338,18 @@ proc rtl8710_reboot {} {
mww 0xE000ED0C 0x05FA0007 mww 0xE000ED0C 0x05FA0007
} }
proc boot_load_srdam {local_filename loc} {
echo "# Set flag WISDRAM"
mww 0x1FFF0000 0x12345678
mww 0x40000210 0x20011113
resume
echo "# Wait Init SDRAM..."
# sleep 1000
while {[rtl8710_flasher_mrw 0x1FFF0000] == 0x12345678 } { sleep 10 }
halt
echo "# Load SDRAM image..."
load_image $local_filename $loc
resume
# echo "# Go"
mww 0x1FFF0000 1
}

View file

@ -1,14 +1,14 @@
#============================================= #=============================================
# User defined # User defined
#============================================= #=============================================
#SDK_PATH = ../RTL00_WEB/USDK/ #SDK_PATH = ../RTL00MP3/RTL00_SDKV35a/
SDK_PATH = RTL00_SDKV35a/ SDK_PATH = RTL00_SDKV35a/
#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH #GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH
#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/5.2_2015q4/bin/# + or set in PATH #OPENOCD_PATH = D:/MCU/OpenOCD/bin/# + or set in PATH
#OPENOCD_PATH = d:/MCU/OpenOCD/bin/# + or set in PATH
TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/ TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/
FLASHER_TYPE ?= Jlink #FLASHER_TYPE = Jlink
#FLASHER_TYPE ?= OCD FLASHER_TYPE = cmsis-dap
FLASHER_PATH ?= $(SDK_PATH)flasher/ FLASHER_SPEED = 3500
FLASHER_PATH = flasher/
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/
JLINK_GDBSRV ?= JLinkGDBServer.exe JLINK_GDBSRV ?= JLinkGDBServer.exe