|
84 | 84 | {{ |
85 | 85 | __{0}_{1}_start = .; |
86 | 86 | {4} |
| 87 | +#if {6} |
| 88 | + . = ALIGN({6}); |
| 89 | +#else |
87 | 90 | MPU_ALIGN(__{0}_{1}_size); |
| 91 | +#endif |
88 | 92 | __{0}_{1}_end = .; |
89 | 93 | }} {5} |
90 | 94 | __{0}_{1}_size = __{0}_{1}_end - __{0}_{1}_start; |
@@ -187,6 +191,12 @@ def assign_to_correct_mem_region(memory_type, |
187 | 191 | iteration_sections["text"] or iteration_sections["rodata"]): |
188 | 192 | all_regions = True |
189 | 193 |
|
| 194 | + pos = memory_type.find('_') |
| 195 | + if pos in range(len(memory_type)): |
| 196 | + align_size = int(memory_type[pos+1:]) |
| 197 | + memory_type = memory_type[:pos] |
| 198 | + mpu_align[memory_type] = align_size |
| 199 | + |
190 | 200 | if memory_type in complete_list_of_sections: |
191 | 201 | for iter_sec in ["text", "rodata", "data", "bss"]: |
192 | 202 | if ((iteration_sections[iter_sec] or all_regions) and |
@@ -229,8 +239,12 @@ def string_create_helper(region, memory_type, |
229 | 239 | linker_string += tmp |
230 | 240 | else: |
231 | 241 | if memory_type != 'SRAM' and region == 'rodata': |
| 242 | + align_size = 0 |
| 243 | + if memory_type in mpu_align.keys(): |
| 244 | + align_size = mpu_align[memory_type] |
| 245 | + |
232 | 246 | linker_string += LINKER_SECTION_SEQ_MPU.format(memory_type.lower(), region, memory_type.upper(), |
233 | | - region.upper(), tmp, load_address_string) |
| 247 | + region.upper(), tmp, load_address_string, align_size) |
234 | 248 | else: |
235 | 249 | linker_string += LINKER_SECTION_SEQ.format(memory_type.lower(), region, memory_type.upper(), |
236 | 250 | region.upper(), tmp, load_address_string) |
@@ -389,6 +403,8 @@ def create_dict_wrt_mem(): |
389 | 403 |
|
390 | 404 |
|
391 | 405 | def main(): |
| 406 | + global mpu_align |
| 407 | + mpu_align = {} |
392 | 408 | parse_args() |
393 | 409 | searchpath = args.directory |
394 | 410 | linker_file = args.output |
|
0 commit comments