|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.core.Program
The Program class represents a complete program of AVR
instructions. It stores the actual instructions and initialized data
of the program in one instr4 segment, as well as storing the data
space and eeprom space requirements for the program. It contains
a map of labels (strings) to addresses, which can be either
case sensitive (GAS style) or case insensitive (Atmel style).
Instr| Nested Class Summary | |
class |
Program.DataLabel
The DataLabel class represents a label within the program that
refers to the data segment. |
class |
Program.EEPromLabel
The EEPromLabel class represents a label within the program
that refers to the eeprom segment. |
class |
Program.Impression
The Impression class represents a copy of the program that
is suitable for reading and writing during execution without changing the
underlying program. |
class |
Program.Label
The Label class represents a label within the
Program instance that encapsulates it. |
class |
Program.ProgramLabel
The ProgramLabel class represents a label within the program
that refers to the program segment. |
| Field Summary | |
boolean |
caseSensitive
The caseSensitive field controls whether label searching is
case sensitive or not. |
protected byte[] |
data
The data field stores a reference to the array that contains
the raw data (bytes) of the program segment. |
int |
data_end
The data_end field records the address following the highest
address in the program with declared, labelled memory in the data segment. |
int |
data_start
The data_start field records the lowest address of declared,
labelled memory in the data segment. |
int |
eeprom_end
The eeprom_end field records the address following the highest
address in the program with declared, labelled memory in the eeprom segment. |
int |
eeprom_start
The eeprom_start field records the lowest address of declared,
labelled memory in the eeprom segment. |
protected Instr[] |
instrs
The instrs field stores a reference to the array that contains
the instruction representations of the program segment. |
int |
program_end
The program_end field records the address following the
highest address in the program segment that contains valid code or data. |
int |
program_length
The program_length field records the size of the program
(the difference between program_start and program_end. |
int |
program_start
The program_start field records the lowest address in the
program segment that contains valid code or data. |
| Constructor Summary | |
Program(int pstart,
int pend,
int dstart,
int dend,
int estart,
int eend)
The constructor of the Program class builds an internal representation
of the program that is initially empty, but has the given parameters in terms of
how big segments are and where they start. |
|
| Method Summary | |
protected void |
checkAddress(int addr)
The checkAddress() method simply checks an address against the
bounds of the program and throws an error if the address is not within the bounds. |
void |
dump()
The dump() method prints out a textual dump of the program. |
Program.Label |
getLabel(java.lang.String name)
The getLabel() method searches for a label with a given name within
the program, in any section. |
Program.Impression |
makeNewImpression(int program_max)
The makeNewImpression() method creates an instance of the
Impression class that is a deep copy of the program. |
Program.DataLabel |
newDataLabel(java.lang.String name,
int byteAddress)
The newDataLabel() method creates a label in the data segment
with the specified name at the specified byte address. |
Program.EEPromLabel |
newEEPromLabel(java.lang.String name,
int byteAddress)
The newEEPromLabel() method creates a label in the eeprom segment
with the specified name at the specified byte address. |
Program.ProgramLabel |
newProgramLabel(java.lang.String name,
int byteAddress)
The newProgramLabel() method creates a label in the program segment
with the specified name at the specified byte address. |
Instr |
readInstr(int address)
The readInstr() method reads an instruction from the specified
address in the program. |
void |
writeInstr(Instr i,
int address)
The writeInstr() method is used to write an instruction to the
internal representation of the program at the given address. |
void |
writeProgramByte(byte val,
int byteAddress)
The writeProgramByte() method writes a byte into the program segment
at the specified byte address. |
void |
writeProgramBytes(byte[] val,
int byteAddress)
The writeProgramBytes() method writes an array of bytes into the program
segment at the specified byte address. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final int program_start
program_start field records the lowest address in the
program segment that contains valid code or data.
public final int program_end
program_end field records the address following the
highest address in the program segment that contains valid code or data.
public final int program_length
program_length field records the size of the program
(the difference between program_start and program_end.
public final int data_start
data_start field records the lowest address of declared,
labelled memory in the data segment.
public final int data_end
data_end field records the address following the highest
address in the program with declared, labelled memory in the data segment.
public final int eeprom_start
eeprom_start field records the lowest address of declared,
labelled memory in the eeprom segment.
public final int eeprom_end
eeprom_end field records the address following the highest
address in the program with declared, labelled memory in the eeprom segment.
protected final byte[] data
data field stores a reference to the array that contains
the raw data (bytes) of the program segment. NO EFFORT IS MADE IN THIS CLASS
TO KEEP THIS CONSISTENT WITH THE INSTRUCTION REPRESENTATIONS.
protected final Instr[] instrs
instrs field stores a reference to the array that contains
the instruction representations of the program segment. NO EFFORT IS MADE IN
THIS CLASS TO KEEP THIS CONSISTENT WITH THE RAW DATA OF THE PROGRAM SEGMENT.
public boolean caseSensitive
caseSensitive field controls whether label searching is
case sensitive or not. Some program representations use case sensitive labels,
and some do not.
| Constructor Detail |
public Program(int pstart,
int pend,
int dstart,
int dend,
int estart,
int eend)
Program class builds an internal representation
of the program that is initially empty, but has the given parameters in terms of
how big segments are and where they start.
pstart - the start of the program segmentpend - the end of the program segmentdstart - the start of the data segmentdend - the end of the data segmentestart - the start of the eeprom segmenteend - the end of the eeprom segment| Method Detail |
public void writeInstr(Instr i,
int address)
writeInstr() method is used to write an instruction to the
internal representation of the program at the given address. No attempt to
assemble the instruction machine code is made; thus the raw data (if any)
at that location in the program will not be modified.
i - the instruction to writeaddress - the byte address to write the instruction to that must be aligned
on a 2-byte boundary.
Avrora.InternalError - if the address is not within the limits put on the
program instance when it was created.public Instr readInstr(int address)
readInstr() method reads an instruction from the specified
address in the program. No attempt to disassemble raw data into usable instructions is made,
and unaligned accesses will return null.
address - the byte address in the program
Instr instance at that address if that address is valid
code from creation of the Program instance; null if the instruction
is misaligned or only raw data is present at that location.
Avrora.InternalError - if the address is not within the limits put on the
program instance when it was created.
public void writeProgramByte(byte val,
int byteAddress)
writeProgramByte() method writes a byte into the program segment
at the specified byte address. If the address overlaps with an instruction, no effort
is made to keep the instruction representation up to date.
val - the value to writebyteAddress - the byte address in the program segment to write the byte value
to
public void writeProgramBytes(byte[] val,
int byteAddress)
writeProgramBytes() method writes an array of bytes into the program
segment at the specified byte address. If the range of addresses modified overlaps with
any instructions, no effort is made to keep the instruction representations up to date.
val - the byte values to writebyteAddress - the byte address to begin writing the values to
public Program.ProgramLabel newProgramLabel(java.lang.String name,
int byteAddress)
newProgramLabel() method creates a label in the program segment
with the specified name at the specified byte address.
name - the name of the labelbyteAddress - the byte address to associate with the label
ProgramLabel class corresponding to this
new label
public Program.DataLabel newDataLabel(java.lang.String name,
int byteAddress)
newDataLabel() method creates a label in the data segment
with the specified name at the specified byte address.
name - the name of the labelbyteAddress - the byte address to associate with the label
DataLabel class corresponding to this
new label
public Program.EEPromLabel newEEPromLabel(java.lang.String name,
int byteAddress)
newEEPromLabel() method creates a label in the eeprom segment
with the specified name at the specified byte address.
name - the name of the labelbyteAddress - the byte address to associate with the label
EEPromLabel class corresponding to this
new labelpublic Program.Label getLabel(java.lang.String name)
getLabel() method searches for a label with a given name within
the program, in any section.
name - the string name of the label
Label if the label exists; null otherwisepublic Program.Impression makeNewImpression(int program_max)
makeNewImpression() method creates an instance of the
Impression class that is a deep copy of the program.
program_max - the maximum address of the program segment
Impression class trimmed to the maximum
address specified.protected void checkAddress(int addr)
checkAddress() method simply checks an address against the
bounds of the program and throws an error if the address is not within the bounds.
addr - the byte address to check
Avrora.InternalError - if the address is not within the limits of the
program segmentpublic void dump()
dump() method prints out a textual dump of the program. It
is useful for debugging the program building process.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||