110 lines
3.2 KiB
Plaintext
Executable File
110 lines
3.2 KiB
Plaintext
Executable File
#!/usr/local/bin/bdmctrl
|
|
#
|
|
# firebee board initialization for bdmctrl
|
|
#
|
|
open $1
|
|
reset
|
|
sleep 10
|
|
|
|
wait
|
|
|
|
# Turn on MBAR at 0xFF00_0000
|
|
write-ctrl 0x0C0F 0xFF000000
|
|
|
|
# set VBR
|
|
write-ctrl 0x0801 0x00000000
|
|
|
|
#
|
|
# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
|
write 0xFF000500 0xE0000000 4
|
|
write 0xFF000508 0x00001180 4
|
|
write 0xFF000504 0x007F0001 4
|
|
|
|
# SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
|
write 0xFF000004 0x000002AA 4 # SDRAMDS configuration
|
|
write 0xFF000020 0x0000001A 4 # SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF)
|
|
write 0xFF000024 0x0800001A 4 # SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF)
|
|
write 0xFF000028 0x1000001A 4 # SDRAM CS2 configuration (128Mbytes 1000_0000 - 17FF_FFFF)
|
|
write 0xFF00002C 0x1800001A 4 # SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF)
|
|
write 0xFF000108 0x73622830 4 # SDCFG1
|
|
write 0xFF00010C 0x46770000 4 # SDCFG2
|
|
|
|
write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
|
write 0xFF000100 0x40010000 4 # SDMR (write to LEMR)
|
|
write 0xFF000100 0x048D0000 4 # SDMR (write to LMR)
|
|
sleep 100
|
|
write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
|
write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh)
|
|
write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh)
|
|
write 0xFF000100 0x008D0000 4 # SDMR (write to LMR)
|
|
write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh)
|
|
sleep 10
|
|
|
|
|
|
# use system sdram as flashlib scratch area.
|
|
# TODO: plugin flashing seems to work o.k. now for smaller binaries, while it doesn't for larger ones (EmuTOS) yet.
|
|
# This seems to be related to large flash buffers and PC-relative adressing of the plugin
|
|
flash-plugin 0x1000 0xf000 flash29.plugin
|
|
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
|
flash 0xE0000000
|
|
|
|
# Erase flash from 0xE0000000 to 0xE00FFFFF (reserved space for BaS)
|
|
#
|
|
# Caution: sector offset numbers need to be the ones from the x16 address range
|
|
# column and they vary in size - needs to be exactly as in the data sheet (p. 9)
|
|
#
|
|
# contrary to documentation, it seems we need to erase-wait after each sector
|
|
|
|
erase 0xE0000000 0x000000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x001000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x002000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x003000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x004000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x005000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x006000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x007000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x008000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x010000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x018000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x020000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x028000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x014000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x015000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x016000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x017000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x018000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x019000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01a000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01b000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01c000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01d000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01e000
|
|
erase-wait 0xE0000000
|
|
erase 0xE0000000 0x01f000
|
|
erase-wait 0xE0000000
|
|
load -v ../firebee/bas.elf
|
|
wait
|