Skip to content

Commit

Permalink
Move CHERI auto demo to separate directory
Browse files Browse the repository at this point in the history
Reorganises the automotive demo to place the CHERI-specific code
in its own CHERI directory, to mirror the organisation used for
non-CHERIoT legacy firmware, and to more clearly modularise and
separate the two implementations of the demo library.
  • Loading branch information
AlexJones0 committed Sep 18, 2024
1 parent 37499b3 commit 72e04e7
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 60 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <platform-pwm.hh>
#include <thread.h>

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

#include "../../third_party/automotive_demo/automotive_common.h"
#include "../lib/automotive_common.h"

#include "common.hh"

Expand Down
19 changes: 9 additions & 10 deletions examples/automotive/send.cc → examples/automotive/cheri/send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
#include <platform-ethernet.hh>
#include <thread.h>

#include "../../libraries/lcd.hh"
#include "../snake/cherry_bitmap.h"

#include "../../third_party/automotive_demo/analogue_pedal.h"
#include "../../third_party/automotive_demo/analogue_pedal.h"
#include "../../third_party/automotive_demo/automotive_common.h"
#include "../../third_party/automotive_demo/automotive_menu.h"
#include "../../third_party/automotive_demo/digital_pedal.h"
#include "../../third_party/automotive_demo/joystick_pedal.h"
#include "../../third_party/automotive_demo/no_pedal.h"
#include "../../../libraries/lcd.hh"
#include "../../snake/cherry_bitmap.h"

#include "../lib/analogue_pedal.h"
#include "../lib/automotive_common.h"
#include "../lib/automotive_menu.h"
#include "../lib/digital_pedal.h"
#include "../lib/joystick_pedal.h"
#include "../lib/no_pedal.h"

#include "common.hh"

Expand Down
54 changes: 54 additions & 0 deletions examples/automotive/cheri/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
-- Copyright lowRISC Contributors.
-- SPDX-License-Identifier: Apache-2.0

-- Compartments used for the automotive demo firmware
compartment("automotive_send")
add_deps("lcd", "debug")
add_files(
"../lib/automotive_common.c",
"../lib/automotive_menu.c",
"../lib/no_pedal.c",
"../lib/joystick_pedal.c",
"../lib/digital_pedal.c",
"../lib/analogue_pedal.c"
)
add_files("send.cc")

compartment("automotive_receive")
add_deps("lcd", "debug")
add_files("../lib/automotive_common.c")
add_files("receive.cc")

-- Automotive demo: Sending Firmware (1st board) (CHERIoT version)
firmware("automotive_demo_send_cheriot")
add_deps("freestanding", "automotive_send")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "automotive_send",
priority = 2,
entry_point = "entry",
stack_size = 0x1000,
trusted_stack_frames = 3
}
}, {expand = false})
end)
after_link(convert_to_uf2)

-- Automotive Demo: Receiving Firmware (2nd board)
firmware("automotive_demo_receive")
add_deps("freestanding", "automotive_receive")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "automotive_receive",
priority = 2,
entry_point = "entry",
stack_size = 0x1000,
trusted_stack_frames = 5
}
}, {expand = false})
end)
after_link(convert_to_uf2)
49 changes: 1 addition & 48 deletions examples/automotive/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,51 +1,4 @@
-- Copyright lowRISC Contributors.
-- SPDX-License-Identifier: Apache-2.0

compartment("automotive_send")
add_deps("lcd", "debug")
add_files("../../third_party/automotive_demo/automotive_common.c")
add_files("../../third_party/automotive_demo/automotive_menu.c")
add_files("../../third_party/automotive_demo/no_pedal.c")
add_files("../../third_party/automotive_demo/joystick_pedal.c")
add_files("../../third_party/automotive_demo/digital_pedal.c")
add_files("../../third_party/automotive_demo/analogue_pedal.c")
add_files("send.cc")

compartment("automotive_receive")
add_deps("lcd", "debug")
add_files("../../third_party/automotive_demo/automotive_common.c")
add_files("receive.cc")

-- Automotive demo (CHERIoT version)
firmware("automotive_demo_send")
add_deps("freestanding", "automotive_send")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "automotive_send",
priority = 2,
entry_point = "entry",
stack_size = 0x1000,
trusted_stack_frames = 3
}
}, {expand = false})
end)
after_link(convert_to_uf2)

-- Automotive Demo: Receive Firmware (2nd board)
firmware("automotive_demo_receive")
add_deps("freestanding", "automotive_receive")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "automotive_receive",
priority = 2,
entry_point = "entry",
stack_size = 0x1000,
trusted_stack_frames = 5
}
}, {expand = false})
end)
after_link(convert_to_uf2)
includes("cheri", "legacy")

0 comments on commit 72e04e7

Please sign in to comment.