add WDT, new console, ...

This commit is contained in:
pvvx 2017-02-28 10:39:37 +03:00
parent e851661fa4
commit de57c04fb4
21 changed files with 3158 additions and 2639 deletions

View file

@ -471,7 +471,7 @@ void connect_start(void) {
tskreader_enable = 1;
if (xTaskCreate(tskreader, "tskreader", 300, NULL, PRIO_READER, NULL) != pdPASS) {
#if DEBUG_MAIN_LEVEL > 0
DBG_8195A("\n\r%s xTaskCreate(tskreader) failed", __FUNCTION__);
DBG_8195A("\n%s xTaskCreate(tskreader) failed!\n", __FUNCTION__);
#endif
tskreader_enable = 0;
}
@ -483,17 +483,16 @@ void connect_start(void) {
#endif
}
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void) {
void main(void)
{
#if DEBUG_MAIN_LEVEL > 3
ConfigDebugErr = -1;
ConfigDebugInfo = -1; //~_DBG_SPI_FLASH_;
ConfigDebugInfo = ~(_DBG_SPI_FLASH_);//|_DBG_TCM_HEAP_);
ConfigDebugWarn = -1;
CfgSysDebugErr = -1;
CfgSysDebugInfo = -1;
@ -503,10 +502,10 @@ void main(void) {
#if CPU_CLOCK_SEL_DIV5_3
// 6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000 Hz
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
*((int *)0x40000074) |= (1<<17); // REG_SYS_SYSPLL_CTRL1 |= BIT_SYS_SYSPLL_DIV5_3
*((int *)(SYSTEM_CTRL_BASE+REG_SYS_SYSPLL_CTRL1)) |= (1<<17); // REG_SYS_SYSPLL_CTRL1 |= BIT_SYS_SYSPLL_DIV5_3
#else
// 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000 Hz
*((int *)0x40000074) &= ~(1<<17); // REG_SYS_SYSPLL_CTRL1 &= ~BIT_SYS_SYSPLL_DIV5_3
*((int *)(SYSTEM_CTRL_BASE+REG_SYS_SYSPLL_CTRL1)) &= ~(1<<17); // REG_SYS_SYSPLL_CTRL1 &= ~BIT_SYS_SYSPLL_DIV5_3
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
#endif
HAL_LOG_UART_ADAPTER pUartAdapter;
@ -515,17 +514,24 @@ void main(void) {
SystemCoreClockUpdate();
En32KCalibration();
}
#if defined(CONFIG_CRYPTO_STARTUP) && (CONFIG_CRYPTO_STARTUP)
if ( rtl_cryptoEngine_init() != 0 ) {
DBG_8195A("crypto engine init failed\r\n");
#ifdef CONFIG_WDG_ON_IDLE
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & 0x1FFFFF);
WDGInitial(5000); // 5 s
WDGStart();
#endif
#if (defined(CONFIG_CRYPTO_STARTUP) && (CONFIG_CRYPTO_STARTUP))
if(rtl_cryptoEngine_init() != 0 ) {
DBG_8195A("Crypto engine init failed!\n");
}
#endif
#if DEBUG_MAIN_LEVEL > 0
vPortFree(pvPortMalloc(4)); // Init RAM heap
fATST(NULL); // RAM/TCM/Heaps info
fATST(); // RAM/TCM/Heaps info
#endif
start_init(); // in atcmd_user.c
/* pre-processor of application example */
pre_example_entry();
@ -537,7 +543,7 @@ void main(void) {
console_init();
/* Execute application example */
example_entry();
// example_entry();
/*Enable Schedule, Start Kernel*/
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED