Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,3 @@ jobs:
platform_profile_url: https://github.com/libhal/libhal-stm32f1.git
platform_profile: v2/stm32f103c8
secrets: inherit

demo_check_stm32f103r6:
uses: libhal/ci/.github/workflows/[email protected]
with:
compiler_profile_url: https://github.com/libhal/arm-gnu-toolchain.git
compiler_profile: v1/arm-gcc-12.3
platform_profile_url: https://github.com/libhal/libhal-stm32f1.git
platform_profile: v2/stm32f103r6
secrets: inherit
8 changes: 8 additions & 0 deletions demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ libhal_build_demos(
single_level
multi_levels
multiple_virtual_inheritance
results

INCLUDES
.
Expand All @@ -32,4 +33,11 @@ libhal_build_demos(

LINK_LIBRARIES
libhal::exceptions

COMPILE_FLAGS
-fno-threadsafe-statics

LINK_FLAGS
-Wl,-Map=link.map
-fno-threadsafe-statics
)
60 changes: 28 additions & 32 deletions demos/applications/multi_levels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ std::int32_t volatile side_effect = 0;
std::uint32_t start_cycles = 0;
std::uint32_t end_cycles = 0;

resource_list* resources;

std::array<std::uint64_t, 25> cycle_map{};
std::array<std::uint64_t, 25> happy_cycle_map{};

Expand Down Expand Up @@ -59,17 +57,15 @@ std::array functions{
#endif
};

void application(resource_list& p_resources)
void application()
{
resources = &p_resources;

cycle_map.fill(std::numeric_limits<std::int32_t>::max());
happy_cycle_map.fill(std::numeric_limits<std::int32_t>::max());
for (std::size_t i = 0; i < functions.size(); i++) {
try {
functions.at(i)();
} catch ([[maybe_unused]] my_error_t const& p_error) {
end_cycles = resources->clock->uptime();
end_cycles = get_uptime();
cycle_map[i] = end_cycles - start_cycles;
}
}
Expand All @@ -84,7 +80,7 @@ void application(resource_list& p_resources)
was_caught = true;
}
if (!was_caught) {
end_cycles = resources->clock->uptime();
end_cycles = get_uptime();
happy_cycle_map[i] = end_cycles - start_cycles;
}
}
Expand Down Expand Up @@ -230,7 +226,7 @@ int funct_group0_5()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -377,7 +373,7 @@ int funct_group1_11()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xBE, 0xEF } };
}

Expand Down Expand Up @@ -668,7 +664,7 @@ int funct_group2_23()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -1247,7 +1243,7 @@ int funct_group3_47()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -2402,7 +2398,7 @@ int funct_group4_95()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -2477,7 +2473,7 @@ int funct_group5_5()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -2624,7 +2620,7 @@ int funct_group6_11()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0x11, 0x22 } };
}

Expand Down Expand Up @@ -2917,7 +2913,7 @@ int funct_group7_23()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -3496,7 +3492,7 @@ int funct_group8_47()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -4651,7 +4647,7 @@ int funct_group9_95()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -4726,7 +4722,7 @@ int funct_group10_5()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -4873,7 +4869,7 @@ int funct_group11_11()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -5164,7 +5160,7 @@ int funct_group12_23()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -5743,7 +5739,7 @@ int funct_group13_47()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -6898,7 +6894,7 @@ int funct_group14_95()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -6973,7 +6969,7 @@ int funct_group15_5()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -7120,7 +7116,7 @@ int funct_group16_11()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -7411,7 +7407,7 @@ int funct_group17_23()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -7990,7 +7986,7 @@ int funct_group18_47()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -9145,7 +9141,7 @@ int funct_group19_95()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -9220,7 +9216,7 @@ int funct_group20_5()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -9367,7 +9363,7 @@ int funct_group21_11()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -9658,7 +9654,7 @@ int funct_group22_23()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -10237,7 +10233,7 @@ int funct_group23_47()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down Expand Up @@ -11392,7 +11388,7 @@ int funct_group24_95()
instance_0.trigger();

if (side_effect > 0) {
start_cycles = resources->clock->uptime();
start_cycles = get_uptime();
throw my_error_t{ .data = { 0xDE, 0xAD } };
}

Expand Down
13 changes: 4 additions & 9 deletions demos/applications/multiple_virtual_inheritance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include <resource_list.hpp>

resource_list* resources;

struct V
{
int inner_detail_v = 0;
Expand Down Expand Up @@ -80,7 +78,7 @@ std::uint64_t end = 0;
void foo()
{
if (value) {
start = resources->clock->uptime();
start = get_uptime();
error obj{};
obj.inner_detail_r = 0x1111;
obj.inner_detail_r1 = 0x2222;
Expand All @@ -95,20 +93,17 @@ void foo()

std::uint32_t global = 0;

void application(resource_list& p_resources)
void application()
{
resources = &p_resources;

try {
foo();
} catch (M const& p_error) {
end = resources->clock->uptime();
end = get_uptime();
global = p_error.inner_detail_m;
} catch (V const& p_error) {
end = resources->clock->uptime();
end = get_uptime();
global = p_error.inner_detail_v;
}

while (true) {
// print out `global` in gdb to see its contents. Check to see if it matches
// the expected value in error for that sub-object.
Expand Down
Loading
Loading