This file contains release notes and last minute changes that are not found in the printed manuals.
Information in this file, the accompany manuals, and software
is
Copyright © Keil Software, Inc and Keil Elektronik GmbH.
All rights reserved.
The MON390 is a Monitor program that allows you to debug applications on your
target hardware using the Keil µVision2 Debugger. You connect the µVision2
Debugger with a serial cable to a target board that uses a Dallas CPU (like
DS80C390, or DS80C400) running in Contiguous Mode. In this mode up to
16MByte memory are supported.
To get started, you must:
We recommend that you test your MON390 installation with an example project available in the Keil\C51\MON390 folder before you start debugging with your own test program.
MON390 connects to the µVision2 Debugger via the serial interface. MON390 is fully transparent for the user application. There are only a few issues to keep in mind when you are using MON390:
Breakpoints are required to stop the user application for checking of the
system variables. To perform a breakpoint MON390 inserts a ACALL instruction in
the user program. This method avoids extra hardware for the breakpoint logic.
However, breakpoints can only be set in RAM memory. Another drawback is that a
ACALL instruction occupies up to three bytes. Therefore breakpoints may have
side effects when set before a label (jump target) on a one or two byte
CPU instruction. The following example demonstrates this problem.
User Program
8000 E4 CLR A 8001 74 03 MOV A,#3 : : : : : : 8010 80 ED SJMP 8001
First, the user program is executed until address 8010 with a Debugger command like G, 8010.
Then, a breakpoint is set at address 8000. The breakpoint is realized by
writing a ACALL instruction into the user program; this means that the user
program is modified by the breakpoint.
User Program Modified Due to Breakpoints
8000 XX ACALL ; An ACALL instruction is 8001 XX XX ??? ; written at address 8000. : : : : : : 8010 80 ED SJMP 8001
When the user program continues execution at address 8010 the program jumps to address 8001. However, this memory location is overwritten with the second op-code byte of the ACALL instruction that is inserted due to the breakpoint at address 8000. Therefore, the MOV A,#3 instruction will be not executed and the behavior of the user program is unpredictable.
In real C applications such conditions are rare, however, you should keep in mind that the ACALL instruction might influence the user program. In such situations, you may single step in the user program. During single stepping all instructions are executed without conflicts, since the debugger takes care about conflicts.
When only exection breakpoints are defined, the user program is executed in full speed. You may also use access or conditional breakpoints. In this case, the application is executed in single steps and not in real time. Single step execution is at least 1000 times slower.
Preconfigured Mon390 version are available in the folder Keil\C51\MON390\. If your target board is not available, you need to configure the User Monitor for your target hardware.
The following steps are required to customize the User Monitor project:
Program that may be used to verify the settings for a user Mon390 can be found in the folder Keil\C51\MON390\Examples.
Once you have installed the MON390 firmware to the target hardware you may configure the µVision2 Debugger for communication with the Dallas Contiguous Mode target system.
COM Port Settings
- Port: PC COM port used to connect the target hardware.
- Baudrate: Communication baud rate with the target hardware.
Cache Options
The MON390 driver implements data caches to speed-up screen updates.
- Disable the cache options to view actual (un-cached) memory content of DATA (and SFR), IDATA, or XDATA space when you halt program execution. This way you can be certain you are viewing the current values of I/O ports, timers, or memory-mapped peripherals.
- Enable the cache options to obtain maximum performance. This enhances especially the code disassembly and displaying of huge memory areas.
Target Options
When using MON390, the complete target application is stored in von-Neumann mapped RAM. This means that the code memory and xdata memory are accessing the same physical memory space. This is required, since the target hardware is not able to write into code space and the MON390 changes the program code to set breakpoints in your application.
Therefore the EPROM and RAM areas that are entered in the dialog Project - Options for Target – Target – Off-chip Memory must be non-overlapping physical memory areas. These ranges are supplied to the Linker if you have enabled the option Use Memory Layout from Target Dialog in the LX51 Locate dialog page. Therefore you should also check that this option is set.
Refer to the µVision2 projects in the folder Keil\C51\MON390\Examples and review the tool configuration of this applications if you are not sure about the tool configuration.
When the Monitor is installed at address 0 interrupt vectors will be redirected as specified with the INT_ADR_OFF definition in the INSTALL.A51 file. Therefore you need to modify the START390.A51 startup code and you may need to set an interrupt vector offset. The initial LJMP instruction needs to be exchanged by an AJMP instruction. The Monitor-390 already switches the CPU into contiguous mode, and therefore the AJMP instruction can have a jump target anywhere in the 64KB CODE memory class that is used in the START390.A51. The modification in the START390.A51 is as shown below:
?C_STARTUP LABEL NEAR ;DB 02H ; LJMP in Classic 8051 Mode ;DW WORD0 STARTUP1 AJMP STARTUP1 ; AJMP in Contigous Mode
The other modifications depend on the redirection address. If you just change the interrupt vector address offset to a different 64KB segment (for example C:0x010000) you need to enter the start address of the under Project - Options for Target - Target - Off-Chip Code memory. For example: EPROM #1: Start: 0x10000 Size: 0x40000. The uVision2 IDE converts this into a LX51 Linker/Locater CLASSES directive that will contain a CODE memory class that starts at C:0x10000. If you redirect the start address to a page offset (for example to C:0x008000 or C:0x018000), you need in addition also a change for the ?C_CPURESET?0 segment in START390.A51 as shown below:
?C_CPURESET?0 SEGMENT CODE OFFS 8000H RSEG ?C_CPURESET?0
Once the µVision2 Debugger is configured, you may start debugging with Debug - Start/Stop Debug Session. The µVision2 Debugger connects to the Dallas target system via the MON390: Dallas Contiguous Mode driver.
MON390 supports most µVision2 debugger features. For instance, you may single-step through code, set breakpoints, and run your application. Variables may be viewed and modified using the standard debugger features. Changing the values of SFRs and memory of any type can be done in the Watch Windows or the the Register tab.
More information about debugging with MON390 can be found in the User's Guide Getting Started with µVision2, Chapter 5. Testing Programs and Chapter 11. Debugging with Monitor-51.
There are several restrictions you must consider when using MON390 and the µVision2 Debugger.
The following section gives you tips to solve common problems.
... it is typically a problem of MON390 code and xdata locations or the
initialization of the serial interface.
You should first verify that the target system's serial interface is correctly configured. You may check this by using the µVision2 Simulation as follows:
If everything is correctly configured and you are still unable to connect to the hardware, you'll try to link the following test-program with your monitor install code and load it into your hardware. It shoud echo all inputs on the keyboard back in your Hyperterminal.
/* * Test Function: verify serial communication with HyperTerminal */ #include <REG390.H> void main (void) { char c = 'A'; // init serial interface 19200 baud @ 20MHz PCON |= 0x80; SCON0 = 0x50; TMOD |= 0x21; TH1 = 0xF8; CKCON |= 0x10; TCON = 0x50; TI = 1; while (1) { if (RI) { c = SBUF; RI = 0; } while (!TI); TI = 0; SBUF = c; } }
If the serial channel is correctly configured and you are still unable to connect to the target hardware, the MON390 code or xdata space might not be accessable.
... your application is most likely overwriting the user application program. This might happen when the user application makes xdata write accesses to the program code locations. Code and xdata memory must be non-overlapping areas, since the MON390 requires von Neumann wired code space, which means that code and xdata space are physically the same memory area. You should therefore check the XDATA and CODE MEMORY MAPPING that is listed in the Linker MAP file and verify that code and xdata space are not overlapping.
If MON390 does not single step CPU instructions or if you cannot read or write SFR data locations the MON390 xdata memory area cannot be accessed from code space. The MON390 data memory must be also von Neumann mapped xdata/code space.
During operation, MON390 may report the following errors:
CONNECTION TO TARGET SYSTEM LOST: µVision2 has lost the serial connection to the MON390 program. This error might occur because your program re-initializes the serial interface used by MON390. This error also occurs when you single step in the serial I/O routines of your application.
NO CODE MEMORY AT ADDRESS xxxxx: you try to download code into ROM space or non-existing memory. The code memory must be von-Neumann mapped xdata/code RAM.
CANNOT WRITE INTERRUPT VECTOR: MON390 program cannot install the interrupt vectors for the serial interface. This error occurs when the code memory at address 0 cannot be accessed. Most likely this space is not von-Neumann mapped.
At Keil Software, we are dedicated to providing you with the best development tools and technical support. That's why we offer numerous ways you can get the technical support you need to complete your embedded projects.
Many of the features of our Technical Support Knowledgebase and Web Site are the results of your suggestions. If you have any ideas that will improve them, please give us your feedback!
If you experience any problems or have any questions about this product, contact one of our distributors or offices for assistance.
In the USA... |
In Europe... |
Copyright © Keil Software, Inc. and Keil Elektronik GmbH.
All rights reserved.
Visit our web site at www.keil.com.