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

CC2640r2frsm 任务栈大小修改问题。是否是RAM不够用

程序需要使用SPI,再添加SPI初始化后发现程序不运行,在SPI初始化前后各加了打印函数。然后只会打印第一个。

SDITask_PrintfToUART("%s\r\n", "Hello from SPP BLE Server!");
HwSPIInit();
SDITask_PrintfToUART("%s\r\n", "Hello from SPP BLE Server!");

后来发现修改任务栈大小后,可能会一个都不能打印,#define SBP_TASK_STACK_SIZE                   1144//644,1044,1344。

1144大小就不能打印了。1044可以打印1个。但是如果不加这个SPI初始化,1344仍可以打印2个,而且会执行到后面的广播,会打印广播信息。这是RAM不够用吗?

在.MAP文件里发现RAM只用了13K。难道程序在运行的过程中,会消耗7k的RAM,SPI消耗的大?麻烦了解的大佬给指点下,是什么原因,我改如何调试?

还有我也不确定是否使用uDMA,我想使用uDMA应该如何配置?

89 739 bytes of readonly code memory
10 542 bytes of readonly data memory
13 043 bytes of readwrite data memory

void HwSPIInit(void)
{
// hSPIPins = PIN_open(&SPIPins, SPIPinsCfg); //SPIIO配置,后再主程序开始时配置

SPI_init();
SDITask_PrintfToUART("%s\r\n", "Hello from SPP BLE Server!"); //执行不到此处
SPI_Params_init(&SPIparams);
SPIparams.bitRate = 2000000; //2MHz 32:1.8432MHz
SPIparams.dataSize = 8; SPIparams.frameFormat = SPI_POL0_PHA1; //相位1极性0
SPIparams.mode = SPI_MASTER; //SPI主从模式
SPIparams.transferMode = SPI_MODE_CALLBACK; //回调模式
SPIparams.transferCallbackFxn = spiSlaveCallback;//回调函数
SPIparams.transferTimeout = SPI_WAIT_FOREVER;}

/*
* =============================== SPI DMA ===============================
*/
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/***.h>

*** ***[CC2640R2DK_4XS_SPICOUNT];

const *** ***[CC2640R2DK_4XS_SPICOUNT] = {
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
.defaultTxBufValue = 0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
.mosiPin = CC2640R2DK_4XS_SPI0_MOSI,
.misoPin = CC2640R2DK_4XS_SPI0_MISO,
.clkPin = CC2640R2DK_4XS_SPI0_CLK,
.csnPin = CC2640R2DK_4XS_SPI0_CSN
}
};

const SPI_Config SPI_config[CC2640R2DK_4XS_SPICOUNT] = {
{
.fxnTablePtr = &***,
.object = &***[CC2640R2DK_4XS_SPI0],
.hwAttrs = &***[CC2640R2DK_4XS_SPI0]
}
};

const uint_least8_t SPI_count = CC2640R2DK_4XS_SPICOUNT;

Kevin Qiu1:

可以在CCS->view->Stack Usage中查看Stack的使用情况,DMA的话看下手册10.5.3节:www.ti.com.cn/…/swcu117i.pdf

user4441348:

回复 Kevin Qiu1:

谢谢,不过我用的IAR,任务栈大小有限制吗?我把define symbol STACK_SIZE= 0xC00;//3K#define HEAPMGR_SIZE0//3072。
然后任务栈改成#define SBP_TASK_STACK_SIZE2000;都会编译报错Error[Lp015]: section placement failure: overcommitted content in [0x2000'0520-0x2000'43ff] ;
#define SBP_TASK_STACK_SIZE3000;3000出现12个错误.
Error[Lp011]: section placement failed unable to allocate space for sections/blocks with a total estimated minimum size of 0x3784 bytes (max align 0x8) in
<[0x2000'00c8-0x2000'042f], [0x2000'0450-0x2000'04ff], [0x2000'0520-0x2000'43ff]> (total uncommitted space 0x35f0). Uncommitted: [0x2000'00c8-0x2000'042f]:0x368 [0x2000'0204-0x2000'042f]:0x22a [0x2000'0450-0x2000'04ff]:0xb0 [0x2000'0520-0x2000'43ff]: 0x32df
Error[Lp017]: the address of "ti_sysbios_family_arm_m3_Hwi_Module_State_0_excActive__A" was needed when computing compressed
initializers for section .data_ti_sysbios_family_arm_m3_Hwi_Module__state__V (app_ble_prm3.orm3 #156), but that address hasn't been
set yet, since the size of the compressed initializers are needed in order to set it
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error[Lp021]: the destination for compressed initializer batch "RWDATA-1" is placed at an address that is dependent on the size of the
batch, which is not allowed when using lz77 compression. Consider using "initialize by copy with packing = zeros" (or none) instead.
Error while running Linker
Total number of errors: 12
Total number of warnings: 0

Kevin Qiu1:

回复 user4441348:

这个是栈设定值超出了,栈设定的大小和你的程序有关:dev.ti.com/…/node
优化增加RAM可以看下这里:www.ti.com.cn/…/zhca717.pdf

user4441348:

回复 Kevin Qiu1:

好的谢谢,SPI问题解决了,是SPI IO配置的问题。我把PIN_Config 配置屏蔽了,就可以运行了。那SPI不要IO 配置吗?
const PIN_Config BoardGpioInitTable[] = {
CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* LED initially off */CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* LED initially off */CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low */CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low */CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,/* External flash chip select */CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,/* UART RX via debugger back channel */CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,/* UART TX via debugger back channel */
//CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI master out – slave in */
//CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI master in – slave out */
//CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI clock */
PIN_TERMINATE
};

Kevin Qiu1:

回复 user4441348:

需要配置,屏蔽后SPI还能正常使用吗

user4441348:

回复 Kevin Qiu1:

应该是重复配置了吧。我自己配置了下,然后SPICC26XXDMA.c里也配置了,只是工程只包含SPICC26XXDMA.h,所以没发现。是这样吗?

Kevin Qiu1:

回复 user4441348:

屏蔽后SPI还能正常使用的话那就是重复配置了

user4441348:

回复 Kevin Qiu1:

您好,请问栈设定的大小和程序有关是什么意思?

Kevin Qiu1:

回复 user4441348:

如果你的程序占用的RAM比较多,分配的栈空间太大可能达不到

赞(0)
未经允许不得转载:TI中文支持网 » CC2640r2frsm 任务栈大小修改问题。是否是RAM不够用
分享到: 更多 (0)