Skip to content

Commit

Permalink
Merge pull request #1 from libhal/create-pull-request/patch
Browse files Browse the repository at this point in the history
Rename target package to libhal-linux
  • Loading branch information
kammce authored Apr 26, 2024
2 parents 5519586 + 9088c52 commit 7326ad1
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 103 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/update_name.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

cmake_minimum_required(VERSION 3.15)

project(libhal-__platform__ LANGUAGES CXX)
project(libhal-linux LANGUAGES CXX)

libhal_test_and_make_library(
LIBRARY_NAME libhal-__platform__
LIBRARY_NAME libhal-linux

SOURCES
src/output_pin.cpp
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# libhal-__platform__
# libhal-linux

[![✅ Checks](https://github.com/libhal/libhal-__platform__/actions/workflows/ci.yml/badge.svg)](https://github.com/libhal/libhal-__platform__/actions/workflows/ci.yml)
[![Coverage](https://libhal.github.io/libhal-__platform__/coverage/coverage.svg)](https://libhal.github.io/libhal-__platform__/coverage/)
[![GitHub stars](https://img.shields.io/github/stars/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/network)
[![GitHub issues](https://img.shields.io/github/issues/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/issues)
[![✅ Checks](https://github.com/libhal/libhal-linux/actions/workflows/ci.yml/badge.svg)](https://github.com/libhal/libhal-linux/actions/workflows/ci.yml)
[![Coverage](https://libhal.github.io/libhal-linux/coverage/coverage.svg)](https://libhal.github.io/libhal-linux/coverage/)
[![GitHub stars](https://img.shields.io/github/stars/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/network)
[![GitHub issues](https://img.shields.io/github/issues/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/issues)

Platform library for __platform__ series of devices.
Platform library for linux series of devices.

## Contributing

Expand Down Expand Up @@ -39,7 +39,7 @@ To make your own libhal library:

## About the libhal-platform template

The `libhal-__platform__` repository is a template for creating platform
The `libhal-linux` repository is a template for creating platform
libraries in the libhal ecosystem. It provides a structured layout and a set of files to help you get started with creating your own platform library.

## .github/workflows
Expand Down Expand Up @@ -98,7 +98,7 @@ there are `stm32f100`, `stm32f101`, `stm32f102`, `stm32f103`, `stm32f105`, and

Keep `default_options` as it is.

## linker_scripts/libhal-__platform__
## linker_scripts/libhal-linux

This directory contains linker scripts for different configurations of the
platform. Each linker script specifies how the linker should arrange the
Expand Down Expand Up @@ -149,7 +149,7 @@ platform library. It includes:
platform library.
- `main.cpp`: The main entry point for the demo applications.

## include/libhal-__platform__
## include/libhal-linux

This directory contains the header files for the platform library. It currently
includes `output_pin.hpp`, which is a placeholder for the main header file of
Expand All @@ -171,8 +171,8 @@ Conan recipe is working correctly.

This directory contains tests for the platform library. It includes:

- `__platform__.test.cpp`: A placeholder for tests for the platform library.
- `linux.test.cpp`: A placeholder for tests for the platform library.
- `main.test.cpp`: The main entry point for the tests.

Remember to replace all instances of `__platform__` with the actual name of the
Remember to replace all instances of `linux` with the actual name of the
platform that your library is being built for.
File renamed without changes.
2 changes: 1 addition & 1 deletion conan/profiles/profile1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% set arch = "cortex-m3" %}
{% set platform = "profile1" %}
{% include "__platform__" %}
{% include "linux" %}
2 changes: 1 addition & 1 deletion conan/profiles/profile2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% set arch = "cortex-m4" %}
{% set platform = "profile2" %}
{% include "__platform__" %}
{% include "linux" %}
18 changes: 9 additions & 9 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
required_conan_version = ">=2.0.14"


class libhal___platform___conan(ConanFile):
name = "libhal-__platform__"
class libhal_linux_conan(ConanFile):
name = "libhal-linux"
license = "Apache-2.0"
homepage = "https://libhal.github.io/libhal-__platform__"
description = ("A collection of drivers and libraries for the __platform__ "
homepage = "https://libhal.github.io/libhal-linux"
description = ("A collection of drivers and libraries for the linux "
"series microcontrollers.")
topics = ("microcontroller", "__platform__",)
topics = ("microcontroller", "linux",)
settings = "compiler", "build_type", "os", "arch"

python_requires = "libhal-bootstrap/[^1.0.0]"
Expand All @@ -54,24 +54,24 @@ def add_linker_scripts_to_link_flags(self):
platform = str(self.options.platform)
self.cpp_info.exelinkflags = [
"-L" + os.path.join(self.package_folder, "linker_scripts"),
"-T" + os.path.join("libhal-__platform__", platform + ".ld"),
"-T" + os.path.join("libhal-linux", platform + ".ld"),
]

def requirements(self):
# Replace with appropriate processor library
self.requires("libhal-armcortex/[^3.0.2]")

def package_info(self):
self.cpp_info.set_property("cmake_target_name", "libhal::__platform__")
self.cpp_info.libs = ["libhal-__platform__"]
self.cpp_info.set_property("cmake_target_name", "libhal::linux")
self.cpp_info.libs = ["libhal-linux"]

if self.settings.os == "baremetal" and self._use_linker_script:
self.add_linker_scripts_to_link_flags()

self.buildenv_info.define("LIBHAL_PLATFORM",
str(self.options.platform))
self.buildenv_info.define("LIBHAL_PLATFORM_LIBRARY",
"__platform__")
"linux")

def package_id(self):
if self.info.options.get_safe("platform"):
Expand Down
4 changes: 2 additions & 2 deletions demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ libhal_build_demos(
blinker

PACKAGES
libhal-__platform__
libhal-linux

LINK_LIBRARIES
libhal::__platform__
libhal::linux
)
4 changes: 2 additions & 2 deletions demos/applications/blinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <libhal-__platform__/output_pin.hpp>
#include <libhal-linux/output_pin.hpp>
#include <libhal-armcortex/dwt_counter.hpp>
#include <libhal-util/steady_clock.hpp>

Expand All @@ -21,7 +21,7 @@ void application()
using namespace hal::literals;
// TODO(libhal-target): Set the correct frequency and output pin driver
hal::cortex_m::dwt_counter clock(1.0_MHz);
hal::__platform__::output_pin led;
hal::linux::output_pin led;

while (true) {
using namespace std::chrono_literals;
Expand Down
2 changes: 1 addition & 1 deletion demos/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class demos(ConanFile):
def requirements(self):
bootstrap = self.python_requires["libhal-bootstrap"]
bootstrap.module.add_demo_requirements(self, is_platform=True)
self.requires("libhal-__platform__/[^1.0.0 || latest]")
self.requires("libhal-linux/[^1.0.0 || latest]")
4 changes: 2 additions & 2 deletions demos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

// Replace with the correct processor includes
#include <libhal-__platform__/output_pin.hpp>
#include <libhal-linux/output_pin.hpp>
#include <libhal-armcortex/dwt_counter.hpp>
#include <libhal-armcortex/system_control.hpp>
#include <libhal-exceptions/control.hpp>
Expand All @@ -29,7 +29,7 @@ extern void application();
using namespace hal::literals;
// Replace this with something that makes sense...
hal::cortex_m::dwt_counter clock(12.0_MHz);
hal::__platform__::output_pin led;
hal::linux::output_pin led;

while (true) {
led.level(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <libhal/output_pin.hpp>

namespace hal::__platform__ { // NOLINT
namespace hal::linux {
class output_pin : public hal::output_pin
{
public:
Expand All @@ -29,4 +29,4 @@ class output_pin : public hal::output_pin
void driver_level(bool p_high) override;
bool driver_level() override;
};
} // namespace hal::__platform__
} // namespace hal::linux
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/output_pin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <libhal-__platform__/output_pin.hpp>
#include <libhal-linux/output_pin.hpp>

namespace hal::__platform__ { // NOLINT
namespace hal::linux {

void output_pin::driver_configure(
[[maybe_unused]] const settings& p_settings) // Remove [[maybe_unused]]
Expand All @@ -33,4 +33,4 @@ bool output_pin::driver_level()
// Replace this with the correct implementation
return true;
}
} // namespace hal::__platform__
} // namespace hal::linux
4 changes: 2 additions & 2 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(libhal-__platform__ REQUIRED CONFIG)
find_package(libhal-linux REQUIRED CONFIG)
add_executable(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC .)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
target_link_libraries(${PROJECT_NAME} PRIVATE libhal::__platform__)
target_link_libraries(${PROJECT_NAME} PRIVATE libhal::linux)
8 changes: 4 additions & 4 deletions tests/main.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace hal::__platform__ { // NOLINT
extern void output_pin_test(); // NOLINT
} // namespace hal::__platform__
namespace hal::linux {
extern void output_pin_test();
} // namespace hal::linux

int main()
{
hal::__platform__::output_pin_test();
hal::linux::output_pin_test();
}
6 changes: 3 additions & 3 deletions tests/output_pin.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <libhal-__platform__/output_pin.hpp>
#include <libhal-linux/output_pin.hpp>

#include <boost/ut.hpp>

namespace hal::__platform__ { // NOLINT
namespace hal::linux {
void output_pin_test()
{
using namespace boost::ut;
Expand All @@ -28,4 +28,4 @@ void output_pin_test()
// Verify
};
};
} // namespace hal::__platform__
} // namespace hal::linux

0 comments on commit 7326ad1

Please sign in to comment.