3476 views|0 replies

3836

Posts

19

Resources
The OP
 

Some experience of debugging dsp in CCS [Copy link]

When writing DSP sub-functions, you may use some variables. It is best not to use arrays with large data volumes, because when DSP runs the sub-function program, the local variables involved have a temporary storage area in the memory, but DSP cannot identify whether there are other program segments in this area, which may cause the array to be truncated midway, some data to be wrong or the program to run incorrectly.
Solutions:
1. Define global variables directly and allocate a certain memory address in the main program;
2. Use pointers to pass variables, and do not define new variables in sub-functions;
3. Use the function *UTIL_allocMem(Uint32size) to allocate memory blocks in sub-functions.
// Allocatememory from the ad-hoc heap
void*UTIL_allocMem(Uint32 size)
{
void *cPtr;
Uint32 size_temp;
// Ensure word boundaries
size_temp = ((size + 4) >> 2 )<< 2;
if((currMemPtr + size_temp) > ((Uint32)&EXTERNAL_RAM_END))
{
return NULL;
}
cPtr = (void *) (((U int32)&EXTERNAL_RAM_START) + currMemPtr);
currMemPtr += size_temp;
return cPtr;
}

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list