Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).
|
>I run my software and it works >great in ExtRam but will not run under Flash. I traced a big problem back >to sprintf calls. Any time I try to call that it blows up. ANSWER> The real problem here is probably the size of your stack that is allocated via the linker command file. sprintf requires a pretty large buffer when called upon that gets placed upon the stack. In the External Ram Target, the stack is allocated as follows: .xStack (RW) : ORIGIN = 0xF200, LENGTH = 0x0D80 In the Flash Target, the stack is allocated as follows: .xStack (RW) : ORIGIN = 0x0EA0, LENGTH = 0x0160 So, as you can see, you've significantly reduced the size of your stack. In your case, the stack is probably overflowing into the peripherals segment which is defined afterwards in the Flash target and causing problems which permits it from running properly. Therefore, you need to find a way to increase your stack size and still fit everything in the data space. For example, if you have external memory available, you can put some stuff in that space which is defined as follows: .xExtRAM (R) : ORIGIN = 0x2000, LENGTH = 0xDF80 If you'll notice, it is not used in the linker.cmd file for Flash as it tries to fit everything into internal memory on the chip. However, if you have external memory available on your board, you should exercise use of it. If not, then you are just going to have to play a space game and try to increase your stack size and still fit everything into data memory. >I also removed the DSP libraries from the >project to trim the size of stuff. Are there other ways to do that as well, >when we are only using the chip as a micro-controller at this time. ANSWER> The linker does a really good job of deadstripping code that is unused from libraries contained within the SDK project (since all of the libraries are built with the CodeWarrior C Compiler). You can read about this on page DSP-98 in the Targeting_DSP56800.pdf. >Also there are some really strange things happening when running in Flash as >opposed to ExtRam, where is this documented? ANSWER> Without any details I'm not sure how much I can help you on this one. There's not much documentation regarding running from Flash but there is documentation regarding programming the flash and debugging in flash in Chapter 11 of the Targeting_DSP56800.pdf. >Thanks for any help and please excuse my ignorance as this kind of >progrmming is new to me. I am an old hand when there is a big huge >operating system and a ton of resources, but this tight squeeze stuff is all >new. ANSWER> No problem, thanks for using CodeWarrior during the learning curve. :-) Ron -- Metrowerks wishes you and yours Seasons Greetings and Happy Holidays Ron Liechty |