亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1578 | 回復(fù): 0
打印 上一主題 下一主題

在Cygwin下使用GNU tools 開發(fā)contex-m4 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-12-21 08:41 |只看該作者 |倒序瀏覽
使用的開發(fā)工具為YAGARTO最新版本:(29.04.2011更新)
Binutils-2.21
Newlib-1.19.0
GCC-4.6.0
GDB-7.2 
下面貼一下自己的代碼,以備查閱。(代碼不能實際運行,只是為了看生成的反匯編代碼)

test.s
  1. .text
  2. .global _start
  3. .code 16
  4. .syntax unified
  5. _start:
  6. .word 0x20002000
  7. .word reset
  8. .type reset, function
  9. reset:
  10. ldr r0,=main
  11. bx r0
  12. .end

main.c
  1. int main(void)
  2. {
  3.         float a=3.1415926,b=12.9873421,result;
  4.         result=a*b*b;
  5.         while(1);
  6.         return 0;
  7. }

Makefile
  1. test.elf : test.s main.c
  2. arm-none-eabi-gcc -c -gdwarf-2 -mcpu=cortex-m4 -mfloat-abi=hard -mthumb -o test.o test.s
  3. arm-none-eabi-gcc -c -gdwarf-2 -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -o main.o main.c
  4. arm-none-eabi-ld -Ttext 0x0 test.o main.o -o test.elf
  5. arm-none-eabi-objcopy -O binary -S test.elf test.bin
  6. arm-none-eabi-objdump -D -m arm test.elf >_test.dis
  7. dos2unix _test.dis
  8. clean:
  9. rm test.o main.o test.elf _test.dis test.bin

只有這3個文件,可以看到在Makefile中有"-mfloat-abi=hard",這個可以用來生成FPU代碼(cortex-m4帶DSP運算單元)。

生成的反匯編代碼如下:
  1. test.elf: file format elf32-littlearm
  2. Disassembly of section .text:
  3. 00000000 <_start>:
  4. 0: 20002000 andcs r2, r0, r0
  5. 4: 00000009 andeq r0, r0, r9
  6. 00000008 <reset>:
  7. 8: 4800 ldr r0, [pc, #0] ; (c <reset+0x4>)
  8. a: 4700 bx r0
  9. c: 00000011 andeq r0, r0, r1, lsl r0
  10. 00000010 <main>:
  11. 10: b480 push {r7}
  12. 12: b085 sub sp, #20
  13. 14: af00 add r7, sp, #0
  14. 16: 4b08 ldr r3, [pc, #32] ; (38 <main+0x28>)
  15. 18: 60fb str r3, [r7, #12]
  16. 1a: 4b08 ldr r3, [pc, #32] ; (3c <main+0x2c>)
  17. 1c: 60bb str r3, [r7, #8]
  18. 1e: ed97 7a03 vldr s14, [r7, #12]
  19. 22: edd7 7a02 vldr s15, [r7, #8]
  20. 26: ee67 7a27 vmul.f32 s15, s14, s15
  21. 2a: ed97 7a02 vldr s14, [r7, #8]
  22. 2e: ee67 7a87 vmul.f32 s15, s15, s14
  23. 32: edc7 7a01 vstr s15, [r7, #4]
  24. 36: e7fe b.n 36 <main+0x26>
  25. 38: 40490fda ldrdmi r0, [r9], #-250 ; 0xffffff06
  26. 3c: 414fcc27 cmpmi pc, r7, lsr #24
----------------------------------------------------------------------------------------------------------------------------------
生成軟件浮點代碼:
Makefile:
  1. test.elf : test.s main.c
  2. arm-none-eabi-gcc -c -gdwarf-2 -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -o test.o test.s
  3. arm-none-eabi-gcc -c -gdwarf-2 -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -o main.o main.c
  4. arm-none-eabi-gcc -Ttext 0x0 -mcpu=cortex-m4 -mfloat-abi=soft -mthumb -nostartfiles test.o main.o -o test.elf
  5. arm-none-eabi-objcopy -O binary -S test.elf test.bin
  6. arm-none-eabi-objdump -D -m arm test.elf >_test.dis
  7. dos2unix _test.dis
  8. clean:
  9. rm test.o main.o test.elf _test.dis test.bin
生成結(jié)果如下:
  1. 00000000 <_start>:
  2. 0: 20002000 andcs r2, r0, r0
  3. 4: 00000009 andeq r0, r0, r9
  4. 00000008 <reset>:
  5. 8: 4800 ldr r0, [pc, #0] ; (c <reset+0x4>)
  6. a: 4700 bx r0
  7. c: 00000011 andeq r0, r0, r1, lsl r0
  8. 00000010 <main>:
  9. 10: b580 push {r7, lr}
  10. 12: b084 sub sp, #16
  11. 14: af00 add r7, sp, #0
  12. 16: 4b08 ldr r3, [pc, #32] ; (38 <main+0x28>)
  13. 18: 60fb str r3, [r7, #12]
  14. 1a: 4b08 ldr r3, [pc, #32] ; (3c <main+0x2c>)
  15. 1c: 60bb str r3, [r7, #8]
  16. 1e: 68f8 ldr r0, [r7, #12]
  17. 20: 68b9 ldr r1, [r7, #8]
  18. 22: f000 f80d bl 40 <__aeabi_fmul>
  19. 26: 4603 mov r3, r0
  20. 28: 4618 mov r0, r3
  21. 2a: 68b9 ldr r1, [r7, #8]
  22. 2c: f000 f808 bl 40 <__aeabi_fmul>
  23. 30: 4603 mov r3, r0
  24. 32: 607b str r3, [r7, #4]
  25. 34: e7fe b.n 34 <main+0x24>
  26. 36: bf00 nop
  27. 38: 40490fda ldrdmi r0, [r9], #-250 ; 0xffffff06
  28. 3c: 414fcc27 cmpmi pc, r7, lsr #24
  29. 00000040 <__aeabi_fmul>:
  30. 40: f04f 0cff mov.w ip, #255 ; 0xff
  31. 44: ea1c 52d0 ands.w r2, ip, r0, lsr #23
  32. 48: bf1e ittt ne
  33. 4a: ea1c 53d1 andsne.w r3, ip, r1, lsr #23
  34. 4e: ea92 0f0c teqne r2, ip
  35. 52: ea93 0f0c teqne r3, ip
  36. 56: d06f beq.n 138 <__aeabi_fmul+0xf8>
  37. 58: 441a add r2, r3
  38. 5a: ea80 0c01 eor.w ip, r0, r1
  39. 5e: 0240 lsls r0, r0, #9
  40. 60: bf18 it ne
  41. ........(以下省略)

您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP