Other Parts Discussed in Thread: SYSBIOS
Thread 中讨论的其他器件: SYSBIOS
工具/软件:Code Composer Studio
您好!
我对 TI 器件、工具等非常陌生、但我在使用8位和16位微控制器的 C 代码、Atmel 的 ATXmegadevices 以及 National Instruments Labwindows CVI 对用户界面进行编程方面经验丰富。
现在、我正试图进入 TI 世界、使用66AK2Gxx 将我们的半数字音频限制器/寄存器转换为全数字器件、这正是我购买的带有音频附加板的 EVMK2G 板。
经过大量的培训(顺便说一下、相当好且完整)、我刚刚在 CCS 中编译了第一小段代码、其中包含 RTOS、可在 EVMK2G 中运行。 它包括.cfg 中声明的任务、每秒一次的时间中断以及 UART 通信。 一切似乎都正常、但当我使用 EVMK2G 运行这小段代码时、当该过程进入计时器的中断并执行 UART_printf 时、程序会崩溃。 在试图弄清楚为什么会这么长时间后,我只能解释一下为什么会崩溃。 代码为:
/*
*==== main.c ======
*
#include
#include
#include
#include
#include
#include
#include "stdio.h"
#include "stdint.h"
#include "stdlib.h"
#include "string.h"
/*电路板*/
#include
/* UART 头文件*/
#include
#include
#include
void taskFxn (UARg a0、UARg A1)
{
system_printf ("enter taskFxn ()\n");
UART_printf ("Entra task\n");
Task_sleep (10);
system_printf ("exit taskFxn ()\n"\});
UART_printf ("销售任务\n");
system_flush();/*强制 SysMin 输出到控制台*/
返回;
}
空时间1S (UARg a0)
{
System_printf ("Entra tempimal\n");
system_flush();/*强制 SysMin 输出到控制台*/
UART_printf ("Entra Tempo\n");
返回;
}
void Board_initUART (void)
{
board_initCfg boardCfg;
boardCfg = Board_init_PINMUX_CONFIG |
Board_init_module_clock |
Board_init_uart_stdio;
board_init (boardCfg);
返回;
}
/*
*==== main ====
*
int main()
{
Task_Handle 任务;
ERROR_Block EB;
Board_initUART();
system_printf ("enter main()\n");
ERROR_INIT (&EB);
任务= Task_create (taskFxn、NULL、&EB);
if (task =NULL){
System_printf ("Task_create() failed!\n");
UART_printf ("任务创建()失败\n");
BIOS_exit (0);
}
BIOS_start();/*不返回*/
返回(0);
}
配置文件为:
VAR 默认值= xdc.useModule('xdc.runtime.Defaults');
VAR 诊断= xdc.useModule('xdc.runtime.Diags');
VAR 错误= xdc.useModule('xdc.runtime.Error');
VAR 日志= xdc.useModule('xdc.runtime.Log');
VAR LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
VAR Main = xdc.useModule('xdc.runtime.Main');
VAR 内存= xdc.useModule('xdc.runtime.Memory')
VAR SysMin = xdc.useModule('xdc.runtime.SysMin');
VAR 系统= xdc.useModule('xdc.runtime.System');
var text = xdc.useModule('xdc.runtime.Text');
VAR BIOS = xdc.useModule('ti.sysbios.BIOS');
VAR 时钟= xdc.useModule('ti.sysbios.knl.Clock');
VAR Swi = xdc.useModule('ti.sysbios.knl.Swi');
VAR 任务= xdc.useModule('ti.sysbios.knl.Task');
VAR 信标= xdc.useModule('ti.sysbios.knl.Semaphore');
VAR Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
VAR 计时器= xdc.useModule('ti.sysbios.hal.Timer');
var ti_sysbios_timers_timer64_Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
VAR 设置= xdc.useModule('ti.board.Settings');
var ti_drv_UART_Settings = xdc.useModule('ti.drv.uart.Settings');
var ti_osal_Settings = xdc.useModule('ti.osal.Settings');
VAR CpIntc = xdc.useModule('ti.sysbios.family.arm.a15.tci66xx.CpIntc');
VAR LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
/*
*取消注释此行以全局禁用断言。
*所有模块继承'库'模块的默认值。 您
*可以使用 Module.common$按模块覆盖这些默认值。
*禁用断言将节省代码空间并提高运行时性能。
Defaults.common$.diags_ASSERT = Diags.always_off;
*
/*
*取消注释此行以防止模块名称加载到目标上。
*模块名称字符串放置在.const 段中。 设置此值
*将参数设置为 false 将节省.const 段中的空间。 误差和
*断言消息将包含"未知模块"前缀
实际模块名称的*。
Defaults.common$.namedModule = false;
*
/*
*最小化系统中的 EXIT 处理程序数组。 系统模块包括
*向 System_atexit()注册的函数数数组
*由 System_exit()调用。
*
System.maxAtexitHandlers = 4;
/*
*取消注释此行以禁用错误打印功能。
*禁用此功能时,我们会丢失错误信息,因为错误是这样
*未打印。 如果禁用 raiseHook、则会节省一些代码空间
*由于 Error_print()函数,您的应用程序未使用 System_printf()
*调用 System_printf()。
error.raiseHook =空;
*
/*
*取消注释此行以防止 Error、Assert 和 Log 字符串成为字符串
*加载到目标上。 这些字符串放置在.const 段中。
*将此参数设置为 false 将节省.const 段中的空间。
*错误、断言和日志消息将打印原始 ID 和 args 而不是
*格式化的邮件。
text.isLoaded = false;
*
/*
*取消注释此行以禁用 SysMin 的字符输出
*程序退出时。 SysMin 向循环缓冲区写入字符。
*可以使用 ROV 中的 SysMin Output 视图查看该缓冲器。
SysMin。flushAtExit = false;
*
/*
* BIOS 模块将为系统创建默认堆。
*指定此默认堆的大小。
*
BIOS.heapSize = 0x1000;
/*
*从源构建自定义 SYS/BIOS 库。
*
BIOS.libType = BIOS.LibType_Debug;
/*系统堆栈大小(由 ISR 和 Swi 使用)*/
program.stack = 0x2000;
System_printf()的/*循环缓冲区大小*/
SysMin。bufSize = 0x200;
/*
*为整个系统创建并安装记录器
*
var logerBufParams = new LoggerBuf.Params();
LoggerBufParams.numEntry = 16;
var logger0 = LoggerBuf.create (logerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.always_on;
System.SupportProxy = SysMin;
var ti_sysbios_timers_timer64_Timer0Params =新 ti_sysbios_timers_timer64_Timer.Params ();
ti_sysbios_timers_timer64_Timer0Params.instance.name ="Timer1S";
TI_SysBIOS_timers_timer64_Timer0Params.period = 1000000;
program.global.Timer1S = ti_SysBIOS_timers_timer64_Timer.create (-1、"&Tempo1s"、ti_SysBIOS_timers_timer64_Timer0Params);
settings.boardName ="evmK2G";
TI_drv_UART_Settings.socType ="k2g";
Settings.common$.logger = logger0;
TI_drv_UART_Settings.enableProfiling = false;
TI_drv_UART_Settings.libProfile ="发布";
BIOS.customCCOpts ="-Wunused -Wunknown-pragma -ffunion-SECTIONS -Fdata-SECTIONS -MCPU=cortex-a15 -mfpu=neon -mfloat-abi=hard -mabi=aapcs -g -DFAR=-D_DYNAL_REENT__-mapcs";
TI_osal_Settings.socType ="k2g";
LoggingSetup.sysbiosLogging = true;
LoggingSetup.sysbiosHwiLogging = true;
LoggingSetup.sysbiosSemaphoreLogging = true;
LoggingSetup.logerType = LoggingSetup.LoggerType_STOPMODE;
在 CCS 中使用连接到串行端口的控制台、当我运行程序时、我在控制台中获得:
进入任务
销售任务
e
这是任务执行正确、但当任务到达计时器中断代码时、UART_printf 函数似乎发送字符串、但在发送第一个字符后、程序会崩溃、就像计时器中断中的第一个 UART 中断不被接受一样。 ¿为什么会这样呢?
我非常感谢在这一点上提供的帮助。 提前感谢。