TI中文支持网
TI专业的中文技术问题搜集分享网站

请教 error: can't allocate .text, size 00032420 (page 0) in IRAM (avail: 00030000) 此类错误除了裁剪代码,是否还有别的方法?

大家好:

     很奇怪的问题,我改了I2C的API,就一百多行代码,就发现IRAM装不下了,求解?!

dadi zeng:

已解决:

   因为BIOS的LOG无法使用,用了printf,引入了stdio,导致程序突然加大,把所有的puts及printf语句去掉就行了。

noaming:

回复 dadi zeng:

你好,可以看看下面打印函数用法的常见信息。。。

Q: How can I convert printf() statements to LOG_printf()?

The printf() function included in the run-time support library can severely impact real-time performance.

Problems with printf()

It runs often for 1000s of cycles in order to do the string formatting (e.g. displaying an integer as ascii text).
It causes CCS to do a "silent halt". That is, there is a breakpoint that gets hit during calls to printf. CCS responds by reading out the printed message and then starting the DSP running again.

These issues coupled together typically cause severe problems with real-time performance, but you can easily avoid these issues by using LOG_printf instead.

Advantages of LOG_printf()

Formatting is performed on the PC rather than the DSP, i.e. run-time overhead is 10s of cycles instead of 1000s.
The DSP is not halted to transfer the data. Instead DSP/BIOS utilizes RTDX to transfer the data.

Limitations of LOG_printf()

Only two variables can be passed as arguments, e.g. LOG_printf(&trace, "var1=%i, var2=%i", var1, var2);
Not all types are supported! Notably, the %f (float) is not supported. The supported types are:  %d, %u, %x, %o, %s, %r, %p. See the API Guide bundled with BIOS for more details (e.g. bios_5_xx_xx/docs).


Log_trace.jpg

To migrate from printf() to LOG_printf()

Add an object inside the LOG module of your DSP/BIOS configuration

In your BIOS tcf go to Instrumentation->LOG
Right-click on Event Log Manager and select "Insert LOG"
(Optional) You can give it any name you like, e.g. 'trace'.
(Optional) You can make the buffer size larger/smaller and place it in the memory section of your choice.

Add the DSP/BIOS-generated configuration header file (biosfilenamecfg.h) into any source files that will use the LOG_printf(). This header file includes log.h for you and externs your LOG object (e.g. trace).
Replace all printf("message\n"); with LOG_printf(&trace, "message\n");

This should help alleviate the pain of using the big and slow printf() calls.

赞(0)
未经允许不得转载:TI中文支持网 » 请教 error: can't allocate .text, size 00032420 (page 0) in IRAM (avail: 00030000) 此类错误除了裁剪代码,是否还有别的方法?
分享到: 更多 (0)