This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix for CONFIG_STRING option in RedBoot


I agree with you. But I do not use any alias.
In fact I though I could use CONFIG_STRING to add an option to my redboot options as follows:


RedBoot_config_option("Any string",
                     any_string,
                      ALWAYS_ENABLED, true,
                      CONFIG_STRING, 0
    );

If you add such an option, and your flash is erased, there is at boot time a problem when config_init is called which makes the system reboot.
It does not work without that patch.


As it is not correct for aliases, perhaps that option should be splitted into two : CONFIG_ALIAS (with the actual CONFIG_STRING value) and CONFIG_STRING (with a new value).

Xavier

At 10:30 30/07/2003 +0200, Andrew Lunn wrote:
> Index: ecos/packages/redboot/current/src/flash.c
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
> retrieving revision 1.46
> diff -u -u -r1.46 flash.c
> --- ecos/packages/redboot/current/src/flash.c 14 May 2003 20:12:54 -0000 1.46
> +++ ecos/packages/redboot/current/src/flash.c 29 Jul 2003 10:27:29 -0000
> @@ -2006,7 +2006,7 @@
> #endif
> #endif
> case CONFIG_STRING:
> - memcpy(dp, (void *)opt->dflt, config_length(CONFIG_STRING));
> + memcpy(dp, (void *)&opt->dflt, config_length(CONFIG_STRING));
> break;
> case CONFIG_SCRIPT:
> break;


Could you explain this patch a bit more. As far as i can see,
opt->dflt contains the address of the string that should be used, not
the string itself. Take a look at do_alias()


case 3: if (strlen(argv[2]) >= MAX_STRING_LENGTH) { diag_printf("Sorry, value is too long\n"); break; } make_alias(name, argv[1]); opt.type = CONFIG_STRING; opt.enable = (char *)0; opt.enable_sense = 1; opt.key = name; opt.dflt = (CYG_ADDRESS)argv[2]; flash_add_config(&opt, true); break;

To me your patch looks wrong, but i could be missing something here.

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]