特勤学习小组 发表于 2015-11-17 08:27:09

关于STM32单片机的问题2


各位高手,小弟正在调试一个基于WIFI控制电机的应用。操作系统是mico,开发板是mico-3165。庆科提供了TCP server的源码,测试这个源码时发现,没有执行连接AP的操作。单步调试这个源码,进入mico_system_init.c这个文件中的mico_system_init函数,继续单步调试,运行到“#ifdef
MICO_WLAN_CONNECTION_ENABLE”,mico_config.h中已经定义了
MICO_WLAN_CONNECTION_ENABLE这个宏,但是系统没有进入这个分支运行,而是直接跳转到了最后一行“return err”,请教各位高手其中的原因。谢谢。mico_system_init函数的源码如下:
OSStatusmico_system_init( mico_Context_t* in_context)
{
OSStatus err = kNoErr;

require_action( in_context, exit, err = kNotPreparedErr );

/* Initialize power management daemen */
err = mico_system_power_daemon_start( in_context );/*启动电源管理后台*/
require_noerr( err, exit );

/* Initialize mico notify system */
err = system_notification_init( in_context );/*初始化通知事件回调机制*/
require_noerr( err, exit );

#ifdef mico_system_MONITOR_ENABLE
/* MiCO system monitor */
err = mico_system_monitor_daemen_start( );
require_noerr( err, exit );
#endif

#ifdef MICO_CLI_ENABLE
/*初始化命令行接口, MiCO command line interface */
cli_init();
#endif

/*网卡驱动和TCP/IP协议栈初始化, Network PHY driver and tcp/ipstatic init */
err = system_network_daemen_start( in_context );
require_noerr( err, exit );

#ifdef USE_MiCOKit_EXT
/*如果按键按下,则测试扩展板. user test mode to testMiCOKit-EXT board */
if(MicoExtShouldEnterTestMode()){
   system_log("Enter ext-board test mode by key2.");
   micokit_ext_mfg_test(in_context);
}
#endif

#ifdef MICO_WLAN_CONNECTION_ENABLE
if( in_context->flashContentInRam.micoSystemConfig.configured ==wLanUnConfigured ||
   in_context->flashContentInRam.micoSystemConfig.configured ==unConfigured){
   system_log("Empty configuration. Starting configurationmode...");

#if (MICO_CONFIG_MODE ==CONFIG_MODE_EASYLINK) || \
   (MICO_CONFIG_MODE == CONFIG_MODE_SOFT_AP) ||\
    (MICO_CONFIG_MODE == CONFIG_MODE_EASYLINK_WITH_SOFTAP)
   err = system_easylink_start( in_context );/*启动EASYLINK*/
   require_noerr( err, exit );
#elif ( MICO_CONFIG_MODE ==CONFIG_MODE_WAC)
   err = mico_easylink_start( in_context );
   require_noerr( err, exit );
#else
   #error "Wi-Fi configuration mode is not defined"
#endif
}
#ifdef MFG_MODE_AUTO
else if( in_context->flashContentInRam.micoSystemConfig.configured ==mfgConfigured ){
   system_log( "Enter MFG mode automatically" );
   mico_mfg_test( in_context );
   mico_thread_sleep( MICO_NEVER_TIMEOUT );
}
#endif
else{
   system_log("Available configuration. Starting Wi-Ficonnection...");
   system_connect_wifi_fast( in_context );/*建立WIFI连接*/
}
#endif

/*Local configuration server*/
#ifdef MICO_CONFIG_SERVER_ENABLE
config_server_start( in_context );/*创建本地配置服务器*/
#endif

require_noerr_action( err, exit, system_log("Closing main threadwith err num: %d.", err) );
exit:

return err;}

zhoupxa 发表于 2015-11-17 08:47:51

建议论坛提问简明扼要,抓住重点,勿贴大段代码,一些基础性的问题还是立足自己解决,这样才有利于学习成长......

发表于 2015-11-17 10:05:58

是否调用了mico_config.h。
页: [1]
查看完整版本: 关于STM32单片机的问题2