I have a small test program which continuously sends characters (ascii table) to the serial ports (ST uPSD3233). The program runs fine when the memory model is: Memory Model: small: variables in DATA Code ROM Size: Large: 64K program But I get garbage when I change from "Memory Model: small: variables in DATA" to "Large: variables in XDATA". Where should I be looking to fix the problem? Thanks.
The chip has on-chip external flash which can be used as external RAM. I tried to setup the compiler with the right start address (as instructed by the hardware engineer) but the compiler complained saying something like "illegal range". So I just left that configuration box empty and compiled.
"I tried to setup the compiler with the right start address (as instructed by the hardware engineer) but the compiler complained" That is almost certainly your problem, then! Obviously, your tools must be correctly set up to generate code which matches your hardware configuration! Either your HW engineer mis-informed you, or you somehow mis-formed the compiler setup - or maybe a bit of both. Note that this sort of thing usually requires the correct setup in both Compiler and Linker. Note also that the Compiler & Linker setup options (usually) simply inform the tools about your target; they do not generate any code which may be necessary to configure the hardware - you have to write that yourself! Have you looked at the Linker Map file to make sure that it matches your hardware memory map? You say it's a simple Project, so you should be able to examine the generated assembler, or step through in the debugger to see what's happening.
The chip has on-chip external flash which can be used as external RAM. This seems unlikely to me. You have to perform a little algorithm (four bus cycles long) to program a word of flash, and you have to erase it first, as you can only write bits from "1" to "0" and not vice versa without erasing. Also, flash has a limited number of times it can be erased and re-written, usually about 100k or 1M these days -- which is fine for most applications, but you'd burn the flash out pretty quickly if you stored program variables in one. A million changes isn't a lot if you're talking about "for (i = 0;; ++i)". Flash is a sort of programmable ROM, as opposed to a sort of nonvolatile RAM. The chip does have an 8K SRAM. That presumably can be mapped to be your xdata space. I didn't study the data sheet in detail, but there are some chip-specific configuration registers you have to set to control where the SRAM shows up. Double-check those to make sure your SRAM shows up at the address you used when building the project. You may need to add some custom startup code to make sure those configuration registers are properly set after processor reset.
Drew Davis: " there are some chip-specific configuration registers you have to set to control where the SRAM shows up." That's precisely the kind of thing I was thinking of when I said that the options you specify to the tools only inform them about your system - they do not generate any code necessary to configure your system! You must both set the necessary registers to configure the SRAM to a certain address, and specify that address in the Tool options so that they address the SRAM appropriately!
Thanks for all the replies. They have been really helpful especially since this is the first time I'm working on a project of this nature. After setting the right values for "start" and "size" options in the target dialog box for code and data I was able to get the small test program to work fine. In the BL51 Locate dialog box I simply selected the "Use memory layout from target dialog" option (I could not understand the other options in th BL51 dialog box and found nothing in the documentation so I left them vacant). However I get no output on the serial ports when I try to execute my real project which is much larger in size. Andrew Neil: You must both set the necessary registers to configure the SRAM to a certain address, and specify that address in the Tool options so that they address the SRAM appropriately! According to our hardware engineer I do not have to worry about this because after the reset the hardware comes up configured already with the SRAM mapped at the right location. I also looked at the map file and found the following: ACTIVE MEMORY CLASSES OF MODULE: FIRSTPROJ(SERIALIO)
BASE START END USED MEMORY CLASS ========================================================== C:000000H C:000000H C:00FFFFH 009434H CODE I:000000H I:000000H I:0000FFH 000001H IDATA X:000000H X:000000H X:00FFFFH 000256H XDATA I:000020H.0 I:000020H.0 I:00002FH.7 000001H.3 BIT I:000000H I:000000H I:00007FH 00000FH DATA