BREC

From S1MP3 Wiki

Jump to: navigation, search

Contents

The 2nd-stage bootloader

BREC stands for BootRECord; this small 16kB sized bootcode (Z80 instruction set) is held in the NAND flash chip at the first page (the boot record of the flash). The flash also contains a second image (mirror) of this bootloader, following the first one some pages later.

The BREC gets flashed with the content from the flash-type-related BRECxxxx.BIN (located inside the AFI file) during each firmware update. Which BREC version to use gets determined by the update routine.

Some versions (mostly with black'n'white displays) include code to control the display which brings up the (in)famous hour-glass logo, also included inside the BREC file. The BREC bootcodes one and only action, beside displaying the funny hourglass logo, is to detect (position and size) of each NAND flash chip and search for a valid firmware image. Once found it loads and executes the "SYSCFG.SYS" file from this image. After this action is finished, the bootloader is done and the firmware application takes over the device.

Execution flow chart

  • 1st-stage bootloader loads BREC into ZRAM1 and executes it (jp 0x0000), otherwise it enters ADFU Recovery Mode on any error
  • detects all flash chips (position and size) connected to the ATJ chip
  • some versions now display the hour glass image, located inside the BREC
  • (?) compares the boot record source image with the mirror image, and if necessary repairs the source image with the mirror
  • (?) checks the NAND data reliability, if data is found corrupt then starts ADFU Server Launcher to complete the system the recovering
  • (?) checks the validity of system code, and completes the mirror image examination and the eventual backup restore
  • locates and loads the system configuration module (SYSCFG.SYS) file from the firmware image of the first flash
  • passes active execution to the system configuration module

BREC files

Each BRECFxxx.BIN is written for a different type of NAND flash memory, the onboard memory block. Other differences may reside on the display driver, used to show the hourglass on boot time. There are three different types around:

  • BRECF644.BIN : large block nand type flash
  • BRECF641.BIN : medium block nand type flash
  • BRECF321.BIN : small block nand type flash

Each firmware image contains the correct BRECFxxx.BIN. During recovery-mode flashing, the update tool sends some code to detect the flash type, after this step it sends only a firmware containing the specific files, support for other flashs would not be included.

Related Pages

  • ZRAM1, where the BREC is executed at run-time
  • NAND, the physical memory holding the 2nd-stage bootloader
  • BROM, the physical memory holding the 1th-stage bootloader
  • BLOD, the 1th-stage bootloader code
  • TROM, ??
Retrieved from "http://wiki.s1mp3.org/BREC"
Personal tools
about this site
Advertisement