Skip to content

Commit e017ee4

Browse files
committed
⚗️ Add nearpoint targets to benchmark/conanfile.py
- Consolidated generated_tests, test lists, - Consolidate
1 parent c5faa57 commit e017ee4

File tree

73 files changed

+29958
-59321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+29958
-59321
lines changed

.github/workflows/demo_check.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
compiler_profile: ${{ inputs.compiler_profile }}
3939
platform_profile_url: ${{ inputs.platform_profile_url }}
4040
platform_profile: ${{ inputs.platform_profile }}
41-
secrets: inherit
41+
secrets: inherit
4242

4343
build_debug: # STOLEN from libhal/ci
4444
runs-on: ubuntu-22.04
@@ -59,7 +59,7 @@ jobs:
5959
- name: 📥 Install Conan ${{ inputs.conan_version }}
6060
if: ${{ inputs.conan_version != '' }}
6161
run: pipx install conan==${{ inputs.conan_version }}
62-
62+
6363
- name: 📥 Install Conan Latest
6464
if: ${{ inputs.conan_version == '' }}
6565
run: pipx install conan
@@ -106,13 +106,13 @@ jobs:
106106
run: |
107107
sudo apt-get update
108108
sudo apt-get install qemu-system-arm gdb-multiarch
109-
109+
110110
- name: Trim profile version
111111
id: trim
112112
run: |
113113
profile="${{ inputs.platform_profile }}"
114114
echo "trimmed=${profile##*/}" >> $GITHUB_OUTPUT
115-
115+
116116
- name: Download Build Artifacts
117117
uses: actions/download-artifact@v4
118118
with:
@@ -134,7 +134,7 @@ jobs:
134134
-ex "monitor quit" \
135135
${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/single_level.elf \
136136
> gdb.log || {
137-
# Make timeouts more explicit
137+
# Make timeouts more explicit
138138
code=$?
139139
if [ "$code" -eq 124 ]; then
140140
echo "❌ GDB timeout after 5 seconds" >&2
@@ -157,13 +157,13 @@ jobs:
157157
run: |
158158
sudo apt-get update
159159
sudo apt-get install qemu-system-arm gdb-multiarch
160-
160+
161161
- name: Trim profile version
162162
id: trim
163163
run: |
164164
profile="${{ inputs.platform_profile }}"
165165
echo "trimmed=${profile##*/}" >> $GITHUB_OUTPUT
166-
166+
167167
- name: Download Build Artifacts
168168
uses: actions/download-artifact@v4
169169
with:
@@ -185,7 +185,7 @@ jobs:
185185
-ex "monitor quit" \
186186
${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/multiple_inheritance.elf \
187187
> gdb.log || {
188-
# Make timeouts more explicit
188+
# Make timeouts more explicit
189189
code=$?
190190
if [ "$code" -eq 124 ]; then
191191
echo "❌ GDB timeout after 5 seconds" >&2
@@ -199,4 +199,3 @@ jobs:
199199
run: |
200200
cat gdb.log
201201
grep -q "New value = 0x6666" gdb.log
202-

benchmark/CMakeLists.txt

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,73 @@ endif()
6363
# Glob all the files in the directory 'generated_tests'
6464
file(GLOB GENERATED_TEST "${CMAKE_CURRENT_SOURCE_DIR}/generated_tests/*.cpp")
6565

66+
set(BENCHMARK_COMPILE_OPTIONS
67+
-g
68+
-Werror
69+
-Wall
70+
-Wextra
71+
-Wshadow
72+
-fno-threadsafe-statics)
73+
6674
foreach(test_path ${GENERATED_TEST})
6775
get_filename_component(test_file_name ${test_path} NAME)
6876
set(elf ${test_file_name}.elf)
77+
6978
message(STATUS "Generating Demo for \"${elf}\"")
7079
add_executable(${elf} ${test_path})
71-
7280
target_include_directories(${elf} PRIVATE .)
73-
target_compile_options(${elf} PRIVATE
74-
-g
75-
-Werror
76-
-Wall
77-
-Wextra
78-
-Wshadow
79-
-fno-threadsafe-statics
80-
$<$<COMPILE_LANGUAGE:CXX>:-fexceptions -fno-rtti>
81-
)
81+
target_compile_options(${elf} PRIVATE ${BENCHMARK_COMPILE_OPTIONS})
82+
83+
# Check if the test file name starts with "result_"
84+
string(REGEX MATCH "^result_" is_result_file ${test_file_name})
85+
if(is_result_file)
86+
target_compile_options(${elf} PRIVATE
87+
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
88+
else()
89+
target_compile_options(${elf} PRIVATE
90+
$<$<COMPILE_LANGUAGE:CXX>:-fexceptions>)
91+
endif()
8292

8393
target_link_libraries(${elf} PRIVATE
8494
startup_code
8595
libhal::$ENV{LIBHAL_PLATFORM_LIBRARY}
8696
)
97+
target_link_options(${elf} PRIVATE -fno-threadsafe-statics
98+
-L${CMAKE_SOURCE_DIR}/
99+
-Wl,-Map=${CMAKE_BINARY_DIR}/${elf}.map
100+
)
101+
if(prebuilt-picolibc_FOUND)
102+
target_link_libraries(${elf} PRIVATE picolibc)
103+
endif()
87104

88-
target_link_options(${elf} PRIVATE -fno-threadsafe-statics)
105+
if(${CMAKE_CROSSCOMPILING})
106+
# Convert elf into .bin, .hex and other formats needed for programming
107+
# devices.
108+
libhal_post_build(${elf})
109+
libhal_disassemble(${elf})
110+
endif()
111+
endforeach()
89112

113+
# Build nearpoint binary if if available
114+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/nearpoint.cpp")
115+
message(STATUS "nearpoint.cpp exists!")
116+
set(elf nearpoint.cpp.elf)
117+
message(STATUS "Generating Demo for \"${elf}\"")
118+
add_executable(${elf} generated_tests/except.cpp nearpoint.cpp)
119+
target_include_directories(${elf} PRIVATE .)
120+
target_compile_options(${elf} PRIVATE
121+
${BENCHMARK_COMPILE_OPTIONS}
122+
-fexceptions)
123+
124+
target_link_libraries(${elf} PRIVATE
125+
startup_code
126+
libhal::$ENV{LIBHAL_PLATFORM_LIBRARY}
127+
)
128+
target_link_options(${elf} PRIVATE -fno-threadsafe-statics
129+
-L${CMAKE_SOURCE_DIR}/
130+
-Wl,-Map=${CMAKE_BINARY_DIR}/${elf}.map
131+
-Torder.ld
132+
)
90133
if(prebuilt-picolibc_FOUND)
91134
target_link_libraries(${elf} PRIVATE picolibc)
92135
endif()
@@ -97,4 +140,6 @@ foreach(test_path ${GENERATED_TEST})
97140
libhal_post_build(${elf})
98141
libhal_disassemble(${elf})
99142
endif()
100-
endforeach()
143+
else()
144+
message(WARNING "nearpoint.cpp does not exist")
145+
endif()

benchmark/all_tests.csv

Lines changed: 0 additions & 61 deletions
This file was deleted.

benchmark/all_tests.list

Lines changed: 0 additions & 60 deletions
This file was deleted.

benchmark/conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ def requirements(self):
6565
bootstrap = self.python_requires["libhal-bootstrap"]
6666
bootstrap.module.add_demo_requirements(self)
6767
if self.options.platform != "mac":
68-
self.requires("libhal-exceptions/1.3.2")
68+
self.requires("libhal-exceptions/1.4.0")

0 commit comments

Comments
 (0)