Skip to content

Commit e8a719d

Browse files
committed
test: Match custom linker config on subset of target name
Instead of requiring exact matches for the whole target name, look for the longest subset of elements from the target name. This allow use of more general patterns in the cross file which makes them less dependent on the specific compiler in use. Signed-off-by: Keith Packard <[email protected]>
1 parent fc8f5ca commit e8a719d

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

meson.build

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ if enable_multilib
948948
endforeach
949949

950950
foreach target : target_list
951-
message('target ' + target)
952951
tmp = target.split(';')
953952
matches_exclude = false
954953
foreach exclude : multilib_exclude
@@ -1035,13 +1034,21 @@ endif
10351034

10361035
foreach target : ['default-target'] + targets
10371036

1038-
message('generate linker script target ' + target)
1037+
custom_mem_config = ''
10391038

10401039
if target != 'default-target'
1040+
target_part = ''
1041+
foreach part : target.split('_')
1042+
if target_part == ''
1043+
target_part = part
1044+
else
1045+
target_part += '_' + part
1046+
endif
1047+
custom_mem_config = meson.get_cross_property('custom_mem_config_' + target_part, custom_mem_config)
1048+
endforeach
1049+
10411050
target_head = get_variable('target_' + target)[0].split('_')[0].underscorify()
1042-
custom_mem_config = meson.get_cross_property('custom_mem_config_' + target_head, '')
1043-
else
1044-
custom_mem_config = ''
1051+
custom_mem_config = meson.get_cross_property('custom_mem_config_' + target_head, custom_mem_config)
10451052
endif
10461053

10471054
custom_mem_config = meson.get_cross_property('custom_mem_config_' + target, custom_mem_config)
@@ -1524,7 +1531,6 @@ endif
15241531
# Set config variables for each requested 'from' encoding
15251532

15261533
foreach from : newlib_iconv_from_encodings
1527-
message('from ' + from)
15281534
if not available_encodings.contains(from)
15291535
error('Requested from encoding ' + from + ' is not available. Look in newlib/libc/iconv/encoding.aliases')
15301536
endif

scripts/cross-arm-none-eabi.txt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@ default_flash_size = '0x00400000'
2525
default_ram_addr = '0x20000000'
2626
default_ram_size = '0x00200000'
2727

28-
custom_mem_config_thumb_v8_1_m_main_mve_hard = 'mps3_an547'
29-
custom_mem_config_thumb_v8_m_main_dp_hard = 'mps3_an547'
30-
custom_mem_config_thumb_v8_m_main_dp_softfp = 'mps3_an547'
31-
custom_mem_config_thumb_v8_1_m_main_pacbti_bp_nofp = 'mps3_an547'
32-
custom_mem_config_thumb_v8_1_m_main_pacbti_dp_bp_hard = 'mps3_an547'
33-
custom_mem_config_thumb_v8_1_m_main_pacbti_dp_bp_softfp = 'mps3_an547'
34-
custom_mem_config_thumb_v8_1_m_main_pacbti_fp_bp_hard = 'mps3_an547'
35-
custom_mem_config_thumb_v8_1_m_main_pacbti_fp_bp_softfp = 'mps3_an547'
36-
custom_mem_config_thumb_v8_1_m_main_pacbti_mve_bp_hard = 'mps3_an547'
28+
custom_mem_config_thumb_v8_1_m = 'mps3_an547'
29+
custom_mem_config_thumb_v8_m_main_dp = 'mps3_an547'
3730

3831
separate_boot_flash_mps3_an547 = true
3932
default_boot_flash_addr_mps3_an547 = '0x00000000'
@@ -43,10 +36,7 @@ default_flash_size_mps3_an547 = '0x00200000'
4336
default_ram_addr_mps3_an547 = '0x60000000'
4437
default_ram_size_mps3_an547 = '0x01000000'
4538

46-
custom_mem_config_thumb_v8_m_base_nofp = 'mps2_an505'
47-
custom_mem_config_thumb_v8_m_main_nofp = 'mps2_an505'
48-
custom_mem_config_thumb_v8_m_main_fp_hard = 'mps2_an505'
49-
custom_mem_config_thumb_v8_m_main_fp_softfp = 'mps2_an505'
39+
custom_mem_config_thumb_v8_m = 'mps2_an505'
5040

5141
separate_boot_flash_mps2_an505 = true
5242
default_boot_flash_addr_mps2_an505 = '0x10000000'

0 commit comments

Comments
 (0)