background image

Designer’s

 

Handbook

21

directives

 to decide where to place code and data in logical memory and its mapping to 

physical

 memory through a segment register value. The directives are normally specified 

in

 the BIOS. However, the directives may also be useful in the user program for certain 

tasks

 such as compiling a pilot BIOS or coldloader, or special situations where a user 

wants

 two application coresident within a single 256K quadrant of flash.

Each

 origin statement has the following syntax:

#<origin type> <origin name> <segment value> <logical address>

<size> apply

All

 of the arguments are required.

<

origin type

>

 may be one of the following: 

rcodorg, xcodorg, wcodorg,

rvarorg

,

 and 

wvarorg

.

 These origin types define where to place root code, extended 

code,

 watch code, root data, and watch data, respectively. The code origin directives grow 

up

 (increase) whereas the data origins grow down (decrease). Origin directives should be 

defined

 before code or data of the associated type is compiled. For example, any data dec-

larations

 or code should appear after the 

rcodorg

and

 

rvarorg

 directives. Likewise, 

xcodorg

 statement should appear before any code is compiled to xmem.

 <

origin name

>

 creates an identifier associated with that particular directive.

 <

segment value

>

 should be an 8-bit value segment value for the origin segment. The 

physical

 address can be calculated by shifting the <

segment value

>

 to the left by 12 

bits

 and adding the 16-bit <

logical address

>

 value. 

 <

size

>

 tells the compiler when to issue an “out of space” error for that directive when 

the

 code counter grows out of bounds.

apply

 means that the org statement will take effect immediately. This is required for all 

org

 statements. Future releases may allow different keywords to be used in place of the 

apply

 argument.

Examples

An

 typical example of using the origin directives in the BIOS is shown below. The dia-

gram

 below shows how the origin statements define the mapping between the logical and 

physical

 address spaces.

#define DATASEGVAL 0x91

#rvarorg rootdata

(DATASEGVAL) 0xc5ff 0x6600

apply // grows down

#rcodorg rootcode

0x00

0x0000 0x6000

apply

#wcodorg watcode

(DATASEGVAL) 0xc600 0x0400

apply

#wvarorg watdata

(DATASEGVAL) 0xcdff 0x0400

apply // grows down

#xcodorg xmemcode

0xf8

0xe000 0x1a000 apply

// data declarations start here

Summary of Contents for 2000

Page 1: ...Rabbit 2000 Microprocessor Designers Handbook Revision C...

Page 2: ...between the customer and Rabbit Semiconductor prior to use Life support devices or systems are devices or systems intended for surgical impantation into the body or to sustain life and whose failure...

Page 3: ...17 5 2 BIOS Flowchart 18 5 3 Internally defined macros 19 5 4 Modifying the BIOS 19 5 5 Origin Directives to the Compiler 20 6 The System ID Block 23 6 1 Definition 23 6 2 Access 24 6 3 Reading the ID...

Page 4: ...Rabbit 2000 Microprocessor...

Page 5: ...mming cable connects a PC serial port to the pro gramming connector of the target microprocessor system Figure 1 Dynamic C Programming The Rabbit programming cable is a smart cable with an active circ...

Page 6: ...2 Rabbit 2000 Microprocesssor...

Page 7: ...ximum computation per watt is obtained in the range of 3 0 V to 3 6 V The highest clock speeds require 5 V The maximum clock speed with a 3 3 V sup ply is 18 9 MHz but it will usually be convenient to...

Page 8: ...nt can be reduced by executing long strings of multiply zero by zero instructions Keep in mind that a Rabbit operating at 3 68 MHz has the compute power of a Z180 microproces sor operating at approxim...

Page 9: ...mode after reset 3 1 How the Cold Boot Mode Works In Detail The microprocessor starts executing a 12 byte program contained in an internal ROM The program contains the following code origin zero 00 ld...

Page 10: ...from the PC in to a tar get in cold boot mode 2 Run the initial loader and load a secondary loader pilot BIOS at 19200 baud 3 Run the secondary loader and load the BIOS as Dynamic C compiles it 4 Run...

Page 11: ...up the serial port for 115200 baud setting up serial interrupts and starting a new FSM 11 The BIOS code modifies a jump instrucction near the beginning of the program so that the next time it runs it...

Page 12: ...8 Rabbit 2000 Microprocessor...

Page 13: ...in some flash memory can be debugged debugging and program download is faster to RAM There are also types of flash memory that can be used but they cannot support debugging Connect a flash memory tha...

Page 14: ...arger memory The view from the window can be adjusted so that the window points to different blocks in the larger memory Figure 2 on page 12 shows the memory mapping schematically The Rabbit has a bas...

Page 15: ...of a Dynamic C programmer there are a number of different uses of memory Each memory use occupies a different segment in the 16 bit address space The four segments are shown in Figure 1 on page 12 The...

Page 16: ...e memory space needed for root code and as the memory needed for constants or variables increases the amount of code that can be stored in root must decline by moving code to extended memory The rel a...

Page 17: ...ess that are frequently called will use sig nificantly less execution time if placed in the root because of the faster calling linkage for 16 bit versus 20 bit addresses A call and return using 16 bit...

Page 18: ...s most of the code is compiled to extended memory This code executes in the 8K window from E000 to FFFF This 8K window uses paged access Instructions that use 16 bit addressing can jump within the pag...

Page 19: ...tions Set Up By the BIOS The BIOS sets up initial values for the following registers by means of code and declara tions The four memory bank control registers MB0CR MB1CR MB2CR and MB3CR are 8 bit reg...

Page 20: ...a block size 5 2 BIOS Flowchart The following flowchart summarizes the functionality of the BIOS Figure 5 BIOS Flowchart Start at address 0 Initialize BIOS Flag Yes Relocate BIOS if necessary Clear fl...

Page 21: ...be done one step at a time making it easy to detect any problems The source code for the Universal BIOS is in BIOS RABBITBIOS C Dynamic C uses this source code for the BIOS by default but the user ca...

Page 22: ...number of bytes available to the debugger for compiling watch expres sion The default value for both is 0x400 Decreasing these increases the amount of RAM available for root data NUM_RAM_WAITST NUM_F...

Page 23: ...fter the rcodorg and rvarorg directives Likewise xcodorg statement should appear before any code is compiled to xmem origin name creates an identifier associated with that particular directive segment...

Page 24: ...ace programs in different places in root memory or in order to compile a boot strapping program such as a pilot BIOS or coldloader origin statements may be used in the user s program code For example...

Page 25: ...e The reserved field will expand and or shrink to compensate for the change in size typedef struct int tableVersion ver num for this table layout int productID Z World part int vendorID 1 Z World char...

Page 26: ...uadrants mapped to flash Examples 0x01 quadrant 0 only 0x03 quadrants 0 and 1 0x0C quadrants 2 and 3 RETURN VALUE 0 if successful 1 if error reading from flash 2 if ID block missing 3 if ID block inva...

Page 27: ...ed for the entire ID block except the reserved field and compared to the saved value If they do not match the block is considered invalid and an error 3 is returned The CRC field is then restored The...

Page 28: ...ull terminated string 6Fh N Reserved variable size SIZE 10h 4 Size of this ID block SIZE 0Ch 2 Size of user block SIZE 0Ah 2 Offset of user block location from start of this block SIZE 08h 2 CRC value...

Page 29: ...BIOS begins running Finally the master sends blocks of data at high speed and the data are written to the flash memory Data transfer can take place at 57 600 bps or 115 200 bps When the entire flash...

Page 30: ...will blink several times per second if the LED stops blinking then an error has occurred Once the cloning is complete the LED will blink in a distinctive pattern of four flashes than a pause before f...

Page 31: ...this is the power that is dependent on frequency The power drawn while switching is used to charge capacitance or is used when both N and P FETs are simultaneously on for a brief period during a trans...

Page 32: ...large sector flash in your product design you can debug your application in RAM by using the Compile to RAM compiler option or use a board with small sector flash for development only The Rabbit low p...

Page 33: ...le a routine updateTimers that can be called periodically to keep Dynamic C time variables updated These time variables keep track of seconds and milliseconds are normally used by Dynamic C routines t...

Page 34: ...344 Dynamic C User s Manual...

Page 35: ...RAM memory will be required Many programs can subsist on 32K of RAM Having more RAM on the system is convenient for debug ging since debugging and program testing generally operates more powerfully an...

Page 36: ...34 Rabbit 2000 Microprocessor...

Page 37: ...T29LV040 512K 256 2048 sector 200 3 0 3 6 4 6 50 and later Mosel Vitelic V29C51001T 128K 512 256 byte 45 4 5 5 5 1 2 4 6 50 and later Mosel Vitelic V29C51001B 128K 512 256 byte 45 4 5 5 5 1 2 4 6 50 a...

Page 38: ...early in the BIOS to fill this struct before any accesses to the flash struct char flashXPC XPC required to access flash via XMEM int sectorSize byte size of one flash memory sector int numSectors nu...

Page 39: ...needs to perform the following actions 1 Load _FlashInfo XPC with the proper XPC value to access flash memory address 00000h via XMEM address E000h The quadrant num ber for the start of flash memory...

Page 40: ...see below Otherwise it should perform the actual write oper ation required by the particular flash used Interrupts should be turned off set the interrupt level to 3 whenever writes are occur ring to...

Page 41: ...Diagnostic Test 2 This test goes through a series of steps repeatedly The steps are 1 Apply the reset for approximately 1 4 second and then release the reset 2 In cold boot send the following sequenc...

Page 42: ...e starts again If this test fails to function it may be that the programming connector is connected improp erly or the proper pull up resistors are not installed on the SMODE lines Other possibili tie...

Page 43: ...ss zero test program ld hl 1 ld b 16 loop ld a hl add hl hl shift left djnz loop 16 steps jp 0 continue test If this test runs it will toggle the first 16 address lines In addition all of the data lin...

Page 44: ...42 Rabbit 2000 Microprocessor...

Page 45: ...stems intended for surgical impantation into the body or to sustain life and whose failure to perform when properly used in accor dance with instructions for use provided in the labeling and user s ma...

Reviews: