Skip to content

Commit

Permalink
Created an examples directory
Browse files Browse the repository at this point in the history
In the future, we will seperate out the examples into their own
subdirectories.
  • Loading branch information
HU90m committed Jun 14, 2024
1 parent 3fe42fe commit 1efabe0
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ cd sonata-software
Configure and run build:

```sh
xmake
xmake -P examples
```

After running this you should see the build run to completion and report success, the critical lines indicating a successful build are:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion compartments/lcd_test.cc → examples/all/lcd_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <compartment.h>
#include <thread.h>

#include "../libraries/lcd.hh"
#include "../../libraries/lcd.hh"
#include "lowrisc_logo.h"

/// Thread entry point.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions examples/all/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- Copyright lowRISC Contributors.
-- SPDX-License-Identifier: Apache-2.0

compartment("led_walk_raw")
add_deps("debug")
add_files("led_walk_raw.cc")

compartment("echo")
add_files("echo.cc")

compartment("lcd_test")
add_deps("lcd")
add_files("lcd_test.cc")

compartment("i2c_example")
add_deps("debug")
add_files("i2c_example.cc")

compartment("gpiolib")
-- This compartment uses C++ thread-safe static initialisation and so
-- depends on the C++ runtime.
add_deps("cxxrt")
add_files("gpiolib.cc")

compartment("led_walk")
add_files("led_walk.cc")

compartment("proximity_sensor_example")
add_deps("debug")
add_files("proximity_sensor_example.cc")
33 changes: 3 additions & 30 deletions xmake.lua → examples/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
-- SPDX-License-Identifier: Apache-2.0

set_project("Sonata Software")
sdkdir = "cheriot-rtos/sdk"
sdkdir = "../cheriot-rtos/sdk"
includes(sdkdir)
set_toolchains("cheriot-clang")

includes(path.join(sdkdir, "lib"))
includes("libraries")
includes("../libraries")

option("board")
set_default("sonata")
Expand All @@ -20,34 +20,7 @@ function convert_to_uf2(target)
os.execv("uf2conv", { binary_file, "-b0x00101000", "-co", firmware .. ".uf2" })
end


compartment("led_walk_raw")
add_deps("debug")
add_files("compartments/led_walk_raw.cc")

compartment("echo")
add_files("compartments/echo.cc")

compartment("lcd_test")
add_deps("lcd")
add_files("compartments/lcd_test.cc")

compartment("i2c_example")
add_deps("debug")
add_files("compartments/i2c_example.cc")

compartment("gpiolib")
-- This compartment uses C++ thread-safe static initialisation and so
-- depends on the C++ runtime.
add_deps("cxxrt")
add_files("compartments/gpiolib.cc")

compartment("led_walk")
add_files("compartments/led_walk.cc")

compartment("proximity_sensor_example")
add_deps("debug")
add_files("compartments/proximity_sensor_example.cc")
includes("all")

-- A simple demo using only devices on the Sonata board
firmware("sonata_simple_demo")
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
getExe = pkgs.lib.getExe;

clang-lint = let
srcGlob = "{compartments/*,libraries/*.{cc,hh}}";
srcGlob = "{examples/**/*.{h,hh,cc},libraries/*.{cc,hh}}";
in
pkgs.writeShellApplication {
name = "clang-lint";
Expand Down

0 comments on commit 1efabe0

Please sign in to comment.