litex/litex/soc/software/demo
Florent Kermarrec 3d32ac3d2e software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility.
We'll maybe do it but that's probably not the right time. We have to make
the picolibc switch as smooth as possible for users (and so avoid update
as much as possible).

In the long term, it would be good to provide a LiteX C SDK, so we'll make
eventual changes when doing this.
2021-09-27 16:15:13 +02:00
..
Makefile Fix demo compilation 2021-09-16 10:42:54 +02:00
README.md software/demo: Drop bogus "the" in README 2021-02-12 15:15:55 +01:00
__init__.py software/demo: add litex_bare_metal_demo pre-installed script. 2020-12-21 19:27:21 +01:00
demo.py software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility. 2021-09-27 16:15:13 +02:00
donut.c software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility. 2021-09-27 16:15:13 +02:00
helloc.c extend demo with basic C and C++ examples 2021-03-02 01:28:21 -05:00
hellocpp.cpp extend demo with basic C and C++ examples 2021-03-02 01:28:21 -05:00
isr.c software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility. 2021-09-27 16:15:13 +02:00
linker.ld Linker fix for initialized global variables 2021-09-13 00:44:30 -05:00
main.c software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility. 2021-09-27 16:15:13 +02:00

README.md

[> Bare Metal Demo App

This directory provides a minimal bare metal demo app that demonstrates how to easily create a bare metal C application and load it/run it on the CPU of a SoC.

[> Build

Imagine you just built the Arty example design from LiteX-Boards. Build the demo app as follows; where the build path is the path to your previously built Arty build directory:

litex_bare_metal_demo --build-path=build/arty/

[> Load

Loading the compiled demo app can be done in different ways as explain in LiteX's wiki: https://github.com/enjoy-digital/litex/wiki/Load-Application-Code-To-CPU

Since our app is small and for simplicity we'll just load it over serial here: $ lxterm /dev/ttyUSBX --kernel=demo.bin

You should see the minimal demo app running and should be able to interact with it:

--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LXTERM] Received firmware download request from the device.
[LXTERM] Uploading demo.bin to 0x40000000 (9264 bytes)...
[LXTERM] Upload complete (9.8KB/s).
[LXTERM] Booting the device.
[LXTERM] Done.
Executing booted program at 0x40000000

--============= Liftoff! ===============--

LiteX minimal demo app built Dec 10 2020 17:13:02

Available commands:
help               - Show this command
reboot             - Reboot CPU
led                - Led demo
donut              - Spinning Donut demo
litex-demo-app> led
Led demo...
Counter mode...
Shift mode...
Dance mode...
litex-demo-app> donut
Donut demo...

                                      $$$$$@@@@@
                                  $##########$$$$$$$$
                               ###*!!!!!!!!!***##$$$$$$
                             ***!!====;;;;===!!**###$$$$#
                            **!===;;;:::::;:===!!**####$##
                          !*!!==;;:~-,,.,-~::;;=!!**#######!
                          !!!!=;:~-,.......-~::==!!***#####*
                         !!!!==;~~-.........,-:;==!!***###**!
                         !**!!=;:~-...     ..-:;=!!!********!
                        ;!*#####*!!;.       ~:;==!!!******!!=
                        :!*###$$$$#*!      :;==!!!!!****!!!=;
                        ~=!*#$$$@@@$$##!!!!!!!!!!!!****!!!!=;
                         ;=!*#$$$@@@@$$#*******!*!!*!!!!!==;~
                         -;!*###$$$$$$$###******!!!!!!!===;~
                          -;!!*####$#####******!!!!!!==;;:-
                           ,:=!!!!**#**#***!!!!!!!====;:~,
                             -:==!!!*!!*!!!!!!!===;;;:~-
                               .~:;;========;=;;:::~-,
                                  .--~~::::~:~~--,.
litex-demo-app>

[> Going further

To create more complex apps, feel free to explore the source code of the BIOS or other open source projects build with LiteX at https://github.com/enjoy-digital/litex/wiki/Projects.