Application loader and program maintenance





The file EDSLBOOT.FTH provides facilities for file transfer into Flash using XMODEM with HyperTerm or similar terminal emulators. Menu options allow various facilities for boot management, replacement of user applications, and replacement of boot code. The timebase system and a Flash driver are required. The multitasker is disabled by the maintenance menu.




Configuration

True equ BootMenu?      \ -- flag

Set this equate non-zero to include the power up menu code. The word BOOTSTRAP should then be set as the application start up word using the phrase "MAKE-TURNKEY BOOTSTRAP" in your control file.




Handling the Flash memory

: n>app         \ n -- addr

Given an application number, convert it to the required address in the Flash.

: RunApp        \ n --

Copy flash for app n into RAM at address APPRAM, and execute at address APPRAM. If the data at the start of the application Flash area is $FFFFFFFF, which is the signature of unprogrammed flash, RUN-APP issues an error message and returns.

: RemoveApp     \ n --

Erase the flash for application n.

: GetApp        \ n --

Download application n by Xmodem.

: EnterApp#     \ -- n true | 0

Enter an application number. If the number is in range, return the application number and true, otherwise just return zero.

: NewApp        \ --

Get a new application by Xmodem.

: EraseApp      \ --

Wipe an application.

: DefaultApp    \ --

Set the default application number in the first four bytes of the serial EEPROM.

: RunDefault    \ --

Run the default application

: NewBootFlash  \ --

Update the boot Flash area by Xmodem.




User maintenance menu

The maintenance system provides the following features, accessed from the menu.

  • F - run the Forth monitor
  • R - run an application
  • E - erase an application
  • D - download and Flash a new user program
  • B - download and Flash a new boot program
  • S - Set the default application to run
  • Q - quit maintenance system
    : .maintenance-menu     \ --

    Display the maintenance menu.

    : (maintenance) \ mode -- flag ; flag true if Q pressed

    Enter a single command and process it. If mode is non-zero, an invalid key runs an application program if it exists. Flag is returned non-zero if Q was pressed.

    : Maintenance   \ mode -- flag ; true if Q pressed

    Enter the maintenance system. If mode is non-zero, the system will time out after 3 seconds and run an application program if it exists. Flag is returned non-zero if Q was pressed. N.B. the multitasker is turned off, but is restored on exit, and the timebase system is reinitialised.

    : maintain      \ --

    Run the maintenance system until Q is pressed.