2009-03-31 05:45:20     Can't make U-boot working on custom board (newbie)

Document created by Aaronwu Employee on Sep 18, 2013
Version 1Show Document
  • View in full screen mode

2009-03-31 05:45:20     Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71860   

 

Hello,

I'm trying to port U-boot to our custom board with BF532. When I load the compiled u-boot.ldr.hex to SPI flash M25P80, which I wont to boot from, I allways get only few symbols on UART even on totaly strange baudrate (cca 15kbd) instead of 57000. I have read the documents many times, but I still can't find any solution and don't know where to search for mistakes.

 

Here is my conf file. Sorry for dump question if I missed something obvious. I'm using the version 2009.03 from trunk.

 

#ifndef __CONFIG_VISOR1_H__

#define __CONFIG_VISOR1_H__

 

#include <asm/blackfin-config-pre.h>

 

/*

#define CONFIG_DEBUG_EARLY_SERIAL

#define CONFIG_SHOW_BOOT_PROGRESS

*/

 

/* CPU Options

* Be sure to set the Silicon Revision Correctly

*/

#define CONFIG_BFIN_CPU bf532-0.5

#define CONFIG_BFIN_BOOT_MODE BFIN_BOOT_SPI_MASTER

 

 

/*

* Clock Settings

* CCLK = (CLKIN * VCO_MULT) / CCLK_DIV

* SCLK = (CLKIN * VCO_MULT) / SCLK_DIV

*/

/* CONFIG_CLKIN_HZ is any value in Hz */

#define CONFIG_CLKIN_HZ 20000000

/* CLKIN_HALF controls the DF bit in PLL_CTL 0 = CLKIN */

/* 1 = CLKIN / 2 */

#define CONFIG_CLKIN_HALF 0

/* PLL_BYPASS controls the BYPASS bit in PLL_CTL 0 = do not bypass */

/* 1 = bypass PLL */

#define CONFIG_PLL_BYPASS 0

/* VCO_MULT controls the MSEL (multiplier) bits in PLL_CTL */

/* Values can range from 0-63 (where 0 means 64) */

#define CONFIG_VCO_MULT 20

/* CCLK_DIV controls the core clock divider */

/* Values can be 1, 2, 4, or 8 ONLY */

#define CONFIG_CCLK_DIV 1

/* SCLK_DIV controls the system clock divider */

/* Values can range from 1-15 */

#define CONFIG_SCLK_DIV 3

 

 

 

/*

* Memory Settings

*/

 

 

#define CONFIG_MEM_ADD_WDTH 9

#define CONFIG_MEM_SIZE 32

 

 

#define CONFIG_EBIU_SDRRC_VAL (CONFIG_CLKIN_HZ*CONFIG_VCO_MULT/CONFIG_SCLK_DIV * 64 / 8192) - (7 + 2)

#define CONFIG_EBIU_SDGCTL_VAL 0x009111c9

#define CONFIG_EBIU_SDBCTL_VAL 0x0013

 

#define CONFIG_EBIU_AMGCTL_VAL 0x00FF //spravne

#define CONFIG_EBIU_AMBCTL0_VAL 0xffc2ffc2 //spravne

#define CONFIG_EBIU_AMBCTL1_VAL 0xffc2ffc2 //spravne

 

 

#define CONFIG_SYS_MONITOR_LEN (256 * 1024)

#define CONFIG_SYS_MALLOC_LEN (128 * 1024)

 

 

/*

* Serial Flash Infomation

* flash CS = PF2

*/

#define CONFIG_BFIN_SPI

#define CONFIG_SPI_FLASH

#define CONFIG_CMD_SF

#define CONFIG_SF_DEFAULT_HZ 20000000

#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3

 

 

#define CONFIG_ENV_IS_IN_SPI_FLASH

#define CONFIG_ENV_SPI_MAX_HZ 20000000

#define CONFIG_ENV_SPI_MODE SPI_MODE_3

#define CONFIG_ENV_SPI_CS 2

#define CONFIG_ENV_SPI_BUS 0

 

#define CONFIG_ENV_OFFSET 0x4000

#define CONFIG_ENV_SIZE 0x1000

#define CONFIG_ENV_SECT_SIZE 0x1000

 

#define CONFIG_SPI_FLASH_STMICRO

 

#define ENV_IS_EMBEDDED_CUSTOM

 

#define CONFIG_SYS_NO_FLASH

#define CFG_NO_FLASH

#define CONFIG_MISC_INIT_R

 

/*

* Command settings

*/

 

 

/*

* Console settings

*/

#define CONFIG_BAUDRATE 57600

#define CONFIG_LOADS_ECHO 1

#define CONFIG_UART_CONSOLE 0

 

/*

* Pull in common ADI header for remaining command/environment setup

*/

#include <configs/bfin_adi_common.h>

 

#include <asm/blackfin-config-post.h>

 

#endif

 

QuoteReplyEditDelete

 

 

2009-03-31 06:15:06     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71862   

 

have you read the debugging page ?

http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:debugging

 

the DEBUG_EARLY_SERIAL option should give you output immediately

 

how exactly are you programming the serial flash ?  what jtag device ?

 

how did you calculate the sdram settings ?  there is a spreadsheet to help with that:

http://docs.blackfin.uclinux.org/doku.php?id=bfin:sdram

QuoteReplyEditDelete

 

 

2009-03-31 06:29:23     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71865   

 

Thank you for fast reply.

Yes I've read the debbugging page, I tried DEBUG_EARLY_SERIAL on and off and it gives the same output.

 

Unfortunately I haven't JTAG now so I'm programming the flash via serial programmer, maybe here is the problem?

 

I used the SDRAM settings which worked with VisualDSP, but I'll try the proposed spreadsheet, thanks. 

QuoteReplyEditDelete

 

 

2009-03-31 06:35:09     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71867   

 

presumably the programmer is doing it correctly (writing out a binary stream rather than the actual hex codes) ... you most likely wouldnt get any serial output at all if the ldr stream were corrupt

 

what you could do is edit cpu/blackfin/initcode.c and put a while(1) above the serial_putc('A');

 

have you verified that the uart is wired correctly ?

QuoteReplyEditDelete

 

 

2009-03-31 07:06:10     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71871   

 

Now I modified the initcode.c to send the 'A' in the loop. I see correct signal with 'A' on the scope, but the speed is still strange (15.625 kBd). I don't understand why. The board is OK. I have an old hex with u-boot and uclinux which made my former colleague few years ago and it's working.

QuoteReplyEditDelete

 

 

2009-03-31 07:19:27     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71873   

 

the uart speed is calculated based on the clocks you defined, but those may not be the clocks coming out of reset.  so the correct baud rate may not be seen until start.S, which means executing out of external memory.

 

try moving the while(1) down to the 'N' step.  clocks at that point should match what you have in your board config.

QuoteReplyEditDelete

 

 

2009-03-31 08:24:56     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71876   

 

Ok. At the 'N' step, the speed is correct. Same it's at the 'T' step. Where should I search now?

QuoteReplyEditDelete

 

 

2009-03-31 15:37:58     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71902   

 

but after that you dont get any output ?  that means things failed when trying to load into external memory (the initcode loads first and into on-chip memory).  you can write some simple code at the end of that initcode func that reads/writes external memory to make sure that things written are read back correctly (simple mtest).  that indicates you need to verify your sdram settings.

QuoteReplyEditDelete

 

 

2009-04-01 05:04:49     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71946   

 

I performed a memtest for the whole 32MB SDRAM which I have. It seems, it's ok (I've read correct values). But after initcode I still don't have any output...

QuoteReplyEditDelete

 

 

2009-04-01 08:58:11     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71950   

 

It seems that the initcode()  is the only process which come through. All calls in start.S gives no output. I suppose at least serial_early_puts("Program clocks") before the initcode outputs, but ...

QuoteReplyEditDelete

 

 

2009-04-01 09:05:17     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71951   

 

as i said, the initcode() func is the only one that is loaded and executed out of on-chip memory.  everything else involves external memory.  it's pretty difficult to trouble shoot things at this point w/out jtag, so i suggest you buy a gnICE to proceed.

QuoteReplyEditDelete

 

 

2009-04-01 11:34:29     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 71964   

 

I have AD HPUSB-ICE, is there any possibility to debug uboot in win?

QuoteReplyEditDelete

 

 

2009-04-01 11:45:45     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 71966   

 

you can use vdsp to single step and view disassembly, but you wont get any symbols or source code viewing.  we dont really support vdsp.

 

you should be able to connect and figure out where the part has hung, and to verify that external memory is sane ...

QuoteReplyEditDelete

 

 

2009-04-02 08:15:27     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 72040   

 

I stepped the disassembly in the VDSP. As I said before, the initcode comes through well, then there is RTS instruction and processor jups to address EF0002A0 and there is illegal opcode. I have tried also another similar project 'blackstamp' and behaviour is the same. Does that mean, that the transfer to SDRAM isn't working properly?

QuoteReplyEditDelete

 

 

2009-04-02 08:20:06     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 72041   

 

there is no bad code at 0xEF0002A0.  that is VDSP screwing up.  the bootrom lives at 0xEF000000.  so that is not a problem.

QuoteReplyEditDelete

 

 

2009-04-06 05:07:02     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 72203   

 

Problem is solved. By chance I noticed that u-boot.lds.S in for ezkit 533 has different size from all others. I have tried to use it and now it works. I don't know why yet but I hope I will find it out.

QuoteReplyEditDelete

 

 

2009-04-06 05:21:11     Re: Can't make U-boot working on custom board (newbie)

Mike Frysinger (UNITED STATES)

Message: 72204   

 

when dealing with u-boot.ldr, the linker scripts should all be exactly the same.  the only difference between the boards is for bypass boot, but you arent using that boot mode ...

QuoteReplyEditDelete

 

 

2009-04-06 05:29:35     Re: Can't make U-boot working on custom board (newbie)

Jan Pohanka (CZECH REPUBLIC)

Message: 72206   

 

Yes, the only difference is in BYPASS mode and I'm using SPI_MASTER, I can't explain why, but with the change in BYPASS mode u-boot now works on my desk. When I use the other lds.S file (for example from bf537 stamp), I get no output.

QuoteReplyEditDelete

 

 

2009-04-10 03:43:47     Re: Can't make U-boot working on custom board (newbie)

DAVID ZHOU (CHINA)

Message: 72496   

 

How about reconfig you uboot? test again.

 

make distclean

 

make yourboard_config

 

make all

Attachments

    Outcomes