MLECO-2919: Restructuring to standardise HAL APIs
* LCD module component created (removed from individual
platform packs).
* retarget.c moved out into its own component that wraps
the uart module. It also have the native stub for
GetLine => paved the way for removing data_acq module
from profiles.
* shortened names for components' dir for npu and ta
* remove peripheral_memmap and peripheral_irqs headers
from platform_drivers.h. There should be no need for
these to be included in the top level now. These should
be private headers.
* cmsis_device moved in as a component.
* Pyenv created by set_up_default_resource.py will also
install packages that CMake's source generator needs.
TODO's:
* Remove timer from profiles (MLECO-3096)
Change-Id: I9d6ea2f4f291788f40a16ed507019563c8d7f205
diff --git a/source/hal/CMakeLists.txt b/source/hal/CMakeLists.txt
index f720cdf..19f152c 100644
--- a/source/hal/CMakeLists.txt
+++ b/source/hal/CMakeLists.txt
@@ -37,7 +37,7 @@
set(PLATFORM_PROFILE native)
endif()
-set(PLATFORM_PROFILE_DIR profiles/${PLATFORM_PROFILE})
+set(PLATFORM_PROFILE_DIR source/profiles/${PLATFORM_PROFILE})
## Common include directories - public
target_include_directories(${HAL_TARGET}
@@ -48,9 +48,9 @@
## Common sources for all profiles
target_sources(${HAL_TARGET}
PRIVATE
- hal.c
- ${PLATFORM_PROFILE_DIR}/data_presentation/data_psn.c
- ${PLATFORM_PROFILE_DIR}/data_acquisition/data_acq.c
+ source/hal.c
+ source/data_psn.c
+ source/data_acq.c
${PLATFORM_PROFILE_DIR}/timer/platform_timer.c)
if (DEFINED VERIFY_TEST_OUTPUT)
@@ -60,56 +60,7 @@
endif ()
if (NOT DEFINED PLATFORM_DRIVERS_DIR)
- message(FATAL_ERROR "PLATFORM_DRIVERS_DIR need to be defined for this target")
-endif()
-
-
-############################ bare-metal profile #############################
-if (PLATFORM_PROFILE STREQUAL bare-metal)
-
- ## Additional include directories - private
- target_include_directories(${HAL_TARGET}
- PRIVATE
- ${PLATFORM_PROFILE_DIR}/data_presentation/lcd/include)
-
- ## Additional sources - public
- target_sources(${HAL_TARGET}
- PUBLIC
- ${PLATFORM_PROFILE_DIR}/bsp/retarget.c)
-
- ## Additional sources - private
- target_sources(${HAL_TARGET}
- PRIVATE
- ${PLATFORM_PROFILE_DIR}/data_presentation/lcd/lcd_img.c)
-
- ## Compile definition:
- target_compile_definitions(${HAL_TARGET}
- PUBLIC
- PLATFORM_HAL=PLATFORM_CORTEX_M_BAREMETAL)
-
- # Add dependencies for platform_driver first, in case they are needed by it.
- add_subdirectory(cmsis_device ${CMAKE_BINARY_DIR}/cmsis_device)
-
-############################ native profile #############################
-elseif (PLATFORM_PROFILE STREQUAL native)
-
- ## Additional include directories - private
- target_include_directories(${HAL_TARGET}
- PRIVATE
- ${PLATFORM_PROFILE_DIR}/data_presentation/log/include)
-
- ## Additional sources - private
- target_sources(${HAL_TARGET}
- PRIVATE
- ${PLATFORM_PROFILE_DIR}/data_presentation/log/log.c)
-
- ## Compile definition:
- target_compile_definitions(${HAL_TARGET}
- PUBLIC
- PLATFORM_HAL=PLATFORM_UNKNOWN_LINUX_OS
- ACTIVATION_BUF_SRAM_SZ=0)
-else()
- message(FATAL_ERROR "PLATFORM_PROFILE ${PLATFORM_PROFILE} not supported")
+ message(FATAL_ERROR "PLATFORM_DRIVERS_DIR undefined")
endif()
# Add platform_drivers target
@@ -118,8 +69,11 @@
# Link time library targets:
target_link_libraries(${HAL_TARGET}
PUBLIC
- log
- platform_drivers)
+ log # Logging functions
+ lcd_iface # LCD interface
+ stdout_iface # Standard output (and error) interface
+ platform_drivers # Platform drivers implementing the required interfaces
+)
# Display status:
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})