[En-Nut-Discussion] Non reproduceable reboots on 1.3H

Daniel ziu82 at gmx.de
Mon Aug 31 17:00:16 CEST 2009


Hi,

Thiago, thanks for the answer. But this was not the problem.

For reading from eeprom i used following function:

void LoadEEString(int offset, int length, char* buffer)
{
    realloc(buffer, length+1);
    memset(buffer, '\0', length+1);

    // Load from EEPROM
    NutEnterCritical();
    NutNvMemLoad(offset, buffer, length);
    NutExitCritical();
    // Get sure that we can use the buffer for I/O functions
    buffer[length] = '\0';
}

With this implementation my function shows the strange behaviour and 
stucks after 3-5 times called.

Now I stopped using "realloc" and everything works:

void LoadEEString(int offset, int length, char* buffer)
{
    // Load from EEPROM
    NutEnterCritical();
    NutNvMemLoad(offset, buffer, length);
    NutExitCritical();
    // Get sure that we can use the buffer for I/O functions
    buffer[length] = '\0';
}

Is there any know bug about "realloc" or do I have an error in usage of 
this function?

Best regards,
Daniel

Thiago A. Corrêa schrieb:
> Hi,
>
> On Mon, Aug 31, 2009 at 8:47 AM, Daniel<ziu82 at gmx.de> wrote:
>   
>> Hi Thiago,
>>
>> Thanks for the fast reply. It's the onboard eeprom.
>>
>> You say "I haven't checked if ethernut does that, but I do that on my
>> own code before calling ethernut functions.". Can you tell me the
>> functions for disabling/enabling interrupts? I found nothing in the API.
>> So I can test if it works with disabled interrupts.
>>
>>     
>
> NutEnterCritical and NutExitCritical disables and reenables
> interrupts, respectively. I've wrapped my code between those calls.
>
> Kind Regards,
>    Thiago A. Correa
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>   




More information about the En-Nut-Discussion mailing list