This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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]

newlib port problem (stdio and malloc)


Hello everyone:

    I have 2 questions when port the newlib to the ARM platform:

1. I need use stdio to display debug information. The debug information is output by the UART.
    Now I modify the function "int _swiwrite ( int    file,    char * ptr,    int    len)" in "\newlib-1.10.0\newlib\libc\sys\arm\syscalls.c".
    This function is modified something like this:
    for (i=0; i<len; i++)
    {
        while(1)
        {
            if (UART can send data)
            {
                break;
            }    
        }
        send one byte
    }

    Is it OK?
    When I use stdio function, I find it's not a good way to modify like this.
    Any suggestion?

2. I need use malloc/free to manage memory. When I check the function "caddr_t _sbrk (int incr)" in "\newlib-1.10.0\newlib\libc\sys\arm\syscalls.c", I find _sbrk() tries to manage the memory between [end, sp). 
    Although it's ok to manage like this, I want to know why  _sbrk() on the ARM system doesn't try to manage a fixed range of memory? For example, manage the memory between [end, end + MEMORY_SIZE). 

Thanks in advance

Zhang Hua



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