load
The load command loads a program into memory but does not start it.
Command Format
load [-options] pathname
where:
| -f addr | load into flash at address addr |
| -o offset | offset offset is added to the load adress |
| pathname | url or direct pathname to the file to be loaded |
Functional description
The load command is similar to the boot command except that it does not start execution of the program that has been loaded. Instead it returns to the PMON2000 prompt awaiting the next command.
The command can read raw binary files, S-Record files and files in the ELF format as used in:
- Algorithmics SDE-MIPS
- newer SGI compilers
- systems compliant with the MIPS/ABI standard
- OpenBSD ARM, PowerPC and MIPS 32Bit ELF.
- Some Linux for PowerPC implementations
PMON2000 extracts any symbol table information from these files, and adds it to the target symbol table. Optionally the symbol table can be loaded after the loaded program image in a way suitable for for example OpenBSD and other operating systems built in debuggers. This function is activated by using the -k option.
The boot command normally clears the symbol table, exception handlers, and all breakpoints. The -s and -b options suppress the clearing of the symbol table and breakpoints, respectively. The value of the CPC register is set automatically to the entry point of the program. Therefore, to execute the downloaded program, only the g command is required.
The boot command may return a large number of different error messages, relating to network problems or file access permissions on the remote host. For a file to be loaded via TFTP it must be publicly readable, and it may have to be in a directory which is acceptable to the remote server.
The -f (flash_load) option tells the boot wrapper to network load an image into the flash ROM area designated as an address argument. The specified area must be large enough to accept the image. The specified area will first be erased, then the image loaded and then verified. PMON2000 uses some temporary RAM to hold the image so it is important that the amount of free RAM exceed the size of the image (and the the flash area).
The -ooffsetoption provides for assigning a transfer and run (execute) address header for the image that is being loaded into flash ROM. This option is critical when the image being loaded into flash ROM is, in fact, destined to be executed later out of RAM at another address. PMON2000 itself uses this feature because it is stored in flash ROM (usually) at one address, but moved and run from a RAM address on most platforms. The -o offset value specifies the actual address where execution is to begin AFTER an image is transferred by the g command.
Boot an image into Flash ROM Example:
PMON> load -f ff000000 -o 10000 tftp://loke.opsycon.se/pmon.db64360
Loading file: tftp://loke.opsycon.se/pmon.db64360 (elf)
0x100074/447112 + 0x16d2fc/42508(z)
Programming flash 0x00100000:0x00077894 into 0xff000000
Erasing FLASH block 0 Done.
Erasing FLASH block 1 Done.
Programming FLASH. Done.
PMON>
In the above example, the boot -f command was used to load a new PMON2000 image into the 512Kb onboard flashROM on the Marvel DiscoveryII evaluation board. The image was resident on a local network server, in the /tftpboot directory under the name of pmon.db64360.elf and was a standard PowerPC ELF-32 bit image created with GNU tools on an OpenBSD PowerPC system. The image file is loaded and we get to see the binary file characteristics echoed to the console while the load is happening. The load -f command also informs us of the transfer address (0x00100000:0x00077894) and size, as well as confirmation of the stored location (into 0xff000000). Next it tells us which flash ROM block(s) are being erased to hold the new image, followed by confirmation that the flash ROM is being programed, and then reports its success.
When reading the symbol table PMON2000 may complain that it does not have enough room to store the programs symbols. To increase the size of the heap, use the set heaptop command to reserve more space and, if necessary, re-link your program with a higher base address. The boot command will also detect cases where the program being loaded would overwrite PMON2000s crucial data or heap: again re-linking your program at a different address will cure the problem.
Environment
The command uses the bootfile environment variable.
See Also
The boot command and url/pathname description.

