Giter Club home page Giter Club logo

arm-qemu's Introduction

Sample ARM workflow

This repo should get you up and running writing ARM assembly without hardware.

Dependencies

The first step is to install the necessary packages. These are the arm-none-eabi tool chain and qemu with arm support.

Arch Linux

sudo pacman -S arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-gdb \
  arm-none-eabi-newlib qemu qemu-arch-extra

Ubuntu

sudo apt -y install \
    make \
    gcc-arm-none-eabi \
    binutils-arm-none-eabi \
    gdb-arm-none-eabi \
    libstdc++-arm-none-eabi-newlib \
    libnewlib-arm-none-eabi \
    qemu-system-arm

GDB

In .gdbinit we have placed commands which gdb will run on startup. But to make this work the .gdbinit file in our home directory needs to say its ok for gdb to load this .gdbinit file. To do that we just add the directory to the auto-load safe-path.

echo "set auto-load safe-path $PWD" >> ~/.gdbinit

Building

The Makefile should have plenty of comments to help you understand what is being done in it. It takes all the .s assembly files in the current directory and compiles them into object files. Then it runs the linker to create the ELF binary. All of this is done with arm-none-eabi-gcc rather than your regular gcc for host programs.

make

Will rebuild all the modified .s files into their object file forms and relink to the binary. Run make clean all if you are having really weird errors. That usually fixes things.

Running

To run you can do qemu-arm ./main. But hey why not put it in the Makefile right.

make all qemu

Will rebuild any changed files and run the created binary in qemu.

Debugging

Oh you ran the program and everything exploded? Time to debug.

make all gdb

Will rebuild all your source files and start the program in qemu with it as a gdb target on port 1234, so make sure nothing else is using that port or change it in the .gdbinit file and Makefile.

Help nothing works

Comment with the problem so we can figure it out on here and everyone else can see the solution.

arm-qemu's People

Contributors

pdxjohnny avatar

Watchers

Nicholas Esterer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.