From 7a6d202c0c043e558d98d9090e795df858dc5d26 Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Tue, 27 May 2025 15:09:35 -0700 Subject: [PATCH 1/3] :pushpin: Use range for python_requires --- .clangd | 11 +++-------- .github/workflows/ci.yml | 2 +- .github/workflows/take.yml | 2 +- .github/workflows/update_name.yml | 2 +- CMakeLists.txt | 2 +- conanfile.py | 4 ++-- demos/CMakeLists.txt | 2 +- demos/applications/__device__.cpp | 2 +- demos/conanfile.py | 4 ++-- demos/main.cpp | 2 +- demos/platforms/lpc4078.cpp | 2 +- demos/platforms/micromod.cpp | 2 +- demos/platforms/stm32f103c8.cpp | 2 +- demos/resource_list.hpp | 2 +- include/libhal-__device__/__device__.hpp | 2 +- src/__device__.cpp | 2 +- test_package/CMakeLists.txt | 2 +- test_package/conanfile.py | 4 ++-- test_package/main.cpp | 2 +- tests/__device__.test.cpp | 2 +- tests/main.test.cpp | 2 +- 21 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.clangd b/.clangd index f02151c..f8ff8cd 100644 --- a/.clangd +++ b/.clangd @@ -1,8 +1,3 @@ -If: - PathMatch: demos/.* - CompileFlags: - CompilationDatabase: demos -Else: - CompileFlags: - CompilationDatabase: . - +CompileFlags: + CompilationDatabase: . + BuiltinHeaders: QueryDriver diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e72d001..49d26aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/take.yml b/.github/workflows/take.yml index 45c0417..add37da 100644 --- a/.github/workflows/take.yml +++ b/.github/workflows/take.yml @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/update_name.yml b/.github/workflows/update_name.yml index 606457f..ceb7e61 100644 --- a/.github/workflows/update_name.yml +++ b/.github/workflows/update_name.yml @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/CMakeLists.txt b/CMakeLists.txt index f211ba8..80cbf8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/conanfile.py b/conanfile.py index e2aa5e3..678eec9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ class libhal___device___conan(ConanFile): topics = ("__device__", "libhal", "driver") settings = "compiler", "build_type", "os", "arch" - python_requires = "libhal-bootstrap/[^4.2.1]" + python_requires = "libhal-bootstrap/[>=4.3.0 <5]" python_requires_extend = "libhal-bootstrap.library" def requirements(self): diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 462fd3e..15d325b 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/demos/applications/__device__.cpp b/demos/applications/__device__.cpp index d17ffb8..06cf878 100644 --- a/demos/applications/__device__.cpp +++ b/demos/applications/__device__.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/demos/conanfile.py b/demos/conanfile.py index 790e027..9864655 100644 --- a/demos/conanfile.py +++ b/demos/conanfile.py @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ class demos(ConanFile): - python_requires = "libhal-bootstrap/[^4.2.1]" + python_requires = "libhal-bootstrap/[>=4.3.0 <5]" python_requires_extend = "libhal-bootstrap.demo" def requirements(self): diff --git a/demos/main.cpp b/demos/main.cpp index 966e56e..96fc943 100644 --- a/demos/main.cpp +++ b/demos/main.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/demos/platforms/lpc4078.cpp b/demos/platforms/lpc4078.cpp index b0898ec..b73a631 100644 --- a/demos/platforms/lpc4078.cpp +++ b/demos/platforms/lpc4078.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/demos/platforms/micromod.cpp b/demos/platforms/micromod.cpp index eb2b70e..34206dd 100644 --- a/demos/platforms/micromod.cpp +++ b/demos/platforms/micromod.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/demos/platforms/stm32f103c8.cpp b/demos/platforms/stm32f103c8.cpp index c4178e7..5bd11b8 100644 --- a/demos/platforms/stm32f103c8.cpp +++ b/demos/platforms/stm32f103c8.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/demos/resource_list.hpp b/demos/resource_list.hpp index 2800a9c..3fcc165 100644 --- a/demos/resource_list.hpp +++ b/demos/resource_list.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/libhal-__device__/__device__.hpp b/include/libhal-__device__/__device__.hpp index 60c9344..a8ec88b 100644 --- a/include/libhal-__device__/__device__.hpp +++ b/include/libhal-__device__/__device__.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/__device__.cpp b/src/__device__.cpp index c0d3b65..cef47cf 100644 --- a/src/__device__.cpp +++ b/src/__device__.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 886091a..1807da3 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test_package/conanfile.py b/test_package/conanfile.py index afb69c8..727b3df 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -1,4 +1,4 @@ -# Copyright 2024 Khalil Estell +# Copyright 2024 - 2025 Khalil Estell and the libhal contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - python_requires = "libhal-bootstrap/[^4.2.1]" + python_requires = "libhal-bootstrap/[>=4.3.0 <5]" python_requires_extend = "libhal-bootstrap.library_test_package" def requirements(self): diff --git a/test_package/main.cpp b/test_package/main.cpp index 6d7d30c..c89a108 100644 --- a/test_package/main.cpp +++ b/test_package/main.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/__device__.test.cpp b/tests/__device__.test.cpp index c4d9486..952f05b 100644 --- a/tests/__device__.test.cpp +++ b/tests/__device__.test.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/tests/main.test.cpp b/tests/main.test.cpp index cb4f001..55c5e55 100644 --- a/tests/main.test.cpp +++ b/tests/main.test.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Khalil Estell +// Copyright 2024 - 2025 Khalil Estell and the libhal contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 35257c60f94ad57f746d5f221285178a9d22c4eb Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Tue, 27 May 2025 17:25:23 -0700 Subject: [PATCH 2/3] :recycle: libhal-lpc40 -> libhal-arm-mcu/lpc40 --- ARCHITECTURE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index e101692..4afa94e 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -116,8 +116,8 @@ bootstrap.module.add_demo_requirements(self) ``` Must be invoked in order to add the appropriate platform libraries to the -`ConanFile` class. These platform libraries are usually `libhal-lpc40`, -`libhal-stm32f1` and `libhal-micromod`. Note that bootstrap must be updated to +`ConanFile` class. These platform libraries are usually `libhal-arm-mcu`, +`libhal-linux` and `libhal-micromod`. Note that bootstrap must be updated to support additional platforms. If you attempt to use a profile with a platform name outside of what is supported by `libhal-bootstrap` then this API does nothing except include `libhal-util`. From e937ab6e29ca6d25a96a91f18029b50341be8f1f Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Tue, 27 May 2025 17:36:52 -0700 Subject: [PATCH 3/3] :green_heart: Fix mach-o error in mac --- include/libhal-__device__/__device__.hpp | 4 +++- src/__device__.cpp | 15 ++++++++++++++- test_package/CMakeLists.txt | 4 +--- tests/__device__.test.cpp | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/libhal-__device__/__device__.hpp b/include/libhal-__device__/__device__.hpp index a8ec88b..c570ae6 100644 --- a/include/libhal-__device__/__device__.hpp +++ b/include/libhal-__device__/__device__.hpp @@ -16,5 +16,7 @@ namespace hal::__device__ { // NOLINT struct __device___replace_me // NOLINT -{}; +{ + __device___replace_me(); +}; } // namespace hal::__device__ diff --git a/src/__device__.cpp b/src/__device__.cpp index cef47cf..ac041b3 100644 --- a/src/__device__.cpp +++ b/src/__device__.cpp @@ -14,5 +14,18 @@ #include "libhal-__device__/__device__.hpp" -namespace hal::__device__ { // NOLINT +namespace { +int do_something_variable = 0; +} + +namespace hal::__device__ { +__device___replace_me::__device___replace_me() +{ + // Do nothing here, but give something to be contained in the .a archive file. + // Otherwise `apple-clang` tends to get upset with a message: + // + // ld: archive member '/' not a mach-o file in 'libhal-__device__.a' + // + do_something_variable++; +} } // namespace hal::__device__ diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 1807da3..c99fe6f 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -13,12 +13,10 @@ # limitations under the License. cmake_minimum_required(VERSION 3.15) + project(test_package LANGUAGES CXX) find_package(libhal-__device__ REQUIRED CONFIG) add_executable(${PROJECT_NAME} main.cpp) -target_include_directories(${PROJECT_NAME} PUBLIC .) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) target_link_libraries(${PROJECT_NAME} PRIVATE libhal::__device__) diff --git a/tests/__device__.test.cpp b/tests/__device__.test.cpp index 952f05b..7c0d810 100644 --- a/tests/__device__.test.cpp +++ b/tests/__device__.test.cpp @@ -23,6 +23,7 @@ boost::ut::suite test___device__ = []() { // NOLINT "__device__::__device__()"_test = []() { // Setup + [[maybe_unused]] hal::__device__::__device___replace_me bar; // Exercise // Verify };