Skip to content
Joel Stanley edited this page Nov 9, 2016 · 1 revision

Welcome to the linux-lm32 wiki!

Building

Building the kernel

ARCH=lm32 CROSS_COMPILE=$CONDA/bin/lm32-elf- make defconfig
ARCH=lm32 CROSS_COMPILE=$CONDA/bin/lm32-elf- make simpleImage.milkymist_one

The simpleImage.<dtb name> will compiled the device tree <dtb name>.dts and link it into the kernel image. This is currently the only method to pass the device tree to the kernel.

Building Qemu

git clone git://git.qemu-project.org/qemu.git && cd qemu
./configure --target-list=lm32-softmmu
make

Booting with Qemu

./lm32-softmmu/qemu-system-lm32 -M milkymist -nographic -nodefaults \
 -kernel ~/dev/kernels/milkymist/vmlinux \
 -append 'earlyprintk' \
 -monitor pty \
 -serial stdio

Running under GDB

Use the command line from above, but add these two flags: -S -s.

$CONDA/bin/lm32-elf-gdb vmlinux -ex 'target remote localhost:1234'

You can:

  • set breakpoints with break setup_arch
  • begin execution with c
  • see the stack trace with bt

Notes

No dtb

This is what GDB shows if you've forgotten to compile in the dtb:

#0  mark_bootmem (start=262999, end=0, reserve=0, flags=0) at mm/bootmem.c:360
#1  0x4000abcc in free_bootmem (physaddr=<optimised out>, size=<optimised out>) at mm/bootmem.c:431
#2  0x40004314 in bootmem_init () at arch/lm32/mm/init.c:82
#0  bootmem_init () at arch/lm32/mm/init.c:51
#1  0x40003ec8 in setup_arch (cmdline_p=0x4032bffc <init_thread_union+8188>) at arch/lm32/kernel/setup.c:88
#2  0x40000820 in start_kernel () at init/main.c:505

memory maps

flash sdram sram
milkymist 0000 0000 4000 0000 none
litex 0000 0000 4000 0000 1000 0000