AnsweredAssumed Answered

U-Boot on new board: JTAG-loading fails at BSS memset step

Question asked by nocnokneo on Dec 4, 2011
Latest reply on Jan 23, 2012 by James.Kosin

I'm trying to bring up U-Boot on a very simple board of mine: a BF532 with 32 MB SDRAM. Initially I couldn't get any SDRAM functionality to work but with the help of the BfSdcCalculation spreadsheet posted here I was able to get my SDGCTL/SDRRC/SDBCTL registers configured properly such that I can do an exhaustive test of all 32 MB of memory by adding the following code to the end of initcode.c and loading/running it via gnICE JTAG:

 

        / * ... */

        serial_putc('>');

        serial_putc('\n');


        /* Full memory coverage */

        volatile unsigned short *mem_test_16;

        volatile unsigned char *mem_test_8;

        unsigned short patterns[] = { 0x5555, 0xAAAA, 0xFFFF, 0x0000 };

        int patt_ndx;

        for (patt_ndx = 0; patt_ndx < 4; ++patt_ndx)

        {

            mem_test_16 = (unsigned short *)(0x02000000);

            unsigned short pattern = patterns[patt_ndx];


            serial_putc('\n');

            serial_putc('T');

            serial_putc(':');

            serial_put_word16(pattern);

            serial_putc('\n');


            serial_put_word32((unsigned int)mem_test_16);

            while (mem_test_16 > 2)

            {

                --mem_test_16;


                *mem_test_16 = pattern;

                __builtin_bfin_ssync();

                if (*mem_test_16 != pattern)

                {

                    serial_put_word16(pattern);

                    serial_putc(':');

                    serial_put_word32((unsigned int)mem_test_16);

                    serial_putc(':');

                    serial_put_word16(*mem_test_16);

                    serial_putc('\n');

                }

            }

        }


        serial_deinit();

}

Whic properly outputs:
T:5555
02000000
T:AAAA
02000000
T:FFFF
02000000
T:0000
02000000
But also (properly) fails if the address range is adjusted to extend one word past the end of valid 32 MB memory space (0x2000002). This makes me feel that the hardware is good and the SDC is configured properly. However when I reach the BSS memset step of loading U-boot via JTAG I get this:

 

GNU gdb 6.6

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=bfin-elf"...

(gdb) target remote :2000

Remote debugging using :2000

0xef000000 in ?? ()

(gdb) load init.elf

Loading section .text, size 0xca8 lma 0xffa08000

Start address 0xffa08000, load size 3240

Transfer rate: 143204 bits/sec, 3240 bytes/write.

(gdb) c

Continuing.


Program received signal SIGTRAP, Trace/breakpoint trap.

bfin_reset () at reset.c:45

45               asm(

(gdb) load u-boot

Loading section .text.pre, size 0x1f8 lma 0x1fc0000

Loading section .text.init, size 0xc98 lma 0x1fc01f8

Loading section .text, size 0xad50 lma 0x1fc0e90

Loading section .rodata, size 0x4a5c lma 0x1fcbbe0

Loading section .data, size 0x9ca lma 0x1fd063c

Loading section .u_boot_cmd, size 0x408 lma 0x1fd1008

Loading section .text_l1, size 0x28 lma 0x1fd1410

Start address 0x1fc0000, load size 70710

Transfer rate: 1484724 bits/sec, 7071 bytes/write.

(gdb) call memset(&_bss_vma, 0, &_bss_len)


Program received signal SIGTRAP, Trace/breakpoint trap.

0x01fc15aa in memset ()

The program being debugged was signaled while in a function called from GDB.

GDB remains in the frame where the signal was received.

To change this behavior use "set unwindonsignal on"

Evaluation of the expression containing the function (memset) will be abandoned.

(gdb) c

I tried changing the unwindonsignal behaviour, but get this error:

 

(gdb) call memset(&_bss_vma, 0, &_bss_len)
Program received signal SIGTRAP, Trace/breakpoint trap.
0x01fc15aa in memset ()
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/binutils-2.17/gdb/frame.c:620: internal-error: frame_register: Assertion `frame != NULL && frame->next != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

 

I should note that I can build, JTAG-load, and run U-Boot on my BF533-STAMP board using the same procedure.

 

I'm running with the following environment:

 

U-Boot-2010.06-2010R1-RC2

bfin-elf-gcc (ADI-2010R1-RC4) 4.3.5

BF532-0.6

Micron MT48LC16M16A2-7E SDRAM chip

CLKIN = 12.00 MHz

VCO_MULT = 28

CCLK_DIV = 1 (CCLK = 336 MHz)

SCLK_DIV = 4 (SCLK = 84 MHz)

EBIU_SDGCTL = 0x80911109

EBIU_SDRRC = 0x028A

 

I've attached the u-boot board config file I'm using. Any suggestions?

Attachments

Outcomes