×ðÁú¿­Ê±¹ÙÍøµÇ¼

LinuxÏÂʹÓÃGCC¾ÙÐÐǶÈëʽARM»ã±àµÄÍƼöÉèÖÃ

linuxÏÂʹÓÃgcc¾ÙÐÐǶÈëʽarm»ã±àµÄÍƼöÉèÖÃ

ǶÈëʽϵͳ³£ÓõĴ¦ÀíÆ÷¼Ü¹¹Ö®Ò»ÊÇARM¼Ü¹¹ £¬¶øLinuxÊÇÆÕ±éÓ¦ÓÃÓÚǶÈëʽϵͳ¿ª·¢µÄ²Ù×÷ϵͳ¡£ÔÚLinuxÏÂʹÓÃGCC¾ÙÐÐǶÈëʽARM»ã±à¿ÉÒÔÀû±ãµØ¾ÙÐпª·¢ÊÂÇé¡£±¾ÎĽ«ÏÈÈÝÔõÑù¾ÙÐÐGCCµÄÉèÖà £¬²¢ÌṩһЩ´úÂëʾÀý¡£

×°ÖÃGCC¹¤¾ßÁ´

Ê×ÏÈ £¬ÎÒÃÇÐèҪװÖÃGCC¹¤¾ßÁ´¡£GCC¹¤¾ßÁ´ÊÇGCC±àÒëÆ÷ÔÚij¸öÌض¨Æ½Ì¨ÏµÄÜöÝÍ £¬ÆäÖаüÀ¨½»Ö¯±àÒëÆ÷¡¢Á´½ÓÆ÷ºÍµ÷ÊÔÆ÷¡£ÔÚLinuxƽ̨ÉϾÙÐÐARMǶÈëʽ¿ª·¢Ê± £¬ÎÒÃÇÐèҪװÖÃARM½»Ö¯±àÒ빤¾ßÁ´ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐ×°Öãº

sudo apt-get install gcc-arm-none-eabi

µÇ¼ºó¸´ÖÆ

½¨Éè»ã±àÎļþ

ÔÚʹÓÃGCC¾ÙÐÐǶÈëʽARM»ã±à֮ǰ £¬ÎÒÃÇÐèÒªÏȽ¨ÉèÒ»¸ö»ã±àÎļþ £¬ÀýÈçasm_example.s¡£ÔÚ»ã±àÎļþÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃARMÖ¸Áî¾ÙÐбà³Ì¡£ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄʾÀý´úÂ룺

.section .text
.global _start

_start:
    mov r0, #1
    mov r1, #42
    mov r7, #4
    swi 0

    mov r7, #1
    swi 0

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öʾÀýÖÐ £¬ÎÒÃÇʹÓÃÁ˼¸¸öARMÖ¸Áî £¬ÈçmovÓÃÓÚ½«Á¬Ã¦Êý¼ÓÔص½¼Ä´æÆ÷ÖÐ £¬swiÓÃÓÚ´¥·¢ÈíÖÐÖ¹¡£

±àÒë»ã±àÎļþ

½ÓÏÂÀ´ £¬ÎÒÃÇÐèҪʹÓÃGCC½«»ã±àÎļþ±àÒë³É¿ÉÖ´ÐÐÎļþ¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐбàÒ룺

arm-none-eabi-as -o asm_example.o asm_example.s

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁasm_example.s»ã±àÎļþ±àÒë³ÉÄ¿µÄÎļþasm_example.o¡£

Á´½ÓÄ¿µÄÎļþ

±àÒëÍê³Éºó £¬ÎÒÃÇÐèÒª½«Ä¿µÄÎļþÁ´½Ó³É¿ÉÖ´ÐÐÎļþ¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐÁ´½Ó£º

arm-none-eabi-ld -o asm_example.elf asm_example.o

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁĿµÄÎļþasm_example.oÁ´½Ó³É¿ÉÖ´ÐÐÎļþasm_example.elf¡£

µ÷ÊÔºÍÔËÐÐ

×îºó £¬ÎÒÃÇ¿ÉÒÔʹÓõ÷ÊÔÆ÷¾ÙÐе÷ÊÔ £¬Ò²¿ÉÒÔÖ±½ÓÔËÐпÉÖ´ÐÐÎļþ¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐе÷ÊÔ£º

arm-none-eabi-gdb asm_example.elf

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁÆô¶¯GDBµ÷ÊÔÆ÷ £¬²¢¼ÓÔØ¿ÉÖ´ÐÐÎļþasm_example.elf¡£

ÈôÊÇÒªÖ±½ÓÔËÐпÉÖ´ÐÐÎļþ £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

qemu-arm asm_example.elf

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁʹÓÃQEMUÄ£ÄâARM´¦ÀíÆ÷ £¬²¢ÔËÐпÉÖ´ÐÐÎļþasm_example.elf¡£

ÒÔÉϾÍÊÇÔÚlinuxÏÂʹÓÃgcc¾ÙÐÐǶÈëʽarm»ã±àµÄÍƼöÉèÖÃÒªÁ졣ͨ¹ýGCC £¬ÎÒÃÇ¿ÉÒÔÀû±ãµØ¾ÙÐÐARM»ã±à¿ª·¢ £¬²¢ÇÒÄܹ»Ê¹Óø»ºñµÄ¹¤¾ßÁ´Ö§³ÖÍê³ÉǶÈëʽϵͳµÄ¿ª·¢Ê¹Ãü¡£

Ï£Íû±¾ÎĶԶÁÕßÏàʶGCCµÄÉèÖúÍʹÓÃÌṩһЩ×ÊÖú £¬²¢ÇÒÄܹ»ÎªÇ¶ÈëʽARM»ã±àµÄ¿ª·¢ÊÂÇéÌṩһЩ²Î¿¼¡£¸ü¶àÏêϸÐÅÏ¢ºÍ¸ü¸ß¼¶µÄÓ÷¨¿ÉÒԲο¼GCC¹¤¾ßÁ´µÄ¹Ù·½ÎĵµºÍÏà¹Ø×ÊÔ´¡£

ÒÔÉϾÍÊÇLinuxÏÂʹÓÃGCC¾ÙÐÐǶÈëʽARM»ã±àµÄÍƼöÉèÖõÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ