m68302 boot problem - newbie!!!,

Nicolas PIGEON pigeon.nicolas at wanadoo.fr
Fri May 9 07:45:07 UTC 2003


Hi everybody,

Here are the tools I use:
gcc 2.95.2
newlib 1.8.2-7
binutils 2.9.5.0.24-1
rtems 4.5.0

and the linker script (in fact, there are 3 scripts: linkcmds, rom and debugger, but it seems only linkcmds is used):
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x00100000;
_RamSize = DEFINED(_RamSize) ? _RamSize : 1M;
_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;

/*
 * Declare on-board memory.
 */
MEMORY {
          ram : ORIGIN = 0x00100000, LENGTH = 1M
}
SECTIONS
{
	ram : {
		. = .;
	} >ram

	.vtable :
	{
		vtable_start = .;
		*(.vtable)
		evtable = .;
	} >ram


        /*
         * Text, data and bss segments
         */
        .text : {
                *(.text)

		/*
		 * C++ constructors/destructors
		 */
		*(.gnu.linkonce.t.*)

		/*
		 * Initialization and finalization code.
     		 *
     		 * blah blah...
		 */
		PROVIDE (_init = .);
		*crti.o(.init)
		*(.init)
		*crtn.o(.init)
		PROVIDE (_fini = .);
		*crti.o(.fini)
		*(.fini)
		*crtn.o(.fini)

		/*
		 * C++ constructors/destructors
     		 *
     		 * blah blah too...
		 */
		. = ALIGN (16);
		*crtbegin.o(.ctors)
		*(.ctors)
		*crtend.o(.ctors)
		*crtbegin.o(.dtors)
		*(.dtors)
		*crtend.o(.dtors)

		/*
		 * Exception frame info
		 */
		. = ALIGN (16);
		*(.eh_frame)

		/*
		 * Read-only data
		 */
		. = ALIGN (16);
		_rodata_start = . ;
		*(.rodata)
		*(.gnu.linkonce.r*)

                 . = ALIGN (16);
                PROVIDE (_etext = .);
        } >ram
        .data : {
                PROVIDE (_copy_start = .);
                *(.data)
		*(.gnu.linkonce.d*)
		*(.gcc_except_table)
                . = ALIGN (16);
                PROVIDE (_edata = .);
                PROVIDE (_copy_end = .);
        } >ram
        .bss : {
                _clear_start = .;
                *(.bss)
                *(COMMON)
                . = ALIGN (16);
                PROVIDE (end = .);

                . += _StackSize;
                . = ALIGN (16);
                _stack_init = .;
                _clear_end = .;

                _WorkspaceBase = .;
        } >ram
}

m302 = MC68302_BASE;
_VBR = ADDR(.vtable);		/* location of the VBR table (in RAM) */


When I use objdump with the generated exe, all the addresses begin with 0x001xxxxx, which is OK after the chip select swap (before, RAM=001xxxxx ROM=000xxxxx, after RAM=000xxxxx ROM=001xxxxx). But RAM addresses seem to begin by 001xxxxx in the code too (ex: reference to _WorkspaceBase, whose address is 001abcde=in ROM!!!). It's clear that it's a linker script problem... Consequently, the RAM is never used, exept for the copy of the vector table which uses explicit addresses, and the processor stops somewhere...

Thanks for any help!!




More information about the users mailing list