Forum Discussion
Altera_Forum
Honored Contributor
20 years ago[u-boot] hwo to setup ENV in compile time
First of all, u-boot can run on my custom board.
Then 1. setenv 'bootm 00100000' 2. saveenv [error comming] <div class='quotetop'>QUOTE </div> --- Quote Start --- Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... . Erased 1 sectors Writing to Flash... Timeout writing to Flash Protected 1 sectors[/b] --- Quote End --- I notice that my flash is AM29LV128,while using AM29065D.C, and their CFI commands is not the same. So I just modified AM29065D.c to meet AM29LV128.Like here, erasing successed but writing failed.cmd=(vu_char *)0x555;//20051018:according AM29LV128 CFI commands
writeb (cmd, 0xaa);
cmd=(vu_char *)0x2aa;//20051018:according AM29LV128 CFI commands
writeb (cmd, 0x55);
cmd=(vu_char *)0x555;//20051018:according AM29LV128 CFI commands
writeb (cmd, 0xa0);
writeb (dst, b); 3. But I know I can flash-programming flash scussefully, so I give up to save ENV at run time. Please help me to figure out how to setup ENV in compile time, to modify which c-file to determine bootcmd?4 Replies
- Altera_Forum
Honored Contributor
BTW: U-boot log messages are:
<div class='quotetop'>QUOTE </div> --- Quote Start --- U-Boot 1.1.3 (Oct 18 2005 - 22:47:52) CPU : Nios-II SYSID : a8236031, Mon Sep 26 05:20:57 2005 BOARD : Psyent PK-1C20 *** Warning - bad CRC, using default environment[/b] --- Quote End --- I find environment is not stored correctly, or maybe I stored nothing as I just did : 0. modify PK1C20.h to meet my custom board 1. make PK1C20_config 2. make - Altera_Forum
Honored Contributor
Hi ,
> *** Warning - bad CRC, using default environment This indicates that the environment was not saved to NV memory. > I notice that my flash is AM29LV128,while using AM29065D.C, and their CFI > commands is not the same. So I just modified AM29065D.c to meet AM29LV128. > Like here, erasing successed but writing failed. You need to modify the flash driver, make sure you set the appropriate number of sectors, etc. > Please help me to figure out how to setup ENV in compile time, to modify which > c-file to determine bootcmd? Put it in your configuration header file. For example, for the PK1C20 board, it would go in the include/configs/PK1C20.h file. The generic way is with the CONFIG_EXTRA_ENV_SETTINGS macro: # define CONFIG_EXTRA_ENV_SETTINGS "myvar=somthing\0" "hostname=MyHost\0" "" There are many "standard" environment variables that have their own macros: # define CONFIG_BOOTCOMMAND "run net_nfs"# define CONFIG_BOOTDELAY 5# define CONFIG_ETHADDR 08:00:3e:26:0a:5b# define CONFIG_NETMASK 255.255.255.0# define CONFIG_IPADDR 192.168.2.21# define CONFIG_SERVERIP 192.168.2.16 etc. You'll need to review the README file. Regards, --Scott - Altera_Forum
Honored Contributor
Hi mountain8848,
Something that just caught my eye: cmd=(vu_char *)0x555;//20051018:according AM29LV128 CFI commands writeb (cmd, 0xaa); If you're using the device in 16-bit mode, you have to change a few things. When you port from the 065 to the 128, you have to change to vu_char to vu_short, writeb()/readb() to writew()/readw(), etc. But you might find it easier to grab an existing implementation (e.g. from the tqm5200 or xsengine board tree). If you're not using a data cache you won't have to worry about using writew/readw. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott,
I let AM29LV128 only in 8-bit mode by connect BYTEn pin to GND.