本帖最后由 xiepengchenghn 于 2010-5-28 16:46 编辑
本人将LwIP,ucos-II,uc/gui整合到一起,单独跑LwIP没有问题,LwIP也移植到了ucos-II上,应该没有问题,但是ucos-II多任务始终调度不起来。在
OSStartHighRdy中执行到死循环里
OSStartHang
B OSStartHang
无法出来,百思不得其解,调试了4天了,还是解决不了。不知道哪位感兴趣的高人能够指点一下。ucos-II的源文件已经更换成了2.88版本的。想共同提高的朋友不妨讨论下。
备注:开发平台金牛开发板stm32f107+mdk4.11
/* Includes ------------------------------------------------------------------*/
#include "stm32_eth.h"
#include "netconf.h"
#include "main.h"
#include "helloworld.h"
#include "httpd.h"
#include "tftpserver.h"
#include "includes.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#define SYSTEMTICK_PERIOD_MS 10
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
__IO uint32_t LocalTime = 0; /* this variable is used to create a time reference incremented by 10ms */
uint32_t timingdelay;
/* Private function prototypes -----------------------------------------------*/
void System_Periodic_Handle(void *pdata);
void AppTask(void *pdata);
void AppTaskCreate(void );
static OS_STK HelloTaskStartStk[256];
static OS_STK httpdTaskStartStk[256];
static OS_STK PeriodicTaskStartStk[256];
static OS_STK AppTaskStartStk[256];
/* Private functions ---------------------------------------------------------*/
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
INT8U OS_err;
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
RCC_DeInit();
/* Setup STM32 system (clocks, Ethernet, GPIO, NVIC) and STM3210C-EVAL resources */
BSP_Init();
GUI_Init();
LCD_Init();
/* Initilaize the LwIP satck */
LwIP_Init();
OSInit();
/*此处注意cortex M3中栈是向下生长的,与数组地址增长方向相反,所以栈顶即数组最后一个元素*/
OS_err=OSTaskCreate(AppTask,(void *)0,(OS_STK*)&AppTaskStartStk[255],7);
if(OS_err==OS_ERR_NONE)
{
GUI_DispStringAt("Task Create Success",128,12);
}
OSStart();
return 0;
}
void AppTask(void *pdata)
{
OSStatInit();
AppTaskCreate();
while(1)
{
OSTimeDly(10);
}
}
void AppTaskCreate(void)
{
INT8U OS_err;
OS_err=OSTaskCreate(HelloWorld_init,(void *)0,(OS_STK*)&HelloTaskStartStk[255],8);
if(OS_err==OS_ERR_NONE)
{
GUI_DispStringAt("Hello Create Success",128,12);
}
OS_err=OSTaskCreate(httpd_init,(void *)0,(OS_STK*)&httpdTaskStartStk[255],9);
if(OS_err==OS_ERR_NONE)
{
GUI_DispStringAt("http Create Success",128,12);
}
OSTaskCreate(System_Periodic_Handle,(void *)0,(OS_STK*)&PeriodicTaskStartStk[255],10);
if(OS_err==OS_ERR_NONE)
{
GUI_DispStringAt("Sys Create Success",128,12);
}
}
/**
* @brief Handles the periodic tasks of the system
* @param None
* @retval None
*/
void System_Periodic_Handle(void *pdata)
{
/* LwIP periodic services are done here */
while(1)
{
LwIP_Periodic_Handle(LocalTime);
OSTimeDly(10);
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{}
}
#endif
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ |