PIC and arm/linux-crt0.S

Shaun Jackman sjackman@gmail.com
Mon Jun 26 21:20:00 GMT 2006


On 6/26/06, Shaun Jackman <sjackman@gmail.com> wrote:
...
> Although, with this change the primary purpose of linux-crt0.S would
> be to change into thumb mode. I could do instead accomplish this task
> in a couple lines of inline assembler and entirely replace
> linux-crt0.S with linux-crt0.c.

... something like this.

__attribute__((naked))
void _start(void)
{
	register int *sp asm("sp");
#if __thumb__
	// Switch to thumb mode.
	asm(".code 32\n\tadd r0, pc, #1\n\tbx r0");
#endif
	_main(*sp, (char **)(sp + 1));
}

Perhaps I should wait to I collect all my thoughts in one email before
I start posting. =P

Cheers,
Shaun



More information about the Newlib mailing list