This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: crossgcc: code wont run from ROM.


Brendan J Simon wrote:

> compiler : powerpc-eabi-g++ (egcs-1.1.2)
> libc : newlib (newlib-1.8.1 I think)
> os : none.
> target architecture : powerpc (mpc860)
>
> I have ported some code that was originally written for the DiabData
> compiler.  I have managed to load it into RAM on my embedded system
> using the SDS SingleStep debugger via the BDM port.  It runs really
> well.
>
> I tried programming it into Flash and it aborts.  The __eabi function
> which is called from main() never returns.  I have tracked this down to
> malloc returning zero.  The backtrace shows the following functions
> being called.
>
> main()
> __do_global_ctors()
> __get_eh_context()
> __get_eh_info()
> __get_eh_info()
> __empty()
> malloc()
> _malloc_r()
>
> The SDS debugger does not support the gcc debugging formats so I am
> debugging the assembler.  This is getting very tedious but it seems that
> _malloc_r() is returning zero.  From newlib's _malloc_r code, it seems
> that chucksize(top) is zero which is causing the problem.
>
>     /* Try to extend */
>     malloc_extend_top(RCALL nb);
>     remainder_size = chunksize(top) - nb;
>     if (chunksize(top) < nb || remainder_size < (long)MINSIZE)
>     {
>       MALLOC_UNLOCK;
>       return 0; /* propagate failure */
>     }
>
> Has anyone got any ideas what the problem is and/or what I can do to fix
> the problem.

I just had a thought.  Maybe I need to copy the initialised data section from
ROM to RAM ?
I know that the DiabData startup files do this and I'm pretty sure I haven't done
this in my gcc startup files.
Does this sound plausable ?

Brendan Simon.



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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