主题中讨论的其他器件:HALCOGEN
我有一个在 FreeRTOS v9上运行的 Hercules 安全开发套件。 我使用的是 Code Composer Studio v11和 HALCoGen v4。
我的程序在 printf()中挂起。 SCI 工作正常。 我包含了 stdio.h 库。 构建代码时不会出现任何问题。 由于我对这个平台很陌生、我肯定会错过一些东西。
下面给出了一个测试代码片段
#include "FreeRTOS.h"
#include "os_task.h"
#include "HL_sci.h"
#include "HL_het.h"
#include "HL_gio.h"
#include "stdio.h"
#include "HL_sys_common.h"
#define UART sciREG1
#define LENGTH 18
xTaskHandle xTas1kHandle, xTask2Handle;
uint8 TEXT[LENGTH] = {'B', 'u', 't', 't', 'o', 'n', ' ', 'i', 's', ' ', 'p', 'r', 'e', 's', 's', 'e', 'd', ' '};
void consolePrint(sciBASE_t *sci, uint8 *text, uint32 length){
while(length--){
while((sci->FLR & 0x4) == 4);
sciSendByte(sci, *text++);
}
}
void vTask1(void *pvParameters){
for(;;){
gioSetBit(hetPORT1, 0, (gioGetBit(hetPORT1, 0)^1));
printf("Hello World\n\r"); //code hangs here
vTaskDelay(100);
}
}
void vTask2(void *pvParameters){
for(;;){
if((gioGetBit(gioPORTA, 7) == 0)){
consolePrint(UART, &TEXT[0], LENGTH);
vTaskDelay(100);
}
}
}
int main(void)
{
sciInit();
gioSetDirection(hetPORT1, 0xFFFFFFFF);
gioSetDirection(gioPORTA, 0x00000000);
if (xTaskCreate(vTask2, "Task 2", configMINIMAL_STACK_SIZE, NULL, 1, &xTask2Handle) != pdTRUE){
while(1);
}
if (xTaskCreate(vTask1, "Task 1", configMINIMAL_STACK_SIZE, NULL, 1, &xTas1kHandle) != pdTRUE){
consolePrint(UART, &TEXT[0], LENGTH);
}
vTaskStartScheduler();
while(1);
return 0;
}
有人能帮我解决这个问题吗? 任何建议均可获得采纳。
谢谢你。
此致
Ua