前段时间通过大家的帮助,完成了上AWS云的测试,现在想尝试使用蓝牙控制模块发送数据到云
但是发现一启用蓝牙功能,mbedtls就无法申请到足够的空间,导致无法继续运行,查看资料,RTL8720DN的大核片上SRAM足足高达512k,不应该会出现这样的情况才对
开始尝试确认当前剩余堆栈大小,将应用程序全部注释,开启一个线程来周期查询当前剩余堆栈大小,通过API rtw_getFreeHeapSize() 获取得到的值为236768,计算了一下剩余大约231kb的内存可支配,跟手册上的完全看上去并不符合
手册上说可以通过PMU,电源控制管理单元来配置SRAM,但是不知该如何配置,希望能得到帮助,谢谢
下面是我上电后运行的代码
void debug_init(void)
{
if (!(xTaskCreate(km4_debug_task, "km4_debug_task", 1024, NULL, TaskCreate_Level_Debug, NULL)))
{
CTR_IOT_ERROR("%s xTaskCreate fail", __func__);
}
}
VOID app_pmu_init(VOID)
{
if (BKUP_Read(BKUP_REG0) & BIT_SW_SIM_RSVD)
{
return;
}
// pmu_set_sleep_type(SLEEP_PG);
pmu_set_sleep_type(SLEEP_CG);
/* if wake from deepsleep, that means we have released wakelock last time */
//if (SOCPS_DsleepWakeStatusGet() == TRUE) {
// pmu_set_sysactive_time(2);
// pmu_release_wakelock(PMU_OS);
// pmu_tickless_debug(ENABLE);
//}
}
//default main
int main(void)
{
SystemSetCpuClk(CLK_KM4_200M);
if (wifi_config.wifi_ultra_low_power &&
wifi_config.wifi_app_ctrl_tdma == FALSE)
{
SystemSetCpuClk(CLK_KM4_100M);
CTR_IOT_WARN("SystemSetCpuClk CLK_KM4_100M");
}
InterruptRegister(IPC_INTHandler, IPC_IRQ, (u32)IPCM0_DEV, 5);
InterruptEn(IPC_IRQ, 5);
#ifdef CONFIG_MBED_TLS_ENABLED
app_mbedtls_rom_init();
#endif
//app_init_debug();
/* init console */
shell_recv_all_data_onetime = 1;
shell_init_rom(0, 0);
shell_init_ram();
ipc_table_init();
/* Register Log Uart Callback function */
InterruptRegister((IRQ_FUN)shell_uart_irq_rom, UART_LOG_IRQ, (u32)NULL, 5);
InterruptEn(UART_LOG_IRQ, 5);
if (TRUE == SOCPS_DsleepWakeStatusGet())
{
app_dslp_wake();
}
#ifdef CONFIG_FTL_ENABLED
app_ftl_init();
#endif
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
rtw_efuse_boot_write();
/* pre-processor of application example */
// pre_example_entry();
// wlan_network();
/* Execute application example */
// example_entry();
#endif
#if defined(CONFIG_EQC) && CONFIG_EQC
//EQC_test_entry();
#endif
app_start_autoicg();
// app_shared_btmem(ENABLE);
app_pmu_init();
if ((BKUP_Read(0) & BIT_KEY_ENABLE))
app_keyscan_init(FALSE); /* 5uA */
if ((BKUP_Read(0) & BIT_CAPTOUCH_ENABLE))
app_captouch_init(); /* 1uA */
// if ((BKUP_Read(0) & BIT_GPIO_ENABLE))
// app_hp_jack_init();
class_variable_event_group = xEventGroupCreate();
app_init_debug();
// ctr_timer_init();
// ctr_gpio_init();
// app_wifi_init();
// // app_ble_init();
// main_user_loop();
debug_init();
//DBG_8195A("M4U:%d \n", RTIM_GetCount(TIMM05));
/* Enable Schedule, Start Kernel */
vTaskStartScheduler();
}