Make building NG-Ultra chip database optional, follow filename convention

This commit is contained in:
Miodrag Milanovic 2024-11-22 08:55:16 +01:00
parent c5bb3de5df
commit 88c4451cf2
2 changed files with 10 additions and 5 deletions

View File

@ -2,21 +2,26 @@ message(STATUS "Configuring Himbaechel-NG-ULTRA uarch")
cmake_minimum_required(VERSION 3.5)
project(himbaechel-ng-ultra-chipdb NONE)
set(ALL_HIMBAECHEL_NGULTRA_DEVICES ng-ultra)
set(HIMBAECHEL_NGULTRA_DEVICES "" CACHE STRING
"Include support for these NG-Ultra devices (available: ${ALL_HIMBAECHEL_NGULTRA_DEVICES})")
message(STATUS "Enabled Himbaechel-NG-Ultra devices: ${HIMBAECHEL_NGULTRA_DEVICES}")
set(HIMBAECHEL_PRJBEYOND_DB "" CACHE STRING
"Path to a Project Beyond database")
set(chipdb_binaries)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra)
foreach(device "NG-ULTRA")
foreach(device ${HIMBAECHEL_NGULTRA_DEVICES})
if("${HIMBAECHEL_PRJBEYOND_DB}" STREQUAL "")
message(SEND_ERROR "HIMBAECHEL_PRJBEYOND_DB must be set to a prjbeyond database checkout")
endif()
set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/ng-ultra.bba)
set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/ng-ultra.bin)
set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/chipdb-${device}.bba)
set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/chipdb-${device}.bin)
string(TOUPPER ${device} upcase_device)
add_custom_command(
OUTPUT ${device_bin}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py --db ${HIMBAECHEL_PRJBEYOND_DB} --device ${device} --bba ${device_bba}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py --db ${HIMBAECHEL_PRJBEYOND_DB} --device ${upcase_device} --bba ${device_bba}
COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new
# atomically update
COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin}

View File

@ -36,7 +36,7 @@ NgUltraImpl::~NgUltraImpl(){};
void NgUltraImpl::init_database(Arch *arch)
{
init_uarch_constids(arch);
arch->load_chipdb("ng-ultra/ng-ultra.bin");
arch->load_chipdb("ng-ultra/chipdb-ng-ultra.bin");
arch->set_package("FF-1760");
arch->set_speed_grade("DEFAULT");
}