Distinguishing ROM and RAM for external memory
Up to SH Family
Hello,
I am using SH2 - SH7142. I realized that I cannot use the single chip mode in my application for whatever reasons, even though I have to determine Mode2 (internal memory + external memory) or Mode0 (external memory only). I'm designing the circuit first, and I got 3 questions.
1. For Mode0, the program counter starts reading from 0x00000000. It's my responsibility to program the external eeprom so the program runs right, and map the memory to CS0. Is this all I have to do for Mode0?
2.In my application, the space limitation is tight although I may not be able to use both internal ROM and cash. Can I make it run (though it can be slow), where the eeprom takes a role of cash as well as ROM? In my understanding, there is no need to tell SH whether I am using SRAM/eeprom/whatever, but I can control everything (such as wait time) in BSC.
3. In sample schematics I looked up, they put only 256Kx8bit SRAM even though the LSI has 20 address lines and can take a larger SRAM. How can I tell SH that I occupied 0x04000000 – 0x0403ffff (for CS1) so that the routine does not access 0x04040000 by mistake?
Thanks!
- For mode 0 the external Flash/ROM/PROM would need to be preprogrammed. There are ways to have the SH2 program external flash, but it isn't usually picked for production boards.
- Reading from external memory is controlled by the BSC. It can be configured for SRAM/ROM/FLASH/etc. I don't understand the comment about the cache.
- The linker determines where your code resides in memory and what addresses get used. You can configure it yourself. There are linker warning messages to tell you if CODE space exceeds what's available, but it isn't always possible to have the tools tell you if you are running out of RAM. (try searching on RenesasRulz for "memory guard".)

