[En-Nut-Discussion] I need some hint - NutOS and ARM

Harald Kipp harald.kipp at egnite.de
Wed Jul 20 16:28:43 CEST 2005


Hello Paul,


>May I ask what mode CPU should work in ?  My starup code leaves with CPU
>im system mode, disabled irqs.

Good question. :-)
arch\arm\init\crtwolf_ram.S
leaves the CPU in system mode while
arch\arm\init\crtgbaxport2.S
switches to user mode. In addition, the GBA runtime switches to thumb mode,
because it's running from 16 bit flash. But I'm not sure wether the Gameboy
code works with the latest release.

>  If I change NutThreadCreate() in
>arch/arm/os/thread.h so that it runs in system mode
>(sf->csf_cpsr =  0x1F|0x80|0x40;//0xD3;
>sf->csf_spsr = 0x1F|0x80|0x40;// 0xD3;)
>and comment out first "asm volatile..." instruction in NutThreadSwitch
>the nutidle and main threads works and my LED blinks ;) Why putting any
>instruction before thread_start global label makes NutOS hang ?
>I'm a bit confused with this context switching mechanism ;)

Welcome to the club. :-) I assume that something is
wrong with your linker script / startup file combination.
Possibly the stack pointer setting?

I'm sorry that I'm not able to answer your questions in more
detail right now. It had been a few weeks ago I did that part
and probably need some time to become familiar with it again.
I'm a newbie to ARM too.

Harald




More information about the En-Nut-Discussion mailing list