Reply by Casey May 10, 20042004-05-10
Abhinav said...

> I am hoping the memory is setup therefore as follows: > > 0x00000 to 0x1FFFFF (128 KByte RAM) > 0x20000 to 0x3FFFFF (128 KByte FLASH) > > Interrupt table is at 0x30000 (so it is in the Flash) and that is why > the interrupt vector table is set to 0x30000 on my target application > setting and why vectab = 0x30000 on my mon166 configuration code in > config.inc.
I'm not sure what MON166 does as far as interrupts go, but the C167 expects the actual vector table to start at 0x00000. At the system reset, the 167 will fetch the first interrupt vector (at 0x00000) and expect that to be a jump to the start-up code. You may be getting past this point but you won't if the processor cannot find a vector at location 0x00000 using CS0.
> The Test LED Program code is stored at 0x30000 while the firmware > variables and non-constants are stored at 0x400 on the RAM.
The startup code will copy the stored vector table from FLASH to RAM, but the startup code will never execute if the RESET vector isn't found initially.
> The Monitor code will be stored on the FLASH at 0x00000 and then, > during execution, the monitor data will run on the RAM at 0x3A600 and > the monitor code will run on the RAM at 0x3A800.
You lost me (which isn't hard to do). Up above you said RAM was at 0x00000 to 0x1FFFF and FLASH was at 0x20000 to 0x3FFFF, but now they seem reversed. Like I said, it's not clear just how far into the bootup process you're getting. Maybe you're using the on-chip bootstrap routine in internal ROM? Casey
Reply by Abhinav May 10, 20042004-05-10
Problem -------------------------------------

I am not able to successfully configure MON166 (bootstrap mode) to
flash onto my external flash memory so that it communicates properly
with my host PC and downloads my target firmware to the external RAM.
In fact, when I download the MON166 it gives me an error regarding
loss of communication with target.

Components on my board
---------------------------------------------

1. Infineon C167CS-L40M microprocessor
2. 128 KByte external flash memory
3. 128 KByte external RAM memory

Development tools I use
---------------------------------------------

The Keil C166 Compiler, Assembler, and linker (latest C166 version)

Configuration of MON166 (CONFIG.INC file)
-------------------------------------

CS1# controls the external RAM memory
CS0# controls the external FLASH memory
BUSCON1 = 0x4BF
BUSCON0 = 0x4BE
ADDRSEL1 = #5 (128 KByte range starting at address 0x00000)
DISABLED remaining BUSCONx registers
SYSCON0 = 0x7
DISABLED remaining SYSCONx registers

DATA_START = 0x3A600
CODE_START = 0x3A800
VECTAB = 0x30000

On Keil -> "Options for target" -> tab "Target" -> External Memory:
- RAM = Start: 0x20000, Size: 0x20000
- ROM = START: 0x00000, Size: 0x20000

Configuration of Test LED Program (START67.A66)
------------------------------

BUSCON1 = 0x4BF
BUSCON0 = 0x4BE
ADDRSEL1 = #5
DISABLED remaining BUSCONx registers
SYSCON0 = 0x7
DISABLED remaining SYSCONx registers

On Keil -> "Options for target" -> tab "Target" -> External Memory:
- RAM = Start: 0x400, Size: 0x1FC00
- ROM = Start: 0x30000, Size: 0x10000

On Keil -> "Options for target" -> tab "L166 MISC" -> Interrupt vector
table address: 0x30000

On Keil -> "Options for target" -> tab "L166 MISC" -> Interrupt vector
table address: 0x30000

On Keil -> "Options for target" -> tab "L166 MISC" -> Reserve =
8H-0BH,0ACH-0AFH,3A600H-3BFFFH


Hardware Configuration
---------------------------------------------

It is set up for 16-bit De-multiplexed bus mode so that PORT0, high
byte is used for putting address on the bus (A15..A0) and the PORT0,
low byte is used for reading data from/writing data to the bus.
Further, additional segment addresses A17..A16 are used (we have
configured it for 256 KByte address space). Also, it is set for 20
MHz clock.

Conclusion -------------------------------------------------------------------

I am hoping the memory is setup therefore as follows:

0x00000 to 0x1FFFFF (128 KByte RAM)
0x20000 to 0x3FFFFF (128 KByte FLASH)

Interrupt table is at 0x30000 (so it is in the Flash) and that is why
the interrupt vector table is set to 0x30000 on my target application
setting and why vectab = 0x30000 on my mon166 configuration code in
config.inc.

The Test LED Program code is stored at 0x30000 while the firmware
variables and non-constants are stored at 0x400 on the RAM.

The Monitor code will be stored on the FLASH at 0x00000 and then,
during execution, the monitor data will run on the RAM at 0x3A600 and
the monitor code will run on the RAM at 0x3A800.

If anyone can help me in telling me what I am doing wrong in
configuring the Monitor and the LED test program so that I can
finallly have a properly configured MON166 for my Infineon C167 chip
that would be very helpful.