From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Farine To: "Nohee Ko" Cc: Subject: Re: [ECOS] Question about MBX860 redboot Flash/Ethernet support. Date: Sat, 19 May 2001 07:06:00 -0000 Message-id: <86lmntwi29.fsf@halftrack.hq.acn-group.ch> References: <9860C773D04D834D83FD6FAD00A61E930F1FA7@gctsemi.gctsemi.com> X-SW-Source: 2001-05/msg00306.html "Nohee Ko" writes: > hi. > I ported simple mbx redboot to my mpc860 platform. > my mpc860 platform is different from MBX board but very similiar to > that. > > But unfortunately, Flash and Ethernet have not been supported yet. > > > so I have a few questions about it. > > 1. MBX860 module uses Flash AM29F040B. But my mpc860 module uses Flash > AM29LV160. > Because of the difference of used Flash, my mpc860 module is not > working properly when redboot starting. > "FLASH : driver init failed !" message occurs on debug monitor. > ( this case happens when RedBoot start with Flash and Ethernet > support . Without Flash support, RedBoot runs well on > my board). > So I'd like to know the reason why "FLASH : driver init failed !" > message occurs on debug monitor. > Moreover after printing this message, RedBoot stop! . So I can not > test my board using debug monitor any more. > ( I can't key in any commands to debug monitor) > You can disable flash support with a command like: ecosconfig remove CYGPKG_DEVS_FLASH_ look your ecos.ecc file for the value to substitute to . > > 2. I know I can use ethernet using BOOTP without Flash support. But I don't > understand how it works. So could you explain it in more detail? > A possible solution uses a hook in "packages/redboot//src/net/net_io.c" (see below between and ) that lets the application startup code define its own routine to setup network parameters. Those parameters consist of RedBoot global variables, such as: __local_ip_addr my_bootp_info use_bootp and others. My version of the bootloader (an additional object file added to the standard RedBoot link objects) defines a RedBoot initializer that assigns the above-mentioned hook with my own network setup routine. static void set_config_hook(void) { net_init_config_hook = setup_net; } RedBoot_init(set_config_hook, RedBoot_INIT_FIRST); HTH, Robin Index: net_io.c =================================================================== RCS file: /usr/cvs/eCos/base/packages/redboot/current/src/net/net_io.c,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -U4 -r1.1.1.2 -r1.3 --- net_io.c 2001/04/09 13:50:37 1.1.1.2 +++ net_io.c 2001/04/09 15:12:11 1.3 @@ -517,8 +517,26 @@ CYG_HAL_TABLE_END( __NETDEVTAB_END__, netdev ); RedBoot_init(net_init, RedBoot_INIT_LAST); +#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +static void +read_flash_config(void) +{ + // Fetch values from saved config data, if available + flash_get_config("net_debug", &net_debug, CONFIG_BOOL); + flash_get_config("gdb_port", &gdb_port, CONFIG_INT); + flash_get_config("bootp", &use_bootp, CONFIG_BOOL); + flash_get_config("bootp_my_ip", &__local_ip_addr, CONFIG_IP); + flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP); +} + +void (*net_init_config_hook)(void) = read_flash_config; +#else +void (*net_init_config_hook)(void); +#endif + + void net_init(void) { cyg_netdevtab_entry_t *t; @@ -526,16 +544,10 @@ // Set defaults as appropriate use_bootp = true; net_debug = false; gdb_port = CYGNUM_REDBOOT_NETWORKING_TCP_PORT; -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG - // Fetch values from saved config data, if available - flash_get_config("net_debug", &net_debug, CONFIG_BOOL); - flash_get_config("gdb_port", &gdb_port, CONFIG_INT); - flash_get_config("bootp", &use_bootp, CONFIG_BOOL); - flash_get_config("bootp_my_ip", &__local_ip_addr, CONFIG_IP); - flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP); -#endif + if (net_init_config_hook != (void (*)(void))0) + net_init_config_hook(); have_net = false; // Make sure the recv buffers are set up eth_drv_buffers_init(); __pktbuf_init();