AW: [ECOS] Reading flash config value from application

Hoehenleitner, Thomas Thomas.Hoehenleitner@Hach-Lange.de
Wed Jun 21 11:03:00 GMT 2006


Hi Andre,

is it possible, that you are working on an older version and Gary on the current one and you deal here with a fixed bug?

If you write instead of my_ip[i] my_ip[0][i] inside your loop and appropriate in your if statement, you should get the right value. This is the case on my system. I found that by trial and error. On the other hand Gary's code crashed on my system which is an older one. 

Please ignore the text at the end of this mail concerning confidential. I write from my company account and have no influence on this.

Thomas 

-----Ursprüngliche Nachricht-----
Von: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@ecos.sourceware.org] Im Auftrag von Gary Thomas
Gesendet: Mittwoch, 21. Juni 2006 04:15
An: ajmas@bigfoot.com
Cc: ecos-discuss@sources.redhat.com
Betreff: Re: [ECOS] Reading flash config value from application

On Tue, 2006-06-20 at 18:26 -0400, Andre-John Mas wrote:
> Hi,
> 
> I am not sure what I am doing wrong, but CYGACC_CALL_IF_FLASH_CFG_OP is not finding the value (returning false). I am trying to read the "bootp_my_ip" value. Every time the card restarts the redboot sees the right values, so it doesn't seem to be an issue of data getting over-written.
> 
> Below are the modifications I made to network_support.c in the net/common package:
> 
> #include <cyg/hal/hal_if.h>
> 
> // For fetching the IP info from RedBoot #include <cyg/hal/hal_if.h> 
> #ifndef CONFIG_IP #define CONFIG_IP 5 #endif
> 
> typedef unsigned char ip_addr_t[4];
> 
> //
> // taken from redboot ... net/net_io.c // static bool 
> flash_get_IP(char *id, ip_addr_t *val) {
>   ip_addr_t my_ip[4];

Do you really want an array of 4 ip_address_t objects?

>   int i;
> 
>   if (CYGACC_CALL_IF_FLASH_CFG_OP(CYGNUM_CALL_IF_FLASH_CFG_GET, id, &my_ip, CONFIG_IP))
>   {
>     diag_printf("flash_get_IP %s\n", my_ip);
>     if (my_ip[0] != 0 || my_ip[1] != 0 ||
>         my_ip[2] != 0 || my_ip[3] != 0) {
>         // 'id' is set to something so let it override any static IP
>         for (i=0; i<4; i++)
>           (*val)[i] = my_ip[i];
>         }
>     }
>     else
>     {
>       return false;
>     }
> }
> 
> and then in the init_all_networks_interfaces() function I have:
> 
> struct in_addr card_ip;
> 
> flash_get_IP("bootp_my_ip", card_ip.s_addr);
> 
> Any ideas what I might be doing wrong?

I don't see anything in particular wrong with this code.  I tried the attached program and it worked just fine for me.

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law.  If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system.  If you
have any questions about this e-mail please notify the sender
immediately.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list