-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add linker config to model file
- Loading branch information
Showing
3 changed files
with
106 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
menu "SPL Core" | ||
menu "Linking" | ||
config LINKER_OUTPUT_FILE | ||
string "LINKER_OUTPUT_FILE" | ||
default "link_out.elf" | ||
help | ||
The main output file generated by the linker (e.g. main.exe or main.elf). | ||
|
||
config LINKER_BYPRODUCTS_CONFIG | ||
bool "LINKER_BYPRODUCTS_CONFIG" | ||
default n | ||
help | ||
Enable to configure other byproduct files generated by the linker | ||
|
||
config LINKER_BYPRODUCTS_EXTENSIONS | ||
string "LINKER_BYPRODUCTS_EXTENSIONS" | ||
depends on !LINKER_BYPRODUCTS_CONFIG | ||
default "hex,map,mdf" | ||
help | ||
The extensions of other byproducts generated by the linker (comma separated list, e.g., "hex,map,mdf") | ||
|
||
config LINKER_BYPRODUCT_HEX | ||
string "LINKER_BYPRODUCT_HEX" | ||
depends on LINKER_BYPRODUCTS_CONFIG | ||
default "link_out.hex" | ||
help | ||
The hex file generated by the linker | ||
|
||
config LINKER_BYPRODUCT_MAP | ||
string "LINKER_BYPRODUCT_MAP" | ||
depends on LINKER_BYPRODUCTS_CONFIG | ||
default "link_out.map" | ||
help | ||
The map file generated by the linker | ||
|
||
config LINKER_BYPRODUCT_MDF | ||
string "LINKER_BYPRODUCT_MDF" | ||
depends on LINKER_BYPRODUCTS_CONFIG | ||
default "link_out.mdf" | ||
help | ||
The mdf file generated by the linker | ||
|
||
config LINKER_BYPRODUCT_OTHERS | ||
string "LINKER_BYPRODUCT_OTHERS" | ||
depends on LINKER_BYPRODUCTS_CONFIG | ||
default "" | ||
help | ||
Other byproduct files generated by the linker (comma separated list, e.g., "link_out.xml") | ||
endmenu | ||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
include(../spl_test.cmake) | ||
|
||
# mocks | ||
spl_test_create_mock(add_executable) | ||
spl_test_create_mock(target_compile_options) | ||
spl_test_create_mock(set_target_properties) | ||
|
||
# given | ||
cmake_minimum_required(VERSION 3.22.0) | ||
project(test C ASM) | ||
|
||
set(VARIANT mytestvariant) | ||
set(BUILD_KIT prod) | ||
set(LINKER_OUTPUT_FILE main.exe) | ||
|
||
# when | ||
include(${CMAKE_CURRENT_LIST_DIR}/../../../cmake/spl.cmake) | ||
|
||
# expect | ||
if(NOT LINK_TARGET_NAME STREQUAL "link") | ||
message(FATAL_ERROR "Failing Test case: LINK_TARGET_NAME = ${LINK_TARGET_NAME}.") | ||
endif() | ||
|
||
spl_test_expect_is_called(add_executable 1) | ||
spl_test_expect_is_called(target_compile_options 1) | ||
spl_test_expect_is_called(set_target_properties 1) | ||
include(../spl_test.cmake) | ||
|
||
# mocks | ||
spl_test_create_mock(add_executable) | ||
spl_test_create_mock(target_compile_options) | ||
spl_test_create_mock(set_target_properties) | ||
|
||
# given | ||
cmake_minimum_required(VERSION 3.22.0) | ||
project(test C ASM) | ||
|
||
set(VARIANT mytestvariant) | ||
set(BUILD_KIT prod) | ||
set(LINKER_OUTPUT_FILE main.exe) | ||
set(LINKER_BYPRODUCTS_EXTENSIONS "hex") | ||
set(LINKER_BYPRODUCT_HEX bibi.hex tina.map amadeus.mdf) | ||
|
||
# when | ||
include(${CMAKE_CURRENT_LIST_DIR}/../../../cmake/spl.cmake) | ||
|
||
# expect | ||
if(NOT LINK_TARGET_NAME STREQUAL "link") | ||
message(FATAL_ERROR "Failing Test case: LINK_TARGET_NAME = ${LINK_TARGET_NAME}.") | ||
endif() | ||
|
||
if(NOT LINK_FILE_BASENAME STREQUAL "main") | ||
message(FATAL_ERROR "Failing Test case: LINK_FILE_BASENAME = ${LINK_FILE_BASENAME}.") | ||
endif() | ||
|
||
if(NOT LINKER_BYPRODUCTS STREQUAL "main.hex;bibi.hex;tina.map;amadeus.mdf") | ||
message(FATAL_ERROR "Failing Test case: LINKER_BYPRODUCTS = ${LINKER_BYPRODUCTS}.") | ||
endif() | ||
|
||
spl_test_expect_is_called(add_executable 1) | ||
spl_test_expect_is_called(target_compile_options 1) | ||
spl_test_expect_is_called(set_target_properties 1) |