MON166: SOFTWARE RESET USING THE MONITOR
QUESTION
What happens when debugging using MON166 and my program executes a software reset using the SRTS instruction?
Specifically, does SRST restart the monitor or does it restart my program?
ANSWER
The behavior of SRST depends on how MON166 is integrated into your target platform.
If MON166 is programmed into an EPROM, then the monitor restarts when you execute the SRST instruction.
If MON166 is loaded into RAM using the bootstrap loader, the SRST instruction restarts your target program.
MON166: STRANGE PROBLEMS USING INTERRUPTS
QUESTION
Help! We‘re using MON166 to debug our target program and we are experiencing strange program crashes.
The program runs OK in the simulator but not with the monitor.
ANSWER
Make sure you reserve the traps that the monitor uses.
If you don‘t reserve the memory space for these, your program will surely trounce on them and crash the monitor.
The traps used by MON166 are: NMI trap (for breakpoints) and one Serial trap.
To reserve these memory areas, specify the following reserve command on the linker command line:
RESERVE ( 08h - 0Bh , 0ACh - 0AFh , 0B8h - 0BBh )
00’0008H : Non-Maskable Interrupt
00’00ACH : ASC0 Receive
00’00B8H : SSC Receive
MON166: ERROR (WRONG CONFIGURATION OF BOOTSTRAP)
QUESTION
We purchased the KEIL software tools for the Siemens 80c166.
We also got the 167 starter kit for Siemens which has DEMO versions of the KEIL software.
The problem is that MON166.EXE in the starter kit works fine but the MON166.EXE that came with the tools gives me a
"Error: Wrong configuration of bootstrap loader!"
What‘s wrong?
ANSWER
When you use MON166.EXE or MON166.DLL (with dScope) to debug programs on your target hardware,
you must have the correct BOOT and MONITOR files copied into the \C166\BIN directory.
These files are downloaded and started by the MON166 programs.
You may copy these files from the DEMO software‘s \C166\MONITOR into the REAL software‘s \C166\MONITOR directory.
After you do that, run the MON166 program and the starter kit board should work just fine.
MON166: SERIAL ISR OVERWRITTEN WHEN USING NMI ONLY OPTION
SYMPTOMS
I have written a project that includes a serial ISR.
I have downloaded the monitor and selected the ‘stop program execution with NMI only‘ option in uVision2.
When I download my program the monitor overwrites my serial ISR with its own,
yet the monitor should only be using the NMI, not the serial interrupt.
CAUSE
This was a bug in the monitor in V4.02 that is corrected in the current release.
You may download the latest updates from the Keil Website.
Make sure that you have configured your program to use only the NMI to halt program execution. To do so:
- Open the project options dialog.
- Select the Debug tab.
- Select Settings for the Keil monitor (this button is located in the top right corner of the window).
- In the monitor settings dialog, select NMI Only for Stop Program Execution.
MON166: HARDWARE REQUIREMENTS
QUESTION
What are the hardware requirements of the Monitor166?
ANSWER
- Infineon (Siemens) 166/167/165/163 CPU or ST10
- Serial Interface
- Software trap used for breakpoints (usually NMI trap)
- Additional 10 words of stack space in the user application
- 256 bytes of external data memory (RAM)
- 5Kbytes of external code memory (ROM) or
5Kbytes of external data memory (RAM) when the on-chip bootstrap loader is used.
All other hardware components may be used by the user application.
MON166: HOW TO CONFIGURE
QUESTION
How do I configure the 166 monitor for my target hardware?
ANSWER
Refer to the following listing of the README.TXT file that is included in the \KEIL\C166\MONITOR\ directory.
This file discusses how to add MON166 support for additional target hardware.
MON166: CONNECTING TO A TERMINAL DOESN‘T WORK
SYMPTOMS
I have installed the MON166 monitor in ROM in my C167 hardware.
However, I can‘t seem to connect to the monitor with my terminal. What am I doing wrong?
CAUSE
MON166 is meant to connect with the dScope debugger or the uVision debugger.
A special protocol is used which is difficult to emulate with only a terminal.
RESOLUTION
Use dScope or the uVision Debugger to connect with your target hardware.
The debugger will route your serial output to a window.
Since the communication with the monitor uses a protocol,
anything that doesn‘t use this protocol MUST be your serial I/O.
MON166: MONITOR STOPS WORKING AFTER EXECUTING CODE
SYMPTOMS
When using MON166 and executing code, the monitor stops responding after starting the target program.
CAUSE
This problem may be caused by the following:
- Overwriting the interrupt vectors used by the monitor.
- Overwriting the monitor code or data areas.
- Changing the P3 direction register (used by the serial port).
RESOLUTION
Overwriting the interrupt vectors used by the monitor.
If you use the Monitor in Bootstrap mode, you must reserve the interrupt vectors and the monitor code area.
In most cases you have to RESERVE at least the serial interrupt 0 and the NMI trap with L166.
Under uVision2 you need to enter this information under Options - L166 Misc - Reserve:
8H-0BH, 0ACH-0AFH
Overwriting the monitor code or data areas.
You should also reserve the monitor code and data area.
Please check the configuration of your monitor to figure out which areas you need to reserve.
For most boards you will find this information under uVision2 in the dialog Options - Debug - Monitor Settings - Description.
Changing the port 3 direction register (used by the serial port).
I/O port 3 is used by the monitor for the serial port (typically) but may also be used in your application.
Therefore, you need to make sure that the register P3 and DP3 are configured as follows:
- TxD0 (P3.10) as output and initilize the P3.10 port with ‘1‘.
- RxD0 (P3.11) as input.
For example:
P3 = 0x0400; // P3.10 must be ‘high‘ DP3 = 0x0400; // P3.10 must be ‘output‘
MON166: MODIFYING FOR WORD READS AND WRITES
QUESTION
Is it possible to modify the monitor to write words instead of bytes?
ANSWER
This is possible, but not easy to do.
While it is possible to modify the monitor to read and write only words, it does not necessarily make much sense.
One reason is that data downloaded to the monitor comes in 1 byte at a time (that is how the serial port works).
If the monitor were modified to write words, it would have to save the first byte and wait for the second half of the word to be received.
MON166: CAN‘T SINGLE-STEP THROUGH TARGET CODE ABOVE 0X400000
SYMPTOMS
Help, I have configured the MON166 monitor so that my program code lives above address 0x400000.
After I load my program and attempt to single-step, the uVision2 Debugger gives me an error message
and I have to restart my target hardware. Run til cursor works fine.
What could cause this problem?
CAUSE
This problem may be caused by an oversignt in the MON.LIB file that is used when building the C166 monitor program.
The problem specifically affected the single step and procedure steps over instructions at address 40:0000 and higher.
This is not a common problem because most target systems don‘t have that much memory available.
RESOLUTION
This problem is corrected in version 2.02 of the monitor library.
The version of the monitor library may be checked by typing
LIB166 LIST MON.LIB
This problem has been fixed in C166 version 4.10. Install this update and rebuild your monitor.
MON166: HOW MUCH RAM IS REQUIRED?
QUESTION
How much RAM is required to use the MON166 target monitor in my hardware?
ANSWER
Very little RAM is required to use MON166.
The monitor needs only 256 bytes of RAM for its internal use.
The monitor program can be stored in 5K of EPROM or FLASH memory space.
When using the on-chip bootstrap loader, the monitor program is loaded into 5K of external RAM.
In addition to the RAM required by the monitor, you will also need RAM
to download your target program into as well as RAM for your target program‘s variables.
The total amount of RAM required depends on both the requirements of MON166 (256 bytes + 5K with bootstrap loader)
and the size and memory requirements of your target program.
MON166: USING THE SIMULATED SERIAL PORT
QUESTION
Are there any caveats to using the simulated serial port of the MON166 Target Monitor?
ANSWER
There are only a few negative points to using the simulated serial port.
- There is no interrupt associated with the simulated serial port,
so, you can‘t use the stop button in the debugger to stop program execution
and start back where you left off. - This means that you‘ll have to set break points and
single step through your program (but that‘s not a major limitation). - Since the bootloader only works with ASC0,
you‘ll have to burn an EPROM that contains the simulated serial port MONITOR. - You‘ll lose 2 I/O pins with the simulated serial I/O.
MON166: CAN BUS DOES NOT WORK UNDER MONITOR TESTING
QUESTION
I‘m using the CAN peripherals in my application and must set
the XPEN:
XRAM & XBUS Peripheral Enable Control Bit (SYSCON.2) in the START167.A66
file.
Everything works fine in the real hardware, but when I test my
application
with the Keil Monitor-166 it does not work. How can I solve this
problem?
ANSWER
The Monitor-166 initializes the CPU and executes the EINIT instruction
before your program loads and executes.
On most 166/ST10 variants it is
not possible to modify the SYSCON register after execution of EINIT.
For this reason, the monitor‘s startup code (in CONFIG.INC) must match that
of your target program.
If you use the Monitor in bootstrap mode you may
modify the Monitor
using the uVision2 projects in the \KEIL\C166\MONITOR
folder.
MON166: ERROR (CANNOT WRITE MEMORY)
SYMPTOMS
When I try to debug my application with Monitor-166 I receive the following error message:
CANNOT WRITE TO ROM AREA AT ADDRESS 0AEFFFFH
Why is this error message displayed and what does it mean?
CAUSE
Most likely your application is larger than the available memory
and when
loaded it is overwriting the monitor data area.
You can check this in the
linker MAP file (typically this file has the extension *.M66).
This file
tells you the memory areas in use by your program.
Verify that the monitor
data area is not also being used by your application.
RESOLUTION
If your program is using the monitor data area, you have several alternatives:
- Reduce the memory requirements of your application.
- Increase the amount memory available on your target system.
- Reserve the monitor data area using the Linker RESERVE directive.
- Reconfigure the monitor to use a different area for its data space.
MON166: STARTUP CODE CHANGES DO NOT WORK WITH MCB167-NET
QUESTION
I‘m using the MCB167-NET evaluation board to debug my application.
I am
using external devices and have changed the configuration of the SYSCON,
BUSCONx, and ADDRSELx registers.
I have changed the RP0H value using the
PORT0 configuration DIP switches that are provided on the MCB167-NET board.
No matter what values I change in START167.A66, the values in SYSCON and
RSTCON do not change.
It appears to accept only the default values.
ANSWER
It sounds like you are using Monitor-166 to download and test your
program.
For the C16x device, the startup code in Monitor-166 will also be
used by your application.
This is because once the startup code in the
monitor executes the EINIT instruction,
it is impossible to change the
configuration of SYSCON and RSTCON.
Since EINIT has already executed when
the monitor runs your target program,
your startup code changes are
ignored.
You must modify the startup code used by the monitor to configure the device.
The project that configures the Monitor for the MCB167-NET board is stored in
the
\KEIL\C166\MONITOR\KEIL MCB167 NET folder.
You must modify the CONFIG.INC file so that it
contains the same settings as the START167.A66 file of your application.
Then, generate the modified Monitor with uVision using Project
— Rebuild all Target Files.
MON166: CANNOT SINGLE-STEP IN BOOSTRAP MODE
QUESTION
When I start a debug session in μVision2, the Monitor-166 and my application
is downloaded correctly with the on-chip bootstrap loader.
I can see the
application in the disassembly window and I can view all memory areas in the
memory window.
However, I cannot single-step or start the application.
Monitor-166 is configured for my microcontroller board.
There is 1MB
external RAM connected to chip select 1 (\CS1) and
I have enabled this RAM
in the address range from 0x100000 to 0x1FFFFF.
The Monitor-166 and my
application is located within this RAM area.
ANSWER
This memory layout is not suitable for Monitor-166 and your application
because the interrupt vectors cannot be reached.
Monitor-166 needs the
NMI interrupt vector for breakpoints.
Please use one of the following
configurations:
- Map the external RAM to address 0 by setting ‘ADDRESS1‘ to 0 in the
Monitor-166 configuration file (CONFIG.INC).
Locate the Monitor code and data address areas as well as your application into the RAM are from 0x0000 to 0x0FFFFF. - Install Monitor-166 at code address 0 in (FLASH) ROM. The bootstrap loader cannot be used in this case.