Skip to content

Commit

Permalink
Merge branch 'youtube_part_3'
Browse files Browse the repository at this point in the history
matgla committed Apr 4, 2024
2 parents 13a8171 + 4733cee commit c95b041
Showing 7 changed files with 58 additions and 25 deletions.
35 changes: 23 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -17,19 +17,25 @@

cmake_minimum_required(VERSION 3.19)

include(FetchContent)
find_program(yaspem yaspem.py)

FetchContent_Declare(
yaspem
GIT_REPOSITORY https://github.com/matgla/Yaspem.git
GIT_TAG v1.2)
if (NOT yaspem OR $ENV{YASPEM_FETCH_FROM_GIT}})
include(FetchContent)

FetchContent_MakeAvailable(yaspem)
FetchContent_Declare(
yaspem
GIT_REPOSITORY https://github.com/matgla/Yaspem.git
GIT_TAG v2.1)

set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake
${yaspem_SOURCE_DIR}/cmake
CACHE INTERNAL "")
FetchContent_MakeAvailable(yaspem)

else ()
cmake_path(GET yaspem PARENT_PATH yaspem_dir)
message(STATUS "Populating locally available Yaspem: ${yaspem_dir}")
set (yaspem_SOURCE_DIR ${yaspem_dir})
endif ()

list (APPEND CMAKE_MODULE_PATH ${yaspem_SOURCE_DIR}/cmake)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(yaspem)
@@ -52,14 +58,19 @@ generate_config(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
if(${configuration_is_ready})
message(STATUS "Configuration is processed, starting initialization")
add_subdirectory(cpu)

list(APPEND CMAKE_MODULE_PATH "${CPU_MODULE_PATH}")
list(APPEND CMAKE_MODULE_PATH "${ARCHITECTURE_MODULE_PATH}")

include(McuInit)

set(packagesToFetch ${CMAKE_CURRENT_SOURCE_DIR}/packages.json)
if(CPU_PACKAGES_TO_FETCH)
set(packagesToFetch "${packagesToFetch},${CPU_PACKAGES_TO_FETCH}")
set(packagesToFetch ${packagesToFetch} ${CPU_PACKAGES_TO_FETCH})
endif()


message(STATUS "************* ${packagesToFetch}")
setup_yaspem(
YASPEM_SOURCE ${yaspem_SOURCE_DIR} OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/packages PACKAGE_FILES ${packagesToFetch})
2 changes: 1 addition & 1 deletion cpu/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
# <https://www.gnu.org/licenses/>.
#

set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/modules)
set (ARCHITECTURE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules CACHE INTERNAL "")

if (CPU_ARCHITECTURE)
message(STATUS "Adding CPU architecture: ${CPU_ARCHITECTURE}")
2 changes: 1 addition & 1 deletion cpu/arm/v6-m/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -19,5 +19,5 @@
#

if (CPU)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/${CPU}/cmake CACHE INTERNAL "")
set (CPU_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${CPU}/cmake" CACHE INTERNAL "")
endif ()
2 changes: 1 addition & 1 deletion cpu/arm/v6-m/rp2040/cmake/packages.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
{
"link": "https://github.com/raspberrypi/pico-sdk.git",
"type": "git",
"version": "1.5.0",
"version": "1.5.1",
"target": "picosdk",
"options": {
"update_submodules": true,
2 changes: 1 addition & 1 deletion cpu/host/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -20,5 +20,5 @@

message(STATUS "Host architecture was added")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake CACHE INTERNAL "")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

4 changes: 2 additions & 2 deletions kconfig/GenerateConfig.cmake
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
# <https://www.gnu.org/licenses/>.
#

function (generate_config source_directory output_directory)
macro (generate_config source_directory output_directory)
file (MAKE_DIRECTORY ${output_directory}/config)

find_file(kconfig_generator generate.py ${source_directory}/kconfig)
@@ -68,4 +68,4 @@ function (generate_config source_directory output_directory)
set(configuration_is_ready TRUE CACHE INTERNAL "" FORCE)
endif ()

endfunction()
endmacro()
36 changes: 29 additions & 7 deletions packages.json
Original file line number Diff line number Diff line change
@@ -29,8 +29,7 @@
"version": "main",
"target": "renode_rp2040",
"options": {
"cmake_variables": {
},
"cmake_variables": {},
"is_cmake_library": true
}
},
@@ -42,10 +41,33 @@
"options": {
"create_library": {
"type": "STATIC",
"sources_filter": ["lfs.c", "lfs_util.c"],
"sources_directory": "",
"include_directories": ["."],
"compile_definitions": ""
"sources": {
"PRIVATE": [
"lfs.c",
"lfs_util.c"
],
"PUBLIC": [
"lfs.h"
]
},
"include_directories": {
"PUBLIC": [
"."
]
},
"link_libraries": {
"PUBLIC": [
"yasboot_public_flags"
],
"PRIVATE": [
"yasboot_private_flags"
]
},
"compile_options": {
"PRIVATE": [
"-Wno-unused-function"
]
}
}
}
},
@@ -57,7 +79,7 @@
"options": {
"cmake_variables": {
"DISABLE_TESTS": "ON"
}
}
}
}
]

0 comments on commit c95b041

Please sign in to comment.