This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: Fix for CONFIG_STRING option in RedBoot
- From: Xavier Debreuil <xavier dot debreuil at inventel dot fr>
- To: Gary Thomas <gary at mlbassoc dot com>
- Cc: Andrew Lunn <andrew dot lunn at ascom dot ch>, eCos patches <ecos-patches at sources dot redhat dot com>
- Date: Mon, 18 Aug 2003 10:26:51 +0200
- Subject: Re: Fix for CONFIG_STRING option in RedBoot
- References: <5.2.0.9.0.20030731085700.00b35460@172.16.0.2><5.2.0.9.0.20030731085700.00b35460@172.16.0.2>
The default value config_option_any_string.dflt is initialised to 0.
Then the :
case CONFIG_STRING:
memcpy(dp, (void *)opt->dflt, config_length(CONFIG_STRING));
does a memory fault.
The patch I proposed is wrong indeed.
The solution is to set a default value to the STRING option :
RedBoot_config_option("Any string",
any_string,
ALWAYS_ENABLED, true,
CONFIG_STRING,
"default_string"
);
or to check if value of opt->dflt is a valid ram or rom address.
Xavier
At 08:37 31/07/2003 -0600, Gary Thomas wrote:
On Thu, 2003-07-31 at 01:28, Xavier Debreuil wrote:
> 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.
What's the value of "any_string"? (How is it declared)?
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates