Before getting started, if you haven't used libhal before, follow the Getting Started guide.
To build the project:
conan build . -pr <target_name> -pr <compiler>
For the lpc4078
conan build . -pr lpc4078 -pr arm-gcc-12.3
For the STM32F103 MicroMod V4:
conan build . -pr mod-stm32f1-v4 -pr arm-gcc-12.3
- lpc4078
- lpc4074
- micromod
- lpc4078 MicroMod V5
- stm32f103c8 MicroMod V4
- stm32f103c8
lpc40
profiles:
conan config install -sf conan/profiles/v2 -tf profiles https://github.com/libhal/libhal-lpc40.git
stm32f1
profiles:
conan config install -sf conan/profiles/v2 -tf profiles https://github.com/libhal/libhal-stm32f1.git
micromod
profiles:
conan config install -sf conan/profiles/v1 -tf profiles https://github.com/libhal/libhal-micromod.git
main.cpp
: It contains the main loop of the application. In this example, it just prints "Hello, World" and toggles an LED on and off.application.hpp
: This file defines thehardware_map_t
struct which holds pointers to the led, console, clock interfaces and reset callback. Modify this structure to change the set of required drivers and settings for an application.initialize_platform
, andapplication
functions that must be implemented elsewhere.CMakeLists.txt
: This is the build file for the project. It sets the minimum required version of CMake, names the project, and sets the platform library. It also defines the sources to compile and the libraries to link against. Finally, it sets up the post-build steps withlibhal_post_build
.platforms/lpc4078.cpp
: This file provides an implementation forinitialize_platform
, for the LPC4078 platform. Ininitialize_platform
, it sets the clock speed, configures a uart peripheral for console output, and sets up an output pin for the led. Each driver is statically allocated. The returnedhardware_map_t
has the pointers to each statically allocated peripheral and a reset callback that can resets the microcontroller.platforms/*.cpp
: Just likeplatforms/lpc4078.cpp
but for any other platforms. It's important to note that the specifics of theinitialize_platform
function and the peripherals used will likely vary between different platforms but sometimes they don't. As an example thelpc4074.cpp
file just includes directly thelpc4078.cpp
because those are identical.