sprintf() link error for DSP56F801 project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sprintf() link error for DSP56F801 project

Jump to solution
4,108 Views
GregCloutier
Contributor I
To get right to the question, is there any reason that sprintf() does not work with a DSP56F801 processor.  The function exists, and I just can't get it to work.  It seems silly since I have not had a problem doing this on much less capable processors with less resources.
 
I have a 56F800DEMO board with a DSP56F801FA60 processor on it.  I have had no problem building and running the 3 included demo applications.  I have populated the RS232 level converter area and have been able to communicate using the "Term" bean.  So my problem does not seem to be linked to hardware functionality or toolchain problems.
 
I have tried many ways to build an application using the sprintf() function from the stdio.h library in Codewarrior 7.3.  I have tried adding it to the demo projects, a fresh PE Stationary,  EABI Stationary, and the new project wizard. 
 
Here is a sample of the simplest version of the code that demonstrates the problem:
 
Code:
#include<stdio.h>int main(void){ char myString[50]; sprintf(myString,"Test String");   return 0;}
 
Under all conditions, I get the following error:
 
Code:
Link Error   : Segment overflow: .x_internal_RAMReserved size is 0x000003c0 -- Overflow 0x00000068Link failed.
 
By the way, the actual size that I assign to the character array has absolutely no effect on the amount of overflow.
 
Thanks for any help or suggestions,
Greg
0 Kudos
1 Solution
1,441 Views
DanielM
Contributor III
Hi,

if I recall correctly the default sprintf is implemented in such a way that it needs malloc and heap space - which is why it runs out of mem.

Attached is a *very* old project of mine where I have implemented my own printf and sprintf. Perhaps that will be of some help to you.

Daniel

Message Edited by DanielM on 2006-08-24 09:37 AM

View solution in original post

0 Kudos
2 Replies
1,442 Views
DanielM
Contributor III
Hi,

if I recall correctly the default sprintf is implemented in such a way that it needs malloc and heap space - which is why it runs out of mem.

Attached is a *very* old project of mine where I have implemented my own printf and sprintf. Perhaps that will be of some help to you.

Daniel

Message Edited by DanielM on 2006-08-24 09:37 AM

0 Kudos
1,441 Views
GregCloutier
Contributor I
Daniel,
Thanks for the explanation and thanks for providing your stripped down version of sprintf.  It will come in handy while trying out the demo board.  Since it is a memory issue, I should probably choose a higher end family member for my final design.  I ran into a similar problem trying to use the PC Master functionality.  Maybe I should just get a higher end demo board and then scale back when I figure out how things work.
 
Greg
0 Kudos