modified init_fpga() to honour JTAG configuration. Does not work
currently and needs support from the TOS side (program not finished yet)
This commit is contained in:
@@ -203,8 +203,8 @@ SECTIONS
|
|||||||
__EMUTOS_SIZE = 0x00100000;
|
__EMUTOS_SIZE = 0x00100000;
|
||||||
|
|
||||||
/* where FPGA data lives in flash */
|
/* where FPGA data lives in flash */
|
||||||
__FPGA_FLASH_DATA = 0xe0700000;
|
__FPGA_CONFIG = 0xe0700000;
|
||||||
__FPGA_FLASH_DATA_SIZE = 0x100000;
|
__FPGA_CONFIG_SIZE = 0x100000;
|
||||||
|
|
||||||
/* VIDEO RAM BASIS */
|
/* VIDEO RAM BASIS */
|
||||||
__VRAM = 0x60000000;
|
__VRAM = 0x60000000;
|
||||||
@@ -228,8 +228,13 @@ SECTIONS
|
|||||||
/* 4KB on-chip Core SRAM1 */
|
/* 4KB on-chip Core SRAM1 */
|
||||||
__RAMBAR1 = 0xFF101000;
|
__RAMBAR1 = 0xFF101000;
|
||||||
__RAMBAR1_SIZE = 0x00001000;
|
__RAMBAR1_SIZE = 0x00001000;
|
||||||
__SUP_SP = __RAMBAR0 + __RAMBAR0_SIZE - 4;
|
__SUP_SP = __RAMBAR1 + __RAMBAR1_SIZE - 4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this flag (if 1) indicates that FPGA configuration has been loaded through JTAG
|
||||||
|
* and shouldn't be overwritten on boot
|
||||||
|
*/
|
||||||
|
__FPGA_JTAG_LOADED = __RAMBAR1;
|
||||||
/* system variables */
|
/* system variables */
|
||||||
|
|
||||||
/* RAMBAR0 0 to 0x7FF -> exception vectors */
|
/* RAMBAR0 0 to 0x7FF -> exception vectors */
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#error "unknown machine!"
|
#error "unknown machine!"
|
||||||
#endif /* MACHINE_FIREBEE */
|
#endif /* MACHINE_FIREBEE */
|
||||||
|
|
||||||
#define DBG_DMA
|
// #define DBG_DMA
|
||||||
#ifdef DBG_DMA
|
#ifdef DBG_DMA
|
||||||
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
|
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/bdmctrl
|
#!/usr/local/bin/bdmctrl -D2
|
||||||
#
|
#
|
||||||
# firebee board initialization for bdmctrl
|
# firebee board initialization for bdmctrl
|
||||||
#
|
#
|
||||||
@@ -21,32 +21,32 @@ write 0xFF000508 0x00001180 4
|
|||||||
write 0xFF000504 0x007F0001 4
|
write 0xFF000504 0x007F0001 4
|
||||||
|
|
||||||
# SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
# SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
||||||
write 0xFF000004 0x000002AA 4 # SDRAMDS configuration
|
#write 0xFF000004 0x000002AA 4 # SDRAMDS configuration
|
||||||
write 0xFF000020 0x0000001A 4 # SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF)
|
#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 0xFF000024 0x0800001A 4 # SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF)
|
||||||
write 0xFF000028 0x1000001A 4 # SDRAM CS2 configuration (128Mbytes 1000_0000 - 17FF_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 0xFF00002C 0x1800001A 4 # SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF)
|
||||||
write 0xFF000108 0x73622830 4 # SDCFG1
|
#write 0xFF000108 0x73622830 4 # SDCFG1
|
||||||
write 0xFF00010C 0x46770000 4 # SDCFG2
|
#write 0xFF00010C 0x46770000 4 # SDCFG2
|
||||||
|
|
||||||
write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
#write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
||||||
write 0xFF000100 0x40010000 4 # SDMR (write to LEMR)
|
#write 0xFF000100 0x40010000 4 # SDMR (write to LEMR)
|
||||||
write 0xFF000100 0x048D0000 4 # SDMR (write to LMR)
|
#write 0xFF000100 0x048D0000 4 # SDMR (write to LMR)
|
||||||
sleep 100
|
#sleep 100
|
||||||
write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
#write 0xFF000104 0xE10D0002 4 # SDCR + IPALL
|
||||||
write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh)
|
#write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh)
|
||||||
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 0xFF000100 0x008D0000 4 # SDMR (write to LMR)
|
||||||
write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh)
|
#write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh)
|
||||||
sleep 10
|
#sleep 10
|
||||||
|
|
||||||
|
|
||||||
# use system sdram as flashlib scratch area.
|
# 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.
|
# 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
|
# This seems to be related to large flash buffers and PC-relative adressing of the plugin
|
||||||
flash-plugin 0x1000 0xf000 flash29.plugin
|
#flash-plugin 0x1000 0xf000 flash29-5475.plugin
|
||||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||||
flash 0xE0000000
|
flash 0xe0000000
|
||||||
|
|
||||||
# Erase flash from 0xE0000000 to 0xE00FFFFF (reserved space for BaS)
|
# Erase flash from 0xE0000000 to 0xE00FFFFF (reserved space for BaS)
|
||||||
#
|
#
|
||||||
@@ -55,17 +55,44 @@ flash 0xE0000000
|
|||||||
#
|
#
|
||||||
# contrary to documentation, it seems we need to erase-wait after each sector
|
# contrary to documentation, it seems we need to erase-wait after each sector
|
||||||
|
|
||||||
erase 0xE0000000 0
|
erase 0xe0000000 0
|
||||||
erase 0xE0000000 1
|
erase-wait 0xe0000000
|
||||||
erase 0xE0000000 2
|
erase 0xe0000000 0x1000
|
||||||
erase 0xE0000000 3
|
erase-wait 0xe0000000
|
||||||
erase 0xE0000000 4
|
erase 0xe0000000 0x2000
|
||||||
erase 0xE0000000 5
|
erase-wait 0xe0000000
|
||||||
erase 0xE0000000 7
|
erase 0xe0000000 0x3000
|
||||||
erase 0xE0000000 8
|
erase-wait 0xe0000000
|
||||||
erase 0xE0000000 9
|
erase 0xe0000000 0x4000
|
||||||
erase 0xE0000000 10
|
erase-wait 0xe0000000
|
||||||
erase-wait 0xE0000000
|
erase 0xe0000000 0x5000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x6000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x7000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x8000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x10000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x18000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x20000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x28000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x30000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x38000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x40000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x48000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x50000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
erase 0xe0000000 0x58000
|
||||||
|
erase-wait 0xe0000000
|
||||||
|
|
||||||
load -v ../firebee/bas.elf
|
load -v ../firebee/bas.elf
|
||||||
wait
|
wait
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#error Unknown machine!
|
#error Unknown machine!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DBG_FEC
|
// #define DBG_FEC
|
||||||
#ifdef DBG_FEC
|
#ifdef DBG_FEC
|
||||||
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -33,10 +33,16 @@
|
|||||||
#define FPGA_DATA0 (1 << 3)
|
#define FPGA_DATA0 (1 << 3)
|
||||||
#define FPGA_CONF_DONE (1 << 5)
|
#define FPGA_CONF_DONE (1 << 5)
|
||||||
|
|
||||||
extern uint8_t _FPGA_FLASH_DATA[];
|
extern uint8_t _FPGA_CONFIG[];
|
||||||
#define FPGA_FLASH_DATA &_FPGA_FLASH_DATA[0]
|
#define FPGA_FLASH_DATA &_FPGA_CONFIG[0]
|
||||||
extern uint8_t _FPGA_FLASH_DATA_SIZE[];
|
extern uint8_t _FPGA_CONFIG_SIZE[];
|
||||||
#define FPGA_FLASH_DATA_SIZE ((uint32_t) &_FPGA_FLASH_DATA_SIZE[0])
|
#define FPGA_FLASH_DATA_SIZE ((uint32_t) &_FPGA_CONFIG_SIZE[0])
|
||||||
|
|
||||||
|
/*
|
||||||
|
* flag located in processor SRAM1 that indicates that the FPGA configuration has
|
||||||
|
* been loaded through JTAG. init_fpga() will honour this and not overwrite config.
|
||||||
|
*/
|
||||||
|
extern int32_t _FPGA_JTAG_LOADED;
|
||||||
|
|
||||||
void config_gpio_for_fpga_config(void)
|
void config_gpio_for_fpga_config(void)
|
||||||
{
|
{
|
||||||
@@ -78,7 +84,15 @@ bool init_fpga(void)
|
|||||||
volatile int32_t time, start, end;
|
volatile int32_t time, start, end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
xprintf("FPGA load config... ");
|
xprintf("FPGA load config (_FPGA_JTAG_LOADED = %x)...", _FPGA_JTAG_LOADED);
|
||||||
|
if (_FPGA_JTAG_LOADED == 1)
|
||||||
|
{
|
||||||
|
xprintf("detected _FPGA_JTAG_LOADED flag. Not overwriting FPGA config.\r\n");
|
||||||
|
|
||||||
|
/* reset the flag so that next boot will load config again from flash */
|
||||||
|
_FPGA_JTAG_LOADED = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
start = MCF_SLT0_SCNT;
|
start = MCF_SLT0_SCNT;
|
||||||
|
|
||||||
config_gpio_for_fpga_config();
|
config_gpio_for_fpga_config();
|
||||||
|
|||||||
Reference in New Issue
Block a user