This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
因为要使用到printf故在程序中代码如下:
//-------------------------------以下都为 标准 printf函数连接-------------------------------------------------------------- //################################################# //----------------------------------------------- //Printf 函数连接 //----------------------------------------------- void open_uart_debug (void) { int status=0; status = add_device("uart", _MSA, my_open, my_close, my_read, my_write, my_lseek, my_unlink, my_rename); if (status == 0) { freopen("uart:", "w", stdout); // open uart and redirect stdout to UART setvbuf(stdout, NULL, _IONBF, 0); // disable buffering for stdout } } int my_open(const char *path, unsigned flags, int fno) { //scia_fifo_init(); //scia_echoback_init(); path = path; flags = flags; fno = fno; return 0; } int my_close(int fno) { fno =fno; return 0; } int my_read(int fno, char *buffer, unsigned count) { fno = fno; buffer = buffer; count = count; return 0; } int my_write(int fno, const char *buffer, unsigned count) { int i=0; fno = fno; while(count-- > 0) { scia_xmit(buffer[i++]); } return count; } off_t my_lseek(int fno, off_t offset, int origin) { fno = fno; offset = offset; origin = origin; return 0; } int my_unlink(const char *path) { path = path; return 0; } int my_rename(const char *old_name, const char *new_name) { old_name = old_name; new_name = new_name; return 0; }
使用printf好像要占用.ico段,但程序需要使用大数组,故造成程序的空间不够,那么请问不使用printf的CCS编译器是怎么设置?
不使用printf函数的情况下,SCI能否往外打印数据?谢谢!
好的 谢谢 麻烦解决下这个问题 https://e2echina.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/282709/tms320f28027-tms320f28027-memory-allocation/937628#937628 为什么声明数组要用voltaile 难道不用就不行 还有我都怀疑回答问题的专家都没做过验证 谢谢!
你好,voltaile的用法其实可以参考编译器手册的说明,6.5.5 volatile 关键字。里面有介绍几种必须用voltaile关键字的场景,可以对比一下你的使用场景,如果不是在这几个必须的场景下使用的话我认为可以不用volatile 关键字。
TMS320C28x 优化 C/C++ 编译器 v22.6.0.LTS 用户指南 (Rev. Y) (ti.com.cn)
你的数组是定义在中断中,或者在中断中使用的吗?如果是的话就必须要要用volatile关键字去定义。
如果没有用volatile定义的话编译器有可能会把数组优化掉,但是结果会是什么样的,我这边确实没测试过,而且我至少这周应该都没办法测试。。。