Topic : Semtech XE8000 Harvard Architecture and Text String Handling

Forum : Other families

Original Post
Post Information Post
December 17, 2009 - 10:34pm
Guest

Tools: Ride7
CPU: XE8801A
Language: C

Hello All,
I am writing a system diagnostic test in C and have a need to print many text strings to support the user interface and test sequence. Are there any C language extensions to enable string constants to be stored in FLASH memory of the XE8000?

I noticed that when I print a string constant such as " printf("Hello there \n"); ",
the storage for the "Hello there" string is allocated in scarce RAM (only 512 bytes).

When I experimented with a string constant such as " const static foo = "abdefg"; ",
the storage is also assigned to RAM by the compiler. (In this case and the case above, the initialization code generated by the compiler must initialize the RAM to these constant values.)

I tried to figure out a way to use part of the 8192 words of on-chip FLASH (program memory) to store the strings - since Flash memory is much more plentiful than Ram!

After doing a little digging and looking at mixed C/Assembly listings it appears that the XE8801/CoolRISC_816 instruction set is a strict Harvard architecture that does not permit the instruction area to be accessed as data. It seems that the Indexed Addressing modes (that would be needed to access a contiguous text string in memory) are limited to using the data memory index registers (i0, i1, i2, i3) specified by the 2-bit subfield. The program memory index register (ip) is not referenced in the data move instructions.

So it appears that the only way to output a long string is to use the "Immediate data" addressing mode - one character at a time such as:

putchar('H');
putchar('e');
putchar('l');
putchar('l');
putchar('o'); ... and so on.

Am I losing my mind? Or is there a better way to do this?

Many Thanks for your input,
Jeff