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.
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.
- Put the downloaded files into a folder ~/.../lm32stuff/hello and cd to that folder.
- 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
- The result is a file hello.elf
Prepare
- Connect to the power supply (12V)
- Synthesize the WR core and upload the firmware via JTAG
- Make sure, the firmware is running (some blinking LEDs)
Run
- start the lm32-ctl script
- do "load hello.elf"
- do "console"
- 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