Hello World on lm32 Soft CPU

THIS HOWTO IS DEPRECATED

A soft CPU based on the lm32 is embedded in the White Rabbit core. This how-to describes a "Hello World" for that Soft-CPU on a PEXARIA2A board. Here the console output, usually done via an UART, is redirected to the JTAG connector.

Shopping List

Please respect the copyright: The lm32 boot code and the link script have disclaimer and conditions enclosed. The actual hell world program was provided by Wesley Terpstra (thanks!)

Compile

The following steps are required for compilation.
  1. Put the downloaded files into a folder ~/.../lm32stuff/hello and cd to that folder.
  2. Do
    lm32-elf-gcc -Wall -O2 -g -mmultiply-enabled -mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled -ffunction-sections -o hello.o -c hello.c lm32-elf-gcc -Wall -O2 -g -mmultiply-enabled -mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled -ffunction-sections -o crt0ram.o -c crt0ram.S lm32-elf-gcc -Wall -O2 -g -mmultiply-enabled -mbarrel-shift-enabled -mdivide-enabled -msign-extend-enabled -ffunction-sections -T linker.ld -o hello.elf hello.o crt0ram.o -lm -lc -lgcc -lnosys -Wl,--gc-sections
  3. The result is a file hello.elf

Prepare

  1. Connect to the power supply (12V)
  2. Synthesize the WR core and upload the firmware via JTAG
  3. Make sure, the firmware is running (some blinking LEDs)

Run

  1. start the lm32-ctl script
  2. do "load hello.elf"
  3. do "console"
  4. watch the console output printing "LED on!"->"LED off!"->....

Some Explanation

This hello world prints some output to the console. Moreover, the soft-CPU runs in the White Rabbit core. By this, the soft-CPU is connected to the Wishbone interconnect, to which a general purpose IO is connected. By connecting the first bit of the gpio to a LED in the top-level design, an LED actually blinks.

-- DietrichBeck - 30 Sep 2011
I Attachment Action Size Date Who Comment
crt0ram.SS crt0ram.S manage 11 K 05 Oct 2011 - 07:58 DietrichBeck lm32 boot code...
hello.cc hello.c manage 1 K 05 Oct 2011 - 07:57 DietrichBeck PEXARIA2A hello world
linker.ldld linker.ld manage 4 K 05 Oct 2011 - 07:58 DietrichBeck link script
Topic revision: r4 - 19 Jun 2019, DietrichBeck
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback