diff --git a/.cproject b/.cproject index 88ecf99..928a0bf 100644 --- a/.cproject +++ b/.cproject @@ -1,7 +1,5 @@ - - - + @@ -23,6 +21,9 @@ + @@ -158,7 +159,7 @@ - + @@ -176,18 +177,17 @@ - + make - bfl + all true true true - + make - - lib + clean true true true @@ -200,18 +200,10 @@ true true - + make - fls - true - true - true - - - make - - clean + bfl true true true @@ -220,22 +212,15 @@ - - - - - - - - - - - - - + + + + + + @@ -249,17 +234,24 @@ - - - - - - - + + + + + + + + + + + + + + diff --git a/.gdbinit b/.gdbinit index 50cd786..0770898 100644 --- a/.gdbinit +++ b/.gdbinit @@ -7,8 +7,6 @@ define tbtr end tr -define run - continue -end + source mcf5474.gdb diff --git a/basflash.lk.in b/basflash.lk.in index 87368ad..d7f80be 100644 --- a/basflash.lk.in +++ b/basflash.lk.in @@ -7,6 +7,7 @@ SECTIONS { .text : { + objs/basflash_start.o(.text) objs/basflash.o(.text) *(.data) @@ -15,8 +16,95 @@ SECTIONS *(.rodata.*) } > flasher + .bas : + /* The BaS is stored in the flash, just after the init part. + * Then it will be copied to its final location in the RAM. + * This data must be aligned for optimal copy loop speed. + */ + AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4)) + { + } + + #define BAS_LABEL_LMA(x) ((x)) + _xprintf_before_copy = BAS_LABEL_LMA(_xprintf); + _display_progress_before_copy = BAS_LABEL_LMA(_display_progress); + _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); + + /* + * Global memory map + */ + + /* SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes */ + ___SDRAM = 0x00000000; + ___SDRAM_SIZE = 0x20000000; + + /* ST-RAM */ + __STRAM = ___SDRAM; + __STRAM_END = __TOS; + + /* TOS */ + __TOS = 0x00e00000; + + /* FastRAM */ + __FASTRAM = 0x10000000; + __FASTRAM_END = 0x1FFFFFFF; + + /* Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes) */ + ___BOOT_FLASH = 0xe0000000; + ___BOOT_FLASH_SIZE = 0x00800000; + + /* BaS */ + __BAS_LMA = LOADADDR(.bas); + __BAS_IN_RAM = ADDR(.bas); + __BAS_SIZE = SIZEOF(.bas); + + /* Other flash components */ + __FIRETOS = 0xe0400000; + __EMUTOS = 0xe0600000; + __EMUTOS_SIZE = 0x00100000; + + /* VIDEO RAM BASIS */ + __VRAM = 0x60000000; + /* Memory mapped registers */ __MBAR = 0xFF000000; - ___BOOT_FLASH = 0xe0000000; - ___BOOT_FLASH_SIZE = 0x00800000; -} + + /* 32KB on-chip System SRAM */ + __SYS_SRAM = 0xFF010000; + __SYS_SRAM_SIZE = 0x00008000; + + /* MMU memory mapped registers */ + __MMUBAR = 0xFF040000; + + /* + * 4KB on-chip Core SRAM0: -> exception table and exception stack + */ + __RAMBAR0 = 0xFF100000; + __RAMBAR0_SIZE = 0x00001000; + __SUP_SP = __RAMBAR0 + __RAMBAR0_SIZE - 4; + + /* system variables */ + + /* RAMBAR0 0 to 0x7FF -> exception vectors */ + _rt_mod = __RAMBAR0 + 0x800; + _rt_ssp = __RAMBAR0 + 0x804; + _rt_usp = __RAMBAR0 + 0x808; + _rt_vbr = __RAMBAR0 + 0x80C; /* (8)01 */ + _rt_cacr = __RAMBAR0 + 0x810; /* 002 */ + _rt_asid = __RAMBAR0 + 0x814; /* 003 */ + _rt_acr0 = __RAMBAR0 + 0x818; /* 004 */ + _rt_acr1 = __RAMBAR0 + 0x81c; /* 005 */ + _rt_acr2 = __RAMBAR0 + 0x820; /* 006 */ + _rt_acr3 = __RAMBAR0 + 0x824; /* 007 */ + _rt_mmubar = __RAMBAR0 + 0x828; /* 008 */ + _rt_sr = __RAMBAR0 + 0x82c; + _d0_save = __RAMBAR0 + 0x830; + _a7_save = __RAMBAR0 + 0x834; + _video_tlb = __RAMBAR0 + 0x838; + _video_sbt = __RAMBAR0 + 0x83C; + _rt_mbar = __RAMBAR0 + 0x844; /* (c)0f */ + + /* 4KB on-chip Core SRAM1: -> modified code */ + __RAMBAR1 = 0xFF101000; + __RAMBAR1_SIZE = 0x00001000; + } diff --git a/mcf5474.gdb b/mcf5474.gdb index 7b65166..0edf899 100644 --- a/mcf5474.gdb +++ b/mcf5474.gdb @@ -4,11 +4,14 @@ define addresses set $vbr = 0x00000000 -monitor bdm-ctl-set 0x0801 0x00000000 +monitor bdm-ctl-set 0x0801 0x00000000 + set $mbar = 0xFF000000 monitor bdm-ctl-set 0x0C0F 0xFF000000 + set $rambar0 = 0xFF100000 monitor bdm-ctl-set 0x0C04 0xFF100007 + set $rambar1 = 0xFF101000 monitor bdm-ctl-set 0x0C05 0xFF101001 end @@ -54,7 +57,8 @@ end # define ib -addresses -setup-dram + addresses + setup-dram end + ib diff --git a/sources/basflash_start.c b/sources/basflash_start.c new file mode 100644 index 0000000..c0869fb --- /dev/null +++ b/sources/basflash_start.c @@ -0,0 +1,16 @@ +/* + * basflash_start.c + * + * Created on: 16.02.2013 + * Author: mfro + */ + + +void startup(void) +{ + void basflash(void); + void init_serial(void); + + init_serial(); + basflash(); +}