HomeCommunityArchitectures and Processors blog
August 18, 2014

Hello World with Bare Metal and QEMU

I have followed some tutorials on the internet and found one in particular quite interesting and didactic for those just starting to program ARM Bare metal. The Blog é Freedom Embedded | Balau's technical blog on open hardware, free softwa...

By Carlos Delfino

Share
Reading time less than 1 minute

I have followed some tutorials on the internet and found one in particular quite interesting and didactic for those just starting to program ARM Bare metal. The Blog é Freedom Embedded | Balau's technical blog on open hardware, free software and security.

Below is a summary of needed to succeed in building a Hello World commands, let noted here that in the near future I may supplement this information and synthesize into a more detailed tutorial.

Based on the link: Hello world for bare metal ARM using QEMU | Freedom Embedded

Compile the code with the following commands:

$ arm-none-eabi-as -mcpu=ARM926EJ-s -g startup.s -o startup.o
$ arm-none-eabi-gcc-c  -mcpu=ARM926EJ-S test.c -g -o test.o
$ arm-none-eabi-ld-T test.ld test.o startup.o -o test.elf
$ arm-none-eabi-objcopy -O binary test.elf test.bin


And execute with the following command:

qemu-system-arm -M versatilepb -m 128M -s -nographic S -kernel test.bin


Debug with GDB, with the following comand:

arm-none-eabi-gdb


Where you get the prompt from GDB, type:

target remote localhost: 1234
file test.elf


when finished working with qemu if you have problems with the terminal, use the command:

stty sane

to fix it.


Log in to like this post
Share

Article text

Re-use is only permitted for informational and non-commercial or personal use only.

placeholder