Technical discussions about the TI C28x DSPs (including the C2810, C2811, C2812, F2801, F2806, F2808, F2810,, F2811, F2812, R2811 and R2812).
Hi all, I'm using the sprintf function like: Result = sprintf(strFloat,"%3.3f",stInterpVars.fResult); Where: Result - number of copeid charectars. strFloat - destination, type char[]. stInterpVars.fResult - source, type double. The function is working, I got the correct result in destination, but there is a memory leak. The function overwrite other variable. Does someone know what happend? or anyone handle with that function? Thanks ------------------------------------ OMAP35x EVM jump-starts low-power apps ------------------------------------ The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building applications based on the OMAP35x architecture:http://www.DSPRelated.com/omap35x You can post a message or access and search the archives of this group on DSPRelated.com: http://www.dsprelated.com/groups/c28x/1.php _____________________________________
Are you sure the strFloat variable has enough space reserved ? If you typedef as a char[], it means char*, so no memory allocated to your= =20 string. Veuillez r=E9pondre =E0 e...@gmail.com Envoy=E9 par : c...@yahoogroups.com Pour : c...@yahoogroups.com cc :=20=20=20=20=20 Objet : [c28x] sprintf function Hi all, I'm using the sprintf function like: Result =3D sprintf(strFloat,"%3.3f",stInterpVars.fResult); Where: Result - number of copeid charectars. strFloat - destination, type char[]. stInterpVars.fResult - source, type double. The function is working, I got the correct result in destination, but=20 there is a memory leak. The function overwrite other variable. Does someone know what happend? or anyone handle with that function? Thanks ------------------------------------ OMAP35x EVM jump-starts low-power apps ------------------------------------ The modular and extensible OMAP35x Evaluation Module (EVM) enables develope= rs to start building applications based on the OMAP35x architecture: http:/= /www.DSPRelated.com/omap35x You can post a message or access and search the archives of this group on D= SPRelated.com: http://www.dsprelated.com/groups/c28x/1.php _____________________________________
Hi, I typed the strFloat as char[32], and the result i want to get is less then 10 charecters (%3.3f). I know that the sprinf needs to allocate memory, and in my DSP/BIOS i'm not using a heap. Is the unprototype heap couse this problam? Thanks. On Fri, May 16, 2008 at 9:01 AM, Alain SALMETOZ <a...@mgeups.com> wrote: > Are you sure the strFloat variable has enough space reserved ? > If you typedef as a char[], it means char*, so no memory allocated to your > string. > > Veuillez répondre à e...@gmail.com <erantec%40gmail.com> > Envoyé par : c...@yahoogroups.com <c28x%40yahoogroups.com> > Pour : c...@yahoogroups.com <c28x%40yahoogroups.com> > cc : > > Objet : [c28x] sprintf function > > Hi all, > > I'm using the sprintf function like: > Result = sprintf(strFloat,"%3.3f",stInterpVars.fResult); > > Where: > Result - number of copeid charectars. > strFloat - destination, type char[]. > stInterpVars.fResult - source, type double. > > The function is working, I got the correct result in destination, but > there is a memory leak. The function overwrite other variable. > > Does someone know what happend? or anyone handle with that function? > Thanks >
yes, you need to allcoate from 0x100 to 0x300 words to heap to all=20 printf() function to work. Pour : "Alain SALMETOZ" <a...@mgeups.com> cc : c...@yahoogroups.com=20 Objet : Re: R=E9f. : [c28x] sprintf function Hi, =20 I typed the strFloat as char[32], and the result i want to get is less=20 then 10 charecters (%3.3f). I know that the sprinf needs to allocate memory, and in my DSP/BIOS i'm=20 not using a heap. Is the unprototype heap couse this problam? =20 Thanks. On Fri, May 16, 2008 at 9:01 AM, Alain SALMETOZ <a...@mgeups.com > wrote: Are you sure the strFloat variable has enough space reserved ? If you typedef as a char[], it means char*, so no memory allocated to your= =20 string. Veuillez r=E9pondre =E0 e...@gmail.com Envoy=E9 par : c...@yahoogroups.com Pour : c...@yahoogroups.com cc :=20 Objet : [c28x] sprintf function=20 Hi all, I'm using the sprintf function like: Result =3D sprintf(strFloat,"%3.3f",stInterpVars.fResult); Where: Result - number of copeid charectars. strFloat - destination, type char[]. stInterpVars.fResult - source, type double. The function is working, I got the correct result in destination, but=20 there is a memory leak. The function overwrite other variable. Does someone know what happend? or anyone handle with that function? Thanks =20 ------------------------------------ OMAP35x EVM jump-starts low-power apps ------------------------------------ The modular and extensible OMAP35x Evaluation Module (EVM) enables develope= rs to start building applications based on the OMAP35x architecture: http:/= /www.DSPRelated.com/omap35x You can post a message or access and search the archives of this group on D= SPRelated.com: http://www.dsprelated.com/groups/c28x/1.php _____________________________________
Unfortunately even when I add a 0x300 size of heap, the problem still remain. but as I said befor the function is working but I got a proble, with different variable. On Mon, May 19, 2008 at 9:26 AM, Alain SALMETOZ <A...@mgeups.com> wrote: > > yes, you need to allcoate from 0x100 to 0x300 words to heap to all printf= () > function to work. > Pour : "Alain SALMETOZ" <a...@mgeups.com> > cc : c...@yahoogroups.com > > Objet : Re: R=E9f. : [c28x] sprintf function > > Hi, > > I typed the strFloat as char[32], and the result i want to get is less th= en > 10 charecters (%3.3f). > I know that the sprinf needs to allocate memory, and in my DSP/BIOS i'm n= ot > using a heap. > Is the unprototype heap couse this problam? > > Thanks. > > On Fri, May 16, 2008 at 9:01 AM, Alain SALMETOZ <* > a...@mgeups.com* <a...@mgeups.com>> wrote: > Are you sure the strFloat variable has enough space reserved ? > If you typedef as a char[], it means char*, so no memory allocated to you= r > string. > > Veuillez r=E9pondre =E0 *e...@gmail.com* <erantec%40gmail.com> > Envoy=E9 par : *c...@yahoogroups.com* <c28x%40yahoogroups.com> > Pour : *c...@yahoogroups.com* <c28x%40yahoogroups.com> > cc : > > Objet : [c28x] sprintf function > Hi all, > > I'm using the sprintf function like: > Result =3D sprintf(strFloat,"%3.3f",stInterpVars.fResult); > > Where: > Result - number of copeid charectars. > strFloat - destination, type char[]. > stInterpVars.fResult - source, type double. > > The function is working, I got the correct result in destination, but > there is a memory leak. The function overwrite other variable. > > Does someone know what happend? or anyone handle with that function? > Thanks > >=20 > ------------------------------------ OMAP35x EVM jump-starts low-power apps ------------------------------------ The modular and extensible OMAP35x Evaluation Module (EVM) enables develope= rs to start building applications based on the OMAP35x architecture: http:/= /www.DSPRelated.com/omap35x You can post a message or access and search the archives of this group on D= SPRelated.com: http://www.dsprelated.com/groups/c28x/1.php _____________________________________
Please, verify that you have assigned the esysmem section to a RAM block=20 as below. Note : If you are using LARGE memory model, esysmem is used instead of=20 sysmem. .esysmem : > EXTRAM2, PAGE =3D 1 >From documentation: The .esysmem section is a uninitialized section that reserves space for=20 dynamic memory allocation.=20 The reserved space is used by far malloc functions. If no far malloc functions are used, the size of the section remains 0. Envoy=E9 par : c...@yahoogroups.com Pour : "Alain SALMETOZ" <A...@mgeups.com> cc : c...@yahoogroups.com=20 Objet : Re: [c28x] sprintf function Unfortunately even when I add a 0x300 size of heap, the problem still remain. but as I said befor the function is working but I got a proble, with different variable. On Mon, May 19, 2008 at 9:26 AM, Alain SALMETOZ=20 <A...@mgeups.com> wrote: > > yes, you need to allcoate from 0x100 to 0x300 words to heap to all=20 printf() > function to work. > Pour : "Alain SALMETOZ" <a...@mgeups.com> > cc : c...@yahoogroups.com > > Objet : Re: R=E9f. : [c28x] sprintf function > > Hi, > > I typed the strFloat as char[32], and the result i want to get is less=20 then > 10 charecters (%3.3f). > I know that the sprinf needs to allocate memory, and in my DSP/BIOS i'm=20 not > using a heap. > Is the unprototype heap couse this problam? > > Thanks. > > On Fri, May 16, 2008 at 9:01 AM, Alain SALMETOZ <* > a...@mgeups.com* <a...@mgeups.com>> wrote: > Are you sure the strFloat variable has enough space reserved ? > If you typedef as a char[], it means char*, so no memory allocated to=20 your > string. > > Veuillez r=E9pondre =E0 *e...@gmail.com* <erantec%40gmail.com> > Envoy=E9 par : *c...@yahoogroups.com* <c28x%40yahoogroups.com> > Pour : *c...@yahoogroups.com* <c28x%40yahoogroups.com> > cc : > > Objet : [c28x] sprintf function > Hi all, > > I'm using the sprintf function like: > Result =3D sprintf(strFloat,"%3.3f",stInterpVars.fResult); > > Where: > Result - number of copeid charectars. > strFloat - destination, type char[]. > stInterpVars.fResult - source, type double. > > The function is working, I got the correct result in destination, but > there is a memory leak. The function overwrite other variable. > > Does someone know what happend? or anyone handle with that function? > Thanks > >=20 > ------------------------------------ OMAP35x EVM jump-starts low-power apps ------------------------------------ The modular and extensible OMAP35x Evaluation Module (EVM) enables develope= rs to start building applications based on the OMAP35x architecture: http:/= /www.DSPRelated.com/omap35x You can post a message or access and search the archives of this group on D= SPRelated.com: http://www.dsprelated.com/groups/c28x/1.php _____________________________________
SECTIONS
{
/* Setup for "boot to SARAM" mode:
The codestart section (found in DSP28_CodeStartBranch.asm)
re-directs execution to the start of user code. */
/* codestart : > BEGIN, PAGE = 0*/
/*** User Defined Sections ***/
codestart :> BEGIN_M0, PAGE = 0 /* Used by file CodeStartBranch.asm */
ramfuncs :> L47SARAM PAGE = 0
.adc_cal :> L03SARAM PAGE = 0
SaramCode :> L47SARAM PAGE = 0
RecorderData :> L47SARAM PAGE = 0
RecorderCode :> SRAM PAGE = 0
IoCode :> SRAM PAGE = 0
IoData :> L47SARAM PAGE = 0
DmaCode :> L47SARAM PAGE = 0
DmaData :> L47SARAM PAGE = 0
ServoCode :> L03SARAM PAGE = 0
ServoData :> L03SARAM PAGE = 0
Servo2Code :> L47SARAM PAGE = 0
Servo2Data :> L47SARAM PAGE = 0
DMARAML4 :> L47SARAM PAGE = 0
SramCode :> SRAM PAGE = 0
LexCode :> SRAM PAGE = 0
CanIsrCode :> L03SARAM PAGE = 0
pECanaMboxesData :> L03SARAM PAGE = 0
SramData :> SRAMDATA PAGE = 1
/* SaramCode :> MSARAM PAGE = 1 */
}
SECTIONS
{
/* Setup for "boot to SARAM" mode:
The codestart section (found in DSP28_CodeStartBranch.asm)
re-directs execution to the start of user code. */
/* codestart : > BEGIN, PAGE = 0*/
/*** User Defined Sections ***/
codestart :> BEGIN_M0, PAGE = 0 /* Used by file CodeStartBranch.asm */
ramfuncs :> L47SARAM PAGE = 0
.adc_cal :> L03SARAM PAGE = 0
SaramCode :> L47SARAM PAGE = 0
RecorderData :> L47SARAM PAGE = 0
RecorderCode :> SRAM PAGE = 0
IoCode :> SRAM PAGE = 0
IoData :> L47SARAM PAGE = 0
DmaCode :> L47SARAM PAGE = 0
DmaData :> L47SARAM PAGE = 0
ServoCode :> L03SARAM PAGE = 0
ServoData :> L03SARAM PAGE = 0
Servo2Code :> L47SARAM PAGE = 0
Servo2Data :> L47SARAM PAGE = 0
DMARAML4 :> L47SARAM PAGE = 0
SramCode :> SRAM PAGE = 0
LexCode :> SRAM PAGE = 0
CanIsrCode :> L03SARAM PAGE = 0
pECanaMboxesData :> L03SARAM PAGE = 0
SramData :> SRAMDATA PAGE = 1
/* SaramCode :> MSARAM PAGE = 1 */
}