看板 Programming 關於我們 聯絡資訊
01 .cpu cortex-m4 23 chk_nodup: 02 .syntax unified 24 push {r1, lr} 25 mov r0, r1 03 .text 26 mov r3, #0 04 .global main 27 chk_loop: 05 main: 28 cmp r0, #0 06 mov r0, #0 29 it eq 07 loop: 30 popeq {r1, pc} 08 bl next_perm 31 mov r2, #10 09 // show register 0 32 udiv r1, r0, r2 33 mul r1, r2 10 b loop 34 sub r1, r0, r1 35 udiv r0, r2 11 next_perm: 12 push {lr} 36 mov r2, #1 13 next_loop: 37 lsl r2, r1 14 add r0, #1 38 mov r1, r2 15 mov r1, r0 39 and r2, r3 16 bl chk_nodup 17 eor r0, r1 40 cmp r2, #0 18 eor r1, r0 41 itt ne 19 eor r0, r1 42 movne r0, #1 43 popne {r1, pc} 20 cmp r1, #1 21 beq next_loop 44 orr r3, r1 22 pop {pc} 45 b chk_loop -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.66.155 ※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1481922002.A.243.html ※ 編輯: DonaldTrunnp (140.113.66.155), 12/17/2016 13:05:30
DonaldTrunnp: GitHub Gist: http://goo.gl/7vWVUU 140.113.66.155 12/17 13:07
lc85301: 開始出現asm 了 (._.) 140.112.25.105 12/17 13:42
shadowjohn: 可以寫一下怎compiler嗎 36.233.136.119 12/17 18:12
$ arm-none-eabi-as -mcpu=cortex-m4 -o code.o code.s $ arm-none-eabi-gcc -mcpu=cortex-m4 --specs=nosys.specs -o code.elf code.o 或是直接使用板子提供的開發環境會方便許多 如果想要在普通 PC 上執行的話,建議轉寫成 x86 的 inline assembly ※ 編輯: DonaldTrunnp (140.113.66.155), 12/17/2016 19:32:19
chuegou: 下一篇pic 36.230.110.124 12/18 17:34
DonaldTrunnp: 也可以挑戰 Verilog 或 VHDL 140.113.66.155 12/18 23:34
lc85301: 普通pc 可以用qemu 來跑 140.112.16.185 12/20 11:26