.global CM3_proc0
.thumb_func
CM3_proc0:
ldr r1, =0x40011010 @ PORT C BSRR register.
mov r2, 0x00001000 @ Set bit 12.
str r2, [r1]
mov r0, 0x1 @ Yield system call.
svc @ Perform the system call.
mov r0, 0x800000 @ Delay loop.
loop0:
sub r0, 0x1
cmp r0, 0x0
bne loop0
b CM3_proc0
A blog about my spare time projects in the microcontroller electronics area. My recent projects include a simple PIC-based television remote control and an MP3 player, based on the PIC 18F25J10 and the VS1011 MP3 decoder. Currently I am learning more about the Cortex M3 CPU, developing a simple RTOS running on the STM32 microcontroller.
Wednesday, June 10, 2009
Flash a LED!
Yesterday, I configured GPIO port C to be able to flash the status LED. I now have two processes yielding to each other. One of them turns on the LED, the other turns it off. Here is one of them. It writes to the GPIO C BSRR (bit set/reset register) to set port C bit 12 high, which turns the LED off.
Subscribe to:
Post Comments (Atom)
Hello,
ReplyDeleteIt looks like a very interesting project. I will try to write my own little embryo of an OS during the summer if I have the time.
It would be very interesting if you would explain your basic setup. Tools/debuggers/IDE/if you emulators and also describe the base layer like, booting, exception handling, simple scheduler etc.
I know you have made some notes about exceptions before but it would be nice to know more about how you go from power-on to first scheduled process.
Is the code available by any chance?
Can you recommend any web-pages or books?
Regards,
Nils
Sorry for the long delay, I've been on vacation and did not have the time to answer.
ReplyDeleteI'll post a blog entry explaining some of those things. I'm planning on releasing the source code in some way, but the state is very much in an alpha-status right now, so I'm not sure if it would help anyone much currently.
When it comes to books, I use the ARMv7-M Architecture Reference Manual (which you need ARM's approval to download, apply at www.arm.com). A web site that I've had much use of is http://chibios.sourceforge.net/.