Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
* release/v1.1.0:
  🔖 Version bump 1.1.0
  🚸 (rc): Set Serial Number as BLE device name
  ✨ (SN): Add short SN
  🐛 (SN): Get SN array reference of SerialNumberKit
  🚨 (sonarcloud): Fix pass large object "card" by reference to const
  🚨 (sonarcloud): Fix ignoring return value of function declared with 'nodiscard' attribute
  ♻️ (audio): Modernize spike
  ✨ (audio): Add audio spike based on functional certification test
  🔥 (libs): Remove lib HardwareTests
  🔥 (drivers): Remove FastLED driver, spike
  🔥 (tests): Remove functional tests
  ✨ (IOKit): Add DigitalOut class
  ✨ (utils): Add random8 function
  ✨ (fs): Add options to run loop script fast or provide custom delay
  ⚡ (fs): Speed up display of images to reduce check time
  🎨 (cmake): Reformat cmake python scripts
  🎨 (cmake): Reformat all .cmake script files
  🎨 (cmake): Reformat all CMakeLists.txt files
  ✨ (drivers): Add CoreIOExpander
  ♻️ (interface): IOExpander - Add set/read output pin methods
  • Loading branch information
ladislas committed Oct 2, 2022
2 parents ed7772a + 67749a7 commit e79f8d3
Show file tree
Hide file tree
Showing 200 changed files with 3,123 additions and 14,462 deletions.
5 changes: 0 additions & 5 deletions .github/actions/config_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ runs:
run: |
make spikes TARGET_BOARD=${{ inputs.target_board }}
- name: Build functional tests
shell: bash
run: |
make tests_functional TARGET_BOARD=${{ inputs.target_board }}
- name: Build misc
shell: bash
run: |
Expand Down
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.21)
#
# MARK: - External tools
#

find_program(CCACHE "ccache")

if(CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}")
Expand Down Expand Up @@ -41,7 +41,8 @@ add_compile_options(

# Bootloader
option(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER "Build targets with padding to use with bootloader" OFF)
if (BUILD_TARGETS_TO_USE_WITH_BOOTLOADER)

if(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER)
set(MBED_APP_FLAGS
-DMBED_APP_START=0x08041000
-DMBED_APP_SIZE=0x17E000
Expand All @@ -50,12 +51,14 @@ endif(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER)

# Logger
option(ENABLE_LOG_DEBUG "Enable LogKit output" OFF)

if(ENABLE_LOG_DEBUG)
add_definitions(-DENABLE_LOG_DEBUG)
endif(ENABLE_LOG_DEBUG)

# SYSTEM Stats
option(ENABLE_SYSTEM_STATS "Enable SYSTEM stats" OFF)

if(ENABLE_LOG_DEBUG AND ENABLE_SYSTEM_STATS)
add_definitions(-DMBED_CPU_STATS_ENABLED)
add_definitions(-DMBED_STACK_STATS_ENABLED)
Expand All @@ -67,26 +70,25 @@ endif(ENABLE_LOG_DEBUG AND ENABLE_SYSTEM_STATS)
#

# Before all
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})

# extern
set(MBED_OS_DIR ${ROOT_DIR}/extern/mbed-os)
set(MCUBOOT_DIR ${ROOT_DIR}/extern/mcuboot/boot)
set(MBED_OS_DIR ${ROOT_DIR}/extern/mbed-os)
set(MCUBOOT_DIR ${ROOT_DIR}/extern/mcuboot/boot)
set(MBED_HTTP_DIR ${ROOT_DIR}/extern/mbed-http)

# includes
set(LIBS_DIR ${ROOT_DIR}/libs)
set(LIBS_DIR ${ROOT_DIR}/libs)
set(DRIVERS_DIR ${ROOT_DIR}/drivers)
set(INCLUDE_DIR ${ROOT_DIR}/include)
set(TARGETS_DIR ${ROOT_DIR}/targets)

# app
set(OS_DIR ${ROOT_DIR}/app/os)
set(OS_DIR ${ROOT_DIR}/app/os)
set(BOOTLOADER_DIR ${ROOT_DIR}/app/bootloader)

# spikes, functional tests
set(SPIKES_DIR ${ROOT_DIR}/spikes)
set(FUNCTIONAL_TESTS_DIR ${ROOT_DIR}/tests/functional)
# spikes
set(SPIKES_DIR ${ROOT_DIR}/spikes)

#
# MARK: - LekaOS Project
Expand All @@ -99,7 +101,8 @@ project(LekaOS LANGUAGES C CXX ASM)

# Add custom target subdirectory
set(AVAILABLE_CUSTOM_TARGETS LEKA_DISCO LEKA_V1_2_DEV)
if (${TARGET_BOARD} IN_LIST AVAILABLE_CUSTOM_TARGETS)

if(${TARGET_BOARD} IN_LIST AVAILABLE_CUSTOM_TARGETS)
message(STATUS "Add subdirectory for hardware target ${TARGET_BOARD}")
add_subdirectory(${TARGETS_DIR}/TARGET_${TARGET_BOARD})
else()
Expand Down Expand Up @@ -130,9 +133,8 @@ add_subdirectory(${MBED_HTTP_DIR})
add_subdirectory(${DRIVERS_DIR})
add_subdirectory(${LIBS_DIR})

# Add spikes, functional tests
# Add spikes
add_subdirectory(${SPIKES_DIR})
add_subdirectory(${FUNCTIONAL_TESTS_DIR})

# Add bootloader
add_subdirectory(${BOOTLOADER_DIR})
Expand All @@ -146,8 +148,8 @@ mbed_cmake_print_build_report()
#
# MARK: - Misc. options
#

option(VERBOSE_BUILD "Have a verbose build process")

if(VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
Expand Down
8 changes: 4 additions & 4 deletions app/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ add_mbed_executable(bootloader)

target_include_directories(bootloader
PRIVATE
.
.
)

target_sources(bootloader
PRIVATE
main.cpp
default_bd.cpp
signing_keys.c
main.cpp
default_bd.cpp
signing_keys.c
)

target_link_libraries(bootloader
Expand Down
6 changes: 5 additions & 1 deletion app/bootloader/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ namespace config {

void setBootloaderVersion()
{
configkit.write(bootloader_version, bootloader_version.default_value());
auto ret = configkit.write(bootloader_version, bootloader_version.default_value());

if (!ret) {
log_error("Error writing config bootloader version");
}
}

void setOSVersion(uint8_t major, uint8_t minor, uint16_t revision)
Expand Down
4 changes: 2 additions & 2 deletions app/os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ add_mbed_executable(LekaOS)

target_include_directories(LekaOS
PRIVATE
.
.
)

target_sources(LekaOS
PRIVATE
main.cpp
main.cpp
)

target_link_libraries(LekaOS
Expand Down
2 changes: 1 addition & 1 deletion app/os/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ auto main() -> int
robot::controller.registerOnFactoryResetNotificationCallback(factory_reset::set);
robot::controller.registerEvents();

rfidkit.onTagActivated([](MagicCard card) { robot::emergencyStop(card); });
rfidkit.onTagActivated([](const MagicCard &card) { robot::emergencyStop(card); });

// TODO(@team): Add functional test prior confirming the firmware
firmware::confirmFirmware();
Expand Down
16 changes: 8 additions & 8 deletions cmake/ToolchainGCCArmBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ add_dependencies(mbed-os-static mbed-linker-script)
# disable some annoying warnings during the Mbed build
target_compile_options(mbed-os-static
PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-register>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-volatile>
-Wno-unused-function
-Wno-unused-variable
-Wno-enum-compare
-Wno-attributes
$<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-register>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-volatile>
-Wno-unused-function
-Wno-unused-variable
-Wno-enum-compare
-Wno-attributes
)

# create final library target (wraps actual library target in -Wl,--whole-archive [which is needed for weak symbols to work])
add_library(mbed-os INTERFACE)

target_include_directories(mbed-os
INTERFACE
${MBED_OS_DIR}
${MBED_OS_DIR}
)

target_link_libraries(mbed-os INTERFACE
Expand Down
29 changes: 15 additions & 14 deletions cmake/ToolchainGCCArmDefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,27 @@ set(CHIP_LINKER_FLAGS "")
set(MBED_LINK_OPTIONS "")

foreach(FLAG ${MCU_LINK_OPTIONS})
if("${FLAG}" MATCHES "--wrap")
list(APPEND MBED_LINK_OPTIONS "${FLAG}")
elseif("${FLAG}" IN_LIST MCU_COMPILE_FLAGS)
# duplicate flag, do nothing
else()
string(APPEND CHIP_LINKER_FLAGS " ${FLAG}")
endif()
if("${FLAG}" MATCHES "--wrap")
list(APPEND MBED_LINK_OPTIONS "${FLAG}")
elseif("${FLAG}" IN_LIST MCU_COMPILE_FLAGS)
# duplicate flag, do nothing
else()
string(APPEND CHIP_LINKER_FLAGS " ${FLAG}")
endif()
endforeach()

# also add config-specific link flags (these go with mbed-os since they need generator expressions)
foreach(BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${BUILD_TYPE}" BUILD_TYPE_UCASE)
foreach(OPTION ${MCU_LINK_OPTIONS_${BUILD_TYPE_UCASE}})
if(NOT "${OPTION}" STREQUAL "")
list(APPEND MBED_LINK_OPTIONS $<$<CONFIG:${BUILD_TYPE}>:${OPTION}>)
endif()
endforeach()
string(TOUPPER "${BUILD_TYPE}" BUILD_TYPE_UCASE)

foreach(OPTION ${MCU_LINK_OPTIONS_${BUILD_TYPE_UCASE}})
if(NOT "${OPTION}" STREQUAL "")
list(APPEND MBED_LINK_OPTIONS $<$<CONFIG:${BUILD_TYPE}>:${OPTION}>)
endif()
endforeach()
endforeach()

#note: these initialize the cache variables on first configure
# note: these initialize the cache variables on first configure
set(CMAKE_C_FLAGS_INIT "${CHIP_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${CHIP_FLAGS} -Wvla -fno-exceptions -fno-rtti")
set(CMAKE_ASM_FLAGS_INIT "${CHIP_FLAGS}")
Expand Down
12 changes: 2 additions & 10 deletions cmake/mbed-cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release)

# check configuration files
# -------------------------------------------------------------

set(MBED_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})

# relative to CMakeLists.txt inside mbed-cmake
if(NOT DEFINED MBED_CMAKE_GENERATED_CONFIG_RELPATH)
set(MBED_CMAKE_GENERATED_CONFIG_RELPATH ${MBED_CMAKE_CONFIG_DIR})
endif()

set(MBED_CMAKE_GENERATED_CONFIG_PATH ${MBED_CMAKE_CONFIG_DIR})

if(NOT DEFINED MBED_CMAKE_CONFIG_HEADERS_PATH)
Expand All @@ -78,39 +78,32 @@ endif()
# search for and load compilers
enable_language(C CXX ASM)


foreach(BUILD_TYPE RELWITHDEBINFO DEBUG RELEASE)
list_to_space_separated(CMAKE_C_FLAGS_${BUILD_TYPE} ${MCU_COMPILE_OPTIONS_${BUILD_TYPE}})
list_to_space_separated(CMAKE_CXX_FLAGS_${BUILD_TYPE} ${MCU_COMPILE_OPTIONS_${BUILD_TYPE}})
list_to_space_separated(CMAKE_ASM_FLAGS_${BUILD_TYPE} ${MCU_COMPILE_OPTIONS_${BUILD_TYPE}})
endforeach()


# find python (used for memap and several upload methods)
# -------------------------------------------------------------

find_package(Python3 COMPONENTS Interpreter)

# load the Mbed CMake functions
# -------------------------------------------------------------

include(AddMbedExecutable)

# Configure upload methods
# -------------------------------------------------------------

set(CMAKE_EXECUTABLE_SUFFIX .elf)

# add Mbed OS source
# -------------------------------------------------------------

set(MBED_CMAKE_CONFIG_HEADERS_PATH ${MBED_CMAKE_GENERATED_CONFIG_PATH}/config-headers)
add_subdirectory(${MBED_OS_DIR}) #first get Mbed standard library
add_subdirectory(${MBED_OS_DIR}) # first get Mbed standard library

# build report
# -------------------------------------------------------------
function(mbed_cmake_print_build_report)

message(STATUS "---- Completed configuration of ${PROJECT_NAME} ----")

# build type
Expand All @@ -123,5 +116,4 @@ function(mbed_cmake_print_build_report)
message(STATUS ">> CXX Compile Flags (Global): ${CMAKE_CXX_FLAGS}")
message(STATUS ">> CXX Compile Flags (For ${CMAKE_BUILD_TYPE}): ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UCASE}}")
message(STATUS ">> Linker Flags: ${CMAKE_EXE_LINKER_FLAGS}")

endfunction(mbed_cmake_print_build_report)
4 changes: 2 additions & 2 deletions cmake/scripts/check_python_package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#file which is invoked by the cmake build system to check if all necessary python packages are installed.
# file which is invoked by the cmake build system to check if all necessary python packages are installed.

import sys

Expand All @@ -7,4 +7,4 @@
except ImportError:
exit(1)

exit(0)
exit(0)
Loading

0 comments on commit e79f8d3

Please sign in to comment.