GHS: Update BSP selection logic

Selection of a BSP only needs to be performed if not set by user.

Remove all the logic for printing error and status messages about BSP
selection. These messages also breaks CMake tests.

NOTE: If BSP selection fails then the compiler checks will result in
a build error.  The build error will report that the BSP does not exist.
This commit is contained in:
Fred Baksik
2021-11-15 13:15:11 -05:00
parent 0427f22539
commit a55b5c4e18
3 changed files with 20 additions and 18 deletions

View File

@@ -121,6 +121,8 @@ the ``GHS_BSP_NAME`` variable.
* ``cmake -G "Green Hills MULTI" -A 86`` for ``sim86`` on ``86_integrity.tgt``.
* ``cmake -G "Green Hills MULTI" -A ppc -D GHS_BSP_NAME=sim800`` for ``sim800``
on ``ppc_integrity.tgt``.
* ``cmake -G "Green Hills MULTI" -D GHS_PRIMARY_TARGET=ppc_integrity.tgt -D GHS_BSP_NAME=fsl-t1040``
for ``fsl-t1040`` on ``ppc_integrity.tgt``.
Target Properties
^^^^^^^^^^^^^^^^^

View File

@@ -83,4 +83,20 @@ mark_as_advanced(GHS_OS_DIR)
set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
mark_as_advanced(GHS_OS_DIR_OPTION)
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
# Select GHS_BSP_NAME if not set by user and is known to be required
if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
set(_ghs_bsp_name "GHS_BSP_NAME-NOT-SPECIFIED")
else()
set(_ghs_bsp_name "IGNORE")
endif()
if(_ghs_bsp_name AND NOT DEFINED GHS_BSP_NAME)
# First try taking architecture from `-A` option
if(CMAKE_GENERATOR_PLATFORM)
set(_ghs_bsp_name "sim${CMAKE_GENERATOR_PLATFORM}")
else()
set(_ghs_bsp_name "simarm")
endif()
endif()
set(GHS_BSP_NAME "${_ghs_bsp_name}" CACHE STRING "BSP name")

View File

@@ -132,23 +132,6 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
"Generator selected GHS MULTI primaryTarget.",
cmStateEnums::STRING, true);
}
// Determine GHS_BSP_NAME
std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
if (cmIsOff(bspName) && platform.find("integrity") != std::string::npos) {
std::string arch = "arm"; /* FIXME - extract from GHS_PRIMARY_TARGET */
bspName = "sim" + arch;
/* write back the calculate name for next time */
mf->AddCacheDefinition("GHS_BSP_NAME", bspName,
"Name of GHS target platform.",
cmStateEnums::STRING, true);
std::string m = cmStrCat(
"Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \"",
bspName, '"');
cmSystemTools::Message(m);
}
return true;
}
@@ -308,6 +291,7 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
fout << "# Top Level Project File\n";
// Specify BSP option if supplied by user
// -- not all platforms require this entry in the project file
cmValue bspName =
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
if (!cmIsOff(bspName)) {