Re: [U-Boot] mkconfig arch link generation

2010-07-15 Thread Matteo Facchinetti
Wolfgang Denk wrote:
 Dear Matteo Facchinetti,

 In message 4c3d83f3.1040...@sirius-es.it you wrote:
   
 I'm updating my uboot to mainline and I have a question about a link 
 generate from mkconfig (with mpc5121_config).
 

 Which code are you talkign about? There is no target mpc5121_config
 supported in mainline...

   
yes,
I've started from mpc5121ads_config but mpc5121ads_rev2_config is the same.
U-boot head mainline version. ( 54841ab50c20d6fa6c9cc3eb826989da3a22d934 )

In practice:
$ make distclean
$ ls -l include/asm/arch
ls: cannot access include/asm/arch: No such file or directory

$ make mpc5121ads_config
Configuring for mpc5121ads board...
$ ls -l include/asm/arch
lrwxrwxrwx 1 teox teox 12 2010-07-15 09:02 include/asm/arch - arch-mpc512x

Regards,
Matteo Facchinetti
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] mkconfig arch link generation

2010-07-14 Thread Matteo Facchinetti
Hi,

I'm updating my uboot to mainline and I have a question about a link 
generate from mkconfig (with mpc5121_config).
Follwing link in include/asm, I found a link named arch genarated by 
mkconfig.
This is broken so point to arch-mpc512x instead of 
arch/powerpc/cpu/mpc512x.
Result is #include asm/arch/asm-offsets.h or similar are be broken.

How is the correct way to modify mkconfig?
I don't understand mean of link points arch-mpc512x.

Regards,

Matteo Facchinetti
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] mkconfig arch link generation

2010-07-14 Thread Matteo Facchinetti
Stefano Babic wrote:
 Matteo Facchinetti wrote:
   
 Hi,

 

 Hi Matteo,

   
Hi Stefano,
 I'm updating my uboot to mainline and I have a question about a link 
 generate from mkconfig (with mpc5121_config).
 Follwing link in include/asm, I found a link named arch genarated by 
 mkconfig.
 This is broken so point to arch-mpc512x instead of 
 arch/powerpc/cpu/mpc512x.
 

 Yes, the link is broken. However, all boards in the mainline using the
 MPC512x are compiled clean. This is because asm-offsets.h is included
 only by arch/powerpc/cpu/mpc512x/start.S with #include asm-offsets.h,
 and the compiler search for the file in the same directory of start.S
 and can find it.
 The link is not required to compile the 512x boards supported currently
 by u-boot, but it must be set for the ARM architecture. Under the
 kernel, asm-offsets.h is auto-generated (I know, this is the best solution).

 However, why do you need this file ? It should be required only by low
 level initialization in assembly, as it is done by start.S. After that,
 it is required in u-boot to access to registers/peripherals via C
 structures and not using offsets.
   
Yes, you're rigth,
but I'm tring to write nand_spl driver for add nand boot support for my 
TWR-MPC5125 evaluation board.
In first step I take what I need from LTIB (freescale) and  then I 
adjust the code for uboot mainline.
The part takes from LTIB of 2k first stage nandboot code uses directly 
SRAMBAR and SWCRR defines.

Now, I suppose, correct develop is to use the common c code in nand_spl 
directory and eventually customizing for my board unless use 
include/asm/arch/... for powerpc arch.
Is it true?

 Result is #include asm/arch/asm-offsets.h or similar are be broken.

 How is the correct way to modify mkconfig?
 

 Probably not setting the link for powerpc, because it is not required.

 Regards,
 Stefano Babic

   

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] add usb_system_autoupdate command.

2008-11-17 Thread Matteo Facchinetti

Hi Marco,

I looked updater.c and and I take that code as example.

Well,
I removed all function as same as do_... (do_fat_fsload, do_protect, 
do_flerase, do_mem_cp).
In this way, I could remove also strcpy() and sprintf() needed to made 
their parameters and the result is that I cleaned and emproved all code.


Now all works correctly.
I think that the rewrite of the code, indirectly solve some bugs of 
memory corruption.


In attach, the code...
and if anyone try it, I'm interesting to feedback or opinions.

Thanks at all.
Matteo.




Marco wrote:

Hi Matteo,

in my opinion you should follow the philosophy of updater.c under the
tools folder to erase the flash. This command is very interesting, let
me know if you fix your problem.

Regards,

Marco

Matteo Facchinetti ha scritto:
  

Hi,

I have add the possibility to automatic update entire flash using a USB
pendrive.

To make it, need the following steps:
1) insert usb pendrive. In pendrive must be present these files:
install.dat and the files we want to copy.
2) from uboot console: = usb_system_autoupdate
3) the system update start, reading information from install.dat file.

The install.dat file raws has this syntax:
file_type file_name star_flash_addr_partition
end_flash_addr_partition

file_type values: kernel, uboot, fdt, rootfs.

In attachment there's an example of install.dat and the source code.

Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem
that I can't fix:
if try to update uboot partition, it freeze in line 211 when call
do_flerase().

debugging I can see that it freeze in:
cmd_flash.c
434: printf (Erased %d sectors\n, erased);
after uboot partition erasing.


Can you help me?


Thanks in advance.
Matteo Facchinetti










___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot



  


/*
 * (C) Copyright 2008
 * Matteo Facchinetti, Sirius Electronic Systems S.R.L., [EMAIL PROTECTED]
 *
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#include common.h
#include command.h
#include usb.h
#include fat.h

#define INSTALL_DAT_FILENAME install.dat
#define INSTALL_DAT_PTR (unsigned char *)0x10
#define MAX_FILE_TO_UPDATE 6


struct install_dat {
	int type;
	char file_name[255];
	unsigned long file_size;
	unsigned long flash_s_address;
	unsigned long flash_e_address;
	unsigned long mem_address;
};


struct install_dat files_to_update[MAX_FILE_TO_UPDATE];


static int parse_installdat(char* start_file_ptr, int file_size, struct install_dat fupdate[]) {

	char *open_quote=NULL, *file_ptr=start_file_ptr;
	char *end_file_ptr, *end_fladdr_ptr;
	int idx=0;
	

	fupdate[0].type = -1;
	*fupdate[0].file_name='\0';
	fupdate[0].flash_s_address = 0x;
	fupdate[0].flash_e_address = 0x;
	end_file_ptr = file_ptr + file_size;
	while (file_ptr  end_file_ptr)
	{
		switch (*file_ptr) {
			case '\n':
open_quote=NULL;
start_file_ptr = file_ptr; 
files_to_update[idx].type = -1; 
*fupdate[idx].file_name='\0';
fupdate[idx].flash_s_address = 0x;
fupdate[idx].flash_e_address = 0x;
break;  
			
			case '':
if (open_quote) {
	/* close_quote -- copy quote content to filename */
	*file_ptr='\0';
	strcpy(fupdate[idx].file_name, open_quote); 
} else {
	open_quote=file_ptr + 1;
	/* validate image type uboot - kernel - rootfs */
	*file_ptr='\0';
	if (strstr(start_file_ptr, uboot))
		fupdate[idx].type = 1; 
	else if (strstr(start_file_ptr, kernel))
		fupdate[idx].type = 2; 
	else if (strstr(start_file_ptr, fdt))
		fupdate[idx].type = 3; 
	else if (strstr(start_file_ptr, rootfs))
		fupdate[idx].type = 4; 
	else
		*open_quote='\n'; /* error: invalidate line */
}			
break;

			case '#':
if (!fupdate[idx].flash_s_address) 
{
	/* parse start address */
	file_ptr+=1;
	end_fladdr_ptr=file_ptr+8; 
	*end_fladdr_ptr='\0';
	fupdate[idx].flash_s_address = simple_strtoul(file_ptr, end_fladdr_ptr, 16);
}
else
{
	/* parse start address */
	file_ptr+=1;
	end_fladdr_ptr=file_ptr+8

[U-Boot] add usb_system_autoupdate command.

2008-11-15 Thread Matteo Facchinetti

Hi,

I have add the possibility to automatic update entire flash using a USB 
pendrive.


To make it, need the following steps:
1) insert usb pendrive. In pendrive must be present these files: 
install.dat and the files we want to copy.

2) from uboot console: = usb_system_autoupdate
3) the system update start, reading information from install.dat file.

The install.dat file raws has this syntax:
file_type file_name star_flash_addr_partition 
end_flash_addr_partition


file_type values: kernel, uboot, fdt, rootfs.

In attachment there's an example of install.dat and the source code.

Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem 
that I can't fix:
if try to update uboot partition, it freeze in line 211 when call 
do_flerase().


debugging I can see that it freeze in:
cmd_flash.c
434: printf (Erased %d sectors\n, erased);
after uboot partition erasing.


Can you help me?


Thanks in advance.
Matteo Facchinetti







/*
 * (C) Copyright 2008
 * Matteo Facchinetti, Sirius Electronic Systems S.R.L., [EMAIL PROTECTED]
 *
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#include common.h
#include command.h
#include usb.h
#include fat.h

#define INSTALL_DAT_FILENAME install.dat
#define INSTALL_DAT_PTR (char *)0x10
#define MAX_FILE_TO_UPDATE 6


struct install_dat {
	int type;
	char file_name[255];
	unsigned long file_size;
	unsigned long flash_s_address;
	unsigned long flash_e_address;
	unsigned long mem_address;
};


struct install_dat files_to_update[MAX_FILE_TO_UPDATE];

char *param_fat_fsload[] = {fatload, usb, 0, 10, INSTALL_DAT_FILENAME};
char *param_protect_off[] = {protect, off, all};
char *param_flerase[] = {erase, ff00, };	
char *param_memcp[] = {cp.b, 10, ff00, $(filesize)};	


static void print_cmd(char *param_cmd[], int num_param) {
	int i;
	
	for (i=0; inum_param; i++) printf(%s , param_cmd[i]);
	printf(\n);
}


static unsigned long read_ex_env(char *env) {
	char *ptr_s, *ptr_e;

	ptr_s = getenv(env);
	ptr_e = ptr_s + 8;
	return simple_strtoul(ptr_s, ptr_e, 16);
}


static int parse_installdat(char* start_file_ptr, int file_size, struct install_dat fupdate[]) {

	char *open_quote=NULL, *file_ptr=start_file_ptr;
	char *end_file_ptr, *end_fladdr_ptr;
	int idx=0;
	

	fupdate[0].type = -1;
	*fupdate[0].file_name='\0';
	fupdate[0].flash_s_address = 0x;
	fupdate[0].flash_e_address = 0x;
	end_file_ptr = file_ptr + file_size;
	while (file_ptr  end_file_ptr)
	{
		switch (*file_ptr) {
			case '\n':
open_quote=NULL;
start_file_ptr = file_ptr; 
files_to_update[idx].type = -1; 
*fupdate[idx].file_name='\0';
fupdate[idx].flash_s_address = 0x;
fupdate[idx].flash_e_address = 0x;
break;  
			
			case '':
if (open_quote) {
	/* close_quote -- copy quote content to filename */
	*file_ptr='\0';
	strcpy(fupdate[idx].file_name, open_quote); 
} else {
	open_quote=file_ptr + 1;
	/* validate image type uboot - kernel - rootfs */
	*file_ptr='\0';
	if (strstr(start_file_ptr, uboot))
		fupdate[idx].type = 1; 
	else if (strstr(start_file_ptr, kernel))
		fupdate[idx].type = 2; 
	else if (strstr(start_file_ptr, fdt))
		fupdate[idx].type = 3; 
	else if (strstr(start_file_ptr, rootfs))
		fupdate[idx].type = 4; 
	else
		*open_quote='\n'; /* error: invalidate line */
}			
break;

			case '#':
if (!fupdate[idx].flash_s_address) 
{
	/* parse start address */
	file_ptr+=1;
	end_fladdr_ptr=file_ptr+8; 
	*end_fladdr_ptr='\0';
	fupdate[idx].flash_s_address = simple_strtoul(file_ptr, end_fladdr_ptr, 16);
}
else
{
	/* parse start address */
	file_ptr+=1;
	end_fladdr_ptr=file_ptr+8; 
	*end_fladdr_ptr='\n';
	fupdate[idx].flash_e_address = simple_strtoul(file_ptr, end_fladdr_ptr, 16);
	
	if ((fupdate[idx].type != -1)  
		(*fupdate[idx].file_name != '\0')) 
	{
		/* line parse OK */
		file_ptr+=8;
		idx++;
		open_quote=NULL;
		start_file_ptr = file_ptr;
	}
	else
		*file_ptr='\n'; /* error: invalidate line */
}
break;
		}

		file_ptr++;
	}
	
	return idx;
}


int do_usb_system_autoupdate(cmd_tbl_t