發表文章

目前顯示的是 8月, 2014的文章

自己動手做OS, micro kernel develop on Beagleboard-XM(ARMv7) lab1

This is a tutorial on bare-metal [OS] development on the Beagleboard-XM. I will show you how to implement a Helloworld image in this article. 在這篇文章中,我會介紹如何寫一個Helloworld的image.  1. From BeagleBoard-xM System Reference Manual, we can get, "A single RS232 port is provided on the BeagleBoard and provides access to the TX and RX lines of UART3 on the processor." 2. From DM3730 Technical Reference Manual- we can get "THR_REG W UART3 base address is 0x49020000"  - 首先我們可以從BeagleBoard-xM System Reference Manual,查到板上子上的RS-232是接在UART3上,再從DM3730 Technical Reference Manual,得知,UART3的THR_REG的位址是0x49020000. I've already added  comments in source file, please refer to source code(github) for details. 我把註解加入到檔案中了,請到github下載source。 1.boot.asm #UART3 THR_REG register address .equ UART3_THR_REG, 0x49020000 .arm _start: ldr r0,=UART3_THR_REG adr r1,.L0 bl helloworld .L1: b .L1 .align 2 .L0: .ascii "helloworld\n\0" 2.Helloworld.c int helloworld(unsigned int...

Assembly - moving data 組合語言,移動資料

圖片
從記憶體中讀資料 load date from memory into register 把暫存器中存資料存進記憶體 store register data into memory                Figure 1. integer registes,                 source:https://www.cs.cmu.edu/~fp/courses/15213-s07/misc/asm64-handout.pdf mov operand combinations(mov的運算整理) mov imm to register, mov $0x11,%eax -> var_a=0x11; mov imm to mem, mov $0x39,(%eax) -> *p=0x39; mov reg to reg, mov %edx,%eax -> var_a=var_b; mov reg to mem, mov %eax,(%edx) -> *p=var_a; mov mem to reg, mov (%eax),%eax -> var_a=*p; *can not do memory to memory transfer in single instruction. Here is an simple swap code: void swap(int *xp, int *yp) {    int a=*xp;    int b=*yp;    *xp=b;    *yp=a; } Let's see how above code done by assembly. Variables store in which memory place and registers is assigned...