DSP-TMS320F28379D-HDSP Xds200-CCS7.3.0新建工程项目并点亮LED灯《保姆级教程》
可以直接傻白甜的导入controlsuit官方工程,但为了熟悉软件使用,特寄几新建一个项目练练手。步骤如下:
一、新建项目并配置环境
1.首先,打开CCS界面,File->New->CCS Project,如下所示:
2.上图中Finish为灰色是因为我命名工程名时与原来命名过的工程名重复了,大家第一次新建的时候Finish肯定是蓝色可点击的。点完Finish后CCS界面左方如下图所示:
鼠标右键工程名,选择属性properties:
3.属性配置界面如下所示:
点击6处的添加按钮
添加如下路径处的两个include文件夹:
随后在C2000 Linker里继续操作并添加:
上半部框框添加完成的总文件如图所示,共三个:
下半部框框同理,总文件如下下图所示:
继续属性配置,C2000 Linker->Advanced Options->Symbol Management,添加_c_int00指定要进入代码的程序入口点:
其实属性配置还有一步,稍后再说(假装高深莫测)。
4.添加.c,.asm文件:
右键User是右键的CCS中的User:
添加完.C,.asm文件后CCS左半部如下所示,再补上之前属性配置未做的一步:
5.拷贝代码至LED.c文件:
//###########################################################################
// $TI Release: F2837xD Support Library v210 $
// $Release Date: Tue Nov 1 14:46:15 CDT 2016 $
// $Copyright: Copyright (C) 2013-2016 Texas Instruments Incorporated -
// http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################
#include "F28x_Project.h"
#define BLINKY_LED_GPIO 133
#define BLINKY_LED1_GPIO 99
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xD_SysCtrl.c file.
//
InitSysCtrl();
//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xD_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//
InitGpio();
GPIO_SetupPinMux(BLINKY_LED_GPIO, GPIO_MUX_CPU1, 0);
GPIO_SetupPinOptions(BLINKY_LED_GPIO, GPIO_OUTPUT, GPIO_PUSHPULL);
GPIO_SetupPinMux(BLINKY_LED1_GPIO, GPIO_MUX_CPU1, 0);
GPIO_SetupPinOptions(BLINKY_LED1_GPIO, GPIO_OUTPUT, GPIO_PUSHPULL);
//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xD_PieCtrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2837xD_DefaultIsr.c.
// This function is found in F2837xD_PieVect.c.
//
InitPieVectTable();
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//
// Step 6. IDLE loop. Just sit and loop forever (optional):
//
for(;;)
{
//
// Turn on LED
//
GPIO_WritePin(BLINKY_LED_GPIO, 0);
GPIO_WritePin(BLINKY_LED1_GPIO, 1);
//
// Delay for a bit.
//
DELAY_US(1000*500);
//
// Turn off LED
//
GPIO_WritePin(BLINKY_LED_GPIO, 1);
GPIO_WritePin(BLINKY_LED1_GPIO, 0);
//
// Delay for a bit.
//
DELAY_US(1000*500);
}
}
// End of file
//
注意:文首的宏定义#define BLINKY_LED_GPIO 133
和#define BLINKY_LED1_GPIO 99
代表开发板上的GPIO口,可按自己开发板的原理图进行修改,我的是F28379D的板子,LED灯DM1,DM2的硬件结构及芯片管脚如下图:
准备编译程序:
二、在线烧录程序至RAM
1.首先新建ccxml文件并配置:
实际上我命名的是F28379xds200,上图是我以前做的。。
到此处可以看到.ccxml文件已经生成,看不到Target configuration的可以在下图中调出
---------------------------------------软硬分界线--------------------------------
2.板子操作:
**
切记注意连接顺序!!!!
**
---------------------------------------软硬分界线--------------------------------
3.回到CCS软件页面,按如下步骤烧录:
72ab5944b9ce803aa821d85617c7f3c7
问题总结
第一次问题总会乱七八糟,啥也看不懂,小白就不总结了。但也正因为第一次,可以肆无忌惮,实在忍不了就卸载重装,简而言之,尽量选择简单的程序,经典的软件版本更容易上手,记录于此。
-------2021.8.19
参考文档:
https://blog.csdn.net/qq_39432978/article/details/81566779