Hello everyone
I’m developing an image application using the DSP C6748 and the VLIB Release 3.2.1.0. I tested the function VLIB_integralImage8 and worked fine. Then I moved to “Connected Components Labeling” But it failed.
Let me describe my steps.
I took the “VLIB_Connected_Components_Labeling_674_LE_ELF” as example and then I made some modifications; actually my code is like this:
void VLIB_Connected_Components_Labeling_d ()
{
/* Compute buffer sizes */
uint32_t inp_size = 64 * 8;
uint32_t packed_width = (64+31) / 32;
uint32_t mod_width = packed_width * 32;
uint32_t packed_size = packed_width * 8;
uint32_t out_size = mod_width * 8;
int32_t maxBytesRequired;
int32_t sizeOfCCHandle;
/* Allocate buffers for each test vector */
uint8_t *input_image = (uint8_t *) malloc(inp_size*sizeof(uint8_t));
uint32_t *pIn32BitPacked = (uint32_t *) malloc(packed_size*sizeof(uint32_t));
uint8_t *pOutMap = (uint8_t *) malloc(out_size*sizeof(uint8_t));
void *pBuf;
VLIB_CCHandle *handle;
VLIB_calcConnectedComponentsMaxBufferSize(64, 8, 7, &maxBytesRequired);
pBuf = (void *) malloc(maxBytesRequired);
sizeOfCCHandle = VLIB_GetSizeOfCCHandle();
handle = (VLIB_CCHandle *) malloc(sizeOfCCHandle);
if( input_image && pIn32BitPacked && pOutMap && pBuf && handle)
{
int32_t fail, i, j;
int32_t status;
int32_t numCCs;
VLIB_CC vlibBlob;
status = VLIB_initConnectedComponentsList(handle, pBuf, maxBytesRequired);
VLIB_fillBuffer(STATIC, (uint8_t)255, input_image, img0, 64, 8, 64, sizeof(uint8_t), testPatternString);
memset(pIn32BitPacked, 0, packed_size * sizeof(int32_t));
memset(pOutMap, 0, out_size);
int32_t j;
int32_t fgMaskPixel;
int32_t word, shift, pos;
int32_t extra = (mod_width > 64);
for( j=0; j < 8; j++ )
{
shift = 31;
word = 0;
pos = 0;
for( i=0; i < 64; i++ )
{
if( input_image[j*64+i] > 0 ) fgMaskPixel = 1;
else fgMaskPixel = 0;
word |= (fgMaskPixel << shift);
if( shift == 0 )
{
pIn32BitPacked[j*packed_width+pos] = word;
pos++;
word = 0;
shift = 31;
}
else shift--;
}
if(extra) pIn32BitPacked[j*packed_width+pos] = word;
}
status = VLIB_createConnectedComponentsList(handle,
mod_width,
8,
pIn32BitPacked,
7,
1);
VLIB_getNumCCs(handle, &numCCs);
for( i=0; i < numCCs; i++ )
{
VLIB_getCCFeatures(handle, &vlibBlob, i);
}
status = VLIB_createCCMap8Bit(handle, pOutMap, mod_width, 8);
}
free(handle);
free(pBuf);
free(pOutMap);
free(pIn32BitPacked);
free(input_image);
}
The image img0 is from the example “VLIB_Connected_Components_Labeling_674_LE_ELF”.
My project in CCS 5.3 looks like the follow image
When I built project a link error appears. It was related with the _kernel_size and _data_size symbols (link error: undefined symbols). So, I included as the example says and my new cmd file looks like the follow:
MEMORY
{
DSPL2ROM o = 0x00700000 l = 0x00100000 /* 1MB L2 Internal ROM */
DSPL2RAM o = 0x00800000 l = 0x00040000 /* 256kB L2 Internal RAM */
DSPL1PRAM o = 0x00E00000 l = 0x00008000 /* 32kB L1 Internal Program RAM */
DSPL1DRAM o = 0x00F00000 l = 0x00008000 /* 32kB L1 Internal Data RAM */
SHDSPL2ROM o = 0x11700000 l = 0x00100000 /* 1MB L2 Shared Internal ROM */
SHDSPL2RAM o = 0x11800000 l = 0x00040000 /* 256kB L2 Shared Internal RAM */
SHDSPL1PRAM o = 0x11E00000 l = 0x00008000 /* 32kB L1 Shared Internal Program RAM */
SHDSPL1DRAM o = 0x11F00000 l = 0x00008000 /* 32kB L1 Shared Internal Data RAM */
EMIFACS0 o = 0x40000000 l = 0x20000000 /* 512MB SDRAM Data (CS0) */
EMIFACS2 o = 0x60000000 l = 0x02000000 /* 32MB Async Data (CS2) */
EMIFACS3 o = 0x62000000 l = 0x02000000 /* 32MB Async Data (CS3) */
EMIFACS4 o = 0x64000000 l = 0x02000000 /* 32MB Async Data (CS4) */
EMIFACS5 o = 0x66000000 l = 0x02000000 /* 32MB Async Data (CS5) */
SHRAM o = 0x80000000 l = 0x00020000 /* 128kB Shared RAM */
DDR2 o = 0xC0000000 l = 0x20000000 /* 512MB DDR2 Data */
}
SECTIONS
{
.sram_start START(_sram_start) > SHRAM NOINIT
.kernel
{
vlib.a*<*.o*> (.text:optimized)
} SIZE(_kernel_size)
.kernel_data
{
vlib.a*<*.o*> (.bss)
vlib.a*<*.o*> (.const)
vlib.a*<*.o*> (.neardata)
vlib.a*<*.o*> (.rodata)
vlib.a*<*.o*> (.far)
vlib.a*<*.o*> (.fardata)
vlib.a*<*.o*> (.switch)
} SIZE(_data_size)
.text > SHRAM
.stack > SHRAM
.bss > SHRAM
.cio > SHRAM
.const > SHRAM
.data > SHRAM
.switch > SHRAM
.sysmem > SHRAM
.far > SHRAM
.args > SHRAM
.ppinfo > SHRAM
.ppdata > SHRAM
/* COFF sections */
.pinit > SHRAM
.cinit > SHRAM
/* EABI sections */
.binit > SHRAM
.init_array > SHRAM
.neardata > SHRAM
.fardata > SHRAM
.rodata > SHRAM
.c6xabi.exidx > SHRAM
.c6xabi.extab > SHRAM
}
The building is complete now but with some warnings appears like the follow:
"../C6748.cmd", line 52 warning #10068-D: no matching section
Those warning are related with follow cmd lines:
kernel_data
{
vlib.a*<*.o*> (.bss)
vlib.a*<*.o*> (.const)
vlib.a*<*.o*> (.neardata)
vlib.a*<*.o*> (.rodata)
vlib.a*<*.o*> (.far)
vlib.a*<*.o*> (.fardata)
vlib.a*<*.o*> (.switch)
} SIZE(_data_size)
But I decided to debug the project and see what happen. And then the DSP stops in the “VLIB_calcConnectedComponentsMaxBufferSize” function.
So, I’m wondering what it’s going on. Maybe the problem is regarding with the cmd file, a missing library or something else, please you can help me with this.
Thank you in advance.
By the way, I change the compiler and linker option (see below) in order to include all the libraries and header files.


